Examples of AdviceWithRouteBuilder


Examples of org.apache.camel.builder.AdviceWithRouteBuilder

  @Test
  public void testRoutes() throws Exception {
        // Adjust routes
        List<RouteDefinition> routes = context.getRouteDefinitions();

        routes.get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // Replace "from" endpoint with direct:start
                replaceFromWith("direct:start");
                // Mock and skip result endpoint
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

        return context.getManagementStrategy().getManagementAgent().getMBeanServer();
    }

    @Test
    public void testTransactionSuccess() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                onException(AssertionError.class).to("log:error", "mock:error");
            }
        });
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

*
*/
public class AdviceWithRouteScopedErrorHandlerIssueTest extends ContextTestSupport {

    public void testAdviceWith() throws Exception {
        context.getRouteDefinition("route-a").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("direct:bar")
                    .skipSendToOriginalEndpoint()
                    .throwException(new IllegalArgumentException("Forced"));
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    }
    @Test
    public void testWeaveAddFirst() throws Exception {
        // START SNIPPET: e1
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // insert at first the given piece of route to the existing route
                weaveAddFirst().to("mock:a").transform(constant("Bye World"));
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    }
    @Test
    public void testWeaveAddLast() throws Exception {
        // START SNIPPET: e2
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // insert at the end of the existing route, the given piece of route
                weaveAddLast().to("mock:a").transform(constant("Bye World"));
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    }

    @Test
    public void testIsUseAdviceWith() throws Exception {

        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            public void configure() throws Exception {

                replaceFromWith(directEndPointURI);

                interceptSendToEndpoint(providerEndPointURI).to("mock:intercepted").skipSendToOriginalEndpoint();
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

*
*/
public class AdviceWithTwoRoutesOnExceptionIssueTest extends ContextTestSupport {

    public void testAdviceWith() throws Exception {
        context.getRouteDefinition("a").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:a").skipSendToOriginalEndpoint()
                    .to("mock:error");
            }
        });

        context.getRouteDefinition("b").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:b").skipSendToOriginalEndpoint()
                    .to("mock:error");
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    }

    public void testSimpleMultipleAdvice() throws Exception {
        context.addRoutes(createRouteBuilder());

        context.getRouteDefinition("RouteA").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:resultA").process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
                    }
                });
            }
        });

        context.getRouteDefinition("RouteB").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
            }
        });
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    }

    public void testMultipleAdviceWithExceptionThrown() throws Exception {
        context.addRoutes(createRouteBuilder());

        context.getRouteDefinition("RouteA").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:resultA").process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    }

    public void testMultipleAdvice() throws Exception {
        context.addRoutes(createRouteBuilder());

        context.getRouteDefinition("RouteA").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:resultA").process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
                        throw new Exception("my exception");
                    }
                });
            }
        });

        context.getRouteDefinition("RouteB").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
            }
        });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.