camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
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 GMT
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 {



Mime
View raw message