Search in sources :

Example 26 with CBDescIn

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

the class PropertyPrimTest method testOnChangeMonitorDouble.

public void testOnChangeMonitorDouble() {
    // TODO implement...
    CBdoubleImpl cb = new CBdoubleImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    Monitordouble monitor = ROpropertyDouble.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()...
    ROpropertyDouble.alarm_high_on();
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ie) {
    }
    // disable test
    monitor.set_value_trigger(0, false);
    ROpropertyDouble.alarm_high_on();
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ie) {
    }
    monitor.set_value_trigger(0, true);
    ROpropertyDouble.alarm_high_on();
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ie) {
    }
    System.out.println("------");
    // disable test
    monitor.suspend();
    ROpropertyDouble.alarm_high_on();
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ie) {
    }
    // / ... this should revive it
    monitor.resume();
    System.out.println("------");
    ROpropertyDouble.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
}
Also used : CBDescIn(alma.ACS.CBDescIn) Monitordouble(alma.ACS.Monitordouble)

Example 27 with CBDescIn

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

the class PropertyPrimTest method testGetAsyncLongRO.

public void testGetAsyncLongRO() {
    CBlongImpl cb = new CBlongImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    synchronized (cb) {
        ROpropertyLong.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());
    CBResponseLong response = (CBResponseLong) cb.getResponseQueue().firstElement();
    // check reponse type
    assertEquals(CBResponseLong.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);
}
Also used : CBDescIn(alma.ACS.CBDescIn)

Example 28 with CBDescIn

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

the class PropertyPrimTest method testCreateMonitorLong.

public void testCreateMonitorLong() {
    // TODO do test with null callback ;)
    // TODO implement...
    CBlongImpl cb = new CBlongImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    Monitorlong monitor = ROpropertyLong.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 : Monitorlong(alma.ACS.Monitorlong) CBDescIn(alma.ACS.CBDescIn)

Example 29 with CBDescIn

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

the class PropertySeqTest method testGetAsyncFloatRO.

public void testGetAsyncFloatRO() {
    CBfloatSeqImpl cb = new CBfloatSeqImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    synchronized (cb) {
        ROpropertyFloatSeq.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());
    CBResponseFloatSeq response = (CBResponseFloatSeq) cb.getResponseQueue().firstElement();
    // check reponse type
    assertEquals(CBResponseFloatSeq.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);
}
Also used : CBDescIn(alma.ACS.CBDescIn)

Example 30 with CBDescIn

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

the class PropertySeqTest method testGetAsyncFloatRW.

public void testGetAsyncFloatRW() {
    CBfloatSeqImpl cb = new CBfloatSeqImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    synchronized (cb) {
        RWpropertyFloatSeq.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());
    CBResponseFloatSeq response = (CBResponseFloatSeq) cb.getResponseQueue().firstElement();
    // check reponse type
    assertEquals(CBResponseFloatSeq.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);
}
Also used : 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