Package org.graylog2.plugin.streams

Examples of org.graylog2.plugin.streams.StreamRule


public class ExactMatcherTest extends MatcherTest {

    @Test
    public void testSuccessfulMatch() {
        StreamRule rule = getSampleRule();

        Message msg = getSampleMessage();
        msg.addField("something", "foo");

        StreamRuleMatcher matcher = getMatcher(rule);
View Full Code Here


        assertTrue(matcher.match(msg, rule));
    }

    @Test
    public void testMissedMatch() {
        StreamRule rule = getSampleRule();

        Message msg = getSampleMessage();
        msg.addField("something", "nonono");

        StreamRuleMatcher matcher = getMatcher(rule);
View Full Code Here

        assertFalse(matcher.match(msg, rule));
    }

    @Test
    public void testInvertedMatch() {
        StreamRule rule = getSampleRule();
        rule.setInverted(true);

        Message msg = getSampleMessage();
        msg.addField("something", "nonono");

        StreamRuleMatcher matcher = getMatcher(rule);
View Full Code Here

        assertTrue(matcher.match(msg, rule));
    }

    @Test
    public void testNonExistantField() {
        StreamRule rule = getSampleRule();

        Message msg = getSampleMessage();
        msg.addField("someother", "foo");

        StreamRuleMatcher matcher = getMatcher(rule);
View Full Code Here

        assertFalse(matcher.match(msg, rule));
    }

    @Test
    public void testNonExistantFieldInverted() {
        StreamRule rule = getSampleRule();
        rule.setInverted(true);

        Message msg = getSampleMessage();
        msg.addField("someother", "foo");

        StreamRuleMatcher matcher = getMatcher(rule);
View Full Code Here

        StreamRuleMatcher matcher = getMatcher(rule);
        assertFalse(matcher.match(msg, rule));
    }

    protected StreamRule getSampleRule() {
        StreamRule rule = super.getSampleRule();
        rule.setType(StreamRuleType.EXACT);
        rule.setValue("foo");

        return rule;
    }
View Full Code Here

* @author Dennis Oelkers <dennis@torch.sh>
*/
public class FieldPresenceMatcherTest extends MatcherTest {
    @Test
    public void testBasicMatch() throws Exception {
        StreamRule rule = getSampleRule();
        rule.setField("message");
        rule.setType(StreamRuleType.PRESENCE);
        rule.setInverted(false);

        Message message = getSampleMessage();

        StreamRuleMatcher matcher = getMatcher(rule);

View Full Code Here

        assertTrue(result);
    }

    @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);
View Full Code Here

        assertFalse(result);
    }

    @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);
View Full Code Here

        assertFalse(result);
    }

    @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);
View Full Code Here

TOP

Related Classes of org.graylog2.plugin.streams.StreamRule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.