camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r1445896 - in /camel/trunk/camel-core/src/test/java/org/apache/camel: component/vm/VmMultipleConsumersIssueTest.java component/vm/VmMultipleContextsStartStopTest.java issues/SedaMultipleConsumersIssueTest.java
Date Wed, 13 Feb 2013 20:15:15 GMT
Author: raulk
Date: Wed Feb 13 20:15:15 2013
New Revision: 1445896

URL: http://svn.apache.org/r1445896
Log:
Fix VmMultipleContextsStartStopTest to stop the second context so that itit doesn't interfere
with other tests. Rename and move a test from Seda to VM.

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleConsumersIssueTest.java
      - copied, changed from r1445889, camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SedaMultipleConsumersIssueTest.java
Removed:
    camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SedaMultipleConsumersIssueTest.java
Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleContextsStartStopTest.java

Copied: camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleConsumersIssueTest.java
(from r1445889, camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SedaMultipleConsumersIssueTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleConsumersIssueTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleConsumersIssueTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SedaMultipleConsumersIssueTest.java&r1=1445889&r2=1445896&rev=1445896&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SedaMultipleConsumersIssueTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleConsumersIssueTest.java
Wed Feb 13 20:15:15 2013
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.issues;
+package org.apache.camel.component.vm;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.ExchangePattern;
@@ -23,9 +23,9 @@ import org.apache.camel.builder.RouteBui
 /**
  *
  */
-public class SedaMultipleConsumersIssueTest extends ContextTestSupport {
+public class VmMultipleConsumersIssueTest extends ContextTestSupport {
 
-    public void testSedaMultipleConsumersIssue() throws Exception {
+    public void testVmMultipleConsumersIssue() throws Exception {
         getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
         getMockEndpoint("mock:b").expectedBodiesReceived("Hello World");
         getMockEndpoint("mock:done").expectedBodiesReceived("Hello World");

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleContextsStartStopTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleContextsStartStopTest.java?rev=1445896&r1=1445895&r2=1445896&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleContextsStartStopTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/VmMultipleContextsStartStopTest.java
Wed Feb 13 20:15:15 2013
@@ -16,49 +16,25 @@
  */
 package org.apache.camel.component.vm;
 
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.DefaultCamelContext;
 
 /**
  * @version 
  */
-public class VmMultipleContextsStartStopTest extends ContextTestSupport {
+public class VmMultipleContextsStartStopTest extends AbstractVmTestSupport {
 
     public void testStartStop() throws Exception {
-        DefaultCamelContext c1 = new DefaultCamelContext();
-        c1.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:test")
-                    .to("vm:foo");
-            }
-        });
-        c1.start();
-        ProducerTemplate template = c1.createProducerTemplate();
-
-        DefaultCamelContext c2 = new DefaultCamelContext();
-        c2.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("vm:foo")
-                    .to("mock:result");
-            }
-        });
-        c2.start();
-        
         /* Check that contexts are communicated */
-        MockEndpoint mock = c2.getEndpoint("mock:result", MockEndpoint.class);
+        MockEndpoint mock = context2.getEndpoint("mock:result", MockEndpoint.class);
         mock.expectedMessageCount(1);
         template.requestBody("direct:test", "Hello world!");
         mock.assertIsSatisfied();
         mock.reset();
         
         /* Restart the consumer Camel Context */
-        c2.stop();
-        c2.start();
+        context2.stop();
+        context2.start();
         
         /* Send a message again and assert that it's received */
         template.requestBody("direct:test", "Hello world!");
@@ -71,8 +47,20 @@ public class VmMultipleContextsStartStop
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                from("direct:test").to("vm:foo");
+            }
+        };
+    }
 
+    @Override
+    protected RouteBuilder createRouteBuilderForSecondContext() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("vm:foo").to("mock:result");            
             }
         };
+       
     }
+    
 }
\ No newline at end of file



Mime
View raw message