Class StartServ

java.lang.Object
org.glassfish.main.itest.tools.asadmin.StartServ

public class StartServ extends Object
Tool for executing startserv command. The tool is stateless.
Author:
Ondro Mihalyi
  • Constructor Details

    • StartServ

      public StartServ(File startServ)
      Creates a stateless instance of the tool.
      Parameters:
      startServ - - executable file
  • Method Details

    • withEnv

      public StartServ withEnv(String name, String value)
      Adds environment property set for the asadmin execution.
      Parameters:
      name -
      value -
      Returns:
      this
    • withTextToWaitFor

      public StartServ withTextToWaitFor(String textToWaitFor)
      Wait for this text in stdout or stderr and exit if found, or until timeout. Don't wait for the process to stop
      Parameters:
      textToWaitFor -
      Returns:
      this
    • withNoTextToWaitFor

      public StartServ withNoTextToWaitFor()
      Do not wait for any text in stdout or stderr, wait for the process to stop or until timeout
      Returns:
      this
    • getCommandName

      public String getCommandName()
      Returns:
      asadmin command file name
    • exec

      public AsadminResult exec(String... args)
      Executes the command with arguments, waits until its standard output contains given text. Doesn't terminate the command, the command should either stop later or should be killed later.
      Parameters:
      args - command and arguments.
      Returns:
      AsadminResult never null. OK if text found in output, error if not found and command terminates or timeout reached.
    • exec

      public AsadminResult exec(int timeout, String... args)
      Executes the command with arguments.
      Parameters:
      timeout - timeout in millis
      args - command and arguments.
      Returns:
      AsadminResult never null.
    • toString

      public String toString()
      Overrides:
      toString in class Object