Package org.graylog2.plugin.streams

Examples of org.graylog2.plugin.streams.StreamRule


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

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

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

        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", "90000");

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

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

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

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

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

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

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

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

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

        return rule;
    }
View Full Code Here

public class RegexMatcherTest extends MatcherTest {

    @Test
    public void testSuccessfulMatch() {
        StreamRule rule = getSampleRule();
        rule.setValue("^foo");

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

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

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

    @Test
    public void testSuccessfulInvertedMatch() {
        StreamRule rule = getSampleRule();
        rule.setValue("^foo");
        rule.setInverted(true);

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

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

            streamService.load(streamid);
        } catch (NotFoundException e) {
            throw new javax.ws.rs.NotFoundException("Stream not found!");
        }

        final StreamRule streamRule = streamRuleService.create(streamid, cr);

        final String id;
        try {
            id = streamService.save(streamRule);
        } catch (ValidationException e) {
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.