mirror of https://github.com/apache/activemq.git
updated test case to check: https://issues.apache.org/jira/browse/AMQ-4149 could not reproduce issue.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1404122 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f6a5c7bd47
commit
cb3392c307
|
@ -16,16 +16,17 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.usecases;
|
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.Connection;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
import javax.jms.Topic;
|
import javax.jms.Topic;
|
||||||
import javax.jms.TopicSubscriber;
|
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 {
|
public class DurableSubscriptionRemoveOfflineTest extends EmbeddedBrokerTestSupport {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
|
@ -46,6 +47,21 @@ public class DurableSubscriptionRemoveOfflineTest extends EmbeddedBrokerTestSupp
|
||||||
return answer;
|
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 {
|
public void testRemove() throws Exception {
|
||||||
Connection connection = createConnection();
|
Connection connection = createConnection();
|
||||||
connection.setClientID("cliID");
|
connection.setClientID("cliID");
|
||||||
|
@ -60,10 +76,29 @@ public class DurableSubscriptionRemoveOfflineTest extends EmbeddedBrokerTestSupp
|
||||||
public boolean isSatisified() throws Exception {
|
public boolean isSatisified() throws Exception {
|
||||||
return broker.getAdminView().getInactiveDurableTopicSubscribers().length == 0;
|
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() {
|
protected boolean isPersistent() {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue