mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/messaging/TestMessageFactoryImpl.java
@Test
    public void testQueueMetaTypeResponse() throws IOException
    {
        // construct fake request message
        TerraHarvestMessage request = createRequestFiller();
        
        // construct data message to send
        GetAttributeDefinitionRequestData messageData = 
                GetAttributeDefinitionRequestData.newBuilder().setBundleId(1).setPid("test-pid").build();
        
        MessageResponseWrapper response = 
                m_SUT.createMetaTypeResponseMessage(request, MetaTypeMessageType.GetAttributeDefinitionResponse, 
                        messageData);

        // request to send over mock channel and verify namespace
        ByteString namespace = confirmResponseWrapperQueue(response, Namespace.MetaType);
        
        // verify namespace message
        MetaTypeNamespace messageResponse = MetaTypeNamespace.parseFrom(namespace);
        assertThat(messageResponse.getType(), is(MetaTypeMessageType.GetAttributeDefinitionResponse));
        
        //verify data message
        assertThat(messageResponse.getData(), is(messageData.toByteString()));
        
        //--send again with no data message--//
        response = m_SUT.createMetaTypeResponseMessage(request, MetaTypeMessageType.GetAttributeDefinitionResponse, 
                        null);

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

        // verify namespace message
        messageResponse = MetaTypeNamespace.parseFrom(namespace);
        assertThat(messageResponse.getType(), is(MetaTypeMessageType.GetAttributeDefinitionResponse));
        
        //verify data message
        assertThat(messageResponse.hasData(), is(false));
    }
/**
     * Verify the message wrapper returned contains the expected metatype contents.
     */
Verify the message wrapper returned contains the expected metatype contents.
Verify the message wrapper returned contains the expected metatype contents .
@Test
    public void testQueueMetaTypeResponse() throws IOException
    {
        TerraHarvestMessage request = createRequestFiller();
        GetAttributeDefinitionRequestData messageData = 
                GetAttributeDefinitionRequestData.newBuilder().setBundleId(1).setPid("test-pid").build();
        MessageResponseWrapper response = 
                m_SUT.createMetaTypeResponseMessage(request, MetaTypeMessageType.GetAttributeDefinitionResponse, 
                        messageData);
        ByteString namespace = confirmResponseWrapperQueue(response, Namespace.MetaType);
        MetaTypeNamespace messageResponse = MetaTypeNamespace.parseFrom(namespace);
        assertThat(messageResponse.getType(), is(MetaTypeMessageType.GetAttributeDefinitionResponse));
        assertThat(messageResponse.getData(), is(messageData.toByteString()));
        response = m_SUT.createMetaTypeResponseMessage(request, MetaTypeMessageType.GetAttributeDefinitionResponse, 
                        null);
        namespace = confirmResponseWrapperQueue(response, Namespace.MetaType);
        messageResponse = MetaTypeNamespace.parseFrom(namespace);
        assertThat(messageResponse.getType(), is(MetaTypeMessageType.GetAttributeDefinitionResponse));
        assertThat(messageResponse.hasData(), is(false));
    }
@ Test public void testQueueMetaTypeResponse ( ) throws IOException { TerraHarvestMessage request = createRequestFiller ( ) ; GetAttributeDefinitionRequestData messageData = GetAttributeDefinitionRequestData . newBuilder ( ) . setBundleId ( 1 ) . setPid ( "test-pid" ) . build ( ) ; MessageResponseWrapper response = m_SUT . createMetaTypeResponseMessage ( request , MetaTypeMessageType . GetAttributeDefinitionResponse , messageData ) ; ByteString namespace = confirmResponseWrapperQueue ( response , Namespace . MetaType ) ; MetaTypeNamespace messageResponse = MetaTypeNamespace . parseFrom ( namespace ) ; assertThat ( messageResponse . getType ( ) , is ( MetaTypeMessageType . GetAttributeDefinitionResponse ) ) ; assertThat ( messageResponse . getData ( ) , is ( messageData . toByteString ( ) ) ) ; response = m_SUT . createMetaTypeResponseMessage ( request , MetaTypeMessageType . GetAttributeDefinitionResponse , null ) ; namespace = confirmResponseWrapperQueue ( response , Namespace . MetaType ) ; messageResponse = MetaTypeNamespace . parseFrom ( namespace ) ; assertThat ( messageResponse . getType ( ) , is ( MetaTypeMessageType . GetAttributeDefinitionResponse ) ) ; assertThat ( messageResponse . hasData ( ) , is ( false ) ) ; }
Verify the message wrapper returned contains the expected metatype contents.
Verify the message wrapper returned contains the expected metatype 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