Package org.apache.camel.builder

Examples of org.apache.camel.builder.AdviceWithRouteBuilder


        assertFalse("Should not have removed id", context.hasEndpoint("mock:bar") == null);
    }

    public void testBefore() throws Exception {
        // START SNIPPET: e3
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // weave the node in the route which has id = bar
                // and insert the following route path before the adviced node
                weaveById("bar").before().to("mock:a").transform(constant("Bye World"));
View Full Code Here


        assertMockEndpointsSatisfied();
    }

    public void testAfter() throws Exception {
        // START SNIPPET: e4
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // weave the node in the route which has id = bar
                // and insert the following route path after the advice node
                weaveById("bar").after().to("mock:a").transform(constant("Bye World"));
View Full Code Here

    // START SNIPPET: e1
    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(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // mock all endpoints
                mockEndpoints();
            }
View Full Code Here

    // START SNIPPET: e2
    public void testAdvisedMockEndpointsWithPattern() throws Exception {
        // advice the first route using the inlined AdviceWith route builder
        // which has extended capabilities than the regular route builder
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // mock only log endpoints
                mockEndpoints("log*");
            }
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(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // mock all endpoints (will mock in all routes)
                mockEndpoints();
            }
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

*/
public class AdviceWithTasksToStringPatternTest extends ContextTestSupport {

    public void testUnknownId() throws Exception {
        try {
            context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                    weaveByToString("xxx").replace().to("mock:xxx");
                }
            });
View Full Code Here

        }
    }

    public void testReplace() throws Exception {
        // START SNIPPET: e1
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // weave nodes in the route which has foo anywhere in their to string representation
                // and replace them with the following route path
                weaveByToString(".*foo.*").replace().multicast().to("mock:a").to("mock:b");
 
View Full Code Here

        assertMockEndpointsSatisfied();
    }

    public void testRemove() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveByToString(".*bar.*").remove();
            }
        });
View Full Code Here

        assertFalse("Should not have removed id", context.hasEndpoint("mock:bar") == null);
    }

    public void testBefore() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveByToString(".*bar.*").before().to("mock:a").transform(constant("Bye World"));
            }
        });
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.