use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class FieldPresenceMatcherTest method testBasicNonMatch.
@Test
public void testBasicNonMatch() throws Exception {
StreamRule rule = getSampleRule();
rule.setField("nonexistentField");
rule.setType(StreamRuleType.PRESENCE);
rule.setInverted(false);
Message message = getSampleMessage();
StreamRuleMatcher matcher = getMatcher(rule);
Boolean result = matcher.match(message, rule);
assertFalse(result);
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class InputMatcherTest method testUnsuccessfulMatchWhenMissing.
@Test
public void testUnsuccessfulMatchWhenMissing() {
StreamRule rule = getSampleRule();
rule.setValue("input-id-dead");
Message msg = getSampleMessage();
StreamRuleMatcher matcher = getMatcher(rule);
assertFalse(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class InputMatcherTest method testUnsuccessfulMatchWhenMissingInverted.
@Test
public void testUnsuccessfulMatchWhenMissingInverted() {
StreamRule rule = getSampleRule();
rule.setValue("input-id-dead");
rule.setInverted(true);
Message msg = getSampleMessage();
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 testMissedMatch.
@Test
public void testMissedMatch() {
StreamRule rule = getSampleRule();
rule.setValue("^foo");
Message msg = getSampleMessage();
msg.addField("something", "zomg");
StreamRuleMatcher matcher = getMatcher(rule);
assertFalse(matcher.match(msg, rule));
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class RegexMatcherTest method testMissingFieldShouldNotMatch.
@Test
public void testMissingFieldShouldNotMatch() throws Exception {
final StreamRule rule = getSampleRule();
rule.setField("nonexistingfield");
rule.setValue("^foo");
final Message msg = getSampleMessage();
final StreamRuleMatcher matcher = getMatcher(rule);
assertFalse(matcher.match(msg, rule));
}
Aggregations