use of org.graylog2.lookup.db.DBLookupTableService in project graylog2-server by Graylog2.
the class LookupTableFacadeTest method setUp.
@Before
@SuppressForbidden("Using Executors.newSingleThreadExecutor() is okay in tests")
public void setUp() throws Exception {
final ClusterEventBus clusterEventBus = new ClusterEventBus("cluster-event-bus", Executors.newSingleThreadExecutor());
lookupTableService = new DBLookupTableService(mongodb.mongoConnection(), new MongoJackObjectMapperProvider(objectMapper), clusterEventBus);
facade = new LookupTableFacade(objectMapper, lookupTableService);
}
use of org.graylog2.lookup.db.DBLookupTableService in project graylog2-server by Graylog2.
the class InputFacadeTest method setUp.
@Before
@SuppressForbidden("Using Executors.newSingleThreadExecutor() is okay in tests")
public void setUp() throws Exception {
final MetricRegistry metricRegistry = new MetricRegistry();
final ClusterEventBus clusterEventBus = new ClusterEventBus("cluster-event-bus", Executors.newSingleThreadExecutor());
final GrokPatternService grokPatternService = new InMemoryGrokPatternService(clusterEventBus);
grokPatternService.save(GrokPattern.create("GREEDY", ".*"));
final EventBus clusterBus = new EventBus();
final GrokPatternRegistry grokPatternRegistry = new GrokPatternRegistry(clusterBus, grokPatternService, Executors.newScheduledThreadPool(1));
final ExtractorFactory extractorFactory = new ExtractorFactory(metricRegistry, grokPatternRegistry, lookupTableService);
final ConverterFactory converterFactory = new ConverterFactory(lookupTableService);
inputService = new InputServiceImpl(mongodb.mongoConnection(), extractorFactory, converterFactory, messageInputFactory, clusterEventBus);
final InputRegistry inputRegistry = new InputRegistry();
Set<PluginMetaData> pluginMetaData = new HashSet<>();
Map<String, MessageInput.Factory<? extends MessageInput>> inputFactories = new HashMap<>();
final FakeHttpMessageInput.Factory fakeHttpMessageInputFactory = mock(FakeHttpMessageInput.Factory.class);
final FakeHttpMessageInput.Descriptor fakeHttpMessageInputDescriptor = mock(FakeHttpMessageInput.Descriptor.class);
when(fakeHttpMessageInputFactory.getDescriptor()).thenReturn(fakeHttpMessageInputDescriptor);
final RawUDPInput.Factory rawUDPInputFactory = mock(RawUDPInput.Factory.class);
final RawUDPInput.Descriptor rawUDPInputDescriptor = mock(RawUDPInput.Descriptor.class);
when(rawUDPInputFactory.getDescriptor()).thenReturn(rawUDPInputDescriptor);
inputFactories.put("org.graylog2.inputs.random.FakeHttpMessageInput", fakeHttpMessageInputFactory);
inputFactories.put("org.graylog2.inputs.raw.udp.RawUDPInput", rawUDPInputFactory);
facade = new InputFacade(objectMapper, inputService, inputRegistry, dbLookupTableService, grokPatternService, messageInputFactory, extractorFactory, converterFactory, serverStatus, pluginMetaData, inputFactories);
}
Aggregations