Package org.graylog2.plugin

Examples of org.graylog2.plugin.Message.addField()


    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);
        assertFalse(matcher.match(msg, rule));
    }
View Full Code Here


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

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

        StreamRuleMatcher matcher = getMatcher(rule);
        assertFalse(matcher.match(msg, rule));
    }
View Full Code Here

        StreamRule rule = getSampleRule();
        rule.setValue("42");
        rule.setInverted(true);

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

        StreamRuleMatcher matcher = getMatcher(rule);
        assertFalse(matcher.match(msg, rule));
    }
View Full Code Here

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

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

        StreamRuleMatcher matcher = getMatcher(rule);
        assertTrue(matcher.match(msg, rule));
    }
View Full Code Here

        StreamRule rule = getSampleRule();
        rule.setValue("^foo");
        rule.setInverted(true);

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

        StreamRuleMatcher matcher = getMatcher(rule);
        assertTrue(matcher.match(msg, rule));
    }
View Full Code Here

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

        StreamRule rule = getSampleRule();
        rule.setValue("^foo");
        rule.setInverted(true);

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

        StreamRuleMatcher matcher = getMatcher(rule);
        assertFalse(matcher.match(msg, rule));
    }
View Full Code Here

        StreamRule rule = getSampleRule();
        rule.setField("some_field");
        rule.setValue("foo=^foo|bar\\d.+wat");

        Message msg = getSampleMessage();
        msg.addField("some_field", "bar1foowat");

        StreamRuleMatcher matcher = getMatcher(rule);
        assertTrue(matcher.match(msg, rule));
    }
View Full Code Here

        int tookMs = rateDeviation(msBase, deviation, rand);

        msg = new Message(shortMessage("GET", state.resource, code, tookMs), state.source, Tools.iso8601());

        msg.addField("http_method", "GET");
        msg.addField("http_response_code", code);

        final Resource resource = RESOURCE_MAP.get(state.resource);
        msg.addField("resource", resource.getResource());
        msg.addField("controller", resource.getController());
View Full Code Here

        int tookMs = rateDeviation(msBase, deviation, rand);

        msg = new Message(shortMessage("GET", state.resource, code, tookMs), state.source, Tools.iso8601());

        msg.addField("http_method", "GET");
        msg.addField("http_response_code", code);

        final Resource resource = RESOURCE_MAP.get(state.resource);
        msg.addField("resource", resource.getResource());
        msg.addField("controller", resource.getController());
        msg.addField("action", resource.getAction());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.