Package org.rhq.core.domain.measurement

Examples of org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest


            }

            Set<ResourceMeasurementScheduleRequest> resScheds = measurementScheduleManager
                .findSchedulesForResourceAndItsDescendants(new int[] { resource1.getId() }, false);
            Assert.assertEquals(1, resScheds.size());
            ResourceMeasurementScheduleRequest rmsr = resScheds.iterator().next();
            Set<MeasurementScheduleRequest> scheds = rmsr.getMeasurementSchedules();
            Assert.assertEquals(1, scheds.size());
            MeasurementScheduleRequest msr = scheds.iterator().next();
            Assert.assertEquals(updatedInterval, msr.getInterval());
            Assert.assertEquals(true, msr.isEnabled());

            // Test disable of metrics at the template level, this should have no effect on the interval in the client
            // or in the db
            testCommService.init();

            testCommService.setExpectedInterval(updatedInterval);
            testCommService.setExpectedIsEnabled(false);

            measurementScheduleManager.disableSchedulesForResourceType(overlord, new int[] { definitionCt1.getId() },
                true);
            Assert.assertTrue(testCommService.isTested());

            resScheds = measurementScheduleManager.findSchedulesForResourceAndItsDescendants(
                new int[] { resource1.getId() }, false);
            Assert.assertEquals(1, resScheds.size());
            rmsr = resScheds.iterator().next();
            scheds = rmsr.getMeasurementSchedules();
            Assert.assertEquals(1, scheds.size());
            msr = scheds.iterator().next();
            Assert.assertEquals(updatedInterval, msr.getInterval());
            Assert.assertEquals(false, msr.isEnabled());

            // Test enable of metrics at the template level, this should have no effect on the interval in the client
            // or in the db
            testCommService.init();

            testCommService.setExpectedInterval(updatedInterval);
            testCommService.setExpectedIsEnabled(false);

            measurementScheduleManager.enableSchedulesForResourceType(overlord, new int[] { definitionCt1.getId() },
                true);
            Assert.assertTrue(testCommService.isTested());

            resScheds = measurementScheduleManager.findSchedulesForResourceAndItsDescendants(
                new int[] { resource1.getId() }, false);
            Assert.assertEquals(1, resScheds.size());
            rmsr = resScheds.iterator().next();
            scheds = rmsr.getMeasurementSchedules();
            Assert.assertEquals(1, scheds.size());
            msr = scheds.iterator().next();
            Assert.assertEquals(updatedInterval, msr.getInterval());
            Assert.assertEquals(true, msr.isEnabled());
View Full Code Here


                    int resourceId = (Integer) row[i++];
                    String name = (String) row[i++];
                    DataType dataType = (DataType) row[i++];
                    NumericType numericType = (NumericType) row[i++];

                    ResourceMeasurementScheduleRequest req = reqMap.get(resourceId);
                    if (null == req) {
                        req = new ResourceMeasurementScheduleRequest(resourceId);
                        reqMap.put(resourceId, req);
                    }
                    MeasurementScheduleRequest msr = new MeasurementScheduleRequest(schedId, name,
                        ((collectionInterval > 0) ? collectionInterval : existingInterval), enable, dataType,
                        numericType);
                    req.addMeasurementScheduleRequest(msr);
                }

                Map<Agent, Set<ResourceMeasurementScheduleRequest>> agentUpdates = null;
                agentUpdates = new HashMap<Agent, Set<ResourceMeasurementScheduleRequest>>();
View Full Code Here

        for (int nextAgentId : agentIds) {
            scheduleRequestQuery.setParameter("agentId", nextAgentId);
            List<Object[]> scheduleRequests = scheduleRequestQuery.getResultList();
            for (Object[] nextScheduleDataSet : scheduleRequests) {
                int resourceId = (Integer) nextScheduleDataSet[0];
                ResourceMeasurementScheduleRequest resourceRequest = agentRequests.get(resourceId);
                if (resourceRequest == null) {
                    resourceRequest = new ResourceMeasurementScheduleRequest(resourceId);
                    agentRequests.put(resourceId, resourceRequest);
                }

                MeasurementScheduleRequest requestData = new MeasurementScheduleRequest( //
                    (Integer) nextScheduleDataSet[1], // scheduleId
                    (String) nextScheduleDataSet[2], // definitionName,
                    (Long) nextScheduleDataSet[3], // interval,
                    (Boolean) nextScheduleDataSet[4], // enabled,
                    (DataType) nextScheduleDataSet[5], // dataType,
                    (NumericType) nextScheduleDataSet[6]); // rawNumericType
                resourceRequest.addMeasurementScheduleRequest(requestData);
            }

            boolean markResources = false;
            try {
                Agent nextAgent = agentManager.getAgentByID(nextAgentId);
View Full Code Here

                    NumericType rawNumericType = NumericType.values()[results.getInt(7)];
                    if (results.wasNull()) {
                        rawNumericType = null;
                    }

                    ResourceMeasurementScheduleRequest scheduleRequest = scheduleRequestMap.get(resourceId);
                    if (scheduleRequest == null) {
                        scheduleRequest = new ResourceMeasurementScheduleRequest(resourceId);
                        scheduleRequestMap.put(resourceId, scheduleRequest);
                        allSchedules.add(scheduleRequest);
                    }

                    MeasurementScheduleRequest requestData = new MeasurementScheduleRequest(scheduleId, definitionName,
                        interval, enabled, dataType, rawNumericType);
                    scheduleRequest.addMeasurementScheduleRequest(requestData);
                }
            } finally {
                results.close();
            }
        } finally {
View Full Code Here

                Boolean getChildSchedules = (Boolean) args[1];

                Set<Resource> resources = getResources(resourceIds, getChildSchedules);
                Set<ResourceMeasurementScheduleRequest> allSchedules = new HashSet<ResourceMeasurementScheduleRequest>();
                for (Resource resource : resources) {
                    ResourceMeasurementScheduleRequest resourceSchedules = getDefaultMeasurementSchedules(resource);
                    if (resourceSchedules != null) {
                        allSchedules.add(resourceSchedules);
                    }
                }
                return allSchedules;
View Full Code Here

                Set<Integer> resourceIds = (Set<Integer>) args[0];

                Set<Resource> resources = getResources(resourceIds, false);
                Set<ResourceMeasurementScheduleRequest> allSchedules = new HashSet<ResourceMeasurementScheduleRequest>();
                for (Resource resource : resources) {
                    ResourceMeasurementScheduleRequest resourceSchedules = getDefaultMeasurementSchedules(resource);
                    if (resourceSchedules != null) {
                        allSchedules.add(resourceSchedules);
                    }
                }
                return allSchedules;
View Full Code Here

        Set<MeasurementDefinition> metrics = rt.getMetricDefinitions();
        if (metrics == null || metrics.isEmpty()) {
            return null;
        }

        ResourceMeasurementScheduleRequest resourceSchedules = new ResourceMeasurementScheduleRequest(resource.getId());
        for (MeasurementDefinition metric : metrics) {
            int id = this.metricScheduleCounter.getAndIncrement();
            String name = metric.getName();
            long interval = metric.getDefaultInterval();
            boolean enabled = metric.isDefaultOn() || metric.getDisplayType() == DisplayType.SUMMARY;
            DataType dataType = metric.getDataType();
            NumericType nDataType = metric.getNumericType();
            MeasurementScheduleRequest schedule = new MeasurementScheduleRequest(id, name, interval, enabled, dataType,
                nDataType);
            resourceSchedules.addMeasurementScheduleRequest(schedule);
        }
        return resourceSchedules;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest

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.