mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/messaging/TestMessageFactoryImpl.java
@Test
    public void testQueueLinkLayerMessageResponse() throws InvalidProtocolBufferException
    {
        // construct fake request message
        TerraHarvestMessage request = createRequestFiller();
        
        java.util.UUID testUuid = java.util.UUID.randomUUID();
        
        // construct data message to send
        IsActivatedRequestData messageData = IsActivatedRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .build();
        
        MessageResponseWrapper response = m_SUT.createLinkLayerResponseMessage(request, 
                LinkLayerMessageType.IsActivatedResponse, messageData);

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

        // verify namespace message
        LinkLayerNamespace linkResponse = LinkLayerNamespace.parseFrom(namespace);
        assertThat(linkResponse.getType(), is(LinkLayerMessageType.IsActivatedResponse));

        //verify data message
        assertThat(linkResponse.getData(), is(messageData.toByteString()));
        
        //--send again with no data message--//
        response = m_SUT.createLinkLayerResponseMessage(request, LinkLayerMessageType.IsActivatedResponse, null);

        // request to send over mock channel and verify namespace
        namespace = confirmResponseWrapperQueue(response, Namespace.LinkLayer);
        // verify namespace message
        linkResponse = LinkLayerNamespace.parseFrom(namespace);
        assertThat(linkResponse.getType(), is(LinkLayerMessageType.IsActivatedResponse));
        
        //verify data message
        assertThat(linkResponse.hasData(), is(false));
    }
/**
     * Verify the message wrapper returned contains the expected link layer contents.
     */
Verify the message wrapper returned contains the expected link layer contents.
Verify the message wrapper returned contains the expected link layer contents .
@Test
    public void testQueueLinkLayerMessageResponse() throws InvalidProtocolBufferException
    {
        TerraHarvestMessage request = createRequestFiller();
        java.util.UUID testUuid = java.util.UUID.randomUUID();
        IsActivatedRequestData messageData = IsActivatedRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .build();
        MessageResponseWrapper response = m_SUT.createLinkLayerResponseMessage(request, 
                LinkLayerMessageType.IsActivatedResponse, messageData);
        ByteString namespace = confirmResponseWrapperQueue(response, Namespace.LinkLayer);
        LinkLayerNamespace linkResponse = LinkLayerNamespace.parseFrom(namespace);
        assertThat(linkResponse.getType(), is(LinkLayerMessageType.IsActivatedResponse));
        assertThat(linkResponse.getData(), is(messageData.toByteString()));
        response = m_SUT.createLinkLayerResponseMessage(request, LinkLayerMessageType.IsActivatedResponse, null);
        namespace = confirmResponseWrapperQueue(response, Namespace.LinkLayer);
        linkResponse = LinkLayerNamespace.parseFrom(namespace);
        assertThat(linkResponse.getType(), is(LinkLayerMessageType.IsActivatedResponse));
        assertThat(linkResponse.hasData(), is(false));
    }
@ Test public void testQueueLinkLayerMessageResponse ( ) throws InvalidProtocolBufferException { TerraHarvestMessage request = createRequestFiller ( ) ; java . util . UUID testUuid = java . util . UUID . randomUUID ( ) ; IsActivatedRequestData messageData = IsActivatedRequestData . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testUuid ) ) . build ( ) ; MessageResponseWrapper response = m_SUT . createLinkLayerResponseMessage ( request , LinkLayerMessageType . IsActivatedResponse , messageData ) ; ByteString namespace = confirmResponseWrapperQueue ( response , Namespace . LinkLayer ) ; LinkLayerNamespace linkResponse = LinkLayerNamespace . parseFrom ( namespace ) ; assertThat ( linkResponse . getType ( ) , is ( LinkLayerMessageType . IsActivatedResponse ) ) ; assertThat ( linkResponse . getData ( ) , is ( messageData . toByteString ( ) ) ) ; response = m_SUT . createLinkLayerResponseMessage ( request , LinkLayerMessageType . IsActivatedResponse , null ) ; namespace = confirmResponseWrapperQueue ( response , Namespace . LinkLayer ) ; linkResponse = LinkLayerNamespace . parseFrom ( namespace ) ; assertThat ( linkResponse . getType ( ) , is ( LinkLayerMessageType . IsActivatedResponse ) ) ; assertThat ( linkResponse . hasData ( ) , is ( false ) ) ; }
Verify the message wrapper returned contains the expected link layer contents.
Verify the message wrapper returned contains the expected link layer 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