Search in sources :

Example 1 with CompletionHolder

use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.

the class BCTClient method getPropertySync.

/**
	 * TEST_2_1_1 & TEST_3_1_1
	 * @param loop
	 */
public void getPropertySync(long loop) {
    CompletionHolder completionHolder = new CompletionHolder();
    m_startTime = System.currentTimeMillis();
    for (int i = 0; i < loop; i++) m_property.get_sync(completionHolder);
    m_endTime = System.currentTimeMillis();
}
Also used : CompletionHolder(alma.ACSErr.CompletionHolder)

Example 2 with CompletionHolder

use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.

the class SimpleMasterComponentTest method test.

/**
	 * Main test routine.
	 */
public void test() {
    initializeCORBA();
    Manager manager = resolveManager();
    if (manager != null) {
        ClientInfo clientInfo = login(manager);
        if (clientInfo != null) {
            System.out.println("All initialization done.");
            //
            // get component
            //
            final String COMPONENT_NAME = "SIMPLEMASTERCOMPONENT1";
            org.omg.CORBA.Object obj;
            try {
                obj = manager.get_component(clientInfo.h, COMPONENT_NAME, true);
                SimpleMasterComponent simpleMasterComponent = SimpleMasterComponentHelper.narrow(obj);
                ROstringSeq currentStateHierarchy = simpleMasterComponent.currentStateHierarchy();
                // syncvalue retrival
                System.out.println("Current state hierarchy: " + getStringArray(currentStateHierarchy.get_sync(new CompletionHolder())));
                System.out.println("Monitoring - 1s interval...");
                // create a monitor
                MonitorstringSeq monitor = currentStateHierarchy.create_monitor(new CBstringSeqImpl()._this(orb), new CBDescIn());
                // sleep for a while
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException ie) {
                }
                ;
                monitor.set_timer_trigger(0);
                monitor.set_value_trigger(new String[0], true);
                System.out.println("On-change monitoring...");
                // sleep for a while
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException ie) {
                }
                ;
                monitor.destroy();
            } catch (Exception e) {
                // CannotGetComponentEx, ComponentConfigurationNotFoundEx
                System.err.println("Failed to obtain component: " + COMPONENT_NAME);
            }
            // release now
            try {
                manager.release_component(clientInfo.h, COMPONENT_NAME);
            } catch (NoPermissionEx ex) {
                ex.printStackTrace();
            }
            logout(manager, clientInfo);
        }
    }
    finalizeCORBA();
}
Also used : SimpleMasterComponent(test.jbaci.SimpleMasterComponent) POAManager(org.omg.PortableServer.POAManager) Manager(si.ijs.maci.Manager) CBDescIn(alma.ACS.CBDescIn) ROstringSeq(alma.ACS.ROstringSeq) MonitorstringSeq(alma.ACS.MonitorstringSeq) NoPermissionEx(alma.maciErrType.NoPermissionEx) CompletionHolder(alma.ACSErr.CompletionHolder) ClientInfo(si.ijs.maci.ClientInfo)

Example 3 with CompletionHolder

use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.

the class PropertySeqTest method testGetSyncAll.

public void testGetSyncAll() {
    //ROlong
    CompletionHolder completionHolder = new CompletionHolder();
    // TODO check value
    ROpropertyLongSeq.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
    RWpropertyLongSeq.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
    ROpropertyDoubleSeq.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
    RWpropertyDoubleSeq.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
    ROpropertyFloatSeq.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
    RWpropertyFloatSeq.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 4 with CompletionHolder

use of alma.ACSErr.CompletionHolder in project ACS by ACS-Community.

the class PropertySeqTest method testSetAsyncFloatRW.

public void testSetAsyncFloatRW() {
    CBvoidImpl cb = new CBvoidImpl();
    CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
    synchronized (cb) {
        RWpropertyFloatSeq.set_async(new float[] { (float) 500.0, (float) 600.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();
    float[] value = RWpropertyFloatSeq.get_sync(completionHolder);
    assertEquals(500.0, value[0], 0.001);
    assertEquals(600.0, value[1], 0.001);
}
Also used : CompletionHolder(alma.ACSErr.CompletionHolder) CBDescIn(alma.ACS.CBDescIn)

Example 5 with CompletionHolder

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

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