Examples of AdviceWithRouteBuilder


Examples of org.apache.camel.builder.AdviceWithRouteBuilder

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

    public void testReplaceFromUri() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // replace the input in the route with a new endpoint uri
                replaceFromWith("seda:foo");
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    }

    public void testReplaceFromEndpoint() throws Exception {
        final Endpoint endpoint = context.getEndpoint("seda:foo");

        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // replace the input in the route with a new endpoint
                replaceFromWith(endpoint);
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

        assertMockEndpointsSatisfied();
    }

    public void testReplaceFromInvalidUri() throws Exception {
        try {
            context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                    replaceFromWith("xxx:foo");
                }
            });
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

* Advice with try catch
*/
public class AdviceWithTryCatchTest extends ContextTestSupport {

    public void testTryCatch() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveById("foo").replace().process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

        return true;
    }

    @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

            assertTrue(e.getMessage(), e.getMessage().startsWith("There are no outputs which matches: gold* in the route"));
        }
    }

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

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

        assertMockEndpointsSatisfied();
    }

    public void testSelectRangeOneTwo() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // should match the 2nd and 3rd (0-based)
                weaveById("gold*").selectRange(1, 2).replace().multicast().to("mock:a").to("mock:b");
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

*/
public class AdviceWithTasksTest extends ContextTestSupport {

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

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

        }
    }

    public void testReplace() throws Exception {
        // START SNIPPET: e1
        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 replace it with the following route path
                weaveById("bar").replace().multicast().to("mock:a").to("mock:b");
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

        assertMockEndpointsSatisfied();
    }

    public void testRemove() throws Exception {
        // START SNIPPET: e2
        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 remove it
                weaveById("bar").remove();
            }
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.