ServerManagement.undeployTopic("CompletelyNewTopic2");
   public void testDurableSubscriptionDifferentSelector() throws Exception   {      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");      Topic topic = (Topic)ic.lookup("/topic/Topic");      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 durable =         s.createDurableSubscriber(topic,                                   "monicabelucci",                                   "color = 'red' AND shape = 'square'",                                   false);      TextMessage tm = s.createTextMessage("A red square message");      tm.setStringProperty("color", "red");      tm.setStringProperty("shape", "square");      prod.send(tm);      conn.start();      TextMessage rm = (TextMessage)durable.receive(5000);      assertEquals("A red square message", rm.getText());      tm = s.createTextMessage("Another red square message");      tm.setStringProperty("color", "red");      tm.setStringProperty("shape", "square");      prod.send(tm);      // TODO: when subscriptions/durable subscription will be registered as MBean, use the JMX      //       interface to make sure the 'another red square message' is maintained by the      //       durable subascription      //       http://jira.jboss.org/jira/browse/JBMESSAGING-217      conn.close();      conn = cf.createConnection();      conn.setClientID("brookeburke");      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);      // modify the selector      durable = s.createDurableSubscriber(topic,                                          "monicabelucci",                                          "color = 'red'",                                          false);      conn.start();      Message m = durable.receive(1000);      // the durable subscription is destroyed and re-created. The red square message stored by      // the previous durable subscription is lost and (hopefully) garbage collected.      assertNull(m);   }