Hi

Thanks for you quick answer!

>> 3) If Weld and Camel versions are the same - where do i look for the
error??!?
> Not sure I understand the question here :(

This refered to the fact, that i had two different behaviours in the two
projects - and i could'nt figure out which was the correct behaviour and
WHY they were different. You answer gave me a clue though. It turned out,
that one of my projects was a WAR project and the other was a JAR project,
and that beans.xml was not loaded on the WAR file (since it was located
/webapp/WEB-INF/beans.xml and therefor not picked up by the classloader).

This gave me a "solution" to my problem, even though it's not perfect.
Unfortunately you can't override src/main/resources/beans.xml with a
src/test/resources/beans.xml in Weld (
https://issues.jboss.org/browse/WELD-2054), but i was able to exclude the
package containing my RouteBuildes by adding an exclution to my beans.xml,
and having a "marker class" (ExcludeRouteBuildersFromTest.java) in
src/test/java.

<beans ...>
    <weld:scan>
        <!-- Exclude routes from beans scan...! -->
        <weld:exclude name="my.routebuilder.package.**" >
            <weld:if-class-available name="ExcludeRouteBuildersFromTest"/>
        </weld:exclude>
    </weld:scan>
</beans>

> That being said, we may want to improve CamelCdiRunner to meet your need,
provided that it does not hinder the original intent, that is simplicity
and convention over configuration.

I think that would be a very good idea. The problem with the current
default, is that if all routes a loaded, you have to handle all endpoints
in every class. "Unfortunately" you are helped by the fact that the
folowing code, actually mocks and skips ALL endpoints in the CamelContext,
not just endpoints in the current route being adviced, but i'm thinkin that
thats a bug that will be fixed at some point:

context.getRouteDefinition("MyRouteId").adviceWith(context, new
AdviceWithRouteBuilder() {
    public void configure() throws Exception {
        mockEndpointsAndSkip("*");
    }
});

But you would also have to replace "from endpoints" of all routes in every
test, if they communicate with resources that are not available in you unit
tests - and you can't advice with the same replaceFromWith(...), in
different classes, since advices with @Observable conflict when all routes
are loaded.

... But thanks again!

/Dennis

Reply via email to