org.aludratest.service.cmdline
Interface CommandLineInteraction

All Superinterfaces:
Action, Interaction
All Known Implementing Classes:
CommandLineActionImpl

public interface CommandLineInteraction
extends Interaction

Provides methods for interacting with the command line.

Author:
Volker Bergmann

Method Summary
 int create(String processType, String processName, int processTimeout, int responseTimeout, String... command)
          Creates a process.
 void destroy(String processType, String processName, int processId)
          Destroys the referenced process.
 void enter(String processType, String processName, int processId, String text)
          Enters a text into the referenced process' standard input.
 String readLineOfErrOut(String processType, String processName, int processId)
          Reads the next line of the referenced process' error output.
 String readLineOfStdOut(String processType, String processName, int processId)
          Reads the next line of the referenced process' standard output.
 void redirectErrOutTo(String processType, String processName, int processId, OutputStream out)
          Redirects the error output of the referenced process to the provided OutputStream.
 void redirectStdInFrom(String processType, String processName, int processId, InputStream in)
          Redirects provided OutputStream's output to the standard input of the referenced process.
 void redirectStdOutTo(String processType, String processName, int processId, OutputStream out)
          Redirects the standard output of the referenced process to the provided OutputStream.
 void setEnvironmentVariable(String processType, String processName, int processId, String key, String value)
          Sets an environment variable of the specified process.
 void setRelativeWorkingDirectory(String processType, String processName, int processId, String relativeWorkingDirectory)
          Sets the working directory of the specified process.
 void skipErrOutUntilLineMatches(String processType, String processName, int processId, org.databene.commons.Validator<String> validator)
          Skips lines of the refernced process' error output until a line matches the Validator.
 void skipStdOutUntilLineMatches(String processType, String processName, int processId, org.databene.commons.Validator<String> validator)
          Skips the references process' standard output lines until a line matches the validator or the no more output is available.
 void start(String processType, String processName, int processId)
          Starts the referenced process.
 int waitUntilFinished(String processType, String processName, int processId)
          Waits until the references process has finished.
 
Methods inherited from interface org.aludratest.service.Action
createAttachments, createDebugAttachments, setSystemConnector
 

Method Detail

create

int create(String processType,
           String processName,
           int processTimeout,
           int responseTimeout,
           String... command)
Creates a process.

Parameters:
processType - the process type
processName - the process name
processTimeout - the maximum time to wait for process termination
responseTimeout - the maximum time to wait for process response
command -
Returns:
the processId

setRelativeWorkingDirectory

void setRelativeWorkingDirectory(String processType,
                                 String processName,
                                 int processId,
                                 String relativeWorkingDirectory)
Sets the working directory of the specified process.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
relativeWorkingDirectory - the path of the process' working directory relative to the configuration's base.directory setting

setEnvironmentVariable

void setEnvironmentVariable(String processType,
                            String processName,
                            int processId,
                            String key,
                            String value)
Sets an environment variable of the specified process.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
key -
value -

redirectStdOutTo

void redirectStdOutTo(String processType,
                      String processName,
                      int processId,
                      OutputStream out)
Redirects the standard output of the referenced process to the provided OutputStream.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
out -

redirectErrOutTo

void redirectErrOutTo(String processType,
                      String processName,
                      int processId,
                      OutputStream out)
Redirects the error output of the referenced process to the provided OutputStream.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
out -

redirectStdInFrom

void redirectStdInFrom(String processType,
                       String processName,
                       int processId,
                       InputStream in)
Redirects provided OutputStream's output to the standard input of the referenced process.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
in -

start

void start(String processType,
           String processName,
           int processId)
Starts the referenced process.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process

readLineOfStdOut

String readLineOfStdOut(String processType,
                        String processName,
                        int processId)
Reads the next line of the referenced process' standard output.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
Returns:

skipStdOutUntilLineMatches

void skipStdOutUntilLineMatches(String processType,
                                String processName,
                                int processId,
                                org.databene.commons.Validator<String> validator)
Skips the references process' standard output lines until a line matches the validator or the no more output is available.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
validator -

readLineOfErrOut

String readLineOfErrOut(String processType,
                        String processName,
                        int processId)
Reads the next line of the referenced process' error output.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
Returns:

skipErrOutUntilLineMatches

void skipErrOutUntilLineMatches(String processType,
                                String processName,
                                int processId,
                                org.databene.commons.Validator<String> validator)
Skips lines of the refernced process' error output until a line matches the Validator.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
validator -

enter

void enter(String processType,
           String processName,
           int processId,
           String text)
Enters a text into the referenced process' standard input.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
text -

waitUntilFinished

int waitUntilFinished(String processType,
                      String processName,
                      int processId)
Waits until the references process has finished.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process
Returns:

destroy

void destroy(String processType,
             String processName,
             int processId)
Destroys the referenced process.

Parameters:
processType - the process type
processName - the process name
processId - the internal id of the process


Copyright © 2015 aludratest.org. All rights reserved.