+ protected ExecuteStreamHandler createExecuteStreamHandler(
+ final Writer stdOutWriter, final Writer stdErrWriter) {
+ // Log writers
+
+ PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(
+ new LogOutputStream() {
+ protected void processLine(String line, int level) {
+ log(stdOutLogLevel, line);
+ if (stdOutWriter != null)
+ appendLineToFile(stdOutWriter, line);
+ }
+ }, new LogOutputStream() {
+ protected void processLine(String line, int level) {
+ log(stdErrLogLevel, line);
+ if (stdErrWriter != null)
+ appendLineToFile(stdErrWriter, line);
+ }
+ }, null);
+ return pumpStreamHandler;
+ }
+
+ protected ExecuteResultHandler createExecuteResultHandler(
+ final CommandLine commandLine) {
+ return new ExecuteResultHandler() {
+
+ public void onProcessComplete(int exitValue) {
+ if (log.isDebugEnabled())
+ log
+ .debug("Process " + commandLine
+ + " properly completed.");
+ if (testResult != null) {
+ forwardPath(testResult, null);
+ testResult.addResultPart(new SimpleResultPart(
+ TestStatus.PASSED, "Process " + commandLine
+ + " properly completed."));
+ }
+ }
+
+ public void onProcessFailed(ExecuteException e) {
+ if (testResult != null) {
+ forwardPath(testResult, null);
+ testResult.addResultPart(new SimpleResultPart(
+ TestStatus.ERROR, "Process " + commandLine
+ + " failed.", e));
+ } else {
+ throw new SlcException("Process " + commandLine
+ + " failed.", e);
+ }
+ }
+ };
+ }
+