[ 
https://issues.apache.org/jira/browse/CAMEL-4239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066639#comment-13066639
 ] 

Christian Müller commented on CAMEL-4239:
-----------------------------------------

Updated the wiki page: https://cwiki.apache.org/confluence/display/CAMEL/VM

> Improve the VM component tests
> ------------------------------
>
>                 Key: CAMEL-4239
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4239
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Christian Müller
>            Assignee: Christian Müller
>             Fix For: 2.9.0
>
>
> The [VM component|http://camel.apache.org/vm.html] is designed to support 
> communication across CamelContext instances.
> Only one of the test classes use different Camel contexts. I think all tests 
> should use at least two Camel contexts.
> I came to this, because of the following issue (please have a look into the 
> following test):
> {code:java}
> public class VmDifferentOptionsOnConsumerAndProducerTest extends 
> ContextTestSupport {
>     
>     private CamelContext context2;
>     private ProducerTemplate template2;
>     
>     @Override
>     @Before
>     protected void setUp() throws Exception {
>         super.setUp();
>         
>         context2 = new DefaultCamelContext(new 
> JndiRegistry(JndiTest.createInitialContext()));
>         context2.addRoutes(new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 from("direct:start")
>                     .to("vm:foo");
>             }
>         });
>         
>         template2 = context2.createProducerTemplate();
>         
>         ServiceHelper.startServices(template2, context2);
>     }
>     
>     @Override
>     @After
>     protected void tearDown() throws Exception {
>         ServiceHelper.stopServices(context2, template2);
>         
>         super.tearDown();
>     }
>     @Test
>     public void testSendToVm() throws Exception {
>         getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
>         
>         template2.sendBody("direct:start", "Hello World");
>         assertMockEndpointsSatisfied();
>     }
>     @Override
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 from("vm:foo?concurrentConsumers=5")
>                     .to("mock:result");
>             }
>         };
>     }
> }
> {code}
> As documented in the [SEDA component|http://camel.apache.org/seda.html] which 
> is extended by the VM component, this should work with Camel 2.x (look for 
> "Same URI must be used for both producer and consumer"). I try this with 
> Camel 2.0, 2.1, 2.2 and 2.3 (the version we are using) and it fails. It's 
> fixed in Camel 2.4 (I will update the wiki page).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to