use of org.graylog.plugins.pipelineprocessor.rest.PipelineConnections 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);
}
Aggregations