mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/controller/TestControllerMgrImpl.java
@Test
    public void testEventHelperSystemInfo()
    {
        //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); 

        //get controller
        ControllerModel controller = m_SUT.getController(contNew);
 
        //verify
        assertThat(controller.getName(), is("Bacon"));
        assertThat(controller.getVersion(), is("TheBest"));
        assertThat(controller.getBuildInfo().size(), is(1));
        assertThat(controller.getBuildInfo(), hasEntry("key", "info"));
        assertThat(controller.getBuildInfoKeys().get(0), is("key"));
        
        // verify event is sent for new controller
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(eventCaptor.capture());
        
        assertThat(eventCaptor.getAllValues().size(), is(2));
        
        Event controllerEvent = eventCaptor.getAllValues().get(0);
        assertThat(controllerEvent.getTopic(), is(ControllerMgr.TOPIC_CONTROLLER_ADDED));
        assertThat((Integer)controllerEvent.getProperty(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID), is(6431));
    
        Event controllerUpdated = eventCaptor.getAllValues().get(1);
        assertThat(controllerUpdated.getTopic(), is(ControllerMgr.TOPIC_CONTROLLER_UPDATED));
    }
/**
     * Test event handling.
     * 
     * Verify that controller information is updated.
     */
Test event handling.

Verify that controller information is updated.
Test event handling . Verify that controller information is updated .
@Test
    public void testEventHelperSystemInfo()
    {
        int contNew = 6431;                    
        RemoteChannel channel = addChannelMockHelper(contNew);
        m_ChannelHelper.handleEvent(createBasicChannelUpdatedEvent(channel, contNew));
        mockControllerMessage(contNew, BaseMessageType.ControllerInfo); 
        ControllerModel controller = m_SUT.getController(contNew);
        assertThat(controller.getName(), is("Bacon"));
        assertThat(controller.getVersion(), is("TheBest"));
        assertThat(controller.getBuildInfo().size(), is(1));
        assertThat(controller.getBuildInfo(), hasEntry("key", "info"));
        assertThat(controller.getBuildInfoKeys().get(0), is("key"));
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(eventCaptor.capture());
        assertThat(eventCaptor.getAllValues().size(), is(2));
        Event controllerEvent = eventCaptor.getAllValues().get(0);
        assertThat(controllerEvent.getTopic(), is(ControllerMgr.TOPIC_CONTROLLER_ADDED));
        assertThat((Integer)controllerEvent.getProperty(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID), is(6431));
        Event controllerUpdated = eventCaptor.getAllValues().get(1);
        assertThat(controllerUpdated.getTopic(), is(ControllerMgr.TOPIC_CONTROLLER_UPDATED));
    }
@ Test public void testEventHelperSystemInfo ( ) { int contNew = 6431 ; RemoteChannel channel = addChannelMockHelper ( contNew ) ; m_ChannelHelper . handleEvent ( createBasicChannelUpdatedEvent ( channel , contNew ) ) ; mockControllerMessage ( contNew , BaseMessageType . ControllerInfo ) ; ControllerModel controller = m_SUT . getController ( contNew ) ; assertThat ( controller . getName ( ) , is ( "Bacon" ) ) ; assertThat ( controller . getVersion ( ) , is ( "TheBest" ) ) ; assertThat ( controller . getBuildInfo ( ) . size ( ) , is ( 1 ) ) ; assertThat ( controller . getBuildInfo ( ) , hasEntry ( "key" , "info" ) ) ; assertThat ( controller . getBuildInfoKeys ( ) . get ( 0 ) , is ( "key" ) ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 2 ) ) . postEvent ( eventCaptor . capture ( ) ) ; assertThat ( eventCaptor . getAllValues ( ) . size ( ) , is ( 2 ) ) ; Event controllerEvent = eventCaptor . getAllValues ( ) . get ( 0 ) ; assertThat ( controllerEvent . getTopic ( ) , is ( ControllerMgr . TOPIC_CONTROLLER_ADDED ) ) ; assertThat ( ( Integer ) controllerEvent . getProperty ( SharedPropertyConstants . EVENT_PROP_CONTROLLER_ID ) , is ( 6431 ) ) ; Event controllerUpdated = eventCaptor . getAllValues ( ) . get ( 1 ) ; assertThat ( controllerUpdated . getTopic ( ) , is ( ControllerMgr . TOPIC_CONTROLLER_UPDATED ) ) ; }
Test event handling.
Test event handling .
//controllerId //mock channel lookup //mock addition of controller //mock sys info response for new controller //get controller //verify // verify event is sent for new controller