// OK
}
ServerManagement.deployTopic("TopicToBeRedeployed");
ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
Topic topic = (Topic)ic.lookup("/topic/TopicToBeRedeployed");
Connection conn = cf.createConnection();
conn.setClientID("brookeburke");
Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer prod = s.createProducer(topic);
prod.setDeliveryMode(DeliveryMode.PERSISTENT);
MessageConsumer ds = s.createDurableSubscriber(topic, "monicabelucci");
conn.start();
prod.send(s.createTextMessage("one"));
prod.send(s.createTextMessage("two"));
TextMessage tm = (TextMessage)ds.receive();
assertEquals("one", tm.getText());
conn.close();
ServerManagement.undeployTopic("TopicToBeRedeployed");
log.debug("topic undeployed");
try
{
topic = (Topic)ic.lookup("/topic/TopicToBeRedeployed");
fail("should throw exception");
}
catch(NamingException e)
{
// OK
}
conn = cf.createConnection();
conn.setClientID("brookeburke");
s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
try