mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/MissionProgramNamespaceUtils.java
public static boolean cancelScheduledMission(final Socket socket, final String missionName) 
        throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        
        //execution message
        CancelProgramRequestData requestMessage = CancelProgramRequestData.newBuilder().
                setMissionName(missionName).build();
        
        //create cancel message
        TerraHarvestMessage message = 
            TestMissionProgrammingNamespace.createMissionProgramMessage(
                    MissionProgrammingMessageType.CancelProgramRequest, requestMessage);
        
        // send out message
        message.writeDelimitedTo(socket.getOutputStream());
        
        //wait for execution and response, response is from the actual thread executing the mission program
        Message responseRcvd = listener.waitForMessage(
            Namespace.MissionProgramming, MissionProgrammingMessageType.CancelProgramResponse, 1000);

        MissionProgrammingNamespace namespace = (MissionProgrammingNamespace)responseRcvd;
        CancelProgramResponseData responseData = CancelProgramResponseData.parseFrom(namespace.getData());

        //verify success
        assertThat(responseData.getMissionStatus(), isOneOf(MissionStatus.CANCELED));
        assertThat(responseData.getMissionName(), is(missionName));
        return true;
    }
/**
     * Clean up a mission created. This assumes that the mission is in a scheduled state.
     * @param socket
     *     the socket to use
     * @return name
     *     a mission program name
     */
Clean up a mission created. This assumes that the mission is in a scheduled state.
@param socket
the socket to use
@return name
a mission program name
Clean up a mission created . This assumes that the mission is in a scheduled state . @param socket the socket to use @return name a mission program name
public static boolean cancelScheduledMission(final Socket socket, final String missionName) 
        throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        CancelProgramRequestData requestMessage = CancelProgramRequestData.newBuilder().
                setMissionName(missionName).build();
        TerraHarvestMessage message = 
            TestMissionProgrammingNamespace.createMissionProgramMessage(
                    MissionProgrammingMessageType.CancelProgramRequest, requestMessage);
        message.writeDelimitedTo(socket.getOutputStream());
        Message responseRcvd = listener.waitForMessage(
            Namespace.MissionProgramming, MissionProgrammingMessageType.CancelProgramResponse, 1000);
        MissionProgrammingNamespace namespace = (MissionProgrammingNamespace)responseRcvd;
        CancelProgramResponseData responseData = CancelProgramResponseData.parseFrom(namespace.getData());
        assertThat(responseData.getMissionStatus(), isOneOf(MissionStatus.CANCELED));
        assertThat(responseData.getMissionName(), is(missionName));
        return true;
    }
public static boolean cancelScheduledMission ( final Socket socket , final String missionName ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; CancelProgramRequestData requestMessage = CancelProgramRequestData . newBuilder ( ) . setMissionName ( missionName ) . build ( ) ; TerraHarvestMessage message = TestMissionProgrammingNamespace . createMissionProgramMessage ( MissionProgrammingMessageType . CancelProgramRequest , requestMessage ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; Message responseRcvd = listener . waitForMessage ( Namespace . MissionProgramming , MissionProgrammingMessageType . CancelProgramResponse , 1000 ) ; MissionProgrammingNamespace namespace = ( MissionProgrammingNamespace ) responseRcvd ; CancelProgramResponseData responseData = CancelProgramResponseData . parseFrom ( namespace . getData ( ) ) ; assertThat ( responseData . getMissionStatus ( ) , isOneOf ( MissionStatus . CANCELED ) ) ; assertThat ( responseData . getMissionName ( ) , is ( missionName ) ) ; return true ; }
Clean up a mission created.
Clean up a mission created .
//execution message //create cancel message // send out message //wait for execution and response, response is from the actual thread executing the mission program //verify success