use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorAbsoluteChangeTest method testConstructor.
@Test
public void testConstructor() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.ABSOLUTE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("interface");
threshold.setValue(0.9);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
new ThresholdEvaluatorStateAbsoluteChange(wrapper);
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorAbsoluteChangeTest method testEvaluateTwiceTriggerLowEqual.
@Test
public void testEvaluateTwiceTriggerLowEqual() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.ABSOLUTE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(-1.0);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateAbsoluteChange evaluator = new ThresholdEvaluatorStateAbsoluteChange(wrapper);
assertEquals("should not trigger", Status.NO_CHANGE, evaluator.evaluate(10.0));
assertEquals("should trigger", Status.TRIGGERED, evaluator.evaluate(9.0));
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorAbsoluteChangeTest method testGetEventForStateDefaultUEIS.
@Test
public void testGetEventForStateDefaultUEIS() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.ABSOLUTE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(99.0);
threshold.setRearm(95.0);
threshold.setTrigger(1);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateAbsoluteChange item = new ThresholdEvaluatorStateAbsoluteChange(wrapper);
Event event = item.getEventForState(Status.TRIGGERED, new Date(), 100.0, null);
assertEquals("UEI should be the absoluteChangeThresholdTriggered", EventConstants.ABSOLUTE_CHANGE_THRESHOLD_EVENT_UEI, event.getUei());
}
use of org.opennms.netmgt.config.threshd.Threshold in project opennms by OpenNMS.
the class ThresholdEvaluatorAbsoluteChangeTest method testEvaluateTwiceTriggerHighEqual.
@Test
public void testEvaluateTwiceTriggerHighEqual() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.ABSOLUTE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(1.0);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateAbsoluteChange evaluator = new ThresholdEvaluatorStateAbsoluteChange(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 ThresholdEvaluatorAbsoluteChangeTest method testEvaluateOnce.
@Test
public void testEvaluateOnce() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.ABSOLUTE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(0.9);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThresholdEvaluatorStateAbsoluteChange evaluator = new ThresholdEvaluatorStateAbsoluteChange(wrapper);
assertEquals("should not trigger", Status.NO_CHANGE, evaluator.evaluate(10.0));
}
Aggregations