Search in sources :

Example 1 with LocalProcessExecutor

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();
}
Also used : LocalProcessExecutor(com.axway.ats.core.process.LocalProcessExecutor) Action(com.axway.ats.agent.core.model.Action) CallerRelatedAction(com.axway.ats.agent.core.action.CallerRelatedAction)

Example 2 with LocalProcessExecutor

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);
}
Also used : LocalProcessExecutor(com.axway.ats.core.process.LocalProcessExecutor) Action(com.axway.ats.agent.core.model.Action) CallerRelatedAction(com.axway.ats.agent.core.action.CallerRelatedAction)

Example 3 with LocalProcessExecutor

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;
}
Also used : HashMap(java.util.HashMap) LocalProcessExecutor(com.axway.ats.core.process.LocalProcessExecutor) Action(com.axway.ats.agent.core.model.Action) CallerRelatedAction(com.axway.ats.agent.core.action.CallerRelatedAction)

Example 4 with LocalProcessExecutor

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();
}
Also used : LocalProcessExecutor(com.axway.ats.core.process.LocalProcessExecutor) Action(com.axway.ats.agent.core.model.Action) CallerRelatedAction(com.axway.ats.agent.core.action.CallerRelatedAction)

Example 5 with LocalProcessExecutor

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();
}
Also used : LocalProcessExecutor(com.axway.ats.core.process.LocalProcessExecutor)

Aggregations

LocalProcessExecutor (com.axway.ats.core.process.LocalProcessExecutor)11 CallerRelatedAction (com.axway.ats.agent.core.action.CallerRelatedAction)6 Action (com.axway.ats.agent.core.model.Action)6 IProcessExecutor (com.axway.ats.core.process.model.IProcessExecutor)2 PublicAtsApi (com.axway.ats.common.PublicAtsApi)1 EnvironmentCleanupException (com.axway.ats.environment.EnvironmentCleanupException)1 AbstractRealBrowserDriver (com.axway.ats.uiengine.AbstractRealBrowserDriver)1 MobileOperationException (com.axway.ats.uiengine.exceptions.MobileOperationException)1 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)1 RobotException (com.axway.ats.uiengine.exceptions.RobotException)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 HashMap (java.util.HashMap)1 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)1 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)1