You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2009/11/17 14:05:52 UTC

[jira] Created: (CAMEL-2184) Add adviceWith(routeBuilder) to advice an existing route with interceptors or the likes from the route builder (testing purpose)

Add adviceWith(routeBuilder) to advice an existing route with interceptors or the likes from the route builder (testing purpose)
--------------------------------------------------------------------------------------------------------------------------------

                 Key: CAMEL-2184
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2184
             Project: Apache Camel
          Issue Type: New Feature
          Components: camel-core
    Affects Versions: 2.0.0
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 2.1.0


This will allow us to do unit testing on existing routes and then advice by a route builder where we can configure interceptors and onCompletions etc. so we can intercept sending to endpoints etc. And send it to mocks etc.

{code}
    public void testAdvised() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:foo")
                        .skipSendToOriginalEndpoint()
                        .to("log:foo")
                        .to("mock:advised");
            }
        });

        getMockEndpoint("mock:foo").expectedMessageCount(0);
        getMockEndpoint("mock:advised").expectedMessageCount(1);
        getMockEndpoint("mock:result").expectedMessageCount(1);

        template.sendBody("direct:start", "Hello World");

        assertMockEndpointsSatisfied();
    }
{code}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-2184) Add adviceWith(routeBuilder) to advice an existing route with interceptors or the likes from the route builder (testing purpose)

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-2184.
--------------------------------

    Resolution: Fixed

trunk: 881279.

> Add adviceWith(routeBuilder) to advice an existing route with interceptors or the likes from the route builder (testing purpose)
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2184
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2184
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.0.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.1.0
>
>
> This will allow us to do unit testing on existing routes and then advice by a route builder where we can configure interceptors and onCompletions etc. so we can intercept sending to endpoints etc. And send it to mocks etc.
> {code}
>     public void testAdvised() throws Exception {
>         context.getRouteDefinitions().get(0).adviceWith(new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 interceptSendToEndpoint("mock:foo")
>                         .skipSendToOriginalEndpoint()
>                         .to("log:foo")
>                         .to("mock:advised");
>             }
>         });
>         getMockEndpoint("mock:foo").expectedMessageCount(0);
>         getMockEndpoint("mock:advised").expectedMessageCount(1);
>         getMockEndpoint("mock:result").expectedMessageCount(1);
>         template.sendBody("direct:start", "Hello World");
>         assertMockEndpointsSatisfied();
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.