mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestMetaTypeNamespace.java
@Test
    public void testGetAttributeDefinitionRequest() throws UnknownHostException, IOException, InterruptedException
    {
        //find the example metatype bundle
        long bundleId = 
                BundleNamespaceUtils.getBundleBySymbolicName(EXAMPLE_METATYPE_BUNDLE_NAME, m_Socket);

        //construct request
        GetAttributeDefinitionRequestData request = GetAttributeDefinitionRequestData.newBuilder().
            setBundleId(bundleId).setPid(ExampleClass.class.getName()).setKey(
                    ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE_STRING).build();
        TerraHarvestMessage message = createMetaTypeMessage(MetaTypeMessageType.GetAttributeDefinitionRequest, request);

        //send message
        message.writeDelimitedTo(m_Socket.getOutputStream());

        //read in response
        TerraHarvestMessage response = TerraHarvestMessage.parseDelimitedFrom(m_Socket.getInputStream());
        TerraHarvestPayload payLoadTest = TerraHarvestPayload.parseFrom(response.getTerraHarvestPayload());
        
        assertThat(response, is(notNullValue()));
        assertThat(payLoadTest.getNamespace(), is(Namespace.MetaType));
        //parse specific message type
        MetaTypeNamespace namespaceResponse = MetaTypeNamespace.parseFrom(payLoadTest.getNamespaceMessage());
        assertThat(namespaceResponse.getType(), is(MetaTypeMessageType.GetAttributeDefinitionResponse));
        //verify
        GetAttributeDefinitionResponseData responseData = GetAttributeDefinitionResponseData.parseFrom(
            namespaceResponse.getData());
        assertThat(responseData.getAttributeDefinitionCount(), greaterThan(0));
        assertThat(responseData.getAttributeDefinition(0).getAttributeType(), is(AttributeDefinition.STRING));
        assertThat(responseData.getAttributeDefinition(0).getName(), 
                is("Example Config String Value"));
        assertThat(responseData.getAttributeDefinition(0).getId(), 
                is(ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE_STRING));
        assertThat(responseData.getAttributeDefinition(0).getDefaultValue(0), is("hello"));
        assertThat(responseData.getAttributeDefinition(0).getRequired(), is(false));
    }
/**
     * Test that GetAttributeDefinitionRequest returns a list of attribute definition types.
     * 
     * Verify the expected number of attributes is returned.
     * 
     * Verify content of the attribute definition type.
     */
Test that GetAttributeDefinitionRequest returns a list of attribute definition types.

Verify the expected number of attributes is returned.

Verify content of the attribute definition type.
Test that GetAttributeDefinitionRequest returns a list of attribute definition types . Verify the expected number of attributes is returned . Verify content of the attribute definition type .
@Test
    public void testGetAttributeDefinitionRequest() throws UnknownHostException, IOException, InterruptedException
    {
        long bundleId = 
                BundleNamespaceUtils.getBundleBySymbolicName(EXAMPLE_METATYPE_BUNDLE_NAME, m_Socket);
        GetAttributeDefinitionRequestData request = GetAttributeDefinitionRequestData.newBuilder().
            setBundleId(bundleId).setPid(ExampleClass.class.getName()).setKey(
                    ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE_STRING).build();
        TerraHarvestMessage message = createMetaTypeMessage(MetaTypeMessageType.GetAttributeDefinitionRequest, request);
        message.writeDelimitedTo(m_Socket.getOutputStream());
        TerraHarvestMessage response = TerraHarvestMessage.parseDelimitedFrom(m_Socket.getInputStream());
        TerraHarvestPayload payLoadTest = TerraHarvestPayload.parseFrom(response.getTerraHarvestPayload());
        assertThat(response, is(notNullValue()));
        assertThat(payLoadTest.getNamespace(), is(Namespace.MetaType));
        MetaTypeNamespace namespaceResponse = MetaTypeNamespace.parseFrom(payLoadTest.getNamespaceMessage());
        assertThat(namespaceResponse.getType(), is(MetaTypeMessageType.GetAttributeDefinitionResponse));
        GetAttributeDefinitionResponseData responseData = GetAttributeDefinitionResponseData.parseFrom(
            namespaceResponse.getData());
        assertThat(responseData.getAttributeDefinitionCount(), greaterThan(0));
        assertThat(responseData.getAttributeDefinition(0).getAttributeType(), is(AttributeDefinition.STRING));
        assertThat(responseData.getAttributeDefinition(0).getName(), 
                is("Example Config String Value"));
        assertThat(responseData.getAttributeDefinition(0).getId(), 
                is(ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE_STRING));
        assertThat(responseData.getAttributeDefinition(0).getDefaultValue(0), is("hello"));
        assertThat(responseData.getAttributeDefinition(0).getRequired(), is(false));
    }
@ Test public void testGetAttributeDefinitionRequest ( ) throws UnknownHostException , IOException , InterruptedException { long bundleId = BundleNamespaceUtils . getBundleBySymbolicName ( EXAMPLE_METATYPE_BUNDLE_NAME , m_Socket ) ; GetAttributeDefinitionRequestData request = GetAttributeDefinitionRequestData . newBuilder ( ) . setBundleId ( bundleId ) . setPid ( ExampleClass . class . getName ( ) ) . setKey ( ExampleClassConfig . CONFIG_PROP_EXAMPLE_CONFIG_VALUE_STRING ) . build ( ) ; TerraHarvestMessage message = createMetaTypeMessage ( MetaTypeMessageType . GetAttributeDefinitionRequest , request ) ; message . writeDelimitedTo ( m_Socket . getOutputStream ( ) ) ; TerraHarvestMessage response = TerraHarvestMessage . parseDelimitedFrom ( m_Socket . getInputStream ( ) ) ; TerraHarvestPayload payLoadTest = TerraHarvestPayload . parseFrom ( response . getTerraHarvestPayload ( ) ) ; assertThat ( response , is ( notNullValue ( ) ) ) ; assertThat ( payLoadTest . getNamespace ( ) , is ( Namespace . MetaType ) ) ; MetaTypeNamespace namespaceResponse = MetaTypeNamespace . parseFrom ( payLoadTest . getNamespaceMessage ( ) ) ; assertThat ( namespaceResponse . getType ( ) , is ( MetaTypeMessageType . GetAttributeDefinitionResponse ) ) ; GetAttributeDefinitionResponseData responseData = GetAttributeDefinitionResponseData . parseFrom ( namespaceResponse . getData ( ) ) ; assertThat ( responseData . getAttributeDefinitionCount ( ) , greaterThan ( 0 ) ) ; assertThat ( responseData . getAttributeDefinition ( 0 ) . getAttributeType ( ) , is ( AttributeDefinition . STRING ) ) ; assertThat ( responseData . getAttributeDefinition ( 0 ) . getName ( ) , is ( "Example Config String Value" ) ) ; assertThat ( responseData . getAttributeDefinition ( 0 ) . getId ( ) , is ( ExampleClassConfig . CONFIG_PROP_EXAMPLE_CONFIG_VALUE_STRING ) ) ; assertThat ( responseData . getAttributeDefinition ( 0 ) . getDefaultValue ( 0 ) , is ( "hello" ) ) ; assertThat ( responseData . getAttributeDefinition ( 0 ) . getRequired ( ) , is ( false ) ) ; }
Test that GetAttributeDefinitionRequest returns a list of attribute definition types.
Test that GetAttributeDefinitionRequest returns a list of attribute definition types .
//find the example metatype bundle //construct request //send message //read in response //parse specific message type //verify