use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class RegistryOperations method setIntValue.
/**
* Applies a Integer(REG_DWORD) value on the specified key.
*
* The key will be created if does not exist.
* The key type will be changed if needed.
*
* @param keyPath path to the key
* @param keyName name of the key
* @param keyValue the new key value
*/
@PublicAtsApi
public void setIntValue(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName, @Validate(name = "keyValue", type = ValidationType.NONE) int keyValue) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
registryOperationsImpl.setIntValue(rootKey, keyPath, keyName, keyValue);
}
use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class SystemMonitor method scheduleMonitoring.
/**
* Schedule a monitor and pass some custom parameters to it.
* <br>No statistics collection will be triggered until the startMonitor method is called.
*
* @param monitoredHost the host to monitor
* @param readingType what kind of data to collect. You call a custom monitor here or some of the SystemMonitor.MONITORTYPE_* constants
* @param readingParameters the parameters this monitor knows how to work with
*/
@PublicAtsApi
public void scheduleMonitoring(@Validate(name = "monitoredHost", type = ValidationType.STRING_SERVER_WITH_PORT) String monitoredHost, @Validate(name = "readingType", type = ValidationType.STRING_NOT_EMPTY) String readingType, @Validate(name = "readingParameters", type = ValidationType.NOT_NULL) Map<String, String> readingParameters) {
// validate input parameters
monitoredHost = HostUtils.getAtsAgentIpAndPort(monitoredHost);
new Validator().validateMethodParameters("Could not schedule monitoring a statistic on '" + monitoredHost + "'", new Object[] { monitoredHost, readingType, readingParameters });
Set<FullReadingBean> readingTypes = requestedReadingTypesPerHosts.get(monitoredHost);
if (readingTypes == null) {
readingTypes = new HashSet<FullReadingBean>();
}
Set<String> readingNames = new HashSet<String>();
readingNames.add(readingType);
FullReadingBean reading = ReadingsRepository.getInstance().getReadingXmlDefinition(readingType, readingParameters);
readingTypes.add(reading);
requestedReadingTypesPerHosts.put(monitoredHost, readingTypes);
monitoredHosts.add(monitoredHost);
}
use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class SystemMonitor method scheduleJvmMonitoring.
/**
* Schedule monitoring a JVM application
* <br><b>Note:</b> You must open the tested JVM application for JMX connections by adding the following
* runtime properties:
* "-Dcom.sun.management.jmxremote.port=[PORT NUMBER] -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
*
* @param monitoredHost the host where the monitored application is
* @param jvmPort the JMX port which is used for monitoring the JVM application
* @param alias the alias to use when logging into the database
* @param jvmReadingTypes what kind of data to collect. Use some of the SystemMonitor.MONITOR_JVM_* constants
*/
@PublicAtsApi
public void scheduleJvmMonitoring(@Validate(name = "monitoredHost", type = ValidationType.STRING_SERVER_WITH_PORT) String monitoredHost, @Validate(name = "jvmPort", type = ValidationType.NUMBER_PORT_NUMBER) String jvmPort, @Validate(name = "alias", type = ValidationType.NOT_NULL) String alias, @Validate(name = "jvmReadingTypes", type = ValidationType.NOT_NULL) String[] jvmReadingTypes) {
// validate input parameters
monitoredHost = HostUtils.getAtsAgentIpAndPort(monitoredHost);
new Validator().validateMethodParameters("Could not schedule monitoring JVM statistics on '" + monitoredHost + "' at " + jvmPort + " port", new Object[] { monitoredHost, jvmPort, jvmReadingTypes });
Set<FullReadingBean> readingTypes = requestedReadingTypesPerHosts.get(monitoredHost);
if (readingTypes == null) {
readingTypes = new HashSet<FullReadingBean>();
}
Map<String, String> readingParameters = new HashMap<String, String>();
readingParameters.put("JMX_PORT", jvmPort);
if (!StringUtils.isNullOrEmpty(alias)) {
readingParameters.put(SystemMonitorDefinitions.PARAMETER_NAME__PROCESS_ALIAS, alias);
}
for (String readingType : jvmReadingTypes) {
FullReadingBean reading = ReadingsRepository.getInstance().getReadingXmlDefinition(readingType, readingParameters);
readingTypes.add(reading);
}
requestedReadingTypesPerHosts.put(monitoredHost, readingTypes);
monitoredHosts.add(monitoredHost);
}
use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class SystemMonitor method scheduleChildProcessMonitoring.
/**
* It works in the same way as the <b>scheduleProcessMonitoring</b> method works with an extra parameter specifying
* a name of a parent process.
* </br>When one or more processes have a parent process specified, the parent process will combine
* the statistics of all of its children processes.
* </br>This way it is possible to get a picture of the resource usage of a whole tested product
* which is running more than one actual system processes
*
* @param monitoredHost the host where the monitored process lives
* @param parentProcess the virtual parent process
* @param processPattern the pattern to use in order to find the process among all system processes.
* @param processAlias the process alias to use when logging into the database
* @param processReadingTypes what kind of data to collect. Use some of the SystemMonitor.MONITOR_PROCESS_* constants
*/
@PublicAtsApi
public void scheduleChildProcessMonitoring(@Validate(name = "monitoredHost", type = ValidationType.STRING_SERVER_WITH_PORT) String monitoredHost, @Validate(name = "parentProcess", type = ValidationType.STRING_NOT_EMPTY) String parentProcess, @Validate(name = "processPattern", type = ValidationType.STRING_NOT_EMPTY) String processPattern, @Validate(name = "processAlias", type = ValidationType.STRING_NOT_EMPTY) String processAlias, @Validate(name = "processReadingTypes", type = ValidationType.NOT_NULL) String[] processReadingTypes) {
// validate input parameters
monitoredHost = HostUtils.getAtsAgentIpAndPort(monitoredHost);
new Validator().validateMethodParameters(new Object[] { monitoredHost, parentProcess, processPattern, processAlias, processReadingTypes });
scheduleProcessMonitoring(monitoredHost, parentProcess, processPattern, processAlias, null, processReadingTypes);
}
use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.
the class SystemMonitor method scheduleUserActivityMonitoring.
/**
* Schedule monitoring the user activity on an ATS Agent(usually used as a performance test loader).
* </br>No statistics collection will be triggered until the startMonitor method is called.
*
* @param atsAgent the ATS Agent which runs the monitored virtual users
*/
@PublicAtsApi
public void scheduleUserActivityMonitoring(@Validate(name = "atsAgent", type = ValidationType.STRING_SERVER_WITH_PORT) String atsAgent) {
// validate input parameters
atsAgent = HostUtils.getAtsAgentIpAndPort(atsAgent);
new Validator().validateMethodParameters("Could not schedule users activity monitoring on '" + atsAgent + "'", new Object[] { atsAgent });
monitoredAgents.add(atsAgent);
}
Aggregations