use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class GreaterMatcherTest method testMissedDoubleMatchWithInvalidValue.
@Test
public void testMissedDoubleMatchWithInvalidValue() {
StreamRule rule = getSampleRule();
rule.setValue("LOL I AM NOT EVEN A NUMBER");
Message msg = getSampleMessage();
msg.addField("something", "90000.23");
StreamRuleMatcher matcher = getMatcher(rule);
assertFalse(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class GreaterMatcherTest method testMissedMatch.
@Test
public void testMissedMatch() {
StreamRule rule = getSampleRule();
rule.setValue("25");
Message msg = getSampleMessage();
msg.addField("something", "12");
StreamRuleMatcher matcher = getMatcher(rule);
assertFalse(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class GreaterMatcherTest method testSuccessfulDoubleMatch.
@Test
public void testSuccessfulDoubleMatch() {
StreamRule rule = getSampleRule();
rule.setValue("1.0");
Message msg = getSampleMessage();
msg.addField("something", "1.1");
StreamRuleMatcher matcher = getMatcher(rule);
assertTrue(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class RegexMatcherTest method testInvertedNullFieldShouldMatch.
@Test
public void testInvertedNullFieldShouldMatch() throws Exception {
final String fieldName = "nullfield";
final StreamRule rule = getSampleRule();
rule.setField(fieldName);
rule.setValue("^foo");
rule.setInverted(true);
final Message msg = getSampleMessage();
msg.addField(fieldName, null);
final StreamRuleMatcher matcher = getMatcher(rule);
assertTrue(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class RegexMatcherTest method testSuccessfulMatch.
@Test
public void testSuccessfulMatch() {
StreamRule rule = getSampleRule();
rule.setValue("^foo");
Message msg = getSampleMessage();
msg.addField("something", "foobar");
StreamRuleMatcher matcher = getMatcher(rule);
assertTrue(matcher.match(msg, rule));
}
Aggregations