Package org.graylog2.plugin.streams

Examples of org.graylog2.plugin.streams.StreamRule


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

    @Test
    public void testSuccessfulMatchWithNegativeValue() {
        StreamRule rule = getSampleRule();
        rule.setValue("-54354");

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

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


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

    @Test
    public void testSuccessfulInvertedMatchWithNegativeValue() {
        StreamRule rule = getSampleRule();
        rule.setValue("-54354");
        rule.setInverted(true);

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

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

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

    @Test
    public void testMissedMatch() {
        StreamRule rule = getSampleRule();
        rule.setValue("25");

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

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

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

    @Test
    public void testMissedInvertedMatch() {
        StreamRule rule = getSampleRule();
        rule.setValue("25");
        rule.setInverted(true);

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

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

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

    @Test
    public void testMissedMatchWithEqualValues() {
        StreamRule rule = getSampleRule();
        rule.setValue("-9001");

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

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

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

    @Test
    public void testSuccessfullInvertedMatchWithEqualValues() {
        StreamRule rule = getSampleRule();
        rule.setValue("-9001");
        rule.setInverted(true);

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

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

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

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

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

    @Test
    public void testMissedMatchWithMissingField() {
        StreamRule rule = getSampleRule();
        rule.setValue("42");

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

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

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

    @Test
    public void testMissedInvertedMatchWithMissingField() {
        StreamRule rule = getSampleRule();
        rule.setValue("23");
        rule.setInverted(true);

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

        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.SMALLER);

        return 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.