DeploymentManager manager = getDeploymentManager(uri, Authentication.USERNAME, Authentication.PASSWORD);
Target[] targets = manager.getTargets();
TargetModuleID[] modules = manager.getAvailableModules(ModuleType.EAR, targets);
assertNull(modules);
ProgressObject progress = jsr88Deploy(manager, getEarArchive());
TargetModuleID[] targetModules = progress.getResultTargetModuleIDs();
try {
// Test getAvailableModules
modules = manager.getAvailableModules(ModuleType.EAR, targets);
assertNotNull(modules);
assertEquals(1, modules.length);
TargetModuleID targetModuleID = modules[0];
String moduleID = targetModuleID.getModuleID();
assertTrue("Ends with deployment-app.ear", moduleID.endsWith("deployment-app.ear"));
// Test getNonRunningModules
modules = manager.getNonRunningModules(ModuleType.EAR, targets);
assertEquals("non-running EAR modules count expected to be zero " + modules, 0, modules.length);
// Test getRunningModules
modules = manager.getRunningModules(ModuleType.EAR, targets);
assertEquals("running EAR modules count expected to be one " + modules, 1, modules.length);
targetModuleID = modules[0];
moduleID = targetModuleID.getModuleID();
assertTrue("Ends with deployment-app.ear", moduleID.endsWith("deployment-app.ear"));
ProgressObject operationProgress = manager.stop(modules);
awaitCompletion(operationProgress, TIMEOUT);
// Test getRunningModules
modules = manager.getRunningModules(ModuleType.EAR, targets);
assertEquals("after stopping deployment-app.ear, running EAR modules count expected to be zero" + modules, 0, modules.length);