camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Routes in unit-testing
Date Tue, 04 Aug 2015 07:37:24 GMT
Hi

Take a look at stub, or advice with and use replace from etc for testing.


On Tue, Aug 4, 2015 at 8:48 AM, Marc Ende <me@e-beyond.de> wrote:
> Hi,
>
> I've got a not very complex route:
>
>
> from(routes.getActivemqEndpoint()).routeId(Route.PROCESSING_ROUTE.getRouteId())
>                 .choice()
>
> .when(header(Constants.JMS_HEADER_DATA_SOURCE).isEqualTo(Constants.DEFAULT_JMS_HEADER_B))
>                 .to(routes.getProcessingEndpoint(Constants.ORIGIN_B))
>
> .when(header(Constants.JMS_HEADER_DATA_SOURCE).isEqualTo(Constants.DEFAULT_JMS_HEADER_A))
>                 .to(routes.getProcessingEndpoint(Constants.ORIGIN_A))
>                 .otherwise()
>                 .log(LoggingLevel.ERROR,"Message was not identified...")
>                 .to(routes.getProcessingUnknownEndpoint());
>
> If I try to unit-test this route using spring. This route is correctly
> build up in camel context and I also can send messages to the endpoints in
> this route.
> But I would expect that if i send a message to the activemq endpoint it
> should be delivered to one of the other endpoints. But that didn't happen.
>
> the activemq endpoint is mocked using mock:activemq://queue... If I send a
> message to mock:activemq://queue... it will only be delivered to this
> endpoint.
> If I send the message to the real endpoint of the route
> (activemq://queue...) it will be delivered to the expected endpoint. But
> then the counter within the MockEndpoint of the endpoint
> isn't incremented and the assertion fails.
>
> Does anyone have an idea?
>
> Marc



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2

Mime
View raw message