mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/mp/TestCurrentMissionMgrImpl.java
@Test
    public void testRemoteEventProgramShutdownEvent()
    {
        //initialize m_SUT. Will post a push update
        assertThat(initCurrentMissionModels(123), is(3));
        
        //get an event for the Program Status changed
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(Program.EVENT_PROP_PROGRAM_STATUS, ProgramStatus.SHUTDOWN.toString());
        
        Event shutdownEvent = mockARemoteEvent(123, Program.TOPIC_PROGRAM_SHUTDOWN, "Mission 1", map);
        
        m_RemoteEventHelper.handleEvent(shutdownEvent);
        
        //verify status has changed
        CurrentMissionModel modelToTest = findAMissionModel(123, "Mission 1");
        
        assertThat(modelToTest, notNullValue());
        assertThat(modelToTest.getMissionStatus(), is(ProgramStatus.SHUTDOWN));
        
        verify(m_GrowlUtil).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_INFO), 
                eq("Mission Shutdown"), eq("The mission Mission 1 for system 0x0000007b has been shutdown."));
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(eventCaptor.capture());
        
        //verify push events are called 
        Event capturedEvent1 = eventCaptor.getAllValues().get(0);
        
        assertThat((String)capturedEvent1.getProperty(EventConstants.EVENT_TOPIC), 
                is(CurrentMissionMgr.TOPIC_MISSION_UPDATED));
         
        Event capturedEvent2 = eventCaptor.getAllValues().get(1);
        
        assertThat((String)capturedEvent2.getProperty(EventConstants.EVENT_TOPIC), 
                is(CurrentMissionMgr.TOPIC_MISSION_UPDATED));
    }
/**
     * Verify program shutdown event is properly handled.
     */
Verify program shutdown event is properly handled.
Verify program shutdown event is properly handled .
@Test
    public void testRemoteEventProgramShutdownEvent()
    {
        assertThat(initCurrentMissionModels(123), is(3));
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(Program.EVENT_PROP_PROGRAM_STATUS, ProgramStatus.SHUTDOWN.toString());
        Event shutdownEvent = mockARemoteEvent(123, Program.TOPIC_PROGRAM_SHUTDOWN, "Mission 1", map);
        m_RemoteEventHelper.handleEvent(shutdownEvent);
        CurrentMissionModel modelToTest = findAMissionModel(123, "Mission 1");
        assertThat(modelToTest, notNullValue());
        assertThat(modelToTest.getMissionStatus(), is(ProgramStatus.SHUTDOWN));
        verify(m_GrowlUtil).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_INFO), 
                eq("Mission Shutdown"), eq("The mission Mission 1 for system 0x0000007b has been shutdown."));
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(eventCaptor.capture());
        Event capturedEvent1 = eventCaptor.getAllValues().get(0);
        assertThat((String)capturedEvent1.getProperty(EventConstants.EVENT_TOPIC), 
                is(CurrentMissionMgr.TOPIC_MISSION_UPDATED));
        Event capturedEvent2 = eventCaptor.getAllValues().get(1);
        assertThat((String)capturedEvent2.getProperty(EventConstants.EVENT_TOPIC), 
                is(CurrentMissionMgr.TOPIC_MISSION_UPDATED));
    }
@ Test public void testRemoteEventProgramShutdownEvent ( ) { assertThat ( initCurrentMissionModels ( 123 ) , is ( 3 ) ) ; Map < String , Object > map = new HashMap < String , Object > ( ) ; map . put ( Program . EVENT_PROP_PROGRAM_STATUS , ProgramStatus . SHUTDOWN . toString ( ) ) ; Event shutdownEvent = mockARemoteEvent ( 123 , Program . TOPIC_PROGRAM_SHUTDOWN , "Mission 1" , map ) ; m_RemoteEventHelper . handleEvent ( shutdownEvent ) ; CurrentMissionModel modelToTest = findAMissionModel ( 123 , "Mission 1" ) ; assertThat ( modelToTest , notNullValue ( ) ) ; assertThat ( modelToTest . getMissionStatus ( ) , is ( ProgramStatus . SHUTDOWN ) ) ; verify ( m_GrowlUtil ) . createGlobalFacesMessage ( eq ( FacesMessage . SEVERITY_INFO ) , eq ( "Mission Shutdown" ) , eq ( "The mission Mission 1 for system 0x0000007b has been shutdown." ) ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 2 ) ) . postEvent ( eventCaptor . capture ( ) ) ; Event capturedEvent1 = eventCaptor . getAllValues ( ) . get ( 0 ) ; assertThat ( ( String ) capturedEvent1 . getProperty ( EventConstants . EVENT_TOPIC ) , is ( CurrentMissionMgr . TOPIC_MISSION_UPDATED ) ) ; Event capturedEvent2 = eventCaptor . getAllValues ( ) . get ( 1 ) ; assertThat ( ( String ) capturedEvent2 . getProperty ( EventConstants . EVENT_TOPIC ) , is ( CurrentMissionMgr . TOPIC_MISSION_UPDATED ) ) ; }
Verify program shutdown event is properly handled.
Verify program shutdown event is properly handled .
//initialize m_SUT. Will post a push update //get an event for the Program Status changed //verify status has changed //verify push events are called 