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

public class Asadmin extends Object
Tool for executing asadmin/asadmin.bat commands. The tool is stateless.
Author:
David Matejcek
  • Constructor Details

    • Asadmin

      public Asadmin(File asadmin, String adminUser, File adminPasswordFile)
      Creates a stateless instance of the tool.
      Parameters:
      asadmin - - executable file
      adminUser - - username authorized to use the domain
      adminPasswordFile - - a file containing admin's password set as AS_ADMIN_PASSWORD=...
    • Asadmin

      public Asadmin(File asadmin, String adminUser, File adminPasswordFile, boolean terse)
      Creates a stateless instance of the tool.
      Parameters:
      asadmin - - executable file
      adminUser - - username authorized to use the domain
      adminPasswordFile - - a file containing admin's password set as AS_ADMIN_PASSWORD=...
      terse - - to produce output, minimized and suitable for parsing.
  • Method Details

    • withEnv

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

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

      public <T> KeyAndValue<T> getValue(String key, Function<String,T> transformer)
    • get

      public <T> List<KeyAndValue<T>> get(String key, Function<String,T> transformer)
    • execDetached

      public DetachedTerseAsadminResult execDetached(String... args)
      Executes the command with arguments asynchronously with 30000 ms timeout. The command can be attached by the attach command. You should find the job id in the AsadminResult.getStdOut() as Job ID: [0-9]+
      Parameters:
      args -
      Returns:
      AsadminResult never null.
    • exec

      public AsadminResult exec(String... args)
      Executes the command with arguments synchronously with 30000 ms timeout.
      Parameters:
      args -
      Returns:
      AsadminResult never null.
    • exec

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