use of com.axway.ats.core.process.LocalProcessExecutor in project ats-framework by Axway.
the class InternalProcessOperations method killProcess.
@Action(name = "Internal Process Operations kill Process")
public void killProcess(@Parameter(name = "internalProcessId") String internalProcessId) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.kill();
}
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 getEnvVariables.
@Action(name = "Internal Process Operations get Env Variables")
public Map<String, String> getEnvVariables(@Parameter(name = "internalProcessId") String internalProcessId) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
// some internal impl, not serializable
Map<String, String> mapInt = processExecutor.getEnvVariables();
// clone and serializable
HashMap<String, String> hMap = new HashMap<>(mapInt);
return hMap;
}
use of com.axway.ats.core.process.LocalProcessExecutor in project ats-framework by Axway.
the class InternalProcessOperations method killProcessAndItsChildren.
@Action(name = "Internal Process Operations kill Process And Its Children")
public void killProcessAndItsChildren(@Parameter(name = "internalProcessId") String internalProcessId) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.killAll();
}
use of com.axway.ats.core.process.LocalProcessExecutor in project ats-framework by Axway.
the class LocalSystemOperations method setWindowsTime.
/**
* Set the time on a windows system
*
* @param calendar the time to set
*/
private void setWindowsTime(Calendar calendar) throws Exception {
// we are using the default date format and the system specific time format
// set the date
String dateArguments = String.format("%1$02d-%2$02d-%3$02d", calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.YEAR));
LocalProcessExecutor processExecutor = new LocalProcessExecutor(HostUtils.LOCAL_HOST_IPv4, "cmd /c date " + dateArguments);
processExecutor.execute();
// set the time
String timeArguments = SimpleDateFormat.getTimeInstance().format(calendar.getTime());
processExecutor = new LocalProcessExecutor(HostUtils.LOCAL_HOST_IPv4, "cmd /c time " + timeArguments);
processExecutor.execute();
}
Aggregations