mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/mp/MissionProgrammingMessageService.java
private Message executeTest(final TerraHarvestMessage request, final MissionProgrammingNamespace missionMessage, 
         final RemoteChannel channel) throws IOException
    {
        //parse request
        final ExecuteTestRequestData requestMessage = ExecuteTestRequestData.parseFrom(missionMessage.getData());

        //get the program
        final Program program = m_Manager.getProgram(requestMessage.getMissionName());

        final String errorStringPrefix = "Mission program [%s] was requested to execute its test function, "; 
        try
        {
            program.executeTest();
        }
        catch (final UnsupportedOperationException e)
        {
            //return error
            final String errorDesc = String.format(errorStringPrefix + "but it does not support this ability.", 
                    program.getProgramName());
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.INTERNAL_ERROR,
                errorDesc).queue(channel);
            m_Logging.error(e, errorDesc);
            return requestMessage;
        }
        catch (final IllegalStateException e)
        {
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.INTERNAL_ERROR,
                    e.getMessage()).queue(channel);
            m_Logging.error(e, "The program's dependencies are not fulfilled when the request was made.");
            return requestMessage;
        }
        catch (final MissionProgramException e) 
        { 
            throw new IllegalStateException(e);
        }
        
        final ExecuteTestResponseData response = ExecuteTestResponseData.newBuilder().
                setMissionName(requestMessage.getMissionName()).build();
        m_MessageFactory.createMissionProgrammingResponseMessage(
                request, MissionProgrammingMessageType.ExecuteTestResponse, response).queue(channel);

        return requestMessage;
    }
/**
     * Handle the request execute a test function on a program.
     * 
     * @param request
     *     full request message
     * @param missionMessage
     *     message containing a mission program message
     * @param channel
     *      channel to use for sending a response
     * @return
     *      the data message for this request 
     * @throws IOException
     *     thrown in the event that an error is experienced while attempting to send the response message
     */
Handle the request execute a test function on a program.


Handle the request execute a test function on a program .
private Message executeTest(final TerraHarvestMessage request, final MissionProgrammingNamespace missionMessage, 
         final RemoteChannel channel) throws IOException
    {
        final ExecuteTestRequestData requestMessage = ExecuteTestRequestData.parseFrom(missionMessage.getData());
        final Program program = m_Manager.getProgram(requestMessage.getMissionName());
        final String errorStringPrefix = "Mission program [%s] was requested to execute its test function, "; 
        try
        {
            program.executeTest();
        }
        catch (final UnsupportedOperationException e)
        {
            final String errorDesc = String.format(errorStringPrefix + "but it does not support this ability.", 
                    program.getProgramName());
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.INTERNAL_ERROR,
                errorDesc).queue(channel);
            m_Logging.error(e, errorDesc);
            return requestMessage;
        }
        catch (final IllegalStateException e)
        {
            m_MessageFactory.createBaseErrorMessage(request, ErrorCode.INTERNAL_ERROR,
                    e.getMessage()).queue(channel);
            m_Logging.error(e, "The program's dependencies are not fulfilled when the request was made.");
            return requestMessage;
        }
        catch (final MissionProgramException e) 
        { 
            throw new IllegalStateException(e);
        }
        final ExecuteTestResponseData response = ExecuteTestResponseData.newBuilder().
                setMissionName(requestMessage.getMissionName()).build();
        m_MessageFactory.createMissionProgrammingResponseMessage(
                request, MissionProgrammingMessageType.ExecuteTestResponse, response).queue(channel);
        return requestMessage;
    }
private Message executeTest ( final TerraHarvestMessage request , final MissionProgrammingNamespace missionMessage , final RemoteChannel channel ) throws IOException { final ExecuteTestRequestData requestMessage = ExecuteTestRequestData . parseFrom ( missionMessage . getData ( ) ) ; final Program program = m_Manager . getProgram ( requestMessage . getMissionName ( ) ) ; final String errorStringPrefix = "Mission program [%s] was requested to execute its test function, " ; try { program . executeTest ( ) ; } catch ( final UnsupportedOperationException e ) { final String errorDesc = String . format ( errorStringPrefix + "but it does not support this ability." , program . getProgramName ( ) ) ; m_MessageFactory . createBaseErrorMessage ( request , ErrorCode . INTERNAL_ERROR , errorDesc ) . queue ( channel ) ; m_Logging . error ( e , errorDesc ) ; return requestMessage ; } catch ( final IllegalStateException e ) { m_MessageFactory . createBaseErrorMessage ( request , ErrorCode . INTERNAL_ERROR , e . getMessage ( ) ) . queue ( channel ) ; m_Logging . error ( e , "The program's dependencies are not fulfilled when the request was made." ) ; return requestMessage ; } catch ( final MissionProgramException e ) { throw new IllegalStateException ( e ) ; } final ExecuteTestResponseData response = ExecuteTestResponseData . newBuilder ( ) . setMissionName ( requestMessage . getMissionName ( ) ) . build ( ) ; m_MessageFactory . createMissionProgrammingResponseMessage ( request , MissionProgrammingMessageType . ExecuteTestResponse , response ) . queue ( channel ) ; return requestMessage ; }
Handle the request execute a test function on a program.
Handle the request execute a test function on a program .
//parse request //get the program //return error