Examples of AlertCondition


Examples of org.rhq.core.domain.alert.AlertCondition

                entityManager.merge(alertConditionLog); // update values, for
                entityManager.flush();
            } catch (NoResultException nre) { // this is the expected case 90% of the time
                // lookup the condition entity
                AlertCondition condition = entityManager.find(AlertCondition.class, alertConditionId);

                // persist the log entry
                AlertConditionLog conditionLog = new AlertConditionLog(condition, ctime);
                conditionLog.setValue(value);
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

            for (AlertDefinitionComposite history : result) {
                Set<AlertCondition> acs = history.getAlertDefinition().getConditions();
                if (acs.size() > 1) {
                    history.setConditionText("Multiple Conditions");
                } else if (acs.size() == 1) {
                    AlertCondition condition = acs.iterator().next();
                    String displayText = AlertDefUtil.formatAlertConditionForDisplay(condition, request);

                    history.setConditionText(displayText);
                } else {
                    history.setConditionText("No Conditions");
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

                if (acls.size() > 1) {
                    history.setConditionText("Multiple Conditions");
                    history.setConditionValue("--");
                } else if (acls.size() == 1) {
                    AlertConditionLog log = acls.iterator().next();
                    AlertCondition condition = log.getCondition();
                    String displayText = AlertDefUtil.formatAlertConditionForDisplay(condition, request);

                    String firedValue = log.getValue();
                    if (condition.getMeasurementDefinition() != null) {
                        DataType type = condition.getMeasurementDefinition().getDataType();
                        if (type == DataType.CALLTIME || type == DataType.TRAIT)
                            firedValue = log.getValue();
                        else
                            firedValue = MeasurementConverter.format(Double.valueOf(log.getValue()), condition
                                .getMeasurementDefinition().getUnits(), true);
                    }

                    history.setConditionText(displayText);
                    history.setConditionValue(firedValue);
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

    private static final String TEN_PERCENT = String.format("%2.1f%%", 10d);
    private static final String TWELVE_DOT_5_B = String.format("%2.1fB", 12.5d);
    private String pretty;

    public void testPrettyPrintAVAILABILITY() {
        AlertCondition condition = createCondition(AlertConditionCategory.AVAILABILITY,
            AlertConditionOperator.AVAIL_GOES_UP.name(), null, null, null, null);
        pretty = getPrettyAlertConditionString(condition);
        check(AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_UP);
        pretty = getShortPrettyAlertConditionString(condition);
        check(AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_UP_SHORT);
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

        check(AlertI18NResourceKeys.ALERT_AVAILABILITY_GOES_UNKNOWN_SHORT);

    }

    public void testPrettyPrintAVAILABILITY_DURATION() {
        AlertCondition condition = createCondition(AlertConditionCategory.AVAIL_DURATION,
            AlertConditionOperator.AVAIL_DURATION_DOWN.name(), null, null, "120", null);
        pretty = getPrettyAlertConditionString(condition);
        assert "Availability stays DOWN [2m]".equals(pretty) : pretty;
        pretty = getShortPrettyAlertConditionString(condition);
        assert "Avail stays DOWN [2m]".equals(pretty) : pretty;
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

        assert "Avail stays NOT UP [2m]".equals(pretty) : pretty;
    }

    public void testPrettyPrintTHRESHOLD() {
        MeasurementDefinition md = createDynamicMeasurementDefinition();
        AlertCondition condition = createCondition(AlertConditionCategory.THRESHOLD, md.getDisplayName(), ">", 12.5d,
            null, md);
        pretty = getPrettyAlertConditionString(condition);
        String ref = String.format("Foo Prop > %2.1fB", 12.5d);
        assert ref.equals(pretty) : pretty;
        pretty = getShortPrettyAlertConditionString(condition);
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

    public void testPrettyPrintTHRESHOLD_Calltime() {
        MeasurementDefinition md = createCalltimeMeasurementDefinition();
        String regex = "some.*(reg)?ex$"; // this is the "name" of the condition

        AlertCondition condition = createCondition(AlertConditionCategory.THRESHOLD, regex, ">", 12.5d, "MAX", md);
        pretty = getPrettyAlertConditionString(condition);
        check(AlertI18NResourceKeys.ALERT_METRIC_CALLTIME_THRESHOLD_WITH_EXPR, "CT Prop", "MAX", ">", TWELVE_DOT_5_B,
            regex);
        pretty = getShortPrettyAlertConditionString(condition);
        check(AlertI18NResourceKeys.ALERT_METRIC_CALLTIME_THRESHOLD_WITH_EXPR_SHORT, "CT Prop", "MAX", ">",
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

        check(AlertI18NResourceKeys.ALERT_METRIC_CALLTIME_THRESHOLD_SHORT, "CT Prop", "MAX", ">", TWELVE_DOT_5_B);
    }

    public void testPrettyPrintBASELINE() {
        MeasurementDefinition md = createDynamicMeasurementDefinition();
        AlertCondition condition = createCondition(AlertConditionCategory.BASELINE, md.getDisplayName(), ">", 0.10d,
            "mean", md);
        pretty = getPrettyAlertConditionString(condition);
        check(AlertI18NResourceKeys.ALERT_BASELINE_MEAN, "Foo Prop", ">", TEN_PERCENT);
        pretty = getShortPrettyAlertConditionString(condition);
        check(AlertI18NResourceKeys.ALERT_BASELINE_MEAN_SHORT, "Foo Prop", ">", TEN_PERCENT);
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

        check(AlertI18NResourceKeys.ALERT_BASELINE_MAX_SHORT, "Foo Prop", ">", TEN_PERCENT);
    }

    public void testPrettyPrintCHANGE() {
        MeasurementDefinition md = createDynamicMeasurementDefinition();
        AlertCondition condition = createCondition(AlertConditionCategory.CHANGE, md.getDisplayName(), null, null,
            null, md);
        pretty = getPrettyAlertConditionString(condition);
        check(AlertI18NResourceKeys.ALERT_METRIC_CHANGED, "Foo Prop");
        pretty = getShortPrettyAlertConditionString(condition);
        check(AlertI18NResourceKeys.ALERT_METRIC_CHANGED_SHORT, "Foo Prop");
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertCondition

    public void testPrettyPrintCHANGE_Calltime() {
        MeasurementDefinition md = createCalltimeMeasurementDefinition();
        String regex = "some.*(reg)?ex$"; // this is the "name" of the condition

        AlertCondition condition = createCondition(AlertConditionCategory.CHANGE, regex, "LO", 0.10d, "MIN", md);
        pretty = getPrettyAlertConditionString(condition);
        String msg = AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_METRIC_CALLTIME_CHANGE_SHRINKS);
        String ref = "Calltime Metric CT Prop MIN %s by at least %2.1f%% with calltime destination matching \"some.*(reg)?ex$\"";
        String refs = "CT Prop MIN %s by %2.1f%% matching \"some.*(reg)?ex$\"";
        assert String.format(ref, msg, 10.0f).equals(pretty) : pretty;
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.