Hello folks!

When I test a existing route i prefer to work with AdviceWith. However it is
not possible to get the Route Definition over the ID, but also only via the
index in the collection. That way however is bad for readability.

That doesn't work:
@Test
public void testMainRoutePass() throws Exception {              
                                
        context.getRouteDefinition("dkflsd").adviceWith(context, new
AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                        weaveAddLast().to("mock:mainRoute");                    
        
                }
        });
...

But that works instead:
@Test
public void testMainRoutePass() throws Exception {      
                
        context.getRouteDefinitions().get(0).adviceWith(context, new
AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                        weaveAddLast().to("mock:mainRoute");            
                }
        });
...

Here comes the camel-context.xml:

<bean id="mainRoute"
        class="com.routes.MainRoute">
        <property name="endpointTo" ref="endpointToTestImpl" />
</bean>

<camel:camelContext>
        
        <camel:routeBuilder ref="mainRoute" id="dkflsd"/>
        ...
</camel:camelContext>


Could you help me?

Cheers
Hilde


--
View this message in context: 
http://camel.465427.n5.nabble.com/Testing-routes-Get-route-definition-by-id-gets-null-tp5715014.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to