mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/controller/TestControllerMgrImpl.java
@Test
    public void testEventHelperGetSystemMode()
    {
        //controllerId
        int contNew = 6431;        
        RemoteChannel channel = addChannelMockHelper(contNew);//mock channel lookup
        
        //mock addition of controller
        m_ChannelHelper.handleEvent(createBasicChannelUpdatedEvent(channel, contNew));           
        
        //mock sys info response for new controller 
        mockControllerMessage(contNew, BaseMessageType.ControllerInfo); 
        
        m_Mode = BaseMessages.OperationMode.OPERATIONAL_MODE;
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class); //reset event captor
        mockControllerMessage(contNew,  BaseMessageType.GetOperationModeResponse);
        
        //ensure controller mode was updated
        ControllerModel controller = m_SUT.getController(contNew);
        assertThat(controller.getOperatingMode(), is(OperationMode.OPERATIONAL_MODE));
        
        verify(m_EventAdmin, times(3)).postEvent(eventCaptor.capture());
        
        //verify controller updated event
        Event controllerUpdated2 = eventCaptor.getValue();
        assertThat(controllerUpdated2.getTopic(), is(ControllerMgr.TOPIC_CONTROLLER_UPDATED));
        assertThat(controllerUpdated2.getPropertyNames().length, is(1)); //should only have topic property  
        
        //test with different mode for code coverage; ensure controller mode was updated.
        m_Mode = BaseMessages.OperationMode.TEST_MODE;
        mockControllerMessage(contNew,  BaseMessageType.GetOperationModeResponse);
        
        controller = m_SUT.getController(contNew);
        assertThat(controller.getOperatingMode(), is(OperationMode.TEST_MODE));
    }
/**
     * Test proper handling of GetSystemModeResponse message.
     * Verify Controller is updated with new system mode.  
     */
Test proper handling of GetSystemModeResponse message.
Verify Controller is updated with new system mode.
Test proper handling of GetSystemModeResponse message . Verify Controller is updated with new system mode .
@Test
    public void testEventHelperGetSystemMode()
    {
        int contNew = 6431;        
        RemoteChannel channel = addChannelMockHelper(contNew);
        m_ChannelHelper.handleEvent(createBasicChannelUpdatedEvent(channel, contNew));           
        mockControllerMessage(contNew, BaseMessageType.ControllerInfo); 
        m_Mode = BaseMessages.OperationMode.OPERATIONAL_MODE;
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class); 
        mockControllerMessage(contNew,  BaseMessageType.GetOperationModeResponse);
        ControllerModel controller = m_SUT.getController(contNew);
        assertThat(controller.getOperatingMode(), is(OperationMode.OPERATIONAL_MODE));
        verify(m_EventAdmin, times(3)).postEvent(eventCaptor.capture());
        Event controllerUpdated2 = eventCaptor.getValue();
        assertThat(controllerUpdated2.getTopic(), is(ControllerMgr.TOPIC_CONTROLLER_UPDATED));
        assertThat(controllerUpdated2.getPropertyNames().length, is(1)); 
        m_Mode = BaseMessages.OperationMode.TEST_MODE;
        mockControllerMessage(contNew,  BaseMessageType.GetOperationModeResponse);
        controller = m_SUT.getController(contNew);
        assertThat(controller.getOperatingMode(), is(OperationMode.TEST_MODE));
    }
@ Test public void testEventHelperGetSystemMode ( ) { int contNew = 6431 ; RemoteChannel channel = addChannelMockHelper ( contNew ) ; m_ChannelHelper . handleEvent ( createBasicChannelUpdatedEvent ( channel , contNew ) ) ; mockControllerMessage ( contNew , BaseMessageType . ControllerInfo ) ; m_Mode = BaseMessages . OperationMode . OPERATIONAL_MODE ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; mockControllerMessage ( contNew , BaseMessageType . GetOperationModeResponse ) ; ControllerModel controller = m_SUT . getController ( contNew ) ; assertThat ( controller . getOperatingMode ( ) , is ( OperationMode . OPERATIONAL_MODE ) ) ; verify ( m_EventAdmin , times ( 3 ) ) . postEvent ( eventCaptor . capture ( ) ) ; Event controllerUpdated2 = eventCaptor . getValue ( ) ; assertThat ( controllerUpdated2 . getTopic ( ) , is ( ControllerMgr . TOPIC_CONTROLLER_UPDATED ) ) ; assertThat ( controllerUpdated2 . getPropertyNames ( ) . length , is ( 1 ) ) ; m_Mode = BaseMessages . OperationMode . TEST_MODE ; mockControllerMessage ( contNew , BaseMessageType . GetOperationModeResponse ) ; controller = m_SUT . getController ( contNew ) ; assertThat ( controller . getOperatingMode ( ) , is ( OperationMode . TEST_MODE ) ) ; }
Test proper handling of GetSystemModeResponse message.
Test proper handling of GetSystemModeResponse message .
//controllerId //mock channel lookup //mock addition of controller //mock sys info response for new controller  //reset event captor //ensure controller mode was updated //verify controller updated event //should only have topic property   //test with different mode for code coverage; ensure controller mode was updated.