use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class EnumPropertyTest method testGetSync.
/*
public void testNewSubscriptionAlarm() {
try
{
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
ROproperty.new_subscription_Alarm(null, descIn);
fail("NO_IMPLEMENT exception expected");
}
catch (NO_IMPLEMENT ex)
{
// OK
}
}
*/
public void testGetSync() {
CompletionHolder completionHolder = new CompletionHolder();
// TODO check value
assertEquals(ROproperty.default_value(), ROproperty.get_sync(completionHolder));
assertEquals(0, completionHolder.value.code);
assertEquals(0, completionHolder.value.type);
assertEquals(0, completionHolder.value.previousError.length);
// less than 5s
assertTrue((UTCUtility.utcJavaToOmg(System.currentTimeMillis()) - completionHolder.value.timeStamp) < 50000000);
}
use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class PropertyPrimTest method testSetAsyncLongRW.
public void testSetAsyncLongRW() {
CBvoidImpl cb = new CBvoidImpl();
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
synchronized (cb) {
RWpropertyLong.set_async(500, 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 = RWpropertyLong.get_sync(completionHolder);
assertEquals(500, value, 0);
}
use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class PropertyPrimTest method testGetSyncAll.
public void testGetSyncAll() {
//ROlong
CompletionHolder completionHolder = new CompletionHolder();
// TODO check value
ROpropertyLong.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
RWpropertyLong.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
ROpropertyDouble.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
RWpropertyDouble.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
ROpropertyFloat.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
RWpropertyFloat.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 LampAccessImpl method getLampBrightness.
/**
* Returns the magnitude of the lamp component's brightness.
* @return double
* @see alma.demo.LampAccessOperations#getLampBrightness()
* @throws LampUnavailable
*/
public double getLampBrightness() throws LampUnavailable {
m_logger.finer("LampAccess:getLampBrightness() called...");
try {
m_brightness = getLampBrightnessProperty();
CompletionHolder compHolder = new CompletionHolder();
return m_brightness.get_sync(compHolder);
} catch (Exception ex) {
throw new LampUnavailable(ex.getMessage());
}
}
use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.
the class MasterComponentTest method verifyCurrentState.
/**
* Helper method for the repeated task of getting the current state hierarchy and
* comparing it against the expected hierarchy.
* <p>
* This method is a replica of {@link StateChangeListener#verifyCurrentState(String[])}
* which is necessary for testing w/o using the synchronization facilities offered by <code>StateChangeListener</code>.
*/
private void verifyCurrentState(ROstringSeq statesProperty, String[] expectedHierarchy) {
CompletionHolder ch = new CompletionHolder();
String[] states = statesProperty.get_sync(ch);
AcsJCompletion statesSyncCompletion = AcsJCompletion.fromCorbaCompletion(ch.value);
assertFalse(statesSyncCompletion.isError());
assertEquals(ACSErrTypeOK.value, statesSyncCompletion.getType());
assertEquals(ACSErrOK.value, statesSyncCompletion.getCode());
assertNotNull(states);
// verify state
String expectedPath = AcsStateUtil.stateHierarchyNamesToString(expectedHierarchy);
String actualPath = AcsStateUtil.stateHierarchyNamesToString(states);
assertEquals("current states hierarchy was not as expected!", expectedPath, actualPath);
}
Aggregations