mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestMissionProgrammingNamespace.java
@Test
    public void testExecute() throws UnknownHostException, IOException, InterruptedException
    {
        //message listener
        MessageListener listener = new MessageListener(m_Socket);
        
        m_MissionName = "executeProgram";
                
        //register for the program executed event
        RemoteEventRegistration.regRemoteEventMessages(m_Socket, Program.TOPIC_PROGRAM_EXECUTED, 
                String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, m_MissionName));
        
        //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);
        
        //execution message
        ExecuteTestRequestData requestMessage = ExecuteTestRequestData.newBuilder().
                setMissionName("executeProgram").build();
        
        //create execution message
        TerraHarvestMessage message = 
                createMissionProgramMessage(MissionProgrammingMessageType.ExecuteRequest, requestMessage);
        
        // send out message
        message.writeDelimitedTo(m_Socket.getOutputStream());
        
        try
        {
            //wait for execution and response, response is from the actual thread executing the mission program
            //remote reg ensures that the name matches that of this mission
            listener.waitForMessages(2500,
                new BasicMessageMatcher(Namespace.MissionProgramming, MissionProgrammingMessageType.ExecuteResponse),
                new MessageMatchers.EventMessageMatcher(Program.TOPIC_PROGRAM_EXECUTED));
        }
        finally
        {
            //cleanup
            MissionProgramNamespaceUtils.shutdownExecutedMission(m_Socket, m_MissionName);
        }
    }
/**
     * Test requesting the execution of a mission program.
     * Verify success of the execution.
     */
Test requesting the execution of a mission program.
Verify success of the execution.
Test requesting the execution of a mission program . Verify success of the execution .
@Test
    public void testExecute() throws UnknownHostException, IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(m_Socket);
        m_MissionName = "executeProgram";
        RemoteEventRegistration.regRemoteEventMessages(m_Socket, Program.TOPIC_PROGRAM_EXECUTED, 
                String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, m_MissionName));
        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);
        ExecuteTestRequestData requestMessage = ExecuteTestRequestData.newBuilder().
                setMissionName("executeProgram").build();
        TerraHarvestMessage message = 
                createMissionProgramMessage(MissionProgrammingMessageType.ExecuteRequest, requestMessage);
        message.writeDelimitedTo(m_Socket.getOutputStream());
        try
        {
            listener.waitForMessages(2500,
                new BasicMessageMatcher(Namespace.MissionProgramming, MissionProgrammingMessageType.ExecuteResponse),
                new MessageMatchers.EventMessageMatcher(Program.TOPIC_PROGRAM_EXECUTED));
        }
        finally
        {
            MissionProgramNamespaceUtils.shutdownExecutedMission(m_Socket, m_MissionName);
        }
    }
@ Test public void testExecute ( ) throws UnknownHostException , IOException , InterruptedException { MessageListener listener = new MessageListener ( m_Socket ) ; m_MissionName = "executeProgram" ; RemoteEventRegistration . regRemoteEventMessages ( m_Socket , Program . TOPIC_PROGRAM_EXECUTED , String . format ( "(%s=%s)" , Program . EVENT_PROP_PROGRAM_NAME , m_MissionName ) ) ; 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 ) ; ExecuteTestRequestData requestMessage = ExecuteTestRequestData . newBuilder ( ) . setMissionName ( "executeProgram" ) . build ( ) ; TerraHarvestMessage message = createMissionProgramMessage ( MissionProgrammingMessageType . ExecuteRequest , requestMessage ) ; message . writeDelimitedTo ( m_Socket . getOutputStream ( ) ) ; try { listener . waitForMessages ( 2500 , new BasicMessageMatcher ( Namespace . MissionProgramming , MissionProgrammingMessageType . ExecuteResponse ) , new MessageMatchers . EventMessageMatcher ( Program . TOPIC_PROGRAM_EXECUTED ) ) ; } finally { MissionProgramNamespaceUtils . shutdownExecutedMission ( m_Socket , m_MissionName ) ; } }
Test requesting the execution of a mission program.
Test requesting the execution of a mission program .
//message listener //register for the program executed event //create schedule //create mission program parameters //load the parameters //execution message //create execution message // send out message //wait for execution and response, response is from the actual thread executing the mission program //remote reg ensures that the name matches that of this mission //cleanup