Package org.rhq.enterprise.server.measurement

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


            assertEquals("Unexpected number of platform resources found.", 1, platforms.size());

            int platformResourceId = platforms.get(0).getId();

            //now find the schedule for the measurement
            MeasurementScheduleManagerLocal measurementScheduleManager = LookupUtil.getMeasurementScheduleManager();
            List<MeasurementSchedule> schedules = measurementScheduleManager.findSchedulesByResourceIdAndDefinitionIds(
                freshUser(), platformResourceId, new int[] { mdef.getId() });

            assertEquals("Unexpected number of '" + METRIC_NAME + "' schedules found.", 1, schedules.size());

            assertEquals("The schedule should have been updated along with the definition during the config sync",
View Full Code Here


            assertEquals("Unexpected number of platform resources found.", 1, platforms.size());

            int platformResourceId = platforms.get(0).getId();

            //now find the schedule for the measurement
            MeasurementScheduleManagerLocal measurementScheduleManager = LookupUtil.getMeasurementScheduleManager();
            List<MeasurementSchedule> schedules = measurementScheduleManager.findSchedulesByResourceIdAndDefinitionIds(
                freshUser(), platformResourceId, new int[] { distroNameDef.getId() });

            assertEquals("Unexpected number of '" + METRIC_NAME + "' schedules found.", 1, schedules.size());

            assertEquals("The schedule should have been updated along with the definition during the config sync",
View Full Code Here

        //setup the expected behavior
        context.checking(new Expectations() {
            {
                prereqs.addExpectations(this);

                MeasurementScheduleManagerLocal msm = prereqs.getMeasurementScheduleManager();

                //this is what we expect the measurement schedule manager msm to be
                //called with when the importer finishes its work.
                one(msm).updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(with(any(Subject.class)),
                    with(new int[] { 1 }), with(1000L), with(true), with(false));
View Full Code Here

        prereqs.setMeasurementDefinitions(Arrays.asList(defToEnable, defToDisable));

        context.checking(new Expectations() {
            {
                prereqs.addExpectations(this);
                MeasurementScheduleManagerLocal msm = prereqs.getMeasurementScheduleManager();

                //this is what we expect the measurement schedule manager msm to be
                //called with when the importer finishes its work.
                one(msm).updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(with(any(Subject.class)),
                    with(new int[] { 1 }), with(1000L), with(true), with(false));
View Full Code Here

        context.checking(new Expectations() {
            {
                prereqs.addExpectations(this);

                MeasurementScheduleManagerLocal msm = prereqs.getMeasurementScheduleManager();

                one(msm).updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(with(any(Subject.class)),
                    with(new int[] { 1 }), with(1000L), with(true), with(true));
            }
        });
View Full Code Here

        context.checking(new Expectations() {
            {
                prereqs.addExpectations(this);

                MeasurementScheduleManagerLocal msm = prereqs.getMeasurementScheduleManager();

                one(msm).updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(with(any(Subject.class)),
                    with(new int[] { 1 }), with(1000L), with(true), with(true));
                one(msm).updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(with(any(Subject.class)),
                    with(new int[] { 2 }), with(2000L), with(true), with(false));
View Full Code Here

       
        context.checking(new Expectations() {
            {
                prereqs.addExpectations(this);

                MeasurementScheduleManagerLocal msm = prereqs.getMeasurementScheduleManager();

                one(msm).updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(with(any(Subject.class)),
                    with(new int[] { 1 }), with(1000L), with(true), with(false));
                one(msm).updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(with(any(Subject.class)),
                    with(new int[] { 2 }), with(2000L), with(false), with(false));
View Full Code Here

            log.debug("Ids were: " + resourceIds);
        }

        Subject overlord = LookupUtil.getSubjectManager().getOverlord();
        AlertTemplateManagerLocal alertTemplateManager = LookupUtil.getAlertTemplateManager();
        MeasurementScheduleManagerLocal scheduleManager = LookupUtil.getMeasurementScheduleManager();
        AgentManagerLocal agentManager = LookupUtil.getAgentManager();
        StatusManagerLocal statusManager = LookupUtil.getStatusManager();

        long start = System.currentTimeMillis();

        // do this in one fell swoop, instead of one resource at a time
        Set<ResourceMeasurementScheduleRequest> results = scheduleManager.findSchedulesForResourceAndItsDescendants(
            ArrayUtils.unwrapCollection(resourceIds), false);

        long time = (System.currentTimeMillis() - start);

        if (time >= 10000L) {
View Full Code Here

    private static final Log LOG = LogFactory.getLog(MetricTemplateExporterTest.class);

    public void testCanExport() throws Exception {
        final MeasurementDefinitionManagerLocal measurementDefinitionManager = context.mock(MeasurementDefinitionManagerLocal.class);
        final MeasurementScheduleManagerLocal measurementScheduleManager = context.mock(MeasurementScheduleManagerLocal.class);
        context.checking(new Expectations() {
            {
                allowing(measurementDefinitionManager).findMeasurementDefinitionsByCriteria(with(any(Subject.class)), with(any(MeasurementDefinitionCriteria.class)));
                will(returnValue(getFakeMeasurementDefinitions()));
            }
View Full Code Here

        int parent = WebUtility.getOptionalIntRequestParameter(request, "parent", -1);
        int type = WebUtility.getOptionalIntRequestParameter(request, "type", -1);
        int myGroupId = WebUtility.getOptionalIntRequestParameter(request, "groupId", -1);

        MeasurementScheduleManagerLocal scheduleManager = LookupUtil.getMeasurementScheduleManager();
        MeasurementChartsManagerLocal chartsManager = LookupUtil.getMeasurementChartsManager();

        if (log.isTraceEnabled()) {
            log.trace("finding metric summaries for resource [" + Arrays.toString(resourceIds) + "] for range " + begin
                + ":" + end + " filters value: " + filters + " and keyword: " + keyword);
        }

        List<MetricDisplaySummary> metricSummaries = null;

        //  GH: Why are we only getting the first one? --> single resource case
        if (myGroupId > 0) {
            ResourceGroupManagerLocal resGrpMgr = LookupUtil.getResourceGroupManager();
            int[] definitionIds = resGrpMgr.findDefinitionsForCompatibleGroup(subject, myGroupId, false);
            metricSummaries = chartsManager.getMetricDisplaySummariesForCompatibleGroup(subject,
                EntityContext.forGroup(myGroupId),
                definitionIds, begin, end, false);
        } else if ((parent > 0) && (type > 0)) {
            ResourceGroupManagerLocal resGrpMgr = LookupUtil.getResourceGroupManager();
            int[] definitionIds = resGrpMgr.findDefinitionsForAutoGroup(subject, parent, type, false);
            metricSummaries = chartsManager.getMetricDisplaySummariesForAutoGroup(subject, parent, type, definitionIds,
                begin, end, false);
        } else if ((resourceIds != null) && (resourceIds.length > 0)) {
            int resourceId = resourceIds[0];

            List<MeasurementSchedule> scheds = scheduleManager.findSchedulesForResourceAndType(subject,
                resourceId, null, null, false); //null -> don't filter, we want everything, false -> not only enabled

            int metricOrTraitCount = 0;
            for (MeasurementSchedule sched : scheds) {
                if ((sched.getDefinition().getDataType() == DataType.MEASUREMENT)
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal

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.