set = (Set)ServerManagement.invoke(serverPeerObjectName, "getDestinations", new Object[0], new String[0]);
set = (Set)ServerManagement.getAttribute(serverPeerObjectName, "Destinations");
   public void testDeployDestinationProgramatically() throws Exception   {      ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();      String destinationType = isQueue() ? "Queue" : "Topic";      String createMethod = "create" + destinationType;      String destroyMethod = "destroy" + destinationType;      String destinationName = "BlahBlah";      String expectedJNDIName = (isQueue() ? "/queue/" : "/topic/") + destinationName;      ObjectName destObjectName = new ObjectName("jboss.messaging.destination:service=" +                                                 destinationType +",name=" + destinationName);      // deploy it      String jndiName = (String)ServerManagement.         invoke(serverPeerObjectName, createMethod,                new Object[] { destinationName, null },                new String[] { "java.lang.String", "java.lang.String" });      assertEquals(expectedJNDIName, jndiName);      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());      if (isQueue())      {         Queue q = (Queue)ic.lookup(jndiName);         assertEquals(destinationName, q.getQueueName());      }      else      {         Topic t = (Topic)ic.lookup(jndiName);         assertEquals(destinationName, t.getTopicName());      }      assertEquals(destinationName, ServerManagement.getAttribute(destObjectName, "Name"));      assertEquals(expectedJNDIName,                   (String)ServerManagement.getAttribute(destObjectName, "JNDIName"));      // undeploy it      Boolean b = (Boolean)ServerManagement.invoke(serverPeerObjectName, destroyMethod,                                                   new Object[] { destinationName },                                                   new String[] { "java.lang.String" });      assertTrue(b.booleanValue());      try      {         ic.lookup(expectedJNDIName);         fail("should throw exception");      }      catch(NamingException e)      {         // OK      }      Set set = ServerManagement.query(destObjectName);      assertTrue(set.isEmpty());      set = (Set)ServerManagement.invoke(serverPeerObjectName, "getDestinations",                                         new Object[0], new String[0]);      assertTrue(set.isEmpty());      ic.close();   }