public void testActivateWithExistingTopic() throws Exception {
// create durable subscription
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
session.createDurableSubscriber(topic, "SubsId");
Destination d = broker.getDestination(topic);
assertTrue("More than one consumer found: " + d.getConsumers().size(), d.getConsumers().size() == 1);
// restart the broker
restartBroker();
d = broker.getDestination(topic);
assertTrue("More than one consumer found: " + d.getConsumers().size(), d.getConsumers().size() == 1);
// activate
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
session.createDurableSubscriber(topic, "SubsId");
assertTrue("More than one consumer found: " + d.getConsumers().size(), d.getConsumers().size() == 1);
// re-activate
connection.close();
connection = createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
session.createDurableSubscriber(topic, "SubsId");
assertTrue("More than one consumer found: " + d.getConsumers().size(), d.getConsumers().size() == 1);
}