use of org.opennms.netmgt.threshd.ThresholdEvaluatorHighLow.ThresholdEvaluatorStateHighLow in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNull.
@Test
public void testConstructorThresholdNull() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold argument cannot be null"));
try {
new ThresholdEvaluatorStateHighLow(null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.netmgt.threshd.ThresholdEvaluatorHighLow.ThresholdEvaluatorStateHighLow in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNoDsType.
@Test
public void testConstructorThresholdNoDsType() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold must have a 'ds-type' value set"));
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.HIGH);
threshold.setDsName("ds-name");
threshold.setValue(1.0);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
try {
new ThresholdEvaluatorStateHighLow(wrapper);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.netmgt.threshd.ThresholdEvaluatorHighLow.ThresholdEvaluatorStateHighLow in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNoRearm.
@Test
public void testConstructorThresholdNoRearm() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold must have a 'rearm' value set"));
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.HIGH);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(1.0);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
try {
new ThresholdEvaluatorStateHighLow(wrapper);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.netmgt.threshd.ThresholdEvaluatorHighLow.ThresholdEvaluatorStateHighLow in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testEvaluateLowTriggerOnce.
@Test
public void testEvaluateLowTriggerOnce() {
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);
ThresholdEvaluatorState item = new ThresholdEvaluatorStateHighLow(wrapper);
Status status = item.evaluate(100.0);
assertEquals("threshold evaluation status", Status.NO_CHANGE, status);
}
Aggregations