MeasurementSchedule schedule = resourceWithSchedules.getSchedules().iterator().next();
// simulate a measurement report coming from the agent - two values, but neither fit in our range, so no alerts are fired
MeasurementScheduleRequest request = new MeasurementScheduleRequest(schedule);
MeasurementReport report = new MeasurementReport();
report.addData(new MeasurementDataNumeric(getTimestamp(60), request, 20.0)); // 20 < 60 but !(20 > 40)
report.addData(new MeasurementDataNumeric(getTimestamp(30), request, 70.0)); // !(70 < 60) but 70 > 40
MeasurementDataManagerLocal dataManager = LookupUtil.getMeasurementDataManager();
dataManager.mergeMeasurementReport(report);
// wait for our JMS messages to process and see if we get any alerts
Thread.sleep(5000);
// make sure no alert was triggered
PageList<Alert> alerts = getAlerts(resourceWithSchedules.getId());
assert alerts.size() == 0 : "no alerts should have fired: " + alerts;
// simulate another measurement report coming from the agent - one values that fits in our range, so 1 alert is fired
request = new MeasurementScheduleRequest(schedule);
report = new MeasurementReport();
report.addData(new MeasurementDataNumeric(getTimestamp(15), request, 50.0)); // 50 < 60 AND 50 > 40
dataManager.mergeMeasurementReport(report);
// wait for our JMS messages to process and see if we get any alerts
Thread.sleep(5000);