public class SystemCall
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LOG_STDOUT |
Constructor and Description |
---|
SystemCall()
Empty constructor
|
SystemCall(java.util.List<java.lang.Object> command)
Constructor based on the provided command list.
|
SystemCall(java.lang.String cmd)
Constructor based on the provided command.
|
Modifier and Type | Method and Description |
---|---|
void |
addOutputListener(SystemCallOutputListener outputListener) |
protected void |
appendLineToFile(java.io.Writer writer,
java.lang.String line)
Append line to a log file.
|
SystemCall |
arg(java.lang.String arg)
Append the argument (for chaining)
|
SystemCall |
arg(java.lang.String arg,
java.lang.String value)
Append the argument (for chaining)
|
java.lang.String |
asCommand() |
protected org.apache.commons.exec.CommandLine |
createCommandLine()
Build a command line based on the properties.
|
protected org.apache.commons.exec.ExecuteResultHandler |
createExecuteResultHandler(org.apache.commons.exec.CommandLine commandLine)
Creates the default
ExecuteResultHandler . |
protected org.apache.commons.exec.ExecuteStreamHandler |
createExecuteStreamHandler(java.io.Writer stdOutWriter,
java.io.OutputStream stdOutputStream,
java.io.Writer stdErrWriter,
java.io.InputStream stdInStream)
Creates a
PumpStreamHandler which redirects streams to the custom
logging mechanism. |
protected java.io.OutputStream |
createOutputStream(org.springframework.core.io.Resource target)
Creates an outputstream for the output/err files.
|
protected java.io.Writer |
createWriter(org.springframework.core.io.Resource target,
java.lang.Boolean append)
Creates the writer for the output/err files.
|
protected void |
forwardPath(TestResult testResult)
Deprecated.
|
java.lang.String |
function() |
java.util.Map<java.lang.String,java.lang.String> |
getEnvironmentVariables() |
protected java.lang.String |
getExecDirToUse()
Shortcut method getting the execDir to use
|
java.lang.Boolean |
isRunning() |
void |
kill() |
protected void |
log(java.lang.String logLevel,
java.lang.String line)
Log from the underlying streams.
|
protected void |
logStdErr(java.lang.String line) |
protected void |
logStdOut(java.lang.String line) |
void |
removeOutputListener(SystemCallOutputListener outputListener) |
void |
run()
Executes the system call.
|
void |
setCallbackHandler(javax.security.auth.callback.CallbackHandler callbackHandler) |
void |
setChroot(java.lang.String chroot) |
void |
setCmd(java.lang.String command) |
void |
setCommand(java.util.List<java.lang.Object> command) |
void |
setEnvironmentVariables(java.util.Map<java.lang.String,java.lang.String> environmentVariables) |
void |
setExceptionOnFailed(java.lang.Boolean exceptionOnFailed) |
void |
setExecDir(java.lang.String execdir) |
void |
setExecutionResources(ExecutionResources executionResources) |
void |
setExecutor(org.apache.commons.exec.Executor executor) |
void |
setGenerateScript(java.lang.String generateScript) |
void |
setLogCommand(java.lang.Boolean logCommand) |
void |
setMergeEnvironmentVariables(java.lang.Boolean mergeEnvironmentVariables) |
void |
setOsCmds(java.util.Map<java.lang.String,java.lang.String> osCmds) |
void |
setOsCommands(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> osCommands) |
void |
setOsConsole(java.lang.String osConsole) |
void |
setOutputListeners(java.util.List<SystemCallOutputListener> outputListeners) |
void |
setRedirectStdOut(java.lang.Boolean redirectStdOut) |
void |
setRedirectStreams(java.lang.Boolean redirectStreams) |
void |
setStdErrFile(org.springframework.core.io.Resource stdErrFile) |
void |
setStdErrLogLevel(java.lang.String stdErrLogLevel) |
void |
setStdInFile(org.springframework.core.io.Resource stdInFile) |
void |
setStdOutFile(org.springframework.core.io.Resource stdOutFile) |
void |
setStdOutLogLevel(java.lang.String stdOutLogLevel) |
void |
setSudo(java.lang.String sudo) |
void |
setSynchronous(java.lang.Boolean synchronous) |
void |
setTestResult(TestResult testResult) |
void |
setWatchdogTimeout(java.lang.Long watchdogTimeout) |
java.lang.String |
toString() |
public static final java.lang.String LOG_STDOUT
public SystemCall()
public SystemCall(java.util.List<java.lang.Object> command)
command
- the command listpublic SystemCall(java.lang.String cmd)
cmd
- the command. If the provided string contains no space a
command list is initialized with the argument as first
component (useful for chained construction)public void run()
run
in interface java.lang.Runnable
public java.lang.String function()
public java.lang.String asCommand()
public java.lang.String toString()
toString
in class java.lang.Object
protected org.apache.commons.exec.CommandLine createCommandLine()
protected org.apache.commons.exec.ExecuteStreamHandler createExecuteStreamHandler(java.io.Writer stdOutWriter, java.io.OutputStream stdOutputStream, java.io.Writer stdErrWriter, java.io.InputStream stdInStream)
PumpStreamHandler
which redirects streams to the custom
logging mechanism.protected org.apache.commons.exec.ExecuteResultHandler createExecuteResultHandler(org.apache.commons.exec.CommandLine commandLine)
ExecuteResultHandler
.@Deprecated protected void forwardPath(TestResult testResult)
protected java.lang.String getExecDirToUse()
protected void logStdOut(java.lang.String line)
protected void logStdErr(java.lang.String line)
protected void log(java.lang.String logLevel, java.lang.String line)
protected void appendLineToFile(java.io.Writer writer, java.lang.String line)
protected java.io.Writer createWriter(org.springframework.core.io.Resource target, java.lang.Boolean append)
protected java.io.OutputStream createOutputStream(org.springframework.core.io.Resource target)
public SystemCall arg(java.lang.String arg)
public SystemCall arg(java.lang.String arg, java.lang.String value)
public java.lang.Boolean isRunning()
public void kill()
public void setCmd(java.lang.String command)
public void setCommand(java.util.List<java.lang.Object> command)
public void setExecDir(java.lang.String execdir)
public void setStdErrLogLevel(java.lang.String stdErrLogLevel)
public void setStdOutLogLevel(java.lang.String stdOutLogLevel)
public void setSynchronous(java.lang.Boolean synchronous)
public void setOsCommands(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> osCommands)
public void setOsCmds(java.util.Map<java.lang.String,java.lang.String> osCmds)
public void setEnvironmentVariables(java.util.Map<java.lang.String,java.lang.String> environmentVariables)
public java.util.Map<java.lang.String,java.lang.String> getEnvironmentVariables()
public void setWatchdogTimeout(java.lang.Long watchdogTimeout)
public void setStdOutFile(org.springframework.core.io.Resource stdOutFile)
public void setStdErrFile(org.springframework.core.io.Resource stdErrFile)
public void setStdInFile(org.springframework.core.io.Resource stdInFile)
public void setTestResult(TestResult testResult)
public void setLogCommand(java.lang.Boolean logCommand)
public void setRedirectStreams(java.lang.Boolean redirectStreams)
public void setExceptionOnFailed(java.lang.Boolean exceptionOnFailed)
public void setMergeEnvironmentVariables(java.lang.Boolean mergeEnvironmentVariables)
public void setOsConsole(java.lang.String osConsole)
public void setGenerateScript(java.lang.String generateScript)
public void setExecutionResources(ExecutionResources executionResources)
public void setRedirectStdOut(java.lang.Boolean redirectStdOut)
public void addOutputListener(SystemCallOutputListener outputListener)
public void removeOutputListener(SystemCallOutputListener outputListener)
public void setOutputListeners(java.util.List<SystemCallOutputListener> outputListeners)
public void setExecutor(org.apache.commons.exec.Executor executor)
public void setSudo(java.lang.String sudo)
public void setCallbackHandler(javax.security.auth.callback.CallbackHandler callbackHandler)
public void setChroot(java.lang.String chroot)
Copyright © 2007–2020. All rights reserved.