Package org.apache.camel.builder

Examples of org.apache.camel.builder.AdviceWithRouteBuilder


        assertMockEndpointsSatisfied();
    }

    public void testAfter() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveByToString(".*bar.*").after().to("mock:a").transform(constant("Bye World"));
            }
        });
View Full Code Here


* Advice with match multiple ids test
*/
public class AdviceWithTasksSelectTest extends ContextTestSupport {

    public void testSelectFirst() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // should only match the first
                weaveById("gold*").selectFirst().replace().multicast().to("mock:a").to("mock:b");
            }
View Full Code Here

        assertMockEndpointsSatisfied();
    }

    public void testSelectLast() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // should only match the last
                weaveById("gold*").selectLast().replace().multicast().to("mock:a").to("mock:b");
            }
View Full Code Here

        assertMockEndpointsSatisfied();
    }


    public void testSelectIndexZero() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // should match the first index (0 based)
                weaveById("gold*").selectIndex(0).replace().multicast().to("mock:a").to("mock:b");
            }
View Full Code Here

        assertMockEndpointsSatisfied();
    }

    public void testSelectIndexOne() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // should match the second index (0 based)
                weaveById("gold*").selectIndex(1).replace().multicast().to("mock:a").to("mock:b");
            }
View Full Code Here

        assertMockEndpointsSatisfied();
    }

    public void testSelectIndexTwo() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // should match the third index (0 based)
                weaveById("gold*").selectIndex(2).replace().multicast().to("mock:a").to("mock:b");
            }
View Full Code Here

        assertMockEndpointsSatisfied();
    }

    public void testSelectIndexOutOfBounds() throws Exception {
        try {
            context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                    // should be out of bounds
                    weaveById("gold*").selectIndex(3).replace().multicast().to("mock:a").to("mock:b");
                }
View Full Code Here

    }

    public void testAdviceWithErrorHandler() throws Exception {
        RouteDefinition route = context.getRouteDefinitions().get(0);
        try {
            route.adviceWith(context, new AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                    errorHandler(deadLetterChannel("mock:dead"));
                }
            });
View Full Code Here

        }
    }

    public void testAdviceWithOnException() throws Exception {
        RouteDefinition route = context.getRouteDefinitions().get(0);
        route.adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                onException(IllegalArgumentException.class)
                        .handled(true)
                        .to("mock:error");
View Full Code Here

        assertMockEndpointsSatisfied();
    }

    public void testAdviceWithInterceptFrom() throws Exception {
        RouteDefinition route = context.getRouteDefinitions().get(0);
        route.adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptFrom().to("mock:from");
            }
        });
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.