Package org.apache.camel.builder

Examples of org.apache.camel.builder.AdviceWithRouteBuilder


*/
public class AdviceWithOnExceptionTest extends ContextTestSupport {

    public void testAdviceWithOnException() throws Exception {
        RouteDefinition route = context.getRouteDefinitions().get(0);
        route.adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveById("b").after().to("mock:result");
            }
        });
View Full Code Here


    }

    public void testAdvisedMockEndpoints() throws Exception {
        // advice the first route using the inlined AdviceWith route builder
        // which has extended capabilities than the regular route builder
        context.getRouteDefinitions().get(1).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // mock all endpoints (will mock in all routes)
                mockEndpoints();
            }
View Full Code Here

    public void testAdvised() throws Exception {
        assertFalse(context.getRouteStatus("foo").isStarted());
        assertFalse(context.getRouteStatus("bar").isStarted());

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

        return true;
    }

    @Test
    public void testAdviceWith() throws Exception {
        context.getRouteDefinition("starter").adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // when advicing then use wildcard as URI options cannot be matched
                mockEndpointsAndSkip(advicedPub + "?*");
            }
View Full Code Here

        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

        return true;
    }

    @Test
    public void testSimpleMultipleAdvice() throws Exception {
        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

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testMultipleAdviceWithExceptionThrown() throws Exception {
        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

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testMultipleAdvice() throws Exception {
        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

        return true;
    }

    @Test
    public void testAdviceWithWeaveById() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveById("mock-b*").after().to("mock:last");
            }
        });
View Full Code Here

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testAdviceWithAddLast() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveAddLast().to("mock:last");
            }
        });
View Full Code Here

TOP

Related Classes of org.apache.camel.builder.AdviceWithRouteBuilder

Copyright © 2018 www.massapicom. 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.