mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/mp/TestMissionProgrammingMessageService.java
@Test
    public void testRemoveTemplate() throws IllegalArgumentException, IOException
    {
        //activate the message service
        m_SUT.activate();
        //remove template request
        RemoveTemplateRequestData removeMsg = MissionProgramMessages.RemoveTemplateRequestData.newBuilder().
            setNameOfTemplate("Mom").build();
        //construct mission namespace and terra harvest message
        MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace.newBuilder().
                setType(MissionProgrammingMessageType.RemoveTemplateRequest).setData(removeMsg.toByteString()).build();
        TerraHarvestPayload payload = createPayload(missionMessage);
        TerraHarvestMessage message = createMissionProgrammingMessage(missionMessage);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        // replay
        m_SUT.handleMessage(message, payload, channel);

        // verify the event contains the data message
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((RemoveTemplateRequestData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(removeMsg));
        
        verify(m_TemplateManager, times(1)).removeTemplate(anyString());
        
        // verify parameters loaded message is sent back from source requester
        verify(m_MessageFactory).createMissionProgrammingResponseMessage(message, 
                MissionProgrammingMessageType.RemoveTemplateResponse, null);
        verify(m_ResponseWrapper).queue(channel);
    }
/**
     * Test the removal of a template request.
     */
Test the removal of a template request.
Test the removal of a template request .
@Test
    public void testRemoveTemplate() throws IllegalArgumentException, IOException
    {
        m_SUT.activate();
        RemoveTemplateRequestData removeMsg = MissionProgramMessages.RemoveTemplateRequestData.newBuilder().
            setNameOfTemplate("Mom").build();
        MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace.newBuilder().
                setType(MissionProgrammingMessageType.RemoveTemplateRequest).setData(removeMsg.toByteString()).build();
        TerraHarvestPayload payload = createPayload(missionMessage);
        TerraHarvestMessage message = createMissionProgrammingMessage(missionMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, payload, channel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((RemoveTemplateRequestData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(removeMsg));
        verify(m_TemplateManager, times(1)).removeTemplate(anyString());
        verify(m_MessageFactory).createMissionProgrammingResponseMessage(message, 
                MissionProgrammingMessageType.RemoveTemplateResponse, null);
        verify(m_ResponseWrapper).queue(channel);
    }
@ Test public void testRemoveTemplate ( ) throws IllegalArgumentException , IOException { m_SUT . activate ( ) ; RemoveTemplateRequestData removeMsg = MissionProgramMessages . RemoveTemplateRequestData . newBuilder ( ) . setNameOfTemplate ( "Mom" ) . build ( ) ; MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace . newBuilder ( ) . setType ( MissionProgrammingMessageType . RemoveTemplateRequest ) . setData ( removeMsg . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( missionMessage ) ; TerraHarvestMessage message = createMissionProgrammingMessage ( missionMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , payload , channel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event event = eventCaptor . getValue ( ) ; assertThat ( ( RemoveTemplateRequestData ) event . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( removeMsg ) ) ; verify ( m_TemplateManager , times ( 1 ) ) . removeTemplate ( anyString ( ) ) ; verify ( m_MessageFactory ) . createMissionProgrammingResponseMessage ( message , MissionProgrammingMessageType . RemoveTemplateResponse , null ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; }
Test the removal of a template request.
Test the removal of a template request .
//activate the message service //remove template request //construct mission namespace and terra harvest message // mock the channel the message came from // replay // verify the event contains the data message // verify parameters loaded message is sent back from source requester