Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 48997 invoked from network); 11 May 2009 14:50:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 May 2009 14:50:05 -0000 Received: (qmail 52370 invoked by uid 500); 11 May 2009 14:50:04 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 52342 invoked by uid 500); 11 May 2009 14:50:04 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 52333 invoked by uid 99); 11 May 2009 14:50:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 May 2009 14:50:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 May 2009 14:50:02 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6AF302388D3B; Mon, 11 May 2009 14:49:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r773587 - /camel/branches/camel-1.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutPipelineWithBeanTest.java Date: Mon, 11 May 2009 14:49:42 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090511144942.6AF302388D3B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davsclaus Date: Mon May 11 14:49:42 2009 New Revision: 773587 URL: http://svn.apache.org/viewvc?rev=773587&view=rev Log: Trying to fix rare unit test failure. Modified: camel/branches/camel-1.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutPipelineWithBeanTest.java Modified: camel/branches/camel-1.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutPipelineWithBeanTest.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutPipelineWithBeanTest.java?rev=773587&r1=773586&r2=773587&view=diff ============================================================================== --- camel/branches/camel-1.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutPipelineWithBeanTest.java (original) +++ camel/branches/camel-1.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutPipelineWithBeanTest.java Mon May 11 14:49:42 2009 @@ -31,38 +31,63 @@ public class JmsInOutPipelineWithBeanTest extends ContextTestSupport { public void testA() throws Exception { + context.addRoutes(new RouteBuilder() { + @Override + public void configure() throws Exception { + from("activemq:testA").to("bean:dummyBean").to("activemq:a").to("activemq:b"); + + from("activemq:a").process(new Processor() { + public void process(Exchange exchange) throws Exception { + String body = exchange.getIn().getBody(String.class); + exchange.getOut().setBody(body + ",From A"); + } + }); + + from("activemq:b").process(new Processor() { + public void process(Exchange exchange) throws Exception { + String body = exchange.getIn().getBody(String.class); + exchange.getOut().setBody(body + ",From B"); + } + }); + } + }); + context.start(); + Object response = template.requestBody("activemq:testA", "Hello World"); assertEquals("Reply", "Hello World,From Bean,From A,From B", response); } public void testB() throws Exception { - Object response = template.requestBody("activemq:testB", "Hello World"); - assertEquals("Reply", "Hello World,From A,From Bean,From B", response); - } + context.addRoutes(new RouteBuilder() { + @Override + public void configure() throws Exception { + from("activemq:testB").to("activemq:a").to("bean:dummyBean").to("activemq:b"); - public void testC() throws Exception { - Object response = template.requestBody("activemq:testC", "Hello World"); - assertEquals("Reply", "Hello World,From A,From B,From Bean", response); - } + from("activemq:a").process(new Processor() { + public void process(Exchange exchange) throws Exception { + String body = exchange.getIn().getBody(String.class); + exchange.getOut().setBody(body + ",From A"); + } + }); - protected CamelContext createCamelContext() throws Exception { - CamelContext camelContext = super.createCamelContext(); - camelContext.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false")); - return camelContext; - } + from("activemq:b").process(new Processor() { + public void process(Exchange exchange) throws Exception { + String body = exchange.getIn().getBody(String.class); + exchange.getOut().setBody(body + ",From B"); + } + }); + } + }); + context.start(); - protected JndiRegistry createRegistry() throws Exception { - JndiRegistry reg = super.createRegistry(); - reg.bind("dummyBean", new MyDummyBean()); - return reg; + Object response = template.requestBody("activemq:testB", "Hello World"); + assertEquals("Reply", "Hello World,From A,From Bean,From B", response); } - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { + public void testC() throws Exception { + context.addRoutes(new RouteBuilder() { + @Override public void configure() throws Exception { - from("activemq:testA").to("bean:dummyBean").to("activemq:a").to("activemq:b"); - from("activemq:testB").to("activemq:a").to("bean:dummyBean").to("activemq:b"); from("activemq:testC").to("activemq:a").to("activemq:b").to("bean:dummyBean"); from("activemq:a").process(new Processor() { @@ -79,7 +104,23 @@ } }); } - }; + }); + context.start(); + + Object response = template.requestBody("activemq:testC", "Hello World"); + assertEquals("Reply", "Hello World,From A,From B,From Bean", response); + } + + protected CamelContext createCamelContext() throws Exception { + CamelContext camelContext = super.createCamelContext(); + camelContext.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false")); + return camelContext; + } + + protected JndiRegistry createRegistry() throws Exception { + JndiRegistry reg = super.createRegistry(); + reg.bind("dummyBean", new MyDummyBean()); + return reg; } public static class MyDummyBean {