mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/messaging/TestMessageFactoryImpl.java
@Test
    public void testQueuePhysicalLinkMessageResponse() throws InvalidProtocolBufferException
    {
        // construct fake request message
        TerraHarvestMessage request = createRequestFiller();
        
        // construct data message to send
        IsOpenResponseData messageData = IsOpenResponseData.newBuilder().setIsOpen(true).build();
        
        MessageResponseWrapper response = m_SUT.createPhysicalLinkResponseMessage(request, 
                PhysicalLinkMessageType.IsOpenResponse, messageData);

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

        // verify namespace message
        PhysicalLinkNamespace physicalResponse = PhysicalLinkNamespace.parseFrom(namespace);
        assertThat(physicalResponse.getType(), is(PhysicalLinkMessageType.IsOpenResponse));

        //verify data message
        assertThat(physicalResponse.getData(), is(messageData.toByteString()));
        
        //--send again with no data message--//
        response = m_SUT.createPhysicalLinkResponseMessage(request, PhysicalLinkMessageType.IsOpenResponse, 
                null);

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

        // verify namespace message
        physicalResponse = PhysicalLinkNamespace.parseFrom(namespace);
        assertThat(physicalResponse.getType(), is(PhysicalLinkMessageType.IsOpenResponse));
        
        //verify data message
        assertThat(physicalResponse.hasData(), is(false));
    }
/**
     * Verify the message wrapper returned contains the expected physical link contents.
     */
Verify the message wrapper returned contains the expected physical link contents.
Verify the message wrapper returned contains the expected physical link contents .
@Test
    public void testQueuePhysicalLinkMessageResponse() throws InvalidProtocolBufferException
    {
        TerraHarvestMessage request = createRequestFiller();
        IsOpenResponseData messageData = IsOpenResponseData.newBuilder().setIsOpen(true).build();
        MessageResponseWrapper response = m_SUT.createPhysicalLinkResponseMessage(request, 
                PhysicalLinkMessageType.IsOpenResponse, messageData);
        ByteString namespace = confirmResponseWrapperQueue(response, Namespace.PhysicalLink);
        PhysicalLinkNamespace physicalResponse = PhysicalLinkNamespace.parseFrom(namespace);
        assertThat(physicalResponse.getType(), is(PhysicalLinkMessageType.IsOpenResponse));
        assertThat(physicalResponse.getData(), is(messageData.toByteString()));
        response = m_SUT.createPhysicalLinkResponseMessage(request, PhysicalLinkMessageType.IsOpenResponse, 
                null);
        namespace = confirmResponseWrapperQueue(response, Namespace.PhysicalLink);
        physicalResponse = PhysicalLinkNamespace.parseFrom(namespace);
        assertThat(physicalResponse.getType(), is(PhysicalLinkMessageType.IsOpenResponse));
        assertThat(physicalResponse.hasData(), is(false));
    }
@ Test public void testQueuePhysicalLinkMessageResponse ( ) throws InvalidProtocolBufferException { TerraHarvestMessage request = createRequestFiller ( ) ; IsOpenResponseData messageData = IsOpenResponseData . newBuilder ( ) . setIsOpen ( true ) . build ( ) ; MessageResponseWrapper response = m_SUT . createPhysicalLinkResponseMessage ( request , PhysicalLinkMessageType . IsOpenResponse , messageData ) ; ByteString namespace = confirmResponseWrapperQueue ( response , Namespace . PhysicalLink ) ; PhysicalLinkNamespace physicalResponse = PhysicalLinkNamespace . parseFrom ( namespace ) ; assertThat ( physicalResponse . getType ( ) , is ( PhysicalLinkMessageType . IsOpenResponse ) ) ; assertThat ( physicalResponse . getData ( ) , is ( messageData . toByteString ( ) ) ) ; response = m_SUT . createPhysicalLinkResponseMessage ( request , PhysicalLinkMessageType . IsOpenResponse , null ) ; namespace = confirmResponseWrapperQueue ( response , Namespace . PhysicalLink ) ; physicalResponse = PhysicalLinkNamespace . parseFrom ( namespace ) ; assertThat ( physicalResponse . getType ( ) , is ( PhysicalLinkMessageType . IsOpenResponse ) ) ; assertThat ( physicalResponse . hasData ( ) , is ( false ) ) ; }
Verify the message wrapper returned contains the expected physical link contents.
Verify the message wrapper returned contains the expected physical link 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