mirror of https://github.com/apache/activemq.git
Restore test case removed last commit.
This commit is contained in:
parent
1d39f08c12
commit
226e012d88
|
@ -42,6 +42,7 @@ import javax.jms.Session;
|
|||
import javax.jms.TextMessage;
|
||||
import javax.jms.Topic;
|
||||
|
||||
import org.apache.activemq.broker.jmx.BrokerViewMBean;
|
||||
import org.apache.activemq.broker.jmx.ConnectorViewMBean;
|
||||
import org.apache.activemq.broker.jmx.QueueViewMBean;
|
||||
import org.apache.activemq.transport.amqp.joram.ActiveMQAdmin;
|
||||
|
@ -849,4 +850,48 @@ public class JMSClientTest extends JMSClientTestSupport {
|
|||
assertEquals(messageSize, textMessage.getText().length());
|
||||
assertEquals(messageText, textMessage.getText());
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
public void testDurableConsumerUnsubscribe() throws Exception {
|
||||
ActiveMQAdmin.enableJMSFrameTracing();
|
||||
|
||||
final BrokerViewMBean broker = getProxyToBroker();
|
||||
|
||||
connection = createConnection();
|
||||
connection.start();
|
||||
|
||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
Topic topic = session.createTopic(getDestinationName());
|
||||
MessageConsumer consumer = session.createDurableSubscriber(topic, "DurbaleTopic");
|
||||
|
||||
assertTrue(Wait.waitFor(new Wait.Condition() {
|
||||
|
||||
@Override
|
||||
public boolean isSatisified() throws Exception {
|
||||
return broker.getInactiveDurableTopicSubscribers().length == 0 &&
|
||||
broker.getDurableTopicSubscribers().length == 1;
|
||||
}
|
||||
}));
|
||||
|
||||
consumer.close();
|
||||
|
||||
assertTrue(Wait.waitFor(new Wait.Condition() {
|
||||
|
||||
@Override
|
||||
public boolean isSatisified() throws Exception {
|
||||
return broker.getInactiveDurableTopicSubscribers().length == 1 &&
|
||||
broker.getDurableTopicSubscribers().length == 0;
|
||||
}
|
||||
}));
|
||||
|
||||
session.unsubscribe("DurbaleTopic");
|
||||
assertTrue(Wait.waitFor(new Wait.Condition() {
|
||||
|
||||
@Override
|
||||
public boolean isSatisified() throws Exception {
|
||||
return broker.getInactiveDurableTopicSubscribers().length == 0 &&
|
||||
broker.getDurableTopicSubscribers().length == 0;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue