use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testNegativeValueNoChange.
@Test
public void testNegativeValueNoChange() {
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(1);
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));
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testEvaluateTwiceTriggerHighEqual.
@Test
public void testEvaluateTwiceTriggerHighEqual() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.RELATIVE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(1.1);
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(11.0));
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testGetEventForStateNoChange.
@Test
public void testGetEventForStateNoChange() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.RELATIVE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(1.1);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateRelativeChange evaluator = new ThresholdEvaluatorStateRelativeChange(wrapper);
assertNull("should not have created an event", evaluator.getEventForState(Status.NO_CHANGE, new Date(), 10.0, null));
}
Aggregations