mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestMissionProgrammingNamespace.java
@Test
    public void testGetTemplates() throws IOException, InterruptedException
    {
        //load the test template
        loadProtoTestTemplate();
        
        //construct the request
        TerraHarvestMessage request = createMissionProgramMessage(MissionProgrammingMessageType.GetTemplatesRequest,
            null);
        
        // send out message
        request.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.MissionProgramming));
        //verify namespace and response
        MissionProgrammingNamespace namespaceResponse = MissionProgrammingNamespace.
            parseFrom(payLoadTest.getNamespaceMessage());
        assertThat(namespaceResponse.getType(), is(MissionProgrammingMessageType.GetTemplatesResponse));
        GetTemplatesResponseData responseData = GetTemplatesResponseData.parseFrom(namespaceResponse.getData());
        //should be greater than one, just loaded a template earlier in the tests
        assertThat(responseData.getTemplateCount(), greaterThan(1));
        
        //verify response data contains the template loaded earlier
        for (MissionProgramTemplateGen.MissionProgramTemplate template : responseData.getTemplateList())
        {
            if (template.getName().equals("TEST_TEMPLATE_REMOTE"))
            {
                assertThat(template.getDescription(), is("Something"));
                assertThat(template.getSource(), is("TheSource!@@#(*&$^%_@##$"));
                assertThat(template.getVariableMetaDataCount(), is(1));
                for (MissionProgramTemplateGen.MissionVariableMetaData varData : template.getVariableMetaDataList())
                {
                    if (varData.getBase().getName().equals("variable"))
                    {
                        assertThat(varData.getType(), is(MissionVariableTypes.Enum.ASSET));
                        assertThat(varData.getBase().getDescription(), is("I describe a variable"));
                        assertThat(varData.getBase().getHumanReadableName(), is("human readable name"));
                        assertThat(varData.getBase().getDefaultValue(), is("My Asset"));
                    }
                }
            }
        }
    }
/**
     * Test getting a list of templates.
     * 
     * Verify that the list is greater than one. 
     */
Test getting a list of templates.

Verify that the list is greater than one.
Test getting a list of templates . Verify that the list is greater than one .
@Test
    public void testGetTemplates() throws IOException, InterruptedException
    {
        loadProtoTestTemplate();
        TerraHarvestMessage request = createMissionProgramMessage(MissionProgrammingMessageType.GetTemplatesRequest,
            null);
        request.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.MissionProgramming));
        MissionProgrammingNamespace namespaceResponse = MissionProgrammingNamespace.
            parseFrom(payLoadTest.getNamespaceMessage());
        assertThat(namespaceResponse.getType(), is(MissionProgrammingMessageType.GetTemplatesResponse));
        GetTemplatesResponseData responseData = GetTemplatesResponseData.parseFrom(namespaceResponse.getData());
        assertThat(responseData.getTemplateCount(), greaterThan(1));
        for (MissionProgramTemplateGen.MissionProgramTemplate template : responseData.getTemplateList())
        {
            if (template.getName().equals("TEST_TEMPLATE_REMOTE"))
            {
                assertThat(template.getDescription(), is("Something"));
                assertThat(template.getSource(), is("TheSource!@@#(*&$^%_@##$"));
                assertThat(template.getVariableMetaDataCount(), is(1));
                for (MissionProgramTemplateGen.MissionVariableMetaData varData : template.getVariableMetaDataList())
                {
                    if (varData.getBase().getName().equals("variable"))
                    {
                        assertThat(varData.getType(), is(MissionVariableTypes.Enum.ASSET));
                        assertThat(varData.getBase().getDescription(), is("I describe a variable"));
                        assertThat(varData.getBase().getHumanReadableName(), is("human readable name"));
                        assertThat(varData.getBase().getDefaultValue(), is("My Asset"));
                    }
                }
            }
        }
    }
@ Test public void testGetTemplates ( ) throws IOException , InterruptedException { loadProtoTestTemplate ( ) ; TerraHarvestMessage request = createMissionProgramMessage ( MissionProgrammingMessageType . GetTemplatesRequest , null ) ; request . 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 . MissionProgramming ) ) ; MissionProgrammingNamespace namespaceResponse = MissionProgrammingNamespace . parseFrom ( payLoadTest . getNamespaceMessage ( ) ) ; assertThat ( namespaceResponse . getType ( ) , is ( MissionProgrammingMessageType . GetTemplatesResponse ) ) ; GetTemplatesResponseData responseData = GetTemplatesResponseData . parseFrom ( namespaceResponse . getData ( ) ) ; assertThat ( responseData . getTemplateCount ( ) , greaterThan ( 1 ) ) ; for ( MissionProgramTemplateGen . MissionProgramTemplate template : responseData . getTemplateList ( ) ) { if ( template . getName ( ) . equals ( "TEST_TEMPLATE_REMOTE" ) ) { assertThat ( template . getDescription ( ) , is ( "Something" ) ) ; assertThat ( template . getSource ( ) , is ( "TheSource!@@#(*&$^%_@##$" ) ) ; assertThat ( template . getVariableMetaDataCount ( ) , is ( 1 ) ) ; for ( MissionProgramTemplateGen . MissionVariableMetaData varData : template . getVariableMetaDataList ( ) ) { if ( varData . getBase ( ) . getName ( ) . equals ( "variable" ) ) { assertThat ( varData . getType ( ) , is ( MissionVariableTypes . Enum . ASSET ) ) ; assertThat ( varData . getBase ( ) . getDescription ( ) , is ( "I describe a variable" ) ) ; assertThat ( varData . getBase ( ) . getHumanReadableName ( ) , is ( "human readable name" ) ) ; assertThat ( varData . getBase ( ) . getDefaultValue ( ) , is ( "My Asset" ) ) ; } } } } }
Test getting a list of templates.
Test getting a list of templates .
//load the test template //construct the request // send out message //read in response //verify namespace and response //should be greater than one, just loaded a template earlier in the tests //verify response data contains the template loaded earlier