ServerManagement.start("all", 0); ServerManagement.start("all", 1); ServerManagement.start("all", 2);
ServerManagement.start(0, "all"); ServerManagement.start(1, "all"); ServerManagement.start(2, "all");
   public void testDirtyLeaveTwoNodes() throws Exception   {      ClusterEventNotificationListener clusterEvent = new ClusterEventNotificationListener();      ObjectName postOfficeObjectName = new ObjectName("jboss.messaging:service=PostOffice");      try      {         // Start with a 3 node cluster         ServerManagement.start("all", 0);         ServerManagement.start("all", 1);         ServerManagement.start("all", 2);         Set view = ServerManagement.getServer(0).getNodeIDView();         assertEquals(3, view.size());         assertTrue(view.contains(new Integer(0)));         assertTrue(view.contains(new Integer(1)));         assertTrue(view.contains(new Integer(2)));         ServerManagement.addNotificationListener(0, postOfficeObjectName, clusterEvent);         // Make node 2 to "dirty" leave the cluster, by killing the VM running it.         ServerManagement.kill(2);         log.info("########");         log.info("######## KILLED 2");         log.info("########");         // Wait for FAILOVER_COMPLETED notification         if (!clusterEvent.failoverCompleted(120000))         {            fail("Did not receive a FAILOVER_COMPLETED event after killing server 2!");         }         log.info("received FAILOVER_COMPLETED");         view = ServerManagement.getServer(1).getNodeIDView();         assertEquals(2, view.size());         assertTrue(view.contains(new Integer(0)));         assertTrue(view.contains(new Integer(1)));         // Make node 1 to "dirty" leave the cluster, by killing the VM running it.         ServerManagement.kill(1);         log.info("########");         log.info("######## KILLED 1");         log.info("########");         // Wait for FAILOVER_COMPLETED notification         if (!clusterEvent.failoverCompleted(120000))         {            fail("Did not receive a FAILOVER_COMPLETED event after killing server 1!");         }         log.info("received FAILOVER_COMPLETED");         view = ServerManagement.getServer(0).getNodeIDView();         assertEquals(1, view.size());         assertTrue(view.contains(new Integer(0)));      }      finally      {         ServerManagement.removeNotificationListener(0, postOfficeObjectName, clusterEvent);         ServerManagement.stop(2);         ServerManagement.stop(1);         ServerManagement.stop(0);      }   }