Class LocalProcessClient

java.lang.Object
org.opentestfactory.utils.process.LocalProcessClient

public class LocalProcessClient extends Object
Client responsible to deal with the local system in process executing
Author:
cruhlmann, bfranchet
  • Constructor Details

    • LocalProcessClient

      public LocalProcessClient()
  • Method Details

    • unsetEnvironementVariable

      public boolean unsetEnvironementVariable(String name)
      Convenience method to remove a single variable from the environment.
      Parameters:
      name - the name of the target variable.
      Returns:
      true if the variable existed, false otherwise.
    • unsetEnvironmentVariables

      public Set<String> unsetEnvironmentVariables(Set<String> targetVariables)
      Remove some variables from the run environement.
      Parameters:
      targetVariables - names of the variables tpo unset.
      Returns:
      name of the variables that were actually unset (only previously existing variables will be listed here).
    • setEnvironmentVariable

      public String setEnvironmentVariable(String name, String value)
      Convenience method to set one variable.
      Parameters:
      name - variable name.
      value -
      Returns:
      the previous value if the variable was defined, null otherwise.
    • setEnvironmentVariables

      public Map<String,String> setEnvironmentVariables(Map<String,String> variables)
      Method to set a bunch of environement variables.
      Parameters:
      variables - the variable mappins to set.
      Returns:
      returns a map of replaced values for vairables that were already defined.
    • runLocalProcessCommand

      public ShellResult runLocalProcessCommand(String command, File workingDir, Integer timeout, Integer streamlength) throws IOException, InterruptedException, TimeoutException, ParseException
      This method execute a single command line on the local system.
      Parameters:
      command - The command to execute
      workingDir - The working directory for the launched command. If set to null, the default working directory will be used.
      timeout - The timeout (in ms) before the process gets killed and you get shouted at. If set to 0 or a negative value, no timeout will be applied.
      streamlength - The max stream length to keep (number of characters).
      Returns:
      a ShellResult
      Throws:
      IOException
      InterruptedException
      TimeoutException
      ParseException