activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-527 - [Artemis Testsuite] TopicControlTest fails
Date Thu, 19 May 2016 16:30:57 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master ab5471c57 -> 6204aaac5


ARTEMIS-527 - [Artemis Testsuite] TopicControlTest fails


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

Branch: refs/heads/master
Commit: 17322fb57a38633edb2f754ffb97bbd2dd08bed8
Parents: ab5471c
Author: Erich Duda <eduda@redhat.com>
Authored: Wed May 18 15:54:48 2016 +0200
Committer: Erich Duda <eduda@redhat.com>
Committed: Thu May 19 10:53:27 2016 +0200

----------------------------------------------------------------------
 .../jms/server/management/TopicControlTest.java | 58 ++++++++++++++++++--
 1 file changed, 53 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/17322fb5/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java
index a23f067..238aaa0 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java
@@ -133,9 +133,9 @@ public class TopicControlTest extends ManagementTestBase {
 
       JMSUtil.sendMessages(topic, 2);
 
-      Assert.assertEquals(3 * 2, topicControl.getMessageCount());
-      Assert.assertEquals(1 * 2, topicControl.getNonDurableMessageCount());
-      Assert.assertEquals(2 * 2, topicControl.getDurableMessageCount());
+      waitForMessageCount(3 * 2, topicControl, 3000);
+      waitForNonDurableMessageCount(1 * 2, topicControl, 3000);
+      waitForDurableMessageCount(2 * 2, topicControl, 3000);
 
       connection_1.close();
       connection_2.close();
@@ -406,7 +406,7 @@ public class TopicControlTest extends ManagementTestBase {
       JMSUtil.sendMessages(topic, 3);
 
       TopicControl topicControl = createManagementControl();
-      Assert.assertEquals(3 * 2, topicControl.getMessageCount());
+      waitForMessageCount(3 * 2, topicControl, 3000);
 
       int removedCount = topicControl.removeMessages(null);
       Assert.assertEquals(3 * 2, removedCount);
@@ -494,7 +494,7 @@ public class TopicControlTest extends ManagementTestBase {
 
       JMSUtil.sendMessages(topic, 2);
 
-      Assert.assertEquals(3 * 2, topicControl.getMessagesAdded());
+      waitForAddedMessageCount(3 * 2, topicControl, 3000);
 
       connection_1.close();
       connection_2.close();
@@ -619,6 +619,54 @@ public class TopicControlTest extends ManagementTestBase {
 
    // Private -------------------------------------------------------
 
+   private void waitForMessageCount(long expected, TopicControl topicControl, long timeout)
throws Exception {
+      long timeToWait = System.currentTimeMillis() + timeout;
+
+      while (System.currentTimeMillis() < timeToWait) {
+         if (expected == topicControl.getMessageCount()) {
+            return;
+         }
+         Thread.sleep(100);
+      }
+      assertEquals(expected, topicControl.getMessageCount());
+   }
+
+   private void waitForNonDurableMessageCount(long expected, TopicControl topicControl, long
timeout) throws Exception {
+      long timeToWait = System.currentTimeMillis() + timeout;
+
+      while (System.currentTimeMillis() < timeToWait) {
+         if (expected == topicControl.getNonDurableMessageCount()) {
+            return;
+         }
+         Thread.sleep(100);
+      }
+      assertEquals(expected, topicControl.getNonDurableMessageCount());
+   }
+
+   private void waitForDurableMessageCount(long expected, TopicControl topicControl, long
timeout) throws Exception {
+      long timeToWait = System.currentTimeMillis() + timeout;
+
+      while (System.currentTimeMillis() < timeToWait) {
+         if (expected == topicControl.getDurableMessageCount()) {
+            return;
+         }
+         Thread.sleep(100);
+      }
+      assertEquals(expected, topicControl.getDurableMessageCount());
+   }
+
+   private void waitForAddedMessageCount(long expected, TopicControl topicControl, long timeout)
throws Exception {
+      long timeToWait = System.currentTimeMillis() + timeout;
+
+      while (System.currentTimeMillis() < timeToWait) {
+         if (expected == topicControl.getMessagesAdded()) {
+            return;
+         }
+         Thread.sleep(100);
+      }
+      assertEquals(expected, topicControl.getMessagesAdded());
+   }
+
    // Inner classes -------------------------------------------------
 
 }


Mime
View raw message