camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Ende ...@e-beyond.de>
Subject Routes in unit-testing
Date Tue, 04 Aug 2015 06:48:04 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message