activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1511340 - /activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java
Date Wed, 07 Aug 2013 14:51:39 GMT
Author: tabish
Date: Wed Aug  7 14:51:38 2013
New Revision: 1511340

URL: http://svn.apache.org/r1511340
Log:
apply patch for: https://issues.apache.org/jira/browse/AMQ-4670

Modified:
    activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java

Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java?rev=1511340&r1=1511339&r2=1511340&view=diff
==============================================================================
--- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java
(original)
+++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java
Wed Aug  7 14:51:38 2013
@@ -100,6 +100,13 @@ public class DurableSubDelayedUnsubscrib
         // Ensure we sleep longer than the housekeeper's sweep delay otherwise we can
         // miss the fact that all durables that were abandoned do finally get cleaned up.
 
+        // Wait for all clients to stop
+        Wait.waitFor(new Wait.Condition() {
+            public boolean isSatisified() throws Exception {
+                return clientManager.getClientCount() == 0;
+            }
+        }, Client.lifetime + TimeUnit.SECONDS.toMillis(10));
+
         assertTrue("should have only one inactiveSubscriber subscribed but was: " + brokerService.getAdminView().getInactiveDurableTopicSubscribers().length,
             Wait.waitFor(new Wait.Condition() {
 
@@ -107,7 +114,7 @@ public class DurableSubDelayedUnsubscrib
                 public boolean isSatisified() throws Exception {
                     return brokerService.getAdminView().getInactiveDurableTopicSubscribers().length
== 1;
                 }
-            }, TimeUnit.MINUTES.toMillis(houseKeeper.SWEEP_DELAY * 2)));
+            }, houseKeeper.SWEEP_DELAY * 2));
 
         assertTrue("should be no subscribers subscribed but was: " + brokerService.getAdminView().getDurableTopicSubscribers().length,
             Wait.waitFor(new Wait.Condition() {
@@ -360,6 +367,10 @@ public class DurableSubDelayedUnsubscrib
             setDaemon(true);
         }
 
+        public int getClientCount() {
+            return clients.size();
+        }
+
         @Override
         public void run() {
             try {
@@ -438,7 +449,7 @@ public class DurableSubDelayedUnsubscrib
         private final int id;
         private final String conClientId;
 
-        private final int lifetime = 60 * 1000;
+        public static final int lifetime = 60 * 1000;
         private final int online = 1 * 1000;
         private final int offline = 59 * 1000;
 



Mime
View raw message