public abstract class ExtProcessTestLaunchBean extends AbstractTestLaunchBean
TestLaunchBean if the plugin
needs to launch an external process. This class provides a runExternalProcess(java.lang.String[], java.lang.String[], java.io.File, java.io.PrintStream) method accomplishing
starting an arbitrary external executable. Beside providing the stdout, stderr log info, the process
is automatically killed when the framework demands termination. This is typically if the user aborts
the execution manually, a specified timeout expired, or the execution server shuts down.| Constructor and Description |
|---|
ExtProcessTestLaunchBean() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
asyncRunExternalProcess(java.lang.String[] commandLine,
java.util.Map<java.lang.String,java.lang.String> envVariables,
java.io.File workingDir,
java.io.PrintStream log)
Asynchronously executes an arbitrary executable as external process.
|
protected int |
runExternalProcess(java.lang.String[] commandLine,
java.lang.String[] envVariables,
java.io.File workingDir,
java.io.PrintStream log)
Executes an arbitrary executable as external process.
|
java.lang.String |
stdErrReport()
Returns the current stderr output of the process.
|
java.lang.String |
stdOutReport()
Returns the current stdout output of the process.
|
void |
terminate()
Called to demand immediate termination while an execution takes currently place.
|
java.lang.Integer |
waitForCompletion(int timeout)
Waits the timespan passed as parameter for an asynchronously executing process to complete.
|
context, getTestDefDescription, getTestDefName, initialize, setTestDefName, sourceAccessclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteprotected final int runExternalProcess(java.lang.String[] commandLine,
java.lang.String[] envVariables,
java.io.File workingDir,
java.io.PrintStream log)
throws java.io.IOException,
java.lang.InterruptedException
TestLaunchResultDrain.getLog() to keep the log output in a logfile and display
it as online run info.commandLine - an array where the first element is path to the executable and following elements the parameters passed.envVariables - null or environment variables to be set, where each string in form "name=value"workingDir - the working directory (current directory) for the external processlog - an optional additional stream to which the process's stdout and stderr is printedjava.io.IOException - if the process failed to startjava.lang.InterruptedException - if the framework demanded termination calling terminate()protected final void asyncRunExternalProcess(java.lang.String[] commandLine,
java.util.Map<java.lang.String,java.lang.String> envVariables,
java.io.File workingDir,
java.io.PrintStream log)
throws java.io.IOException
TestLaunchResultDrain.getLog() to keep the log output in a logfile and display
it as online run info.
Note, if environment variables are set, the process will only have these variables
defined, but no global system variables. Use System.getenv() and include
global variables on demand in the passed parameter.commandLine - an array where the first element is path to the executable and following elements the parameters passed.envVariables - environment variable definitions, may be nullworkingDir - the working directory (current directory) for the external processlog - an optional additional stream to which the process's stdout and stderr is printedjava.io.IOException - if the process failed to startpublic void terminate()
TestLaunchBean.execute(long, com.segue.tm.published.api.testlaunch.TestLaunchResultDrain) method, which on reaction should
throw an InterruptedException. This is typically if the user aborts
the execution manually, a specified timeout has expired, or the execution server is shut down.public final java.lang.Integer waitForCompletion(int timeout)
throws java.lang.InterruptedException,
java.io.IOException
timeout - the time in milliseconds how long to wait for the process.java.lang.InterruptedException - if the calling thread has been interrupted.java.io.IOExceptionpublic final java.lang.String stdOutReport()
public final java.lang.String stdErrReport()
Copyright © Micro Focus 2004-2019. All rights reserved.