activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: make the browse more deterministic - awaiting result of acks
Date Fri, 06 Mar 2015 13:12:20 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 9ca4dfaac -> ad39fc00f


make the browse more deterministic - awaiting result of acks


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/ad39fc00
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/ad39fc00
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/ad39fc00

Branch: refs/heads/master
Commit: ad39fc00fbd9556deac2b7ed3646dae598c00125
Parents: 9ca4dfa
Author: gtully <gary.tully@gmail.com>
Authored: Fri Mar 6 13:13:17 2015 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Fri Mar 6 13:13:17 2015 +0000

----------------------------------------------------------------------
 .../org/apache/activemq/broker/jmx/MBeanTest.java    | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/ad39fc00/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
index 95b7ff0..1a363cc 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
@@ -1513,10 +1513,11 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
     public void testQueuePauseResume() throws Exception {
         connection = connectionFactory.createConnection();
         final int numToSend = 20;
+        final int numToConsume = 5;
         useConnection(connection, numToSend);
         ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName="
+ getDestinationString());
 
-        QueueViewMBean queue = MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
queueViewMBeanName, QueueViewMBean.class, true);
+        final QueueViewMBean queue = MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
queueViewMBeanName, QueueViewMBean.class, true);
 
         CompositeData[] compdatalist = queue.browse();
         int initialQueueSize = compdatalist.length;
@@ -1526,14 +1527,20 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
         echo("Attempting to consume 5 bytes messages from: " + destination);
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer consumer = session.createConsumer(destination);
-        for (int i=0; i<5; i++) {
+        for (int i=0; i<numToConsume; i++) {
             assertNotNull("Message: " + i, consumer.receive(5000));
         }
         consumer.close();
         session.close();
 
+        Wait.waitFor(new Wait.Condition() {
+            @Override
+            public boolean isSatisified() throws Exception {
+                return  numToSend - numToConsume == queue.browse().length;
+            }
+        });
         compdatalist = queue.browse();
-        assertEquals("expected", numToSend -5, compdatalist.length);
+        assertEquals("expected", numToSend - numToConsume, compdatalist.length);
 
         echo("pause");
         queue.pause();
@@ -1554,7 +1561,7 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
 
         // verify browse
         compdatalist = queue.browse();
-        assertEquals("expected browse", (2*numToSend)-5, compdatalist.length);
+        assertEquals("expected browse", (2*numToSend)-numToConsume, compdatalist.length);
         assertEquals("expected message count", compdatalist.length, queue.getQueueSize());
 
         echo("resume");


Mime
View raw message