use of com.cosylab.acs.maci.ComponentInfo in project ACS by ACS-Community.
the class ManagerImplTest method internalTestGetHierarchicalComponent.
public void internalTestGetHierarchicalComponent(boolean activateOnActivation) {
try {
TestContainer container = new TestContainer("Container");
Map supportedComponents = new HashMap();
TestHierarchicalComponent mount2HierCOB = new TestHierarchicalComponent("HierarchicalCOB2", manager, new String[] { "MOUNT3" }, false, activateOnActivation);
TestHierarchicalComponent mount3HierCOB = new TestHierarchicalComponent("HierarchicalCOB3", manager, new String[] { "MOUNT4" }, false, activateOnActivation);
Component mount4COB = new TestComponent("MOUNT4");
supportedComponents.put("MOUNT2", mount2HierCOB);
supportedComponents.put("MOUNT3", mount3HierCOB);
supportedComponents.put("MOUNT4", mount4COB);
container.setSupportedComponents(supportedComponents);
// test case when container is unable to activate startup Component - MOUNT1
ClientInfo containerInfo = manager.login(container);
TestAdministrator client = new TestAdministrator(administratorName);
ClientInfo info = manager.login(client);
// test ordinary activation
URI mount2URI;
try {
mount2URI = new URI("MOUNT2");
StatusHolder status = new StatusHolder();
Component ref = manager.getComponent(info.getHandle(), mount2URI, true, status);
assertEquals(mount2HierCOB, ref);
assertEquals(ComponentStatus.COMPONENT_ACTIVATED, status.getStatus());
} catch (Exception ex) {
fail();
}
try {
Thread.sleep(STARTUP_COBS_SLEEP_TIME_MS);
} catch (InterruptedException ie) {
}
// test activated Components
// there should be all three Components activated
ComponentInfo[] infos = manager.getComponentInfo(info.getHandle(), new int[0], "*", "*", true);
assertEquals(3, infos.length);
// container logout and login
manager.logout(containerInfo.getHandle());
try {
Thread.sleep(SLEEP_TIME_MS);
} catch (InterruptedException ie) {
}
// test activated Components
// there should be no Components activated
infos = manager.getComponentInfo(info.getHandle(), new int[0], "*", "*", true);
assertEquals(0, infos.length);
manager.login(container);
try {
Thread.sleep(STARTUP_COBS_SLEEP_TIME_MS);
} catch (InterruptedException ie) {
}
// test activated Components
// there should be all three Components activated
infos = manager.getComponentInfo(info.getHandle(), new int[0], "*", "*", true);
assertEquals(3, infos.length);
// logout client
manager.logout(info.getHandle());
try {
Thread.sleep(SLEEP_TIME_MS);
} catch (InterruptedException ie) {
}
} catch (AcsJNoPermissionEx e) {
fail("No permission");
}
}
Aggregations