Search in sources :

Example 21 with CompletionHolder

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);
}
Also used : CompletionHolder(alma.ACSErr.CompletionHolder)

Example 22 with CompletionHolder

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);
}
Also used : CompletionHolder(alma.ACSErr.CompletionHolder) CBDescIn(alma.ACS.CBDescIn)

Example 23 with CompletionHolder

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);
}
Also used : CompletionHolder(alma.ACSErr.CompletionHolder)

Example 24 with CompletionHolder

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());
    }
}
Also used : LampUnavailable(alma.demo.LampUnavailable) CompletionHolder(alma.ACSErr.CompletionHolder) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException)

Example 25 with CompletionHolder

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);
}
Also used : AcsJCompletion(alma.acs.exceptions.AcsJCompletion) CompletionHolder(alma.ACSErr.CompletionHolder)

Aggregations

CompletionHolder (alma.ACSErr.CompletionHolder)30 CBDescIn (alma.ACS.CBDescIn)11 RWdouble (alma.ACS.RWdouble)5 Monitordouble (alma.ACS.Monitordouble)4 ROdouble (alma.ACS.ROdouble)3 AcsJCompletion (alma.acs.exceptions.AcsJCompletion)3 AcsJException (alma.acs.exceptions.AcsJException)3 ROStates (jbaciEnumPropTest.ROStates)3 RWStates (jbaciEnumPropTest.RWStates)3 States (jbaciEnumPropTest.States)3 AcsJCouldntPerformActionEx (alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx)2 LampUnavailable (alma.demo.LampUnavailable)2 POAManager (org.omg.PortableServer.POAManager)2 ClientInfo (si.ijs.maci.ClientInfo)2 Manager (si.ijs.maci.Manager)2 CBdouble (alma.ACS.CBdouble)1 Monitor (alma.ACS.Monitor)1 MonitorstringSeq (alma.ACS.MonitorstringSeq)1 ROstring (alma.ACS.ROstring)1 ROstringSeq (alma.ACS.ROstringSeq)1