activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r825084 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2439Test.java
Date Wed, 14 Oct 2009 11:11:03 GMT
Author: gtully
Date: Wed Oct 14 11:11:03 2009
New Revision: 825084

URL: http://svn.apache.org/viewvc?rev=825084&view=rev
Log:
fix race condition in test that validates dequeue count, thanks Al on irc

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

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2439Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2439Test.java?rev=825084&r1=825083&r2=825084&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2439Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2439Test.java Wed
Oct 14 11:11:03 2009
@@ -27,6 +27,7 @@
 
 import org.apache.activemq.JmsMultipleBrokersTestSupport;
 import org.apache.activemq.broker.jmx.BrokerView;
+import org.apache.activemq.util.Wait;
 
 public class AMQ2439Test extends JmsMultipleBrokersTestSupport {
     Destination dest;
@@ -39,9 +40,14 @@
     }
     
     private void validateQueueStats() throws Exception {
-       BrokerView brokerView = brokers.get("BrokerA").broker.getAdminView();
+       final BrokerView brokerView = brokers.get("BrokerA").broker.getAdminView();
        assertEquals("enequeue is correct", 1000, brokerView.getTotalEnqueueCount());
-       assertEquals("dequeue is correct", 1000, brokerView.getTotalDequeueCount());
+       
+       assertTrue("dequeue is correct", Wait.waitFor(new Wait.Condition() {
+           public boolean isSatisified() throws Exception {
+               return 1000 == brokerView.getTotalDequeueCount();
+           }
+       }));
     }
 
     protected int receiveExactMessages(String brokerName, int msgCount) throws Exception
{



Mime
View raw message