activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1296368 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
Date Fri, 02 Mar 2012 18:31:45 GMT
Author: gtully
Date: Fri Mar  2 18:31:45 2012
New Revision: 1296368

URL: http://svn.apache.org/viewvc?rev=1296368&view=rev
Log:
fix timing issue with test, fails under load

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java?rev=1296368&r1=1296367&r2=1296368&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
Fri Mar  2 18:31:45 2012
@@ -39,6 +39,7 @@ import org.apache.activemq.broker.region
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.util.Wait;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -119,16 +120,26 @@ abstract public class MessagePriorityTes
     }
     
     public void testStoreConfigured() throws Exception {
-        Queue queue = sess.createQueue("TEST");
-        Topic topic = sess.createTopic("TEST");
+        final Queue queue = sess.createQueue("TEST");
+        final Topic topic = sess.createTopic("TEST");
         
         MessageProducer queueProducer = sess.createProducer(queue);
         MessageProducer topicProducer = sess.createProducer(topic);
-        
-        
-        Thread.sleep(500); // get it all propagated
-        
+
+        Wait.waitFor(new Wait.Condition() {
+            @Override
+            public boolean isSatisified() throws Exception {
+                return broker.getRegionBroker().getDestinationMap().get(queue) != null;
+            }
+        });
         assertTrue(broker.getRegionBroker().getDestinationMap().get(queue).getMessageStore().isPrioritizedMessages());
+
+        Wait.waitFor(new Wait.Condition(){
+            @Override
+            public boolean isSatisified() throws Exception {
+                return broker.getRegionBroker().getDestinationMap().get(topic) != null;
+            }
+        });
         assertTrue(broker.getRegionBroker().getDestinationMap().get(topic).getMessageStore().isPrioritizedMessages());
         
         queueProducer.close();



Mime
View raw message