Examples of MeasurementDataManagerLocal


Examples of org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal

        //the dampening is set for 3 consecutive matches.
        //we want to test that the agent cache reload doesn't confuse the counting

        //first, send 2 matches
        MeasurementDataManagerLocal measurementDataManager = LookupUtil.getMeasurementDataManager();
        MeasurementScheduleRequest request = new MeasurementScheduleRequest(schedule);
        MeasurementReport report = new MeasurementReport();
        report.addData(new MeasurementDataNumeric(getTimestamp(25), request, 0d));
        measurementDataManager.mergeMeasurementReport(report);

        Thread.sleep(3000);

        request = new MeasurementScheduleRequest(schedule);
        report = new MeasurementReport();
        report.addData(new MeasurementDataNumeric(getTimestamp(20), request, 0d));
        measurementDataManager.mergeMeasurementReport(report);

        Thread.sleep(3000);

        //now reload the caches
        reloadAllAlertConditionCaches();

        //ok, so before BZ 1025491, after the cache reload, a non-match wouldn't cancel the counting.
        //so we need to test that if we send a non-match followed by a match we DON'T get an alert.

        //send a non-match, followed by a match
        request = new MeasurementScheduleRequest(schedule);
        report = new MeasurementReport();
        report.addData(new MeasurementDataNumeric(getTimestamp(15), request, 1d));
        measurementDataManager.mergeMeasurementReport(report);

        Thread.sleep(3000);

        request = new MeasurementScheduleRequest(schedule);
        report = new MeasurementReport();
        report.addData(new MeasurementDataNumeric(getTimestamp(10), request, 0d));
        measurementDataManager.mergeMeasurementReport(report);

        Thread.sleep(3000);

        //now, we should get NO alert
        List<Alert> alerts = getAlerts(resourceWithSchedules.getId());
        assert alerts.size() == 0 : "No alert should have fired: " + alerts;

        //let's send in 2 more matches - we should be getting an alert
        request = new MeasurementScheduleRequest(schedule);
        report = new MeasurementReport();
        report.addData(new MeasurementDataNumeric(getTimestamp(5), request, 0d));
        measurementDataManager.mergeMeasurementReport(report);

        Thread.sleep(3000);

        //throw in a cache reload to check that it doesn't mess up the counting of the positives in sequence
        reloadAllAlertConditionCaches();

        request = new MeasurementScheduleRequest(schedule);
        report = new MeasurementReport();
        report.addData(new MeasurementDataNumeric(getTimestamp(0), request, 0d));
        measurementDataManager.mergeMeasurementReport(report);

        //wait
        Thread.sleep(5000);

        //and check that this time, we GOT an alert
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.