Author: gtully
Date: Wed Jul 29 11:35:41 2009
New Revision: 798859

URL: http://svn.apache.org/viewvc?rev=798859&view=rev
Log:
make test more tolerant to slower machines, replace sleep with timed wait : 
https://issues.apache.org/activemq/browse/AMQ-1936

Modified:
    
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java

Modified: 
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java?rev=798859&r1=798858&r2=798859&view=diff
==============================================================================
--- 
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java
 (original)
+++ 
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java
 Wed Jul 29 11:35:41 2009
@@ -18,6 +18,7 @@
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.util.Wait;
 import org.apache.log4j.Logger;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
@@ -187,8 +188,11 @@
         }
 
         // allow some time for messages to be delivered to receivers.
-        Thread.sleep( 5000 );
-        
+        Wait.waitFor(new Wait.Condition() {
+            public boolean isSatisified() throws Exception {
+                return TEST_MESSAGE_COUNT == messages.size();
+            }
+        });
         assertEquals( "Number of messages received does not match the number 
sent", TEST_MESSAGE_COUNT, messages.size( ) );
         assertEquals( TEST_MESSAGE_COUNT,  messageCount.get() );
     }


Reply via email to