try
{
assertServiceRunning(NAME_ONE);
assertServiceRunning(NAME_TWO);
MBeanServer server = getServer();
test1 = (Simple) server.getAttribute(NAME_ONE, "Instance");
assertEquals("()", test1.constructorUsed);
assertEquals(1, test1.createOrder);
assertEquals(2, test1.startOrder);
assertEquals(0, test1.stopOrder);
assertEquals(0, test1.destroyOrder);
test2 = (Simple) server.getAttribute(NAME_TWO, "Instance");
assertEquals("()", test2.constructorUsed);
assertEquals(3, test2.createOrder);
assertEquals(4, test2.startOrder);
assertEquals(0, test2.stopOrder);
assertEquals(0, test2.destroyOrder);
undeploy(mbeans2);
assertServiceRunning(NAME_ONE);
assertNoService(NAME_TWO);
assertEquals(1, test1.createOrder);
assertEquals(2, test1.startOrder);
assertEquals(0, test1.stopOrder);
assertEquals(0, test1.destroyOrder);
assertEquals(3, test2.createOrder);
assertEquals(4, test2.startOrder);
assertEquals(5, test2.stopOrder);
assertEquals(6, test2.destroyOrder);
mbeans2 = deploy(resourceName2);
assertServiceRunning(NAME_ONE);
assertServiceRunning(NAME_TWO);
assertEquals(1, test1.createOrder);
assertEquals(2, test1.startOrder);
assertEquals(0, test1.stopOrder);
assertEquals(0, test1.destroyOrder);
test2 = (Simple) server.getAttribute(NAME_TWO, "Instance");
assertEquals("()", test1.constructorUsed);
assertEquals(7, test2.createOrder);
assertEquals(8, test2.startOrder);
assertEquals(0, test2.stopOrder);
assertEquals(0, test2.destroyOrder);