Package org.rhq.core.domain.discovery.AvailabilityReport

Examples of org.rhq.core.domain.discovery.AvailabilityReport.Datum


        long now = System.currentTimeMillis();
        for (Agent agent : map.keySet()) {
            AvailabilityReport report = new AvailabilityReport(true, null);
            report.setServerSideReport(true);
            for (int resourceId : map.get(agent)) {
                report.addAvailability(new Datum(resourceId, avail, now));
            }
            AvailabilityReportSerializer.getSingleton().lock(agent.getName());
            try {
                this.availabilityManager.mergeAvailabilityReport(report);
            } finally {
View Full Code Here


        createAlertDefinitionWithAvailChangeCondition(resource.getId(), AlertConditionOperator.AVAIL_GOES_NOT_UP);

        // resource has initial UNKNOWN ResourceAvailability and no Availability records. simulate an avail report
        // coming from the agent and setting the initial avail to UP.
        AvailabilityReport availReport = new AvailabilityReport(AGENT_NAME);
        availReport.addAvailability(new Datum(resource.getId(), AvailabilityType.UP, System.currentTimeMillis()));
        AvailabilityManagerLocal availManager = LookupUtil.getAvailabilityManager();
        availManager.mergeAvailabilityReport(availReport);

        // wait for our JMS messages to process and see if we get any alerts
        Thread.sleep(3000);

        PageList<Alert> alerts = getAlerts(resource.getId());
        assert alerts.size() == 0 : "No alert should have fired on the initial avail reporting: " + alerts;

        // Now simulate the down avail
        availReport = new AvailabilityReport(AGENT_NAME);
        availReport
            .addAvailability(new Datum(resource.getId(), AvailabilityType.DOWN, System.currentTimeMillis() + 10));
        availManager.mergeAvailabilityReport(availReport);

        // wait for our JMS messages to process and see if we get any alerts
        final PageList<Alert> finalAlerts = alerts;
        timedAssertion(new AssertUtils.BooleanCondition() {
View Full Code Here

            AlertConditionOperator.AVAIL_DURATION_DOWN, 10);

        // resource has initial UNKNOWN ResourceAvailability and no Availability records. simulate an avail report
        // coming from the agent and setting the initial avail to UP.
        AvailabilityReport availReport = new AvailabilityReport(AGENT_NAME);
        availReport.addAvailability(new Datum(resource.getId(), AvailabilityType.UP, System.currentTimeMillis()));
        AvailabilityManagerLocal availManager = LookupUtil.getAvailabilityManager();
        availManager.mergeAvailabilityReport(availReport);

        // wait for our JMS messages to process and see if we get any alerts
        Thread.sleep(4000);

        PageList<Alert> alerts = getAlerts(resource.getId());
        assert alerts.size() == 0 : "No alert should have fired on the initial avail reporting: " + alerts;

        // Now simulate the down avail
        availReport = new AvailabilityReport(AGENT_NAME);
        availReport
            .addAvailability(new Datum(resource.getId(), AvailabilityType.DOWN, System.currentTimeMillis() + 10));
        availManager.mergeAvailabilityReport(availReport);

        // wait for our JMS messages to process and see if we get any alerts
        Thread.sleep(4000);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.discovery.AvailabilityReport.Datum

Copyright © 2018 www.massapicom. 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.