use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class BCTClient method getPropertySync.
/**
* TEST_2_1_1 & TEST_3_1_1
* @param loop
*/
public void getPropertySync(long loop) {
CompletionHolder completionHolder = new CompletionHolder();
m_startTime = System.currentTimeMillis();
for (int i = 0; i < loop; i++) m_property.get_sync(completionHolder);
m_endTime = System.currentTimeMillis();
}
use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class SimpleMasterComponentTest method test.
/**
* Main test routine.
*/
public void test() {
initializeCORBA();
Manager manager = resolveManager();
if (manager != null) {
ClientInfo clientInfo = login(manager);
if (clientInfo != null) {
System.out.println("All initialization done.");
//
// get component
//
final String COMPONENT_NAME = "SIMPLEMASTERCOMPONENT1";
org.omg.CORBA.Object obj;
try {
obj = manager.get_component(clientInfo.h, COMPONENT_NAME, true);
SimpleMasterComponent simpleMasterComponent = SimpleMasterComponentHelper.narrow(obj);
ROstringSeq currentStateHierarchy = simpleMasterComponent.currentStateHierarchy();
// syncvalue retrival
System.out.println("Current state hierarchy: " + getStringArray(currentStateHierarchy.get_sync(new CompletionHolder())));
System.out.println("Monitoring - 1s interval...");
// create a monitor
MonitorstringSeq monitor = currentStateHierarchy.create_monitor(new CBstringSeqImpl()._this(orb), new CBDescIn());
// sleep for a while
try {
Thread.sleep(10000);
} catch (InterruptedException ie) {
}
;
monitor.set_timer_trigger(0);
monitor.set_value_trigger(new String[0], true);
System.out.println("On-change monitoring...");
// sleep for a while
try {
Thread.sleep(10000);
} catch (InterruptedException ie) {
}
;
monitor.destroy();
} catch (Exception e) {
// CannotGetComponentEx, ComponentConfigurationNotFoundEx
System.err.println("Failed to obtain component: " + COMPONENT_NAME);
}
// release now
try {
manager.release_component(clientInfo.h, COMPONENT_NAME);
} catch (NoPermissionEx ex) {
ex.printStackTrace();
}
logout(manager, clientInfo);
}
}
finalizeCORBA();
}
use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class PropertySeqTest method testGetSyncAll.
public void testGetSyncAll() {
//ROlong
CompletionHolder completionHolder = new CompletionHolder();
// TODO check value
ROpropertyLongSeq.get_sync(completionHolder);
//assertEquals(property.default_value(), value, 0.0);
assertEquals(0, completionHolder.value.code);
assertEquals(0, completionHolder.value.type);
assertEquals(0, completionHolder.value.previousError.length);
// less than 5
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - completionHolder.value.timeStamp) < 50000000);
//RWlong
completionHolder = new CompletionHolder();
// TODO check value
RWpropertyLongSeq.get_sync(completionHolder);
//assertEquals(property.default_value(), value, 0.0);
assertEquals(0, completionHolder.value.code);
assertEquals(0, completionHolder.value.type);
assertEquals(0, completionHolder.value.previousError.length);
// less than 5
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - completionHolder.value.timeStamp) < 50000000);
//RODouble
completionHolder = new CompletionHolder();
// TODO check value
ROpropertyDoubleSeq.get_sync(completionHolder);
//assertEquals(property.default_value(), value, 0.0);
assertEquals(0, completionHolder.value.code);
assertEquals(0, completionHolder.value.type);
assertEquals(0, completionHolder.value.previousError.length);
// less than 5
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - completionHolder.value.timeStamp) < 50000000);
//RWDouble
completionHolder = new CompletionHolder();
// TODO check value
RWpropertyDoubleSeq.get_sync(completionHolder);
//assertEquals(property.default_value(), value, 0.0);
assertEquals(0, completionHolder.value.code);
assertEquals(0, completionHolder.value.type);
assertEquals(0, completionHolder.value.previousError.length);
// less than 5
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - completionHolder.value.timeStamp) < 50000000);
//ROFloat
completionHolder = new CompletionHolder();
// TODO check value
ROpropertyFloatSeq.get_sync(completionHolder);
//assertEquals(property.default_value(), value, 0.0);
assertEquals(0, completionHolder.value.code);
assertEquals(0, completionHolder.value.type);
assertEquals(0, completionHolder.value.previousError.length);
// less than 5
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - completionHolder.value.timeStamp) < 50000000);
//RWFloat
completionHolder = new CompletionHolder();
// TODO check value
RWpropertyFloatSeq.get_sync(completionHolder);
//assertEquals(property.default_value(), value, 0.0);
assertEquals(0, completionHolder.value.code);
assertEquals(0, completionHolder.value.type);
assertEquals(0, completionHolder.value.previousError.length);
// less than 5
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - completionHolder.value.timeStamp) < 50000000);
}
use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class PropertySeqTest method testSetAsyncFloatRW.
public void testSetAsyncFloatRW() {
CBvoidImpl cb = new CBvoidImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
synchronized (cb) {
RWpropertyFloatSeq.set_async(new float[] { (float) 500.0, (float) 600.0 }, cb._this(orb), descIn);
try {
// wait for 5s
cb.wait(5000);
} catch (InterruptedException ie) {
}
}
// only 1 response is expected
//assertEquals(1, cb.getResponseQueue().size());
//CBResponse response = (CBResponse)cb.getResponseQueue().firstElement();
// check reponse type
//assertEquals(CBResponse.DONE_TYPE, response.type);
// check value
// TODO check value
CompletionHolder completionHolder = new CompletionHolder();
float[] value = RWpropertyFloatSeq.get_sync(completionHolder);
assertEquals(500.0, value[0], 0.001);
assertEquals(600.0, value[1], 0.001);
}
use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class PropertyPrimTest method testSetAsyncDoubleRW.
public void testSetAsyncDoubleRW() {
CBvoidImpl cb = new CBvoidImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
synchronized (cb) {
RWpropertyDouble.set_async(500.0, cb._this(orb), descIn);
try {
// wait for 5s
cb.wait(5000);
} catch (InterruptedException ie) {
}
}
// only 1 response is expected
//assertEquals(1, cb.getResponseQueue().size());
//CBResponse response = (CBResponse)cb.getResponseQueue().firstElement();
// check reponse type
//assertEquals(CBResponse.DONE_TYPE, response.type);
// check value
// TODO check value
CompletionHolder completionHolder = new CompletionHolder();
double value = RWpropertyDouble.get_sync(completionHolder);
assertEquals(500.0, value, 0);
}
Aggregations