use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class SmallerMatcherTest method testSuccessfulInvertedMatchWithNegativeValue.
@Test
public void testSuccessfulInvertedMatchWithNegativeValue() {
StreamRule rule = getSampleRule();
rule.setValue("-54354");
rule.setInverted(true);
Message msg = getSampleMessage();
msg.addField("something", "-9000");
StreamRuleMatcher matcher = getMatcher(rule);
assertTrue(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class SmallerMatcherTest method testSuccessfulDoubleMatchWithNegativeValue.
@Test
public void testSuccessfulDoubleMatchWithNegativeValue() {
StreamRule rule = getSampleRule();
rule.setValue("-54354.42");
Message msg = getSampleMessage();
msg.addField("something", "-90000.12");
StreamRuleMatcher matcher = getMatcher(rule);
assertTrue(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class SmallerMatcherTest method testSuccessfulInvertedMatch.
@Test
public void testSuccessfulInvertedMatch() {
StreamRule rule = getSampleRule();
rule.setValue("100");
rule.setInverted(true);
Message msg = getSampleMessage();
msg.addField("something", "200");
StreamRuleMatcher matcher = getMatcher(rule);
assertTrue(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class SmallerMatcherTest method testMissedMatchWithInvalidValue.
@Test
public void testMissedMatchWithInvalidValue() {
StreamRule rule = getSampleRule();
rule.setValue("LOL I AM NOT EVEN A NUMBER");
Message msg = getSampleMessage();
msg.addField("something", "-9001");
StreamRuleMatcher matcher = getMatcher(rule);
assertFalse(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class SmallerMatcherTest method getSampleRule.
@Override
protected StreamRule getSampleRule() {
StreamRule rule = super.getSampleRule();
rule.setType(StreamRuleType.SMALLER);
return rule;
}
Aggregations