Search in sources :

Example 1 with IllegalStateEventEx

use of alma.ACSErrTypeCommon.IllegalStateEventEx in project ACS by ACS-Community.

the class MasterComponentTest method testInitPass1.

public void testInitPass1() throws Exception {
    ROstringSeq statesProperty = m_masterComp.currentStateHierarchy();
    assertNotNull(statesProperty);
    // verify initial state
    String[] expectedHierarchy = new String[] { SUBSYSSTATE_AVAILABLE.value, SUBSYSSTATE_OFFLINE.value, SUBSYSSTATE_SHUTDOWN.value };
    verifyCurrentState(statesProperty, expectedHierarchy);
    // send event
    m_masterComp.doTransition(SubsystemStateEvent.SUBSYSEVENT_INITPASS1);
    // verify transient state (available for 1 second thanks to a sleepy test component action)
    expectedHierarchy[2] = SUBSYSSTATE_INITIALIZING_PASS1.value;
    verifyCurrentState(statesProperty, expectedHierarchy);
    // verify new state 
    Thread.sleep(3000);
    expectedHierarchy[2] = SUBSYSSTATE_PREINITIALIZED.value;
    verifyCurrentState(statesProperty, expectedHierarchy);
    // verify correct error for illegal event
    try {
        m_masterComp.doTransition(SubsystemStateEvent.SUBSYSEVENT_STOP);
        fail("expected IllegalStateEventEx");
    } catch (IllegalStateEventEx e) {
        //			assertEquals("xyz", e.errorTrace.shortDescription);
        m_logger.info("got IllegalStateEventEx as expected.");
    } catch (Exception e) {
        fail("expected IllegalStateEventEx, but not this one: " + e.toString());
    }
}
Also used : IllegalStateEventEx(alma.ACSErrTypeCommon.IllegalStateEventEx) ROstringSeq(alma.ACS.ROstringSeq)

Aggregations

ROstringSeq (alma.ACS.ROstringSeq)1 IllegalStateEventEx (alma.ACSErrTypeCommon.IllegalStateEventEx)1