camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1144640 - /camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TwoConsumerOnSameTopicTest.java
Date Sat, 09 Jul 2011 11:14:28 GMT
Author: davsclaus
Date: Sat Jul  9 11:14:28 2011
New Revision: 1144640

URL: http://svn.apache.org/viewvc?rev=1144640&view=rev
Log:
Fixed test that uses topics and may rarely fail otherwise.

Modified:
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TwoConsumerOnSameTopicTest.java

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TwoConsumerOnSameTopicTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TwoConsumerOnSameTopicTest.java?rev=1144640&r1=1144639&r2=1144640&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TwoConsumerOnSameTopicTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TwoConsumerOnSameTopicTest.java
Sat Jul  9 11:14:28 2011
@@ -32,6 +32,9 @@ public class TwoConsumerOnSameTopicTest 
 
     @Test
     public void testTwoConsumerOnSameTopic() throws Exception {
+        // give a bit of time for AMQ to properly setup topic subscribers
+        Thread.sleep(500);
+
         getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
         getMockEndpoint("mock:b").expectedBodiesReceived("Hello World");
 
@@ -42,6 +45,9 @@ public class TwoConsumerOnSameTopicTest 
 
     @Test
     public void testStopOneRoute() throws Exception {
+        // give a bit of time for AMQ to properly setup topic subscribers
+        Thread.sleep(500);
+
         getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
         getMockEndpoint("mock:b").expectedBodiesReceived("Hello World");
         template.sendBody("activemq:topic:foo", "Hello World");
@@ -60,6 +66,9 @@ public class TwoConsumerOnSameTopicTest 
 
     @Test
     public void testStopAndStartOneRoute() throws Exception {
+        // give a bit of time for AMQ to properly setup topic subscribers
+        Thread.sleep(500);
+
         getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
         getMockEndpoint("mock:b").expectedBodiesReceived("Hello World");
         template.sendBody("activemq:topic:foo", "Hello World");
@@ -88,6 +97,9 @@ public class TwoConsumerOnSameTopicTest 
 
     @Test
     public void testRemoveOneRoute() throws Exception {
+        // give a bit of time for AMQ to properly setup topic subscribers
+        Thread.sleep(500);
+
         getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
         getMockEndpoint("mock:b").expectedBodiesReceived("Hello World");
         template.sendBody("activemq:topic:foo", "Hello World");
@@ -106,9 +118,12 @@ public class TwoConsumerOnSameTopicTest 
     }
 
     protected CamelContext createCamelContext() throws Exception {
+        deleteDirectory("activemq-data");
+
         CamelContext camelContext = super.createCamelContext();
 
-        ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+        // must be persistent to rember the messages
+        ConnectionFactory connectionFactory = CamelJmsTestHelper.createPersistentConnectionFactory();
         camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
 
         return camelContext;



Mime
View raw message