use of si.ijs.maci.Administrator in project ACS by ACS-Community.
the class MaciSupervisor method connectToManager.
// ==================================================================
// Internal
// ==================================================================
// ============= Connecting / Disconnecting ===============
/**
*
*/
protected void connectToManager() throws CannotRetrieveManagerException, NoPermissionEx, SystemException {
log.fine(connect + "connecting to manager");
try {
org.omg.CORBA.Object object = orb.string_to_object(managerLoc);
managerRef = ManagerHelper.narrow(object);
} catch (Exception exc) {
log.fine(connect + "failed to connect to manager: " + exc);
throw new CannotRetrieveManagerException("could not retrieve manager reference", exc);
}
if (managerRef == null) {
log.fine(connect + "failed to connect to manager: got null manager reference");
throw new CannotRetrieveManagerException("orb delivered null-reference for manager-location " + managerLoc);
}
// <-- may throw "port occupied"
Administrator admin = acImpl.asCorbaObject(orb);
administratorClientInfo = managerRef.login(admin);
log.info(connect + "connected to manager (" + getManagerLocation() + ") as " + administratorClientInfo.h + " (= 0x" + Integer.toHexString(administratorClientInfo.h) + ")");
}
use of si.ijs.maci.Administrator in project ACS by ACS-Community.
the class AdministratorClient method connectToManager.
/**
* Connect to the manager
*/
public void connectToManager() throws Exception {
managerLoc = System.getProperty("ACS.manager");
if (managerLoc == null || managerLoc.length() == 0) {
throw new Exception("Error getting the manager loc: " + managerLoc);
}
managerLoc = managerLoc.trim();
org.omg.CORBA.Object object = orb.string_to_object(managerLoc);
if (object == null) {
throw new Exception("Error getting the manager " + managerLoc);
}
managerRef = ManagerHelper.narrow(object);
if (managerRef == null) {
throw new Exception("Error narrowing the " + managerLoc);
}
// <-- throws "port occupied"
Administrator adminIF = _this(orb);
administratorInfo = managerRef.login(adminIF);
logger.info("Connected to manager (name=" + administratorInfo.name + ", handle=" + administratorInfo.h + ")");
}
use of si.ijs.maci.Administrator in project ACS by ACS-Community.
the class ContainerTestUtil method loginToManager.
public void loginToManager() throws AcsJContainerEx {
if (adminProxy == null) {
AdministratorPOATie adminpoa = new AdministratorPOATie(new ManagerAdminClient(containerServices.getName(), logger));
Administrator adminCorbaObj = adminpoa._this(containerServices.getAdvancedContainerServices().getORB());
adminProxy = managerProxy.createInstance();
adminProxy.loginToManager(adminCorbaObj, 1);
int adminManagerHandle = adminProxy.getManagerHandle();
Assert.assertTrue(adminManagerHandle > 0);
}
}
use of si.ijs.maci.Administrator in project ACS by ACS-Community.
the class MaciSupervisorTest method setUp.
@Override
public void setUp() throws Exception {
System.out.println("\n--- " + getName() + " ----------------");
// make the manager
// -----------------------------------------------------------------
orb = Mockito.mock(ORB.class);
manager = Mockito.mock(Manager.class);
administrator = Mockito.mock(Administrator.class);
final int hhhhh = 0;
final int[] empty = new int[] {};
ComponentInfo comp100 = new ComponentInfo("type", "code", null, "comp100", empty, 10, "cont10", 100, 0, new String[] {});
ComponentInfo comp200 = new ComponentInfo("type", "code", null, "comp200", empty, 20, "cont20", 200, 0, new String[] {});
ComponentInfo comp300 = new ComponentInfo("type", "code", null, "comp300", empty, 30, "cont30", 300, 0, new String[] {});
ComponentInfo[] one_comp = { comp100 };
ComponentInfo[] two_comps = { comp100, comp200 };
ComponentInfo[] three_comps = { comp100, comp200, comp300 };
ContainerInfo cont10 = new ContainerInfo("cont10", 10, null, empty);
ContainerInfo cont20 = new ContainerInfo("cont20", 20, null, empty);
ContainerInfo cont30 = new ContainerInfo("cont30", 30, null, empty);
ContainerInfo[] one_cont = { cont10 };
ContainerInfo[] two_conts = { cont10, cont20 };
ContainerInfo[] three_conts = { cont10, cont20, cont30 };
ClientInfo clientA = new ClientInfo(0, null, empty, "clientA", 0);
ClientInfo client1 = new ClientInfo(1, null, empty, "client1", 0);
ClientInfo client2 = new ClientInfo(2, null, empty, "client2", 0);
ClientInfo client3 = new ClientInfo(3, null, empty, "client3", 0);
ClientInfo[] one_client = { client1 };
ClientInfo[] two_clients = { client1, client2 };
ClientInfo[] three_clients = { client1, client2, client3 };
Mockito.when(orb.string_to_object("dummy")).thenReturn(manager);
Mockito.when(manager.login(administrator)).thenReturn(clientA);
Mockito.when(manager.get_component_info(hhhhh, empty, "*", "*", false)).thenReturn(one_comp, two_comps, three_comps);
Mockito.when(manager.get_container_info(hhhhh, empty, "*")).thenReturn(one_cont, one_cont, two_conts, three_conts);
Mockito.when(manager.get_client_info(hhhhh, empty, "*")).thenReturn(one_client, two_clients, three_clients, two_clients, three_clients);
// make the supervisor
// -----------------------------------------------------------------
log = new Logger("Test", null) {
final long start = System.nanoTime();
@Override
public void log(LogRecord r) {
long sinceStart = (System.nanoTime() - start) / 1000 / 1000 / 1000;
System.out.println(String.format("%2d", sinceStart) + " " + r.getLevel() + " " + r.getMessage());
}
};
log.setLevel(Level.FINE);
testee = new MaciSupervisor("Test", "dummy", orb, log);
testee.acImpl = testee.new AdministratorImplementation() {
@Override
protected Administrator asCorbaObject(ORB orb) {
return administrator;
}
};
testee.start();
// assertions
// ----------------------------------------------------------------
maciListener = new MaciInfoListener();
MaciInfo maciInformation = testee.getMaciInformation();
maciInformation.addTreeModelListener(maciListener);
}
use of si.ijs.maci.Administrator in project ACS by ACS-Community.
the class AdministratorClient method connectToManager.
/**
* Connect to the manager
*/
public void connectToManager() throws Exception {
managerLoc = System.getProperty("ACS.manager");
if (managerLoc == null || managerLoc.length() == 0) {
throw new Exception("Error getting the manager loc: " + managerLoc);
}
managerLoc = managerLoc.trim();
org.omg.CORBA.Object object = orb.string_to_object(managerLoc);
if (object == null) {
throw new Exception("Error getting the manager " + managerLoc);
}
managerRef = ManagerHelper.narrow(object);
if (managerRef == null) {
throw new Exception("Error narrowing the " + managerLoc);
}
// <-- throws "port occupied"
Administrator adminIF = _this(orb);
administratorInfo = managerRef.login(adminIF);
logger.info("Connected to manager (name=" + administratorInfo.name + ", handle=" + administratorInfo.h + ")");
}
Aggregations