Hi,

you can do this by intercepting your routes.

public void testFoo() throws Exception {
 RouteDefinition route = context.getRouteDefinitions().get("routeId");
route.adviceWith(context, new RouteBuilder() {
   public void configure() throws Exception {
      interceptSendToEndpoint("seda:in")
      .skipSendToOriginalEndpoint()
      .to("mock:m1");
}
});

Best regrads - Claus


Am Montag, den 29.11.2010, 09:39 +0100 schrieb "Olivier.Roger" <olivier.ro...@bsb.com>:
Hello Camel,

I am using Camel for some time now and I was wondering how I could perform unit test using the same camel context used in production but still being
able to test intermediate messages of the routes.

For instance, with the simple routes A --> B and B --> C.
At the moment I use 4 properties A,B,B' and C. In prod, B == B' and in test
A and C are direct: endpoint and B' and D are mock endpoint.

This allows to sent easily message using the template object and validate
the result by making mock assertions.

I wanted to know if there was a better solution than duplicating the
endpoint URI (B and B' here) for intermediate endpoints.

Thanks in advance for your input!

Reply via email to