Search in sources :

Example 6 with InputService

use of org.graylog2.inputs.InputService in project graylog2-server by Graylog2.

the class StaticFieldFilterTest method testFilterIsNotOverwritingExistingKeys.

@Test
@SuppressForbidden("Executors#newSingleThreadExecutor() is okay for tests")
public void testFilterIsNotOverwritingExistingKeys() throws Exception {
    Message msg = new Message("hello", "junit", Tools.nowUTC());
    msg.addField("foo", "IWILLSURVIVE");
    final StaticFieldFilter filter = new StaticFieldFilter(inputService, new EventBus(), Executors.newSingleThreadScheduledExecutor());
    filter.filter(msg);
    assertEquals("hello", msg.getMessage());
    assertEquals("junit", msg.getSource());
    assertEquals("IWILLSURVIVE", msg.getField("foo"));
}
Also used : Message(org.graylog2.plugin.Message) EventBus(com.google.common.eventbus.EventBus) Test(org.junit.Test) SuppressForbidden(org.graylog2.shared.SuppressForbidden)

Aggregations

SuppressForbidden (org.graylog2.shared.SuppressForbidden)4 EventBus (com.google.common.eventbus.EventBus)3 Message (org.graylog2.plugin.Message)3 Before (org.junit.Before)3 ClusterEventBus (org.graylog2.events.ClusterEventBus)2 Test (org.junit.Test)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 ObjectId (org.bson.types.ObjectId)1 MongoJackObjectMapperProvider (org.graylog2.bindings.providers.MongoJackObjectMapperProvider)1 GrokPatternRegistry (org.graylog2.grok.GrokPatternRegistry)1 GrokPatternService (org.graylog2.grok.GrokPatternService)1 InMemoryGrokPatternService (org.graylog2.grok.InMemoryGrokPatternService)1 Input (org.graylog2.inputs.Input)1 InputServiceImpl (org.graylog2.inputs.InputServiceImpl)1 ConverterFactory (org.graylog2.inputs.converters.ConverterFactory)1 ExtractorFactory (org.graylog2.inputs.extractors.ExtractorFactory)1 FakeHttpMessageInput (org.graylog2.inputs.random.FakeHttpMessageInput)1