Search in sources :

Example 6 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 7 with LocalProcessExecutor

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);
}
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 8 with LocalProcessExecutor

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);
}
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 9 with LocalProcessExecutor

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

Example 10 with LocalProcessExecutor

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

Aggregations

LocalProcessExecutor (com.axway.ats.core.process.LocalProcessExecutor)10 CallerRelatedAction (com.axway.ats.agent.core.action.CallerRelatedAction)5 Action (com.axway.ats.agent.core.model.Action)5 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 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)1 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)1