Search in sources :

Example 6 with CBDescIn

use of alma.ACS.CBDescIn in project ACS by ACS-Community.

the class EnumPropertyTest method testSetAsync.

public void testSetAsync() {
    CBvoidImpl cb = new CBvoidImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    synchronized (cb) {
        RWproperty.set_async(States.DIAGNOSE, 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
    CompletionHolder completionHolder = new CompletionHolder();
    States value = RWproperty.get_sync(completionHolder);
    assertEquals(States.DIAGNOSE, value);
}
Also used : RWStates(jbaciEnumPropTest.RWStates) ROStates(jbaciEnumPropTest.ROStates) States(jbaciEnumPropTest.States) CompletionHolder(alma.ACSErr.CompletionHolder) CBDescIn(alma.ACS.CBDescIn)

Example 7 with CBDescIn

use of alma.ACS.CBDescIn in project ACS by ACS-Community.

the class BACIDispatchActionTest method testNormal.

/**
	 * Normal (success) test.
	 */
public void testNormal() {
    Object value = new Object();
    Completion completion = CompletionUtil.generateNoErrorCompletion();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1234);
    Callback callback = new TestCallback();
    TestCallbackDispatcher dispatcher = new PerfectCallbackDispatcher();
    BACIDispatchAction action = new BACIDispatchAction(callback, descIn, dispatcher);
    synchronized (dispatcher) {
        action.dispatchDoneRequest(completion, value);
        try {
            // wait 
            dispatcher.wait(RESPONSE_WAIT_TIME);
        } catch (InterruptedException ie) {
        }
    }
    // dummy wait (just in case there is a bug and more responses will come)
    dummyWait();
    // only 1 response is expected
    assertEquals(1, dispatcher.getResponseQueue().size());
    DispatchAction response = (DispatchAction) dispatcher.getResponseQueue().firstElement();
    // check response
    checkResponse(value, completion, descIn, callback, response);
}
Also used : BACIDispatchAction(alma.ACS.jbaci.BACIDispatchAction) Completion(alma.ACSErr.Completion) Callback(alma.ACS.Callback) BACIDispatchAction(alma.ACS.jbaci.BACIDispatchAction) CBDescIn(alma.ACS.CBDescIn)

Example 8 with CBDescIn

use of alma.ACS.CBDescIn in project ACS by ACS-Community.

the class PropertyDoubleTest method testCreateMonitor.

public void testCreateMonitor() {
    // TODO do test with null callback ;)
    // TODO implement...
    CBdoubleImpl cb = new CBdoubleImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    Monitordouble monitor = ROproperty.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
}
Also used : CBDescIn(alma.ACS.CBDescIn) Monitordouble(alma.ACS.Monitordouble)

Example 9 with CBDescIn

use of alma.ACS.CBDescIn in project ACS by ACS-Community.

the class PropertyDoubleTest method testNewSubscriptionAlarm.

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
    }
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) CBDescIn(alma.ACS.CBDescIn)

Example 10 with CBDescIn

use of alma.ACS.CBDescIn in project ACS by ACS-Community.

the class EnumPropertyTest method testCreateMonitor.

public void testCreateMonitor() {
    // TODO do test with null callback ;)
    // TODO implement...
    CBStatesImpl cb = new CBStatesImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    Monitorpattern monitor = ROproperty.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
}
Also used : Monitorpattern(alma.ACS.Monitorpattern) CBDescIn(alma.ACS.CBDescIn)

Aggregations

CBDescIn (alma.ACS.CBDescIn)57 CompletionHolder (alma.ACSErr.CompletionHolder)11 Monitordouble (alma.ACS.Monitordouble)10 Completion (alma.ACSErr.Completion)7 Callback (alma.ACS.Callback)6 BACIDispatchAction (alma.ACS.jbaci.BACIDispatchAction)6 NO_IMPLEMENT (org.omg.CORBA.NO_IMPLEMENT)6 RWdouble (alma.ACS.RWdouble)5 Monitorfloat (alma.ACS.Monitorfloat)4 Monitorlong (alma.ACS.Monitorlong)4 ROdouble (alma.ACS.ROdouble)3 OffShoot (alma.ACS.OffShoot)2 LampUnavailable (alma.demo.LampUnavailable)2 NoPermissionEx (alma.maciErrType.NoPermissionEx)2 POAManager (org.omg.PortableServer.POAManager)2 ClientInfo (si.ijs.maci.ClientInfo)2 Manager (si.ijs.maci.Manager)2 CBDescOut (alma.ACS.CBDescOut)1 CBdouble (alma.ACS.CBdouble)1 CBlongPOA (alma.ACS.CBlongPOA)1