use of org.opennms.netmgt.threshd.ThresholdEvaluatorRelativeChange.ThresholdEvaluatorStateRelativeChange in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testConstructor.
@Test
public void testConstructor() {
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);
new ThresholdEvaluatorStateRelativeChange(wrapper);
}
use of org.opennms.netmgt.threshd.ThresholdEvaluatorRelativeChange.ThresholdEvaluatorStateRelativeChange in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testConstructorThresholdNull.
@Test
public void testConstructorThresholdNull() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold argument cannot be null"));
try {
new ThresholdEvaluatorStateRelativeChange(null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.netmgt.threshd.ThresholdEvaluatorRelativeChange.ThresholdEvaluatorStateRelativeChange in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testNegativeNumberNotTriggers.
@Test
public void testNegativeNumberNotTriggers() {
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 not trigger", Status.NO_CHANGE, evaluator.evaluate(-10.5));
}
use of org.opennms.netmgt.threshd.ThresholdEvaluatorRelativeChange.ThresholdEvaluatorStateRelativeChange in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testEvaluateTwiceNoTriggerLowAbove.
@Test
public void testEvaluateTwiceNoTriggerLowAbove() {
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(9.5));
}
use of org.opennms.netmgt.threshd.ThresholdEvaluatorRelativeChange.ThresholdEvaluatorStateRelativeChange in project opennms by OpenNMS.
the class ThresholdEvaluatorRelativeChangeTest method testEvaluateTwiceNoTriggerHighFirstZero.
@Test
public void testEvaluateTwiceNoTriggerHighFirstZero() {
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 on first evaluate", Status.NO_CHANGE, evaluator.evaluate(0.0));
assertEquals("should not trigger on second evaluate", Status.NO_CHANGE, evaluator.evaluate(1000.0));
}
Aggregations