use of com.axway.ats.core.process.LocalProcessExecutor in project ats-framework by Axway.
the class InternalProcessOperations method startProcess.
/**
*
* @param internalProcessId internal process id (the unique id for the current LocalProcessExecutor)
* @param workDirectory the working directory. If null, the working directory of the current Java process will be used
* @param standardOutputFile the standard output file name. If null, the standard output will not be sent to a file
* @param errorOutputFile the error output file name. If null, the error output will not be sent to a file
* @param logStandardOutput whether to log the standard output
* @param logErrorOutput whether to log the error output
* @param waitForCompletion whether to wait for a process completion
*/
@Action(name = "Internal Process Operations start Process")
public void startProcess(@Parameter(name = "internalProcessId") String internalProcessId, @Parameter(name = "workDirectory") String workDirectory, @Parameter(name = "standardOutputFile") String standardOutputFile, @Parameter(name = "errorOutputFile") String errorOutputFile, @Parameter(name = "logStandardOutput") boolean logStandardOutput, @Parameter(name = "logErrorOutput") boolean logErrorOutput, @Parameter(name = "waitForCompletion") boolean waitForCompletion) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.setWorkDirectory(workDirectory);
processExecutor.setStandardOutputFile(standardOutputFile);
processExecutor.setErrorOutputFile(errorOutputFile);
processExecutor.setLogStandardOutput(logStandardOutput);
processExecutor.setLogErrorOutput(logErrorOutput);
processExecutor.execute(waitForCompletion);
}
use of com.axway.ats.core.process.LocalProcessExecutor in project ats-framework by Axway.
the class InternalProcessOperations method appendToEnvVariable.
@Action(name = "Internal Process Operations append To Env Variable")
public void appendToEnvVariable(@Parameter(name = "internalProcessId") String internalProcessId, @Parameter(name = "variableName") String variableName, @Parameter(name = "variableValueToAppend") String variableValueToAppend) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.appendToEnvVariable(variableName, variableValueToAppend);
}
use of com.axway.ats.core.process.LocalProcessExecutor in project ats-framework by Axway.
the class InternalProcessOperations method setEnvVariable.
@Action(name = "Internal Process Operations set Env Variable")
public void setEnvVariable(@Parameter(name = "internalProcessId") String internalProcessId, @Parameter(name = "variableName") String variableName, @Parameter(name = "variableValue") String variableValue) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.setEnvVariable(variableName, variableValue);
}
use of com.axway.ats.core.process.LocalProcessExecutor in project ats-framework by Axway.
the class SystemProcessAction method executeAction.
@Override
protected void executeAction() throws EnvironmentCleanupException {
try {
log.debug("Executing additional action with shell command '" + shellCommand + "'");
LocalProcessExecutor processExecutor = new LocalProcessExecutor(HostUtils.LOCAL_HOST_IPv4, shellCommand);
processExecutor.execute();
} catch (Exception e) {
throw new EnvironmentCleanupException("Could not execute command '" + shellCommand + "'", e);
}
}
use of com.axway.ats.core.process.LocalProcessExecutor in project ats-framework by Axway.
the class LocalSystemOperations method setUnixTime.
/**
* Set the time on a UNIX box
*
* @param calendar the time to set
*/
private void setUnixTime(Calendar calendar) {
// set the date
//MMDDhhmm[[CC]YY][.ss]
String dateArguments = String.format("%1$02d%2$02d%3$02d%4$02d%5$04d.%6$02d", calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.YEAR), calendar.get(Calendar.SECOND));
LocalProcessExecutor processExecutor = new LocalProcessExecutor(HostUtils.LOCAL_HOST_IPv4, "date", dateArguments);
processExecutor.execute();
}
Aggregations