Examples of AdviceWithRouteBuilder


Examples of org.apache.camel.builder.AdviceWithRouteBuilder

        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

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/SpringAdviceWithContextScopedErrorHandlerIssueTest.xml");
    }

    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

public class IsUseAdviceWithTest extends CamelTestSupport {

    @Test
    public void testIsUseAdviceWith() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // replace the from with seda:foo
                replaceFromWith("seda:foo");
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

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

    public void testReplaceMultipleIds() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                // replace all gold id's with the following route path
                weaveById("gold*").replace().multicast().to("mock:a").to("mock:b");
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

    // START SNIPPET: e1
    public void testAdvisedMockEndpointsWithSkip() 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 sending to direct:foo and direct:bar and skip send to it
                mockEndpointsAndSkip("direct:foo", "direct:bar");
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

public class AdviceWithRecipientListMockEndpointsTest extends ContextTestSupport {

    public void testAdvisedMockEndpoints() throws Exception {
        // advice the second 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
                mockEndpoints("log*");
            }
View Full Code Here

Examples of org.apache.camel.builder.AdviceWithRouteBuilder

*/
public class AdviceWithWeaveFirstLastTest extends ContextTestSupport {

    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

        assertMockEndpointsSatisfied();
    }

    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

*/
public class AdviceWithTypeTest extends ContextTestSupport {

    public void testUnknownType() throws Exception {
        try {
            context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                    weaveByType(SplitDefinition.class).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 by type in the route
                // and replace it with the following route path
                weaveByType(LogDefinition.class).replace().multicast().to("mock:a").to("mock:b");
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.