You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Nicky Sandhu (JIRA)" <ji...@apache.org> on 2007/10/12 01:02:23 UTC

[jira] Updated: (CAMEL-177) Splitter forwards pre split exchanges out message

     [ https://issues.apache.org/activemq/browse/CAMEL-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nicky Sandhu updated CAMEL-177:
-------------------------------

    Attachment: pipeline.splitter-patch11102007.txt

Please review this patch carefully. It makes some changes to the tests as well so some assertions are removed/changed to make the test pass. I did this after some thought of what a pipeline should do and am looking for other suggestions/solutions

> Splitter forwards pre split exchanges out message
> -------------------------------------------------
>
>                 Key: CAMEL-177
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-177
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Nicky Sandhu
>         Attachments: pipeline.splitter-patch11102007.txt
>
>
> Added to test... existing test passes, new test fails. Follow up from discussion http://www.nabble.com/Pipeline-createNewExchange-t4609319s22882.html
> Index: C:/backyard/camel/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java
> ===================================================================
> --- C:/backyard/camel/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java	(revision 583358)
> +++ C:/backyard/camel/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java	(working copy)
> @@ -30,19 +30,40 @@
>  public class SplitterTest extends ContextTestSupport {
>      protected Endpoint<Exchange> startEndpoint;
>      protected MockEndpoint resultEndpoint;
> +    protected MockEndpoint nextResultEndpoint;
>  
>      public void testSendingAMessageUsingMulticastReceivesItsOwnExchange() throws Exception {
>          resultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob");
> +        nextResultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob");
> +        
> +        template.send("direct:a", new Processor() {
> +            public void process(Exchange exchange) {
> +                Message in = exchange.getIn();
> +                in.setBody("James,Guillaume,Hiram,Rob");
> +                in.setHeader("foo", "bar");
> +            }
> +        });
>  
> +        resultEndpoint.assertIsSatisfied();
> +        nextResultEndpoint.assertIsSatisfied();
> +    }
> +
> +    public void testSendingAMessageDoesNotForwardOutBody() throws Exception {
> +        resultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob");
> +        nextResultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob");
> +        
>          template.send("direct:a", new Processor() {
>              public void process(Exchange exchange) {
>                  Message in = exchange.getIn();
>                  in.setBody("James,Guillaume,Hiram,Rob");
>                  in.setHeader("foo", "bar");
> +                Message out = exchange.getOut();
> +                out.setBody("Some Junk");
>              }
>          });
>  
>          resultEndpoint.assertIsSatisfied();
> +        nextResultEndpoint.assertIsSatisfied();
>      }
>  
>      @Override
> @@ -50,12 +71,13 @@
>          super.setUp();
>  
>          resultEndpoint = getMockEndpoint("mock:result");
> +        nextResultEndpoint = getMockEndpoint("mock:nextResult");
>      }
>  
>      protected RouteBuilder createRouteBuilder() {
>          return new RouteBuilder() {
>              public void configure() {
> -                from("direct:a").splitter(body().tokenize(",")).to("mock:result");
> +                from("direct:a").splitter(body().tokenize(",")).to("mock:result","mock:nextResult");
>              }
>          };
>      }

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