mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/AssetNamespaceUtils.java
public static ExecuteCommandResponseData executeCommand(final Message command, 
            final CommandTypesGen.CommandType.Enum commandEnum, 
            final SharedMessages.UUID uuid, final Socket socket) throws IOException
    {
        MessageListener listener = new MessageListener(socket);
        
        ExecuteCommandRequestData executeCommandRequest = ExecuteCommandRequestData.newBuilder().
                setUuid(uuid).
                setCommand(command.toByteString()).
                setCommandType(commandEnum).
                build();
        
        TerraHarvestMessage message = AssetNamespaceUtils.createAssetMessage(AssetMessageType.ExecuteCommandRequest, 
                executeCommandRequest);
        message.writeDelimitedTo(socket.getOutputStream());
        
        //listen for messages for a specific time interval
        Message responseRcvd = listener.waitForMessage(Namespace.Asset, 
                AssetMessageType.ExecuteCommandResponse, TIMEOUT);
        AssetNamespace response = (AssetNamespace)responseRcvd;
        ExecuteCommandResponseData responseData =  ExecuteCommandResponseData.parseFrom(response.getData());
        assertThat(responseData.getResponseType(), is(notNullValue()));
        return responseData;
    }
/**
     * Execute a command.
     * @param command
     *      the command to execute
     * @param commandEnum
     *      the enum value of the command being executed
     * @param uuid
     *      the UUID of the asset which will be executing the command
     * @param socket
     *      the socket to use for communication to the controller
     */
Execute a command.
@param command
the command to execute
@param commandEnum
the enum value of the command being executed
@param uuid
the UUID of the asset which will be executing the command
@param socket
the socket to use for communication to the controller
Execute a command . @param command the command to execute @param commandEnum the enum value of the command being executed @param uuid the UUID of the asset which will be executing the command @param socket the socket to use for communication to the controller
public static ExecuteCommandResponseData executeCommand(final Message command, 
            final CommandTypesGen.CommandType.Enum commandEnum, 
            final SharedMessages.UUID uuid, final Socket socket) throws IOException
    {
        MessageListener listener = new MessageListener(socket);
        ExecuteCommandRequestData executeCommandRequest = ExecuteCommandRequestData.newBuilder().
                setUuid(uuid).
                setCommand(command.toByteString()).
                setCommandType(commandEnum).
                build();
        TerraHarvestMessage message = AssetNamespaceUtils.createAssetMessage(AssetMessageType.ExecuteCommandRequest, 
                executeCommandRequest);
        message.writeDelimitedTo(socket.getOutputStream());
        Message responseRcvd = listener.waitForMessage(Namespace.Asset, 
                AssetMessageType.ExecuteCommandResponse, TIMEOUT);
        AssetNamespace response = (AssetNamespace)responseRcvd;
        ExecuteCommandResponseData responseData =  ExecuteCommandResponseData.parseFrom(response.getData());
        assertThat(responseData.getResponseType(), is(notNullValue()));
        return responseData;
    }
public static ExecuteCommandResponseData executeCommand ( final Message command , final CommandTypesGen . CommandType . Enum commandEnum , final SharedMessages . UUID uuid , final Socket socket ) throws IOException { MessageListener listener = new MessageListener ( socket ) ; ExecuteCommandRequestData executeCommandRequest = ExecuteCommandRequestData . newBuilder ( ) . setUuid ( uuid ) . setCommand ( command . toByteString ( ) ) . setCommandType ( commandEnum ) . build ( ) ; TerraHarvestMessage message = AssetNamespaceUtils . createAssetMessage ( AssetMessageType . ExecuteCommandRequest , executeCommandRequest ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; Message responseRcvd = listener . waitForMessage ( Namespace . Asset , AssetMessageType . ExecuteCommandResponse , TIMEOUT ) ; AssetNamespace response = ( AssetNamespace ) responseRcvd ; ExecuteCommandResponseData responseData = ExecuteCommandResponseData . parseFrom ( response . getData ( ) ) ; assertThat ( responseData . getResponseType ( ) , is ( notNullValue ( ) ) ) ; return responseData ; }
Execute a command.
Execute a command .
//listen for messages for a specific time interval