Class Asadmin
java.lang.Object
org.glassfish.main.itest.tools.asadmin.Asadmin
Tool for executing asadmin/asadmin.bat commands. The tool is stateless.
- Author:
- David Matejcek
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExecutes the command with arguments synchronously with given timeout in millis.Executes the command with arguments synchronously without timeout.execDetached(String... args) Executes the command with arguments asynchronously without timeout.<T> List<KeyAndValue<T>> Gets values for a given key from the asadmin get command.<T> KeyAndValue<T> Gets the value for a given key from the asadmin get command.Removes all custom passwords.Adds environment property set for the asadmin execution.withPassword(String name, String secretValue) Adds a password to the password file.
-
Constructor Details
-
Asadmin
Creates a stateless instance of the tool.- Parameters:
asadmin- - executable fileadminUser- - username authorized to use the domainadminPasswordFile- - a file containing admin's password set asAS_ADMIN_PASSWORD=...
-
Asadmin
Creates a stateless instance of the tool.- Parameters:
asadmin- - executable fileadminUser- - username authorized to use the domainadminPasswordFile- - a file containing admin's password set asAS_ADMIN_PASSWORD=...terse- - to produce output, minimized and suitable for parsing.
-
-
Method Details
-
withEnv
Adds environment property set for the asadmin execution.- Parameters:
name-value-- Returns:
- this
-
withPassword
Adds a password to the password file.- Parameters:
name- Name in the password filesecretValue- Value in the password file- Returns:
- this
-
resetPasswords
Removes all custom passwords.- Returns:
- this
-
getCommandName
- Returns:
- asadmin command file name
-
getValue
Gets the value for a given key from the asadmin get command.- Type Parameters:
T- expected result type- Parameters:
key- the key to get the value fortransformer- a function to transform the string value to the expected type- Returns:
- a single KeyAndValue instance if the key is concrete enough to get a single value,
- Throws:
IllegalArgumentException- if the get command returns more than one value
-
get
Gets values for a given key from the asadmin get command.- Type Parameters:
T- expected result type- Parameters:
key- the key to get the values fortransformer- a function to transform the string value to the expected type- Returns:
- a list of KeyAndValue instances, never null, but can be empty
-
execDetached
Executes the command with arguments asynchronously without timeout. The command can be attached by the attach command. You should find the job id in theAsadminResult.getStdOut()asJob ID: [0-9]+- Parameters:
args-- Returns:
AsadminResultnever null.
-
exec
Executes the command with arguments synchronously without timeout.- Parameters:
args-- Returns:
AsadminResultnever null.
-
exec
Executes the command with arguments synchronously with given timeout in millis.- Parameters:
timeout- timeout in millisargs- command and arguments.- Returns:
AsadminResultnever null.
-