activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r798842 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java
Date Wed, 29 Jul 2009 10:26:19 GMT
Author: gtully
Date: Wed Jul 29 10:26:19 2009
New Revision: 798842

URL: http://svn.apache.org/viewvc?rev=798842&view=rev
Log:
resolve https://issues.apache.org/activemq/browse/AMQ-2075 - async dispatch of brokerInfo
could end up getting dispatched after messages

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java?rev=798842&r1=798841&r2=798842&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java
Wed Jul 29 10:26:19 2009
@@ -1127,15 +1127,16 @@
         }
 
         // give the async ack a chance to perculate and validate all are currently consumed
-        assertNull(connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS));
-
+        Message msg = receiveMessage(connection1, MAX_NULL_WAIT);
+        assertNull("all messages were received " + msg, msg);
+        
         // Close the connection, this should in turn close the consumer.
         connection1.request(closeConnectionInfo(connectionInfo1));
 
         // Send another message, connection1 should not get the message.
         connection2.request(createMessage(producerInfo2, destination, deliveryMode));
 
-        assertNull(connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS));
+        assertNull("no message received", receiveMessage(connection1, MAX_NULL_WAIT));
     }
 
     public void initCombosForTestSessionCloseCascades() {
@@ -1187,7 +1188,7 @@
         // Send another message, connection1 should not get the message.
         connection2.request(createMessage(producerInfo2, destination, deliveryMode));
 
-        Object msg = connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS);
+        Message msg = receiveMessage(connection1,MAX_NULL_WAIT);
         assertNull("no message received from connection1 after session close", msg);
     }
 
@@ -1235,7 +1236,8 @@
         }
 
         // give the async ack a chance to perculate and validate all are currently consumed
-        Object result = connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS);
+        // use receive rather than poll as broker info is sent async and may still need to
be dequeued
+        Message result = receiveMessage(connection1, MAX_NULL_WAIT);
         assertNull("no more messages " + result, result);
  
         // Close the consumer.
@@ -1244,7 +1246,8 @@
         // Send another message, connection1 should not get the message.
         connection2.request(createMessage(producerInfo2, destination, deliveryMode));
 
-        assertNull(connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS));
+        result = receiveMessage(connection1, MAX_NULL_WAIT);
+        assertNull("no message received after close " + result, result);
     }
 
     public void initCombosForTestTopicNoLocal() {



Mime
View raw message