mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/mp/TestMissionProgrammingMessageService.java
@Test
    public void testExecutionResponse() throws IllegalArgumentException, IOException
    {
        //response message
        ExecuteResponseData response = ExecuteResponseData.newBuilder().
                setMissionName("pop").build();
        MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace.newBuilder().
                setType(MissionProgrammingMessageType.ExecuteResponse).
                setData(response.toByteString()).build();
        TerraHarvestMessage message = createMissionProgrammingMessage(missionMessage);

        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        // replay
        m_SUT.handleMessage(message, createPayload(missionMessage), channel);
        
        // verify the event
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((String)event.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE),
                is(MissionProgrammingMessageType.ExecuteResponse.toString()));
        assertThat((ExecuteResponseData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(response));
    }
/**
     * Test an event from a response to a execution of a program.
     */
Test an event from a response to a execution of a program.
Test an event from a response to a execution of a program .
@Test
    public void testExecutionResponse() throws IllegalArgumentException, IOException
    {
        ExecuteResponseData response = ExecuteResponseData.newBuilder().
                setMissionName("pop").build();
        MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace.newBuilder().
                setType(MissionProgrammingMessageType.ExecuteResponse).
                setData(response.toByteString()).build();
        TerraHarvestMessage message = createMissionProgrammingMessage(missionMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, createPayload(missionMessage), channel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((String)event.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE),
                is(MissionProgrammingMessageType.ExecuteResponse.toString()));
        assertThat((ExecuteResponseData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(response));
    }
@ Test public void testExecutionResponse ( ) throws IllegalArgumentException , IOException { ExecuteResponseData response = ExecuteResponseData . newBuilder ( ) . setMissionName ( "pop" ) . build ( ) ; MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace . newBuilder ( ) . setType ( MissionProgrammingMessageType . ExecuteResponse ) . setData ( response . toByteString ( ) ) . build ( ) ; TerraHarvestMessage message = createMissionProgrammingMessage ( missionMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , createPayload ( missionMessage ) , channel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event event = eventCaptor . getValue ( ) ; assertThat ( ( String ) event . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE_TYPE ) , is ( MissionProgrammingMessageType . ExecuteResponse . toString ( ) ) ) ; assertThat ( ( ExecuteResponseData ) event . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( response ) ) ; }
Test an event from a response to a execution of a program.
Test an event from a response to a execution of a program .
//response message // mock the channel the message came from // replay // verify the event