*
* @throws Exception
*/
public void testListStartStopModules() throws Exception
{
TargetModuleIDImpl child = null;
TargetModuleIDImpl parent = null;
// Get the deployment manager and the distribution targets
DeploymentManager manager = getDeploymentManager();
Target[] targets = manager.getTargets();
assertEquals(1, targets.length);
TargetModuleID[] modules = manager.getRunningModules(ModuleType.EAR, manager.getTargets());
assertNull("no modules Available", modules);
ProgressObject parentProgress = jsr88Deployment("deployment-ear.ear");
assertServletAccess("custom-context");
assertEjbEchoAccess();
modules = manager.getRunningModules(ModuleType.EAR, manager.getTargets());
assertNotNull(modules);
assertEquals("one EAR module in the server", modules.length, 1);
parent = (TargetModuleIDImpl) modules[0];
assertTrue("wrong state", parent.isRunning());
assertEquals("wrong type", parent.getModuleType(), ModuleType.EAR);
assertEquals("EAR module have a jar and a war", parent.getChildTargetModuleID().length, 2);
child = (TargetModuleIDImpl) parent.getChildTargetModuleID()[0];
assertTrue("wrong state", child.isRunning());
assertTrue("wrong type", child.getModuleType().equals(ModuleType.EJB) || child.getModuleType().equals(ModuleType.WAR));
assertEquals("child have no child", child.getChildTargetModuleID().length, 0);
child = (TargetModuleIDImpl) parent.getChildTargetModuleID()[1];
assertTrue("wrong state", child.isRunning());
assertTrue("wrong type " + child.getModuleType(), child.getModuleType().equals(ModuleType.EJB) || child.getModuleType().equals(ModuleType.WAR));
assertEquals("child have no child", child.getChildTargetModuleID().length, 0);
parentProgress = manager.stop(new TargetModuleID[] { parent });
waitForCompletion(parentProgress.getDeploymentStatus());
modules = manager.getNonRunningModules(ModuleType.EAR, manager.getTargets());
assertNotNull(modules);
assertEquals("one EAR module in the server", modules.length, 1);
parent = (TargetModuleIDImpl) modules[0];
assertFalse("wrong state", parent.isRunning());
assertEquals("wrong type", parent.getModuleType(), ModuleType.EAR);
assertEquals("EAR module have a jar and a war", parent.getChildTargetModuleID().length, 2);
parentProgress = manager.start(new TargetModuleID[]{ parent });
waitForCompletion(parentProgress.getDeploymentStatus());
modules = manager.getRunningModules(ModuleType.EAR, manager.getTargets());
assertNotNull(modules);
assertEquals("one EAR module in the server", modules.length, 1);
parent = (TargetModuleIDImpl) modules[0];
assertTrue("wrong state", parent.isRunning());
assertEquals("wrong type", parent.getModuleType(), ModuleType.EAR);
assertEquals("EAR module have a jar and a war", parent.getChildTargetModuleID().length, 2);
parentProgress = manager.undeploy(new TargetModuleID[]{ parent });
waitForCompletion(parentProgress.getDeploymentStatus());
modules = manager.getAvailableModules(ModuleType.EAR, manager.getTargets());
assertNull("EAR must not be available", modules);