Search in sources :

Example 1 with MessageQueueAcknowledger

use of org.graylog2.shared.messageq.MessageQueueAcknowledger in project graylog2-server by Graylog2.

the class PipelineInterpreterTest method createPipelineInterpreter.

@SuppressForbidden("Allow using default thread factory")
private PipelineInterpreter createPipelineInterpreter(RuleService ruleService, PipelineService pipelineService, Map<String, Function<?>> functions) {
    final RuleMetricsConfigService ruleMetricsConfigService = mock(RuleMetricsConfigService.class);
    when(ruleMetricsConfigService.get()).thenReturn(RuleMetricsConfigDto.createDefault());
    final PipelineStreamConnectionsService pipelineStreamConnectionsService = mock(MongoDbPipelineStreamConnectionsService.class);
    final Set<String> pipelineIds = pipelineService.loadAll().stream().map(PipelineDao::id).collect(Collectors.toSet());
    final PipelineConnections pipelineConnections = PipelineConnections.create("p1", DEFAULT_STREAM_ID, pipelineIds);
    when(pipelineStreamConnectionsService.loadAll()).thenReturn(Collections.singleton(pipelineConnections));
    final FunctionRegistry functionRegistry = new FunctionRegistry(functions);
    final PipelineRuleParser parser = new PipelineRuleParser(functionRegistry);
    final ConfigurationStateUpdater stateUpdater = new ConfigurationStateUpdater(ruleService, pipelineService, pipelineStreamConnectionsService, parser, ruleMetricsConfigService, new MetricRegistry(), Executors.newScheduledThreadPool(1), mock(EventBus.class), (currentPipelines, streamPipelineConnections, ruleMetricsConfig) -> new PipelineInterpreter.State(currentPipelines, streamPipelineConnections, ruleMetricsConfig, new MetricRegistry(), 1, true));
    return new PipelineInterpreter(messageQueueAcknowledger, new MetricRegistry(), stateUpdater);
}
Also used : PipelineStreamConnectionsService(org.graylog.plugins.pipelineprocessor.db.PipelineStreamConnectionsService) MongoDbPipelineStreamConnectionsService(org.graylog.plugins.pipelineprocessor.db.mongodb.MongoDbPipelineStreamConnectionsService) InMemoryPipelineStreamConnectionsService(org.graylog.plugins.pipelineprocessor.db.memory.InMemoryPipelineStreamConnectionsService) PipelineConnections(org.graylog.plugins.pipelineprocessor.rest.PipelineConnections) FunctionRegistry(org.graylog.plugins.pipelineprocessor.parser.FunctionRegistry) MetricRegistry(com.codahale.metrics.MetricRegistry) PipelineRuleParser(org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser) ClusterEventBus(org.graylog2.events.ClusterEventBus) EventBus(com.google.common.eventbus.EventBus) RuleMetricsConfigService(org.graylog.plugins.pipelineprocessor.db.RuleMetricsConfigService) SuppressForbidden(org.graylog2.shared.SuppressForbidden)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)1 EventBus (com.google.common.eventbus.EventBus)1 PipelineStreamConnectionsService (org.graylog.plugins.pipelineprocessor.db.PipelineStreamConnectionsService)1 RuleMetricsConfigService (org.graylog.plugins.pipelineprocessor.db.RuleMetricsConfigService)1 InMemoryPipelineStreamConnectionsService (org.graylog.plugins.pipelineprocessor.db.memory.InMemoryPipelineStreamConnectionsService)1 MongoDbPipelineStreamConnectionsService (org.graylog.plugins.pipelineprocessor.db.mongodb.MongoDbPipelineStreamConnectionsService)1 FunctionRegistry (org.graylog.plugins.pipelineprocessor.parser.FunctionRegistry)1 PipelineRuleParser (org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser)1 PipelineConnections (org.graylog.plugins.pipelineprocessor.rest.PipelineConnections)1 ClusterEventBus (org.graylog2.events.ClusterEventBus)1 SuppressForbidden (org.graylog2.shared.SuppressForbidden)1