use of alma.ACS.CBDescIn in project ACS by ACS-Community.
the class PropertyPrimTest method testGetAsyncFloatRO.
public void testGetAsyncFloatRO() {
CBfloatImpl cb = new CBfloatImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
synchronized (cb) {
ROpropertyFloat.get_async(cb._this(orb), descIn);
try {
// wait for 5s
cb.wait(5000);
} catch (InterruptedException ie) {
}
}
// only 1 response is expected
assertEquals(1, cb.getResponseQueue().size());
CBResponseFloat response = (CBResponseFloat) cb.getResponseQueue().firstElement();
// check reponse type
assertEquals(CBResponseFloat.DONE_TYPE, response.type);
// check value
// TODO check value
//assertEquals(property.default_value(), response.value, 0.0);
// check descriptor
assertEquals(descIn.id_tag, response.desc.id_tag);
// check completion
assertEquals(0, response.completion.code);
assertEquals(0, response.completion.type);
assertEquals(0, response.completion.previousError.length);
// less than 5s
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - response.completion.timeStamp) < 50000000);
}
use of alma.ACS.CBDescIn in project ACS by ACS-Community.
the class PropertyPrimTest method testOnChangeMonitorFloat.
public void testOnChangeMonitorFloat() {
// TODO implement...
CBfloatImpl cb = new CBfloatImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
Monitorfloat monitor = ROpropertyFloat.create_monitor(cb._this(orb), descIn);
// disable on time trigger
monitor.set_timer_trigger(0);
try {
// sleep for 5 sec
Thread.sleep(3000);
} catch (InterruptedException ie) {
}
// TODO monitors should not come
// every change test
monitor.set_value_trigger(0, true);
// TODO change value here...
// ups RO monitor ;)
// !!! TMP - tested with backdoor via alarm_high_on()...
ROpropertyFloat.alarm_high_on();
try {
Thread.sleep(3000);
} catch (InterruptedException ie) {
}
// disable test
monitor.set_value_trigger(0, false);
ROpropertyFloat.alarm_high_on();
try {
Thread.sleep(3000);
} catch (InterruptedException ie) {
}
monitor.set_value_trigger(0, true);
ROpropertyFloat.alarm_high_on();
try {
Thread.sleep(3000);
} catch (InterruptedException ie) {
}
System.out.println("------");
// disable test
monitor.suspend();
ROpropertyFloat.alarm_high_on();
try {
Thread.sleep(3000);
} catch (InterruptedException ie) {
}
// / ... this should revive it
monitor.resume();
System.out.println("------");
ROpropertyFloat.alarm_high_on();
try {
Thread.sleep(3000);
} 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 PropertySeqTest method testGetAsyncLongRO.
public void testGetAsyncLongRO() {
CBlongSeqImpl cb = new CBlongSeqImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
synchronized (cb) {
ROpropertyLongSeq.get_async(cb._this(orb), descIn);
try {
// wait for 5s
cb.wait(5000);
} catch (InterruptedException ie) {
}
}
// only 1 response is expected
assertEquals(1, cb.getResponseQueue().size());
CBResponseLongSeq response = (CBResponseLongSeq) cb.getResponseQueue().firstElement();
// check reponse type
assertEquals(CBResponseLongSeq.DONE_TYPE, response.type);
// check value
// TODO check value
//assertEquals(property.default_value(), response.value, 0.0);
// check descriptor
assertEquals(descIn.id_tag, response.desc.id_tag);
// check completion
assertEquals(0, response.completion.code);
assertEquals(0, response.completion.type);
assertEquals(0, response.completion.previousError.length);
// less than 5s
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - response.completion.timeStamp) < 50000000);
}
use of alma.ACS.CBDescIn 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);
}
use of alma.ACS.CBDescIn in project ACS by ACS-Community.
the class PropertyPrimTest method testCreateMonitorFloat.
public void testCreateMonitorFloat() {
// TODO do test with null callback ;)
// TODO implement...
CBfloatImpl cb = new CBfloatImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
Monitorfloat monitor = ROpropertyFloat.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
}
Aggregations