Hi Claus, thanks for the hint to stub and adviceWith. I'm trying to use stub but I haven't found an example how to use stub. Do I use it in combination with @Produce or is it a completly diffrent approach?
Thanks Marc 2015-08-04 9:37 GMT+02:00 Claus Ibsen <[email protected]>: > 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 <[email protected]> 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 >
