mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/messaging/TestMessageFactoryImpl.java
@Test
    public void testQueueObservationStoreMessageResponse() throws IOException
    {
        // construct fake request message
        TerraHarvestMessage request = createRequestFiller();

        // construct data message to send
        GetBundleInfoRequestData messageData = GetBundleInfoRequestData.newBuilder().setBundleId(1L).build();

        MessageResponseWrapper response = m_SUT.createObservationStoreResponseMessage(request, 
                ObservationStoreMessageType.FindObservationByUUIDResponse, messageData);

        // request to send over mock channel and verify namespace
        ByteString namespace = confirmResponseWrapperQueue(response, Namespace.ObservationStore);

        // verify namespace message
        ObservationStoreNamespace obsMessageResponse = ObservationStoreNamespace.parseFrom(namespace);
        assertThat(obsMessageResponse.getType(), is(ObservationStoreMessageType.FindObservationByUUIDResponse));

        //verify data message
        assertThat(obsMessageResponse.getData(), is(messageData.toByteString()));
        
        //--send again with no data message--//
        response = m_SUT.createObservationStoreResponseMessage(request, 
                ObservationStoreMessageType.FindObservationByUUIDResponse, null);

        // request to send over mock channel and verify namespace
        namespace = confirmResponseWrapperQueue(response, Namespace.ObservationStore);

        // verify namespace message
        obsMessageResponse = ObservationStoreNamespace.parseFrom(namespace);
        assertThat(obsMessageResponse.getType(), is(ObservationStoreMessageType.FindObservationByUUIDResponse));
        
        //verify data message is not set
        assertThat(obsMessageResponse.hasData(), is(false));
    }
/**
     * Verify the message wrapper returned contains the expected observation store contents.
     */
Verify the message wrapper returned contains the expected observation store contents.
Verify the message wrapper returned contains the expected observation store contents .
@Test
    public void testQueueObservationStoreMessageResponse() throws IOException
    {
        TerraHarvestMessage request = createRequestFiller();
        GetBundleInfoRequestData messageData = GetBundleInfoRequestData.newBuilder().setBundleId(1L).build();
        MessageResponseWrapper response = m_SUT.createObservationStoreResponseMessage(request, 
                ObservationStoreMessageType.FindObservationByUUIDResponse, messageData);
        ByteString namespace = confirmResponseWrapperQueue(response, Namespace.ObservationStore);
        ObservationStoreNamespace obsMessageResponse = ObservationStoreNamespace.parseFrom(namespace);
        assertThat(obsMessageResponse.getType(), is(ObservationStoreMessageType.FindObservationByUUIDResponse));
        assertThat(obsMessageResponse.getData(), is(messageData.toByteString()));
        response = m_SUT.createObservationStoreResponseMessage(request, 
                ObservationStoreMessageType.FindObservationByUUIDResponse, null);
        namespace = confirmResponseWrapperQueue(response, Namespace.ObservationStore);
        obsMessageResponse = ObservationStoreNamespace.parseFrom(namespace);
        assertThat(obsMessageResponse.getType(), is(ObservationStoreMessageType.FindObservationByUUIDResponse));
         is not set
        assertThat(obsMessageResponse.hasData(), is(false));
    }
@ Test public void testQueueObservationStoreMessageResponse ( ) throws IOException { TerraHarvestMessage request = createRequestFiller ( ) ; GetBundleInfoRequestData messageData = GetBundleInfoRequestData . newBuilder ( ) . setBundleId ( 1L ) . build ( ) ; MessageResponseWrapper response = m_SUT . createObservationStoreResponseMessage ( request , ObservationStoreMessageType . FindObservationByUUIDResponse , messageData ) ; ByteString namespace = confirmResponseWrapperQueue ( response , Namespace . ObservationStore ) ; ObservationStoreNamespace obsMessageResponse = ObservationStoreNamespace . parseFrom ( namespace ) ; assertThat ( obsMessageResponse . getType ( ) , is ( ObservationStoreMessageType . FindObservationByUUIDResponse ) ) ; assertThat ( obsMessageResponse . getData ( ) , is ( messageData . toByteString ( ) ) ) ; response = m_SUT . createObservationStoreResponseMessage ( request , ObservationStoreMessageType . FindObservationByUUIDResponse , null ) ; namespace = confirmResponseWrapperQueue ( response , Namespace . ObservationStore ) ; obsMessageResponse = ObservationStoreNamespace . parseFrom ( namespace ) ; assertThat ( obsMessageResponse . getType ( ) , is ( ObservationStoreMessageType . FindObservationByUUIDResponse ) ) ; assertThat ( obsMessageResponse . hasData ( ) , is ( false ) ) ; }
Verify the message wrapper returned contains the expected observation store contents.
Verify the message wrapper returned contains the expected observation store contents .
// construct fake request message // construct data message to send // request to send over mock channel and verify namespace // verify namespace message //verify data message //--send again with no data message--// // request to send over mock channel and verify namespace // verify namespace message //verify data message is not set