-
Notifications
You must be signed in to change notification settings - Fork 2
Monitors
Monitors are processes that are also referred to as threads; these threads are defined per test. The monitor thread process runs during the test execution via a separate thread. The monitor can fail the test if it finds a problem with the monitored object. The monitor thread is a parallel thread to the test itself that enables the user to monitor the device under test (DUT). The service that the framework provides is the ability to control the life cycle of the monitor.
In order to implement a monitor the programmer has to extend the monitor class and implement monitor logic in the run() method.
The example illustrates a monitor class; the run method of the monitor class sends a request to the framework for the station system object. The system object then activates a ping operation from the machine represented by the station system object to the address provided by the ping monitor, after performing ping the monitor analyzes ping results.
package com.aqua.services.demo;
import jsystem.framework.monitor.Monitor;
public class PingMonitor extends Monitor {
String pingTo;
public PingMonitor(String pingTo) {
super("ping monitor");
this.pingTo = pingTo;
}
public void run() {
WindowsStation station;
while (true) {
try {
station = (WindowsStation)system.getSystemObject("station");
station.ping(pingTo);
station.analyze(new FindText(“0% loss”))
Thread.sleep(1000);
} catch (Exception e) {
return;
}
}
}
} Copyright (c) 2021 JSystem Software
- Introduction
- Interface Overview
- Building Blocks
- System Objects
- Framework Services
- Advanced Functionality
- Core System Objects
- Cli (SSH/Telnet/RS323)