mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/datastream/TestDataStreamMessageService.java
@Test
    public void testDisableStreamProfile() throws IOException
    {
        DisableStreamProfileRequestData request = DisableStreamProfileRequestData.newBuilder().
                setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testProfileUuid)).build();
        DataStreamServiceNamespace dataStreamMessage = DataStreamServiceNamespace.newBuilder().
                setType(DataStreamServiceMessageType.DisableStreamProfileRequest).
                setData(request.toByteString()).build();
        TerraHarvestPayload payload = createPayload(dataStreamMessage);
        TerraHarvestMessage message = createMessage(dataStreamMessage);
        
        StreamProfile profile = mock(StreamProfile.class);
        
        when(m_DataStreamService.getStreamProfile(testProfileUuid)).thenReturn(profile);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        // replay
        m_SUT.handleMessage(message, payload, channel);
        
        // capture and verify event has been posted locally
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();        
        assertThat((DisableStreamProfileRequestData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(request));
        verify(profile).setEnabled(false);
        verify(m_MessageFactory).createDataStreamServiceResponseMessage(eq(message),
                eq(DataStreamServiceMessageType.DisableStreamProfileResponse), Mockito.any(Message.class));
        verify(m_ResponseWrapper).queue(channel);
    }
/**
     * Test the disable stream profile request/response remote message system for the datastream service.
     * Specifically, the following behaviors are tested: 
     * Verify incoming request message is posted to event admin.
     * Verify stream profile is disabled on request.
     * Verify response is sent after completing request to enable stream profile. 
     */
Test the disable stream profile request/response remote message system for the datastream service.
Specifically, the following behaviors are tested:
Verify incoming request message is posted to event admin.
Verify stream profile is disabled on request.
Verify response is sent after completing request to enable stream profile.
Test the disable stream profile request / response remote message system for the datastream service . Specifically the following behaviors are tested : Verify incoming request message is posted to event admin . Verify stream profile is disabled on request . Verify response is sent after completing request to enable stream profile .
@Test
    public void testDisableStreamProfile() throws IOException
    {
        DisableStreamProfileRequestData request = DisableStreamProfileRequestData.newBuilder().
                setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testProfileUuid)).build();
        DataStreamServiceNamespace dataStreamMessage = DataStreamServiceNamespace.newBuilder().
                setType(DataStreamServiceMessageType.DisableStreamProfileRequest).
                setData(request.toByteString()).build();
        TerraHarvestPayload payload = createPayload(dataStreamMessage);
        TerraHarvestMessage message = createMessage(dataStreamMessage);
        StreamProfile profile = mock(StreamProfile.class);
        when(m_DataStreamService.getStreamProfile(testProfileUuid)).thenReturn(profile);
        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((DisableStreamProfileRequestData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(request));
        verify(profile).setEnabled(false);
        verify(m_MessageFactory).createDataStreamServiceResponseMessage(eq(message),
                eq(DataStreamServiceMessageType.DisableStreamProfileResponse), Mockito.any(Message.class));
        verify(m_ResponseWrapper).queue(channel);
    }
@ Test public void testDisableStreamProfile ( ) throws IOException { DisableStreamProfileRequestData request = DisableStreamProfileRequestData . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testProfileUuid ) ) . build ( ) ; DataStreamServiceNamespace dataStreamMessage = DataStreamServiceNamespace . newBuilder ( ) . setType ( DataStreamServiceMessageType . DisableStreamProfileRequest ) . setData ( request . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( dataStreamMessage ) ; TerraHarvestMessage message = createMessage ( dataStreamMessage ) ; StreamProfile profile = mock ( StreamProfile . class ) ; when ( m_DataStreamService . getStreamProfile ( testProfileUuid ) ) . thenReturn ( profile ) ; 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 ( ( DisableStreamProfileRequestData ) event . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( request ) ) ; verify ( profile ) . setEnabled ( false ) ; verify ( m_MessageFactory ) . createDataStreamServiceResponseMessage ( eq ( message ) , eq ( DataStreamServiceMessageType . DisableStreamProfileResponse ) , Mockito . any ( Message . class ) ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; }
Test the disable stream profile request/response remote message system for the datastream service.
Test the disable stream profile request / response remote message system for the datastream service .
// mock the channel the message came from // replay // capture and verify event has been posted locally