Package org.rhq.core.domain.measurement

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


    }

    @Test(enabled = ENABLED)
    public void testBZ735262_InsideRangeCondition() throws Exception {
        // create our resource with alert definition
        MeasurementDefinition metricDef = createResourceWithMetricSchedule();
        createAlertDefinitionWithOneInsideRangeCondition(metricDef, resource.getId()); // this test would fail if we used createAlertDefinitionWithTwoConditionsALL

        // re-load the resource so we get the measurement schedule
        Resource resourceWithSchedules = loadResourceWithSchedules(resource.getId());
        MeasurementSchedule schedule = resourceWithSchedules.getSchedules().iterator().next();
View Full Code Here


    }

    @Test(enabled = ENABLED)
    public void testBZ735262_OutsideRangeCondition() throws Exception {
        // create our resource with alert definition
        MeasurementDefinition metricDef = createResourceWithMetricSchedule();
        createAlertDefinitionWithOneOutsideRangeCondition(metricDef, resource.getId()); // this test would fail if we used createAlertDefinitionWithTwoConditionsALL

        // re-load the resource so we get the measurement schedule
        Resource resourceWithSchedules = loadResourceWithSchedules(resource.getId());
        MeasurementSchedule schedule = resourceWithSchedules.getSchedules().iterator().next();
View Full Code Here

    }

    @Test(enabled = ENABLED)
    public void testBZ736685_DeleteConditionLogButNoAlert() throws Exception {
        // create our resource with alert definition
        MeasurementDefinition metricDef = createResourceWithMetricSchedule();
        AlertDefinition alertDef = createAlertDefinitionWithTwoConditionsALL(metricDef, resource.getId());

        // re-load the resource so we get the measurement schedule
        Resource resourceWithSchedules = loadResourceWithSchedules(resource.getId());
        MeasurementSchedule schedule = resourceWithSchedules.getSchedules().iterator().next();
View Full Code Here

    }

    @Test(enabled = ENABLED)
    public void testAvailChangeAlert() throws Exception {
        // create our resource with alert definition
        @SuppressWarnings("unused")
        MeasurementDefinition metricDef = createResourceWithMetricSchedule();
        createAlertDefinitionWithAvailChangeCondition(resource.getId(), AlertConditionOperator.AVAIL_GOES_DOWN);
        createAlertDefinitionWithAvailChangeCondition(resource.getId(), AlertConditionOperator.AVAIL_GOES_NOT_UP);

        // resource has initial UNKNOWN ResourceAvailability and no Availability records. simulate an avail report
View Full Code Here

    @Test(enabled = ENABLED)
    public void testAvailDurationAlert() throws Exception {

        // create our resource with two alert definitions (we use 2 to test BZ888927)
        @SuppressWarnings("unused")
        MeasurementDefinition metricDef = createResourceWithMetricSchedule();
        // use a 10s duration, this is not allowed in general, the gui forces 1 minute minimum
        createAlertDefinitionWithAvailDurationCondition(resource.getId(), "testAvailDurationAlertDef_1",
            AlertConditionOperator.AVAIL_DURATION_DOWN, 10);
        createAlertDefinitionWithAvailDurationCondition(resource.getId(), "testAvailDurationAlertDef_2",
View Full Code Here

    }

    @Test(enabled = ENABLED)
    public void testBZ830463_updateDef() throws Exception {
        // create our resource with alert definition
        MeasurementDefinition metricDef = createResourceWithMetricSchedule();
        AlertDefinition alertDef = createAlertDefinitionWithOneInsideRangeCondition(metricDef, resource.getId());

        assert alertDef.getConditions().size() == 1 : "1 alertDef condition should exist";
        AlertCondition condition = alertDef.getConditions().iterator().next();
        int conditionId = condition.getId();
View Full Code Here

    }

    @Test(enabled = ENABLED)
    public void testBZ1058534_changeCondition() throws Exception {
        // create our resource with alert definition
        MeasurementDefinition metricDef = createResourceWithMetricSchedule("type-with-trait.xml", "TypeWithTrait");

        AlertDefinition alertDef = createAlertDefinitionWithChangeFromNull(metricDef, resource.getId());

        assert alertDef.getConditions().size() == 1 : "1 alertDef condition should exist";
        AlertCondition condition = alertDef.getConditions().iterator().next();
View Full Code Here

        Assert.assertEquals(conditionLog.getCondition().getId(), conditionId,
            "original condition should have been associated with the alert");
    }

    public void testDampeningWorksAcrossConditionCacheReloads() throws Exception {
        MeasurementDefinition measDef = createResourceWithMetricSchedule();

        createAlertDefinitionWithDampening(measDef, resource.getId());

        Resource resourceWithSchedules = loadResourceWithSchedules(resource.getId());
        MeasurementSchedule schedule = resourceWithSchedules.getSchedules().iterator().next();
View Full Code Here

        ResourceType resourceType = getResourceType(typeName);
        assert resourceType != null : "failed to deploy resource type";
        assert resourceType.getMetricDefinitions() != null : "failed to create metric defs";
        assert resourceType.getMetricDefinitions().size() == 1 : "do not have the expected number of metric defs";

        final MeasurementDefinition metricDef = resourceType.getMetricDefinitions().iterator().next();

        resource = persistNewResource(resourceType.getName()); // will have UNKNOWN avail
        assert resource != null && resource.getId() > 0 : "failed to create test resource";

        executeInTransaction(false, new TransactionCallback() {
View Full Code Here

            layout.setWidth100();

            //iterate over the retrieved charting data
            for (int index = 0; index < displayOrder.length; index++) {
                //retrieve the correct measurement definition
                final MeasurementDefinition md = measurementDefMap.get(displayOrder[index]);

                //load the data results for the given metric definition
                List<MeasurementDataNumericHighLowComposite> data = results.get(index);

                //locate last and minimum values.
                double lastValue = -1;
                double minValue = Double.MAX_VALUE;
                //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
                String commaDelimitedList = "";
                for (MeasurementDataNumericHighLowComposite d : data) {
                    if ((!Double.isNaN(d.getValue())) && (!String.valueOf(d.getValue()).contains("NaN"))) {
                        commaDelimitedList += d.getValue() + ",";
                        if (d.getValue() < minValue) {
                            minValue = d.getValue();
                        }
                        lastValue = d.getValue();
                    }
                }
                DynamicForm row = new DynamicForm();
                row.setNumCols(3);
                row.setColWidths(65, "*", 100);
                row.setWidth100();
                row.setAutoHeight();
                row.setOverflow(Overflow.VISIBLE);
                HTMLFlow graph = new HTMLFlow();
                String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0' " + "values='"
                        + commaDelimitedList.substring(0,commaDelimitedList.lastIndexOf(",")) + "'>...</span>";
                graph.setContents(contents);
                graph.setContentsType(ContentsType.PAGE);
                //disable scrollbars on span
                graph.setScrollbarSize(0);

                CanvasItem graphContainer = new CanvasItem();
                graphContainer.setShowTitle(false);
                graphContainer.setHeight(16);
                graphContainer.setWidth(60);
                graphContainer.setCanvas(graph);

                final String title = md.getDisplayName();
                LinkItem link = new LinkItem();
                link.setLinkTitle(title);
                link.setShowTitle(false);
                link.setClipValue(false);
                link.setWrap(true);
                if (!BrowserUtility.isBrowserPreIE9()) {

                    link.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            showPopupWithChart(title, md);
                        }
                    });
                } else {
                    link.disable();
                }

                //Value
                String convertedValue = AbstractActivityView.convertLastValueForDisplay(lastValue, md);
                StaticTextItem value = AbstractActivityView.newTextItem(convertedValue);
                value.setVAlign(VerticalAlignment.TOP);
                value.setAlign(Alignment.RIGHT);
                value.setWidth("100%");

                row.setItems(graphContainer, link, value);

                //if graph content returned
                if ((!md.getName().trim().contains("Trait.")) && (lastValue != -1)) {
                    layout.addMember(row);
                    someChartedData = true;
                }
            }
            if (!someChartedData) {// when there are results but no chartable entries.
View Full Code Here

TOP

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

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.