use of alma.ACS.CBDescIn in project ACS by ACS-Community.
the class PropertySeqTest method testSetAsyncLongRW.
public void testSetAsyncLongRW() {
CBvoidImpl cb = new CBvoidImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
synchronized (cb) {
RWpropertyLongSeq.set_async(new int[] { 500, 600 }, 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();
int[] value = RWpropertyLongSeq.get_sync(completionHolder);
assertEquals(500, value[0], 0);
assertEquals(600, value[1], 0);
}
use of alma.ACS.CBDescIn in project ACS by ACS-Community.
the class PropertySeqTest method testSetAsyncDoubleRW.
public void testSetAsyncDoubleRW() {
CBvoidImpl cb = new CBvoidImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
synchronized (cb) {
RWpropertyDoubleSeq.set_async(new double[] { 500.0, 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();
double[] value = RWpropertyDoubleSeq.get_sync(completionHolder);
assertEquals(500.0, value[0], 0);
assertEquals(600.0, value[1], 0);
}
use of alma.ACS.CBDescIn in project ACS by ACS-Community.
the class PropertySeqTest method testCreateMonitorLong.
public void testCreateMonitorLong() {
// TODO do test with null callback ;)
// TODO implement...
CBlongSeqImpl cb = new CBlongSeqImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
Monitorlong monitor = ROpropertyLongSeq.create_monitor(cb._this(orb), descIn);
try {
// 10.5 sec
Thread.sleep(10500);
} catch (InterruptedException ie) {
}
synchronized (cb) {
try {
monitor.destroy();
// wait for 3s
cb.wait(3000);
} catch (InterruptedException ie) {
}
}
// TODO test if done was called
}
use of alma.ACS.CBDescIn in project ACS by ACS-Community.
the class MyTestCBvoid method testActivateOffShoot.
public void testActivateOffShoot() throws Exception {
// activate callback object
MyTestCBvoid cb = new MyTestCBvoid(m_logger);
m_logger.info("MyTestCBvoid instantiated...");
CBvoid cbvoid = alma.ACS.CBvoidHelper.narrow(getContainerServices().activateOffShoot(cb));
m_logger.info("MyTestCBvoid activated.");
// activate dal listener object
m_logger.info("activating dal listener offshoot...");
DALChangeListenerPOA dalListenerSrv = new MyTestDALChangeListener();
OffShoot offshoot2 = getContainerServices().activateOffShoot(dalListenerSrv);
DALChangeListener dalListenerRef = DALChangeListenerHelper.narrow(offshoot2);
m_logger.info("done activating dal listener offshoot.");
// check if dal listener works...
m_logger.info("calling dal listener...");
dalListenerRef.object_changed("happyCurl");
m_logger.info("done calling dal listener.");
// check if callback works...
RWdouble brightness = null;
Lamp lamp = LampHelper.narrow(getContainerServices().getComponent(m_lampCurl));
assertNotNull("reference to Lamp component not null", lamp);
brightness = lamp.brightness();
assertNotNull("brightness property of lamp not null", brightness);
CBDescIn desc = new CBDescIn();
m_logger.info("m_desc instantiated...");
m_logger.info("before setting callback...");
brightness.set_async(7.345, cbvoid, desc);
m_logger.finer("callback set...");
//todo: do something and get feedback from the callback object
// m_logger.finer("changing value (sync)...");
// brightness.set_sync(8.456);
}
use of alma.ACS.CBDescIn in project ACS by ACS-Community.
the class SampleRequester method testA.
public void testA() throws Exception {
// --- activate callback object
ResponseReceiver x = new ResponseReceiver() {
public void incomingResponse(String s) {
System.out.println("Incoming String: " + s);
}
public void incomingResponse(String[] s) {
System.out.println("Incoming StringArray: " + Arrays.asList(s));
}
public void incomingResponse(int s) {
System.out.println("Incoming int: " + s);
}
public void incomingResponse(int[] s) {
System.out.println("Incoming intArray: " + s.length);
}
public void incomingResponse(double s) {
System.out.println("Incoming double: " + s);
}
public void incomingResponse(double[] s) {
System.out.println("Incoming doubleArray: " + s.length);
}
public void incomingResponse(Object s) {
System.out.println("Incoming Object: " + s);
}
public void incomingException(Exception s) {
System.out.println("Responding failed: " + s);
}
};
CBDescIn descIn = RequesterUtil.giveDescIn();
logger.info("setting string callback");
CBstring cb = RequesterUtil.giveCBString(cs, x);
responder.revertString("Hallo", cb, descIn);
logger.info("setting string callback again");
responder.revertString("Welt", cb, descIn);
logger.info("setting long callback");
responder.countString("Hallo", RequesterUtil.giveCBLong(cs, x), descIn);
logger.info("setting long[] callback");
responder.convertString("Hallo", RequesterUtil.giveCBLongSequence(cs, x), RequesterUtil.giveDescIn());
logger.info("setting string[] callback");
responder.dummy1("Hallo", RequesterUtil.giveCBStringSequence(cs, x), RequesterUtil.giveDescIn());
logger.info("setting double[] callback");
responder.dummy2("Hallo", RequesterUtil.giveCBDoubleSequence(cs, x), RequesterUtil.giveDescIn());
logger.info("setting double callback");
responder.dummy3("Hallo", RequesterUtil.giveCBDouble(cs, x), RequesterUtil.giveDescIn());
}
Aggregations