mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/mp/TestCurrentMissionMgrImpl.java
@Test
    public void testRemoteEventProgramRemovedEvent()
    {
        //initialize m_SUT. Will post a push update
        assertThat(initCurrentMissionModels(123), is(3));
        
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(Program.EVENT_PROP_PROGRAM_STATUS, ProgramStatus.SHUTDOWN.toString());
        
        Event programRemoved = mockARemoteEvent(123, MissionProgramManager.TOPIC_PROGRAM_REMOVED, 
                "Mission 1", map);
        
        m_RemoteEventHelper.handleEvent(programRemoved);
        
        //verify there is one less mission
        List<CurrentMissionModel> models = m_SUT.getCurrentMissionsForControllerAsync(123);
        assertThat(models.size(), is(2));
        
        for (CurrentMissionModel model : models)
        {
            if (model.getMissionName().equals("Mission 1"))
            {
                fail("Mission 1 is expected to have been removed. It was not.");
            }
        }
        
        verify(m_GrowlUtil).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_INFO), eq("Mission Removed!"), 
                eq("The mission Mission 1 for system 0x0000007b has been removed with status 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 removed event is properly handled.
     */
Verify program removed event is properly handled.
Verify program removed event is properly handled .
@Test
    public void testRemoteEventProgramRemovedEvent()
    {
        assertThat(initCurrentMissionModels(123), is(3));
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(Program.EVENT_PROP_PROGRAM_STATUS, ProgramStatus.SHUTDOWN.toString());
        Event programRemoved = mockARemoteEvent(123, MissionProgramManager.TOPIC_PROGRAM_REMOVED, 
                "Mission 1", map);
        m_RemoteEventHelper.handleEvent(programRemoved);
        List<CurrentMissionModel> models = m_SUT.getCurrentMissionsForControllerAsync(123);
        assertThat(models.size(), is(2));
        for (CurrentMissionModel model : models)
        {
            if (model.getMissionName().equals("Mission 1"))
            {
                fail("Mission 1 is expected to have been removed. It was not.");
            }
        }
        verify(m_GrowlUtil).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_INFO), eq("Mission Removed!"), 
                eq("The mission Mission 1 for system 0x0000007b has been removed with status 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 testRemoteEventProgramRemovedEvent ( ) { assertThat ( initCurrentMissionModels ( 123 ) , is ( 3 ) ) ; Map < String , Object > map = new HashMap < String , Object > ( ) ; map . put ( Program . EVENT_PROP_PROGRAM_STATUS , ProgramStatus . SHUTDOWN . toString ( ) ) ; Event programRemoved = mockARemoteEvent ( 123 , MissionProgramManager . TOPIC_PROGRAM_REMOVED , "Mission 1" , map ) ; m_RemoteEventHelper . handleEvent ( programRemoved ) ; List < CurrentMissionModel > models = m_SUT . getCurrentMissionsForControllerAsync ( 123 ) ; assertThat ( models . size ( ) , is ( 2 ) ) ; for ( CurrentMissionModel model : models ) { if ( model . getMissionName ( ) . equals ( "Mission 1" ) ) { fail ( "Mission 1 is expected to have been removed. It was not." ) ; } } verify ( m_GrowlUtil ) . createGlobalFacesMessage ( eq ( FacesMessage . SEVERITY_INFO ) , eq ( "Mission Removed!" ) , eq ( "The mission Mission 1 for system 0x0000007b has been removed with status 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 removed event is properly handled.
Verify program removed event is properly handled .
//initialize m_SUT. Will post a push update //verify there is one less mission //verify push events are called 