Add adviceWith(routeBuilder) to advice an existing route with interceptors or 
the likes from the route builder (testing purpose)
--------------------------------------------------------------------------------------------------------------------------------

                 Key: CAMEL-2184
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2184
             Project: Apache Camel
          Issue Type: New Feature
          Components: camel-core
    Affects Versions: 2.0.0
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 2.1.0


This will allow us to do unit testing on existing routes and then advice by a 
route builder where we can configure interceptors and onCompletions etc. so we 
can intercept sending to endpoints etc. And send it to mocks etc.

{code}
    public void testAdvised() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:foo")
                        .skipSendToOriginalEndpoint()
                        .to("log:foo")
                        .to("mock:advised");
            }
        });

        getMockEndpoint("mock:foo").expectedMessageCount(0);
        getMockEndpoint("mock:advised").expectedMessageCount(1);
        getMockEndpoint("mock:result").expectedMessageCount(1);

        template.sendBody("direct:start", "Hello World");

        assertMockEndpointsSatisfied();
    }
{code}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to