Search in sources :

Example 36 with Validator

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);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 37 with Validator

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);
}
Also used : FullReadingBean(com.axway.ats.common.performance.monitor.beans.FullReadingBean) Validator(com.axway.ats.core.validation.Validator) HashSet(java.util.HashSet) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 38 with Validator

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);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) FullReadingBean(com.axway.ats.common.performance.monitor.beans.FullReadingBean) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 39 with Validator

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);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 40 with Validator

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);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

Validator (com.axway.ats.core.validation.Validator)67 PublicAtsApi (com.axway.ats.common.PublicAtsApi)66 IFileSystemOperations (com.axway.ats.core.filesystem.model.IFileSystemOperations)45 LocalFileSystemOperations (com.axway.ats.core.filesystem.LocalFileSystemOperations)6 ISystemOperations (com.axway.ats.core.system.model.ISystemOperations)4 FullReadingBean (com.axway.ats.common.performance.monitor.beans.FullReadingBean)3 MachineDescriptionOperations (com.axway.ats.agent.components.monitoring.operations.clients.MachineDescriptionOperations)1 InternalProcessOperations (com.axway.ats.agent.components.system.operations.clients.InternalProcessOperations)1 AgentException (com.axway.ats.agent.core.exceptions.AgentException)1 FileMatchInfo (com.axway.ats.common.filesystem.FileMatchInfo)1 ProcessExecutorException (com.axway.ats.common.process.ProcessExecutorException)1 DbAccessFactory (com.axway.ats.log.autodb.DbAccessFactory)1 DbWriteAccess (com.axway.ats.log.autodb.DbWriteAccess)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1