use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class ContainsMatcherTest method getSampleRule.
@Override
protected StreamRule getSampleRule() {
final StreamRule rule = super.getSampleRule();
rule.setType(StreamRuleType.CONTAINS);
rule.setValue("foo");
return rule;
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class FieldPresenceMatcherTest method testNulledFieldNonMatch.
@Test
public void testNulledFieldNonMatch() throws Exception {
String fieldName = "sampleField";
StreamRule rule = getSampleRule();
rule.setField(fieldName);
rule.setType(StreamRuleType.PRESENCE);
rule.setInverted(false);
Message message = getSampleMessage();
message.addField(fieldName, null);
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 FieldPresenceMatcherTest method testRandomNumberFieldNonMatch.
@Test
public void testRandomNumberFieldNonMatch() throws Exception {
String fieldName = "sampleField";
Integer randomNumber = 4;
StreamRule rule = getSampleRule();
rule.setField(fieldName);
rule.setType(StreamRuleType.PRESENCE);
rule.setInverted(false);
Message message = getSampleMessage();
message.addField(fieldName, randomNumber);
StreamRuleMatcher matcher = getMatcher(rule);
Boolean result = matcher.match(message, rule);
assertTrue(result);
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class FieldPresenceMatcherTest method testInvertedBasicNonMatch.
@Test
public void testInvertedBasicNonMatch() throws Exception {
StreamRule rule = getSampleRule();
rule.setField("nonexistentField");
rule.setType(StreamRuleType.PRESENCE);
rule.setInverted(true);
Message message = getSampleMessage();
StreamRuleMatcher matcher = getMatcher(rule);
Boolean result = matcher.match(message, rule);
assertTrue(result);
}
use of org.graylog2.plugin.streams.StreamRule in project graylog2-server by Graylog2.
the class FieldPresenceMatcherTest method testInvertedBasicMatch.
@Test
public void testInvertedBasicMatch() throws Exception {
StreamRule rule = getSampleRule();
rule.setField("message");
rule.setType(StreamRuleType.PRESENCE);
rule.setInverted(true);
Message message = getSampleMessage();
StreamRuleMatcher matcher = getMatcher(rule);
Boolean result = matcher.match(message, rule);
assertFalse(result);
}
Aggregations