You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/10/31 14:10:14 UTC
svn commit: r1404122 -
/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionRemoveOfflineTest.java
Author: tabish
Date: Wed Oct 31 13:10:14 2012
New Revision: 1404122
URL: http://svn.apache.org/viewvc?rev=1404122&view=rev
Log:
updated test case to check: https://issues.apache.org/jira/browse/AMQ-4149 could not reproduce issue.
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionRemoveOfflineTest.java
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionRemoveOfflineTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionRemoveOfflineTest.java?rev=1404122&r1=1404121&r2=1404122&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionRemoveOfflineTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionRemoveOfflineTest.java Wed Oct 31 13:10:14 2012
@@ -16,16 +16,17 @@
*/
package org.apache.activemq.usecases;
-import junit.framework.Test;
-import org.apache.activemq.EmbeddedBrokerTestSupport;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.util.Wait;
-
import javax.jms.Connection;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicSubscriber;
+import junit.framework.Test;
+
+import org.apache.activemq.EmbeddedBrokerTestSupport;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.util.Wait;
+
public class DurableSubscriptionRemoveOfflineTest extends EmbeddedBrokerTestSupport {
protected void setUp() throws Exception {
@@ -46,6 +47,21 @@ public class DurableSubscriptionRemoveOf
return answer;
}
+ protected BrokerService restartBroker() throws Exception {
+ broker.stop();
+ broker.waitUntilStopped();
+ broker = null;
+
+ broker = super.createBroker();
+ broker.setOfflineDurableSubscriberTaskSchedule(3 * 1000);
+ broker.setOfflineDurableSubscriberTimeout(5 * 1000);
+
+ broker.start();
+ broker.waitUntilStarted();
+
+ return broker;
+ }
+
public void testRemove() throws Exception {
Connection connection = createConnection();
connection.setClientID("cliID");
@@ -60,10 +76,29 @@ public class DurableSubscriptionRemoveOf
public boolean isSatisified() throws Exception {
return broker.getAdminView().getInactiveDurableTopicSubscribers().length == 0;
}
- }, 10000);
-
+ }, 15000);
}
+ public void testRemoveAfterRestart() throws Exception {
+ Connection connection = createConnection();
+ connection.setClientID("cliID");
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ TopicSubscriber subscriber = session.createDurableSubscriber((Topic) createDestination(), "subName");
+ subscriber.close();
+ connection.close();
+
+ restartBroker();
+
+ assertTrue(broker.getAdminView().getInactiveDurableTopicSubscribers().length == 1);
+
+ Wait.waitFor(new Wait.Condition() {
+ @Override
+ public boolean isSatisified() throws Exception {
+ return broker.getAdminView().getInactiveDurableTopicSubscribers().length == 0;
+ }
+ }, 20000);
+ }
protected boolean isPersistent() {
return true;