use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class ProcessExecutor method killExternalProcess.
/**
* Killing external process(such not started by us) on a remote host. <br/>
* The process is found by a token which is contained in the start command.
* No regex supported.
*
* @param atsAgent the address of the remote ATS agent which will run the kill command
* @param startCommandSnippet the token to search for in the process start command.
* The minimum allowed length is 2 characters
* @return the number of killed processes
*/
@PublicAtsApi
public static int killExternalProcess(@Validate(name = "atsAgent", type = ValidationType.STRING_SERVER_WITH_PORT) String atsAgent, @Validate(name = "startCommandSnippet", type = ValidationType.STRING_NOT_EMPTY) String startCommandSnippet) {
// validate input parameters
atsAgent = HostUtils.getAtsAgentIpAndPort(atsAgent);
new Validator().validateMethodParameters(new Object[] { atsAgent, startCommandSnippet });
try {
return new InternalProcessOperations(atsAgent).killExternalProcess(startCommandSnippet);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class RegistryOperations method createPath.
/**
* Creates path in the registry.
*
* Will fail if the path exists already.
*
* If want to create a nested path(for example "Software\\MyCompany\\MyApplication\\Configuration"),
* it is needed to call this method for each path token(first for "Software\\MyCompany", then for "Software\\MyCompany\\MyApplication" etc)
*
* @param keyPath path to the key
*/
@PublicAtsApi
public void createPath(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { keyPath });
registryOperationsImpl.createPath(rootKey, keyPath);
}
use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class SystemOperations method setTime.
/**
* Set the system time
*
* @param timestamp the timestamp to set
* @param inMilliseconds whether the timestamp is in milliseconds or a formatted date string
* @throws SystemOperationException
*/
@PublicAtsApi
public void setTime(@Validate(name = "timestamp", type = ValidationType.STRING_NOT_EMPTY) String timestamp, @Validate(name = "inMilliseconds", type = ValidationType.NONE) boolean inMilliseconds) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { timestamp, inMilliseconds });
// execute action
ISystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.setTime(timestamp, inMilliseconds);
}
use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class SystemOperations method createScreenshot.
/**
* Creates screenshot image file.<br/>
* The currently supported image formats/types are PNG, JPG, JPEG, GIF and BMP
*
* @param filePath the screenshot image file path. If the file extension is not specified, the default format PNG will be used
*/
@PublicAtsApi
public void createScreenshot(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { filePath });
ISystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.createScreenshot(filePath);
}
use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class SystemOperations method getSystemProperty.
/**
* Get the value of the environment's system property.<br/>
*
* It calls internally System.getProperty("property name");
*
* @param propertyName the name of the system property
* @return the value of the system property
*/
@PublicAtsApi
public String getSystemProperty(@Validate(name = "propertyName", type = ValidationType.NOT_NULL) String propertyName) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { propertyName });
// execute action
ISystemOperations operations = getOperationsImplementationFor(atsAgent);
return operations.getSystemProperty(propertyName);
}
Aggregations