mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/messaging/TestMessageFactoryImpl.java
@Test
    public void testQueueCustomCommsServiceResponse() throws InvalidProtocolBufferException
    {
        // construct fake request message
        TerraHarvestMessage request = createRequestFiller();
        
        FactoryObjectInfo info = FactoryObjectInfo.newBuilder()
                .setPid("aba")
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(java.util.UUID.randomUUID()))
                .setProductType("testPhysicalLink")
                .build();
        
        // construct data message to send
        CreatePhysicalLinkResponseData messageData = CreatePhysicalLinkResponseData.newBuilder()
                .setInfo(info)
                .build();

        MessageResponseWrapper response = 
                m_SUT.createCustomCommsResponseMessage(request, CustomCommsMessageType.CreatePhysicalLinkResponse, 
                        messageData);

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

        // verify namespace message
        CustomCommsNamespace commsResponse = CustomCommsNamespace.parseFrom(namespace);
        assertThat(commsResponse.getType(), is(CustomCommsMessageType.CreatePhysicalLinkResponse));

        //verify data message
        assertThat(commsResponse.getData(), is(messageData.toByteString()));
        
        //--send again with no data message--//
        response = m_SUT.createCustomCommsResponseMessage(request, CustomCommsMessageType.CreatePhysicalLinkResponse, 
                        null);

        // request to send over mock channel and verify namespace
        namespace = confirmResponseWrapperQueue(response, Namespace.CustomComms);
      
        // verify namespace message
        commsResponse = CustomCommsNamespace.parseFrom(namespace);
        assertThat(commsResponse.getType(), is(CustomCommsMessageType.CreatePhysicalLinkResponse));

        //verify data message
        assertThat(commsResponse.hasData(), is(false));
    }
/**
     * Verify the message wrapper returned contains the expected custom comms contents.
     */
Verify the message wrapper returned contains the expected custom comms contents.
Verify the message wrapper returned contains the expected custom comms contents .
@Test
    public void testQueueCustomCommsServiceResponse() throws InvalidProtocolBufferException
    {
        TerraHarvestMessage request = createRequestFiller();
        FactoryObjectInfo info = FactoryObjectInfo.newBuilder()
                .setPid("aba")
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(java.util.UUID.randomUUID()))
                .setProductType("testPhysicalLink")
                .build();
        CreatePhysicalLinkResponseData messageData = CreatePhysicalLinkResponseData.newBuilder()
                .setInfo(info)
                .build();
        MessageResponseWrapper response = 
                m_SUT.createCustomCommsResponseMessage(request, CustomCommsMessageType.CreatePhysicalLinkResponse, 
                        messageData);
        ByteString namespace = confirmResponseWrapperQueue(response, Namespace.CustomComms);
        CustomCommsNamespace commsResponse = CustomCommsNamespace.parseFrom(namespace);
        assertThat(commsResponse.getType(), is(CustomCommsMessageType.CreatePhysicalLinkResponse));
        assertThat(commsResponse.getData(), is(messageData.toByteString()));
        response = m_SUT.createCustomCommsResponseMessage(request, CustomCommsMessageType.CreatePhysicalLinkResponse, 
                        null);
         and verify namespace
        namespace = confirmResponseWrapperQueue(response, Namespace.CustomComms);
        commsResponse = CustomCommsNamespace.parseFrom(namespace);
        assertThat(commsResponse.getType(), is(CustomCommsMessageType.CreatePhysicalLinkResponse));
        assertThat(commsResponse.hasData(), is(false));
    }
@ Test public void testQueueCustomCommsServiceResponse ( ) throws InvalidProtocolBufferException { TerraHarvestMessage request = createRequestFiller ( ) ; FactoryObjectInfo info = FactoryObjectInfo . newBuilder ( ) . setPid ( "aba" ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( java . util . UUID . randomUUID ( ) ) ) . setProductType ( "testPhysicalLink" ) . build ( ) ; CreatePhysicalLinkResponseData messageData = CreatePhysicalLinkResponseData . newBuilder ( ) . setInfo ( info ) . build ( ) ; MessageResponseWrapper response = m_SUT . createCustomCommsResponseMessage ( request , CustomCommsMessageType . CreatePhysicalLinkResponse , messageData ) ; ByteString namespace = confirmResponseWrapperQueue ( response , Namespace . CustomComms ) ; CustomCommsNamespace commsResponse = CustomCommsNamespace . parseFrom ( namespace ) ; assertThat ( commsResponse . getType ( ) , is ( CustomCommsMessageType . CreatePhysicalLinkResponse ) ) ; assertThat ( commsResponse . getData ( ) , is ( messageData . toByteString ( ) ) ) ; response = m_SUT . createCustomCommsResponseMessage ( request , CustomCommsMessageType . CreatePhysicalLinkResponse , null ) ; namespace = confirmResponseWrapperQueue ( response , Namespace . CustomComms ) ; commsResponse = CustomCommsNamespace . parseFrom ( namespace ) ; assertThat ( commsResponse . getType ( ) , is ( CustomCommsMessageType . CreatePhysicalLinkResponse ) ) ; assertThat ( commsResponse . hasData ( ) , is ( false ) ) ; }
Verify the message wrapper returned contains the expected custom comms contents.
Verify the message wrapper returned contains the expected custom comms contents .
// construct fake request message // construct data message to send // request to send over mock channel // 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