camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boday <ben.o...@initekconsulting.com>
Subject Re: Green test, but my RouteBuilder dosent run...
Date Thu, 19 Jun 2014 17:29:03 GMT
remove these lines from testSendMatchingMessage(), this is handled by
CamelTestSupport automatically and causing duplicate "direct:start" routes

        context.addRoutes(createRouteBuilder());
        context.start(); 


Frankiboy wrote
> What is wrong here....
> 
> Green test, but notning happens i dont get into my AddIpBean with this
> signature.
> 
> package dk.bankconnect.hub.unittest;
> 
> import org.apache.camel.ProducerTemplate;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.apache.camel.test.CamelTestSupport;
> import org.junit.Test;
> 
> import dk.bankconnect.hub.processor.AddIpBean;
> 
> public class FilterTest extends CamelTestSupport {
> 
>     String header = "
> <root>
> <name>
> abc
> </name>
> <mainRegistrationNumber>
> 20
> </mainRegistrationNumber>
> <technicalAddress>
> </technicalAddress>
> </root>
> ";
> 
>     protected MockEndpoint resultEndpoint;
> 
>     protected ProducerTemplate template;
> 
>     @Test
>     public void testSendMatchingMessage() throws Exception {
>         context.addRoutes(createRouteBuilder());
>         context.start();
>         resultEndpoint = context.getEndpoint("mock:result",
> MockEndpoint.class);
>         template = context.createProducerTemplate();
>         String expectedBody = "
> <matched/>
> ";
>         resultEndpoint.expectedBodiesReceived(expectedBody);
>         template.setDefaultEndpoint(resultEndpoint);
>         template.sendBodyAndHeader(expectedBody, header, header);
>         resultEndpoint.assertIsSatisfied();
>         context.stop();
>     }
> 
>     @Override
>     protected RouteBuilder createRouteBuilder() {
>         return new RouteBuilder() {
>             public void configure() {
>                
> from("direct:start").bean(AddIpBean.class).to("mock:result");
>             }
>         };
>     }
> 
> }
> 
> I get this exception:
> 
> org.apache.camel.FailedToStartRouteException: Failed to start route route2
> because of Multiple consumers for the same endpoint is not allowed:
> Endpoint[direct://start]
> 	at
> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:2161)
> 	at
> org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:2118)
> 
> 
> Frank 





-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/Green-test-but-my-RouteBuilder-dosent-run-tp5752583p5752587.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message