Search in sources :

Example 1 with StateChangeSemaphore

use of alma.ACS.MasterComponentImpl.StateChangeSemaphore in project ACS by ACS-Community.

the class SpecialTestMasterComponentTest method testHealthySubsystemLifecycle.

/**
	 * Sends the normally expected events <code>SUBSYSEVENT_INITPASS1</code>,
	 * <code>SUBSYSEVENT_INITPASS2</code>, <code>SUBSYSEVENT_START</code>,  
	 * <code>SUBSYSEVENT_STOP</code>, <code>SUBSYSEVENT_SHUTDOWNPASS1</code>,
	 * <code>SUBSYSEVENT_SHUTDOWNPASS2</code>
	 * to our test master component.
	 * Uses state change notification to synchronize sending the next event.
	 * 
	 * @throws Exception
	 */
public void testHealthySubsystemLifecycle() throws Exception {
    ROstringSeq statesProperty = m_masterComp.currentStateHierarchy();
    assertNotNull(statesProperty);
    StateChangeListener listener = new StateChangeListener(m_logger);
    listener.createMonitor(statesProperty, getContainerServices());
    StateChangeSemaphore sync = listener.getStateChangeSemaphore();
    sync.reset();
    m_masterComp.doTransition(SubsystemStateEvent.SUBSYSEVENT_INITPASS1);
    sync.waitForStateChanges(2);
    sync.reset();
    m_masterComp.doTransition(SubsystemStateEvent.SUBSYSEVENT_INITPASS2);
    sync.waitForStateChanges(2);
    sync.reset();
    m_masterComp.doTransition(SubsystemStateEvent.SUBSYSEVENT_START);
    sync.waitForStateChanges(1);
    sync.reset();
    m_masterComp.doTransition(SubsystemStateEvent.SUBSYSEVENT_STOP);
    sync.waitForStateChanges(1);
    sync.reset();
    m_masterComp.doTransition(SubsystemStateEvent.SUBSYSEVENT_SHUTDOWNPASS1);
    sync.waitForStateChanges(2);
    sync.reset();
    m_masterComp.doTransition(SubsystemStateEvent.SUBSYSEVENT_SHUTDOWNPASS2);
    sync.waitForStateChanges(2);
    listener.destroyMonitor();
}
Also used : ROstringSeq(alma.ACS.ROstringSeq) StateChangeSemaphore(alma.ACS.MasterComponentImpl.StateChangeSemaphore) StateChangeListener(alma.ACS.MasterComponentImpl.StateChangeListener)

Aggregations

StateChangeListener (alma.ACS.MasterComponentImpl.StateChangeListener)1 StateChangeSemaphore (alma.ACS.MasterComponentImpl.StateChangeSemaphore)1 ROstringSeq (alma.ACS.ROstringSeq)1