use of org.omg.CORBA.ORB in project alliance by codice.
the class CorbaOrbImplTest method testPropRefresh.
@Test
public void testPropRefresh() {
CorbaOrbImpl corbaOrb = new CorbaOrbImpl();
corbaOrb.setCorbaTimeout(100);
corbaOrb.setCorbaPort(20000);
corbaOrb.init();
ORB orb = corbaOrb.getOrb();
assertThat(orb, notNullValue());
int port = corbaOrb.getCorbaPort();
assertThat(port, is(20000));
Map<String, Object> props = new HashMap<>();
props.put(CorbaOrbImpl.CORBA_PORT, "20001");
props.put(CorbaOrbImpl.CORBA_TIMEOUT, 61);
corbaOrb.refresh(props);
orb = corbaOrb.getOrb();
assertThat(orb, notNullValue());
}
use of org.omg.CORBA.ORB in project alliance by codice.
the class CorbaOrbImplTest method testGetOrb.
@Test
public void testGetOrb() {
CorbaOrbImpl corbaOrb = new CorbaOrbImpl();
corbaOrb.setCorbaTimeout(100);
corbaOrb.setCorbaPort(0);
corbaOrb.init();
ORB orb = corbaOrb.getOrb();
assertThat(orb, notNullValue());
corbaOrb.shutdown();
}
use of org.omg.CORBA.ORB in project alliance by codice.
the class MockNsili method getOrbForServer.
private ORB getOrbForServer(int port) throws InvalidName, AdapterInactive, WrongPolicy, ServantNotActive, IOException {
System.setProperty("org.omg.CORBA.ORBInitialPort", String.valueOf(port));
final ORB orb = ORB.init(new String[0], null);
System.clearProperty("org.omg.CORBA.ORBInitialPort");
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootPOA.the_POAManager().activate();
org.omg.CORBA.Object objref = rootPOA.servant_to_reference(new LibraryImpl(rootPOA));
// set ior.txt for http web server
iorString = orb.object_to_string(objref);
// set ior.txt for ftp web server
File ftpIorFile = new File(ftpHomeDirectoryPath + "/data/ior.txt");
File ftpDataDirectory = new File(ftpHomeDirectoryPath + "/data");
ftpDataDirectory.mkdirs();
if (!ftpIorFile.createNewFile()) {
LOGGER.error("Unable to create new file");
}
PrintWriter printWriter = new PrintWriter(new FileWriter(ftpIorFile.getPath()));
printWriter.print(orb.object_to_string(objref));
if (printWriter.checkError()) {
LOGGER.error("Unable to write ior string to ftp server temporary file");
}
printWriter.close();
return orb;
}
Aggregations