use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testIsThresholdExceededLowNotTriggeredAbove.
@Test
public void testIsThresholdExceededLowNotTriggeredAbove() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.LOW);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(99.0);
threshold.setRearm(0.5);
threshold.setTrigger(1);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateHighLow item = new ThresholdEvaluatorStateHighLow(wrapper);
assertFalse("threshold should not be exceeded", item.isThresholdExceeded(100.0));
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testIsThresholdExceededHighTriggeredAbove.
@Test
public void testIsThresholdExceededHighTriggeredAbove() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.HIGH);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(99.0);
threshold.setRearm(0.5);
threshold.setTrigger(1);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateHighLow item = new ThresholdEvaluatorStateHighLow(wrapper);
assertTrue("threshold should be exceeded", item.isThresholdExceeded(100.0));
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testIsThresholdExceededHighTriggeredEqual.
@Test
public void testIsThresholdExceededHighTriggeredEqual() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.HIGH);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(99.0);
threshold.setRearm(0.5);
threshold.setTrigger(1);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateHighLow item = new ThresholdEvaluatorStateHighLow(wrapper);
assertTrue("threshold should be exceeded", item.isThresholdExceeded(99.0));
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testEvaluateTwiceTriggerLowBelow.
@Test
public void testEvaluateTwiceTriggerLowBelow() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.RELATIVE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(0.9);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateRelativeChange evaluator = new ThresholdEvaluatorStateRelativeChange(wrapper);
assertEquals("should not trigger", Status.NO_CHANGE, evaluator.evaluate(10.0));
assertEquals("should trigger", Status.TRIGGERED, evaluator.evaluate(8.0));
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testEvaluateTwiceNoTrigger.
@Test
public void testEvaluateTwiceNoTrigger() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.RELATIVE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(0.9);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateRelativeChange evaluator = new ThresholdEvaluatorStateRelativeChange(wrapper);
assertEquals("should not trigger", Status.NO_CHANGE, evaluator.evaluate(10.0));
assertEquals("should not trigger", Status.NO_CHANGE, evaluator.evaluate(10.0));
}
Aggregations