mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestMissionProgrammingNamespace.java
@Test
    public void testGetProgramInformation() throws UnknownHostException, IOException, InterruptedException
    {
        //message listener
        MessageListener listener = new MessageListener(m_Socket);
        
        m_MissionName = "testProgramInfo";
                
        //create schedule
        MissionProgramParametersGen.MissionProgramSchedule schedule = MissionProgramParametersGen.
                MissionProgramSchedule.newBuilder().setActive(true).setImmediately(false).
                setIndefiniteInterval(false).build();
        
        //create mission program parameters
        MissionProgramParametersGen.MissionProgramParameters params = 
            MissionProgramNamespaceUtils.genTimedDataLoopParams(schedule, ASSET_NAME, m_MissionName);
        
        //load the parameters
        MissionProgramNamespaceUtils.loadParameters(m_Socket, params);
        
        //create get program Information for all programs
        GetProgramInformationRequestData requestMessage = GetProgramInformationRequestData.getDefaultInstance();

        TerraHarvestMessage message = 
                createMissionProgramMessage(MissionProgrammingMessageType.GetProgramInformationRequest, requestMessage);
        
        // send out message
        message.writeDelimitedTo(m_Socket.getOutputStream());
        
        //wait for execution and response, response is from the actual thread executing the mission program
        MissionProgrammingNamespace namespace = (MissionProgrammingNamespace)listener.waitForMessage(
                Namespace.MissionProgramming, MissionProgrammingMessageType.GetProgramInformationResponse, 2000);
        
        GetProgramInformationResponseData responseData = 
                GetProgramInformationResponseData.parseFrom(namespace.getData());
        
        //might be greater than one if the controller has ran other missions not related to the remote tests
        assertThat(responseData.getMissionInfoCount(), greaterThanOrEqualTo(1));
        
        Map<String, Object> programs = new HashMap<String, Object>();
        for (ProgramInfo info : responseData.getMissionInfoList())
        {
            programs.put(info.getMissionName(), info);
        }
        assertThat(programs.get(m_MissionName), is(notNullValue()));
        ProgramInfo info = (ProgramInfo)programs.get(m_MissionName);
        assertThat(info.getTemplateName(), is("timed-data-capture-loop"));
        //an asset name, a string, and an int
        assertThat(info.getExecutionParamCount(), is(3));
        assertThat(info.getMissionSchedule().getActive(), is(true));
        assertThat(info.getMissionSchedule().getIndefiniteInterval(), is(false));
        assertThat(info.getMissionSchedule().getImmediately(), is(false));
    }
/**
     * Test requesting all the program information known for a system.
     */
Test requesting all the program information known for a system.
Test requesting all the program information known for a system .
@Test
    public void testGetProgramInformation() throws UnknownHostException, IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(m_Socket);
        m_MissionName = "testProgramInfo";
        MissionProgramParametersGen.MissionProgramSchedule schedule = MissionProgramParametersGen.
                MissionProgramSchedule.newBuilder().setActive(true).setImmediately(false).
                setIndefiniteInterval(false).build();
        MissionProgramParametersGen.MissionProgramParameters params = 
            MissionProgramNamespaceUtils.genTimedDataLoopParams(schedule, ASSET_NAME, m_MissionName);
        MissionProgramNamespaceUtils.loadParameters(m_Socket, params);
        GetProgramInformationRequestData requestMessage = GetProgramInformationRequestData.getDefaultInstance();
        TerraHarvestMessage message = 
                createMissionProgramMessage(MissionProgrammingMessageType.GetProgramInformationRequest, requestMessage);
        message.writeDelimitedTo(m_Socket.getOutputStream());
        MissionProgrammingNamespace namespace = (MissionProgrammingNamespace)listener.waitForMessage(
                Namespace.MissionProgramming, MissionProgrammingMessageType.GetProgramInformationResponse, 2000);
        GetProgramInformationResponseData responseData = 
                GetProgramInformationResponseData.parseFrom(namespace.getData());
        assertThat(responseData.getMissionInfoCount(), greaterThanOrEqualTo(1));
        Map<String, Object> programs = new HashMap<String, Object>();
        for (ProgramInfo info : responseData.getMissionInfoList())
        {
            programs.put(info.getMissionName(), info);
        }
        assertThat(programs.get(m_MissionName), is(notNullValue()));
        ProgramInfo info = (ProgramInfo)programs.get(m_MissionName);
        assertThat(info.getTemplateName(), is("timed-data-capture-loop"));
        assertThat(info.getExecutionParamCount(), is(3));
        assertThat(info.getMissionSchedule().getActive(), is(true));
        assertThat(info.getMissionSchedule().getIndefiniteInterval(), is(false));
        assertThat(info.getMissionSchedule().getImmediately(), is(false));
    }
@ Test public void testGetProgramInformation ( ) throws UnknownHostException , IOException , InterruptedException { MessageListener listener = new MessageListener ( m_Socket ) ; m_MissionName = "testProgramInfo" ; MissionProgramParametersGen . MissionProgramSchedule schedule = MissionProgramParametersGen . MissionProgramSchedule . newBuilder ( ) . setActive ( true ) . setImmediately ( false ) . setIndefiniteInterval ( false ) . build ( ) ; MissionProgramParametersGen . MissionProgramParameters params = MissionProgramNamespaceUtils . genTimedDataLoopParams ( schedule , ASSET_NAME , m_MissionName ) ; MissionProgramNamespaceUtils . loadParameters ( m_Socket , params ) ; GetProgramInformationRequestData requestMessage = GetProgramInformationRequestData . getDefaultInstance ( ) ; TerraHarvestMessage message = createMissionProgramMessage ( MissionProgrammingMessageType . GetProgramInformationRequest , requestMessage ) ; message . writeDelimitedTo ( m_Socket . getOutputStream ( ) ) ; MissionProgrammingNamespace namespace = ( MissionProgrammingNamespace ) listener . waitForMessage ( Namespace . MissionProgramming , MissionProgrammingMessageType . GetProgramInformationResponse , 2000 ) ; GetProgramInformationResponseData responseData = GetProgramInformationResponseData . parseFrom ( namespace . getData ( ) ) ; assertThat ( responseData . getMissionInfoCount ( ) , greaterThanOrEqualTo ( 1 ) ) ; Map < String , Object > programs = new HashMap < String , Object > ( ) ; for ( ProgramInfo info : responseData . getMissionInfoList ( ) ) { programs . put ( info . getMissionName ( ) , info ) ; } assertThat ( programs . get ( m_MissionName ) , is ( notNullValue ( ) ) ) ; ProgramInfo info = ( ProgramInfo ) programs . get ( m_MissionName ) ; assertThat ( info . getTemplateName ( ) , is ( "timed-data-capture-loop" ) ) ; assertThat ( info . getExecutionParamCount ( ) , is ( 3 ) ) ; assertThat ( info . getMissionSchedule ( ) . getActive ( ) , is ( true ) ) ; assertThat ( info . getMissionSchedule ( ) . getIndefiniteInterval ( ) , is ( false ) ) ; assertThat ( info . getMissionSchedule ( ) . getImmediately ( ) , is ( false ) ) ; }
Test requesting all the program information known for a system.
Test requesting all the program information known for a system .
//message listener //create schedule //create mission program parameters //load the parameters //create get program Information for all programs // send out message //wait for execution and response, response is from the actual thread executing the mission program //might be greater than one if the controller has ran other missions not related to the remote tests //an asset name, a string, and an int