Search in sources :

Example 11 with PipelineConnections

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);
}
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

PipelineConnections (org.graylog.plugins.pipelineprocessor.rest.PipelineConnections)11 NotFoundException (org.graylog2.database.NotFoundException)6 Pipeline (org.graylog.plugins.pipelineprocessor.ast.Pipeline)3 PipelineDao (org.graylog.plugins.pipelineprocessor.db.PipelineDao)3 PipelineStreamConnectionsService (org.graylog.plugins.pipelineprocessor.db.PipelineStreamConnectionsService)3 PipelineRuleParser (org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser)3 EntityDescriptorIds (org.graylog2.contentpacks.EntityDescriptorIds)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 Graph (com.google.common.graph.Graph)2 GraphBuilder (com.google.common.graph.GraphBuilder)2 ImmutableGraph (com.google.common.graph.ImmutableGraph)2 MutableGraph (com.google.common.graph.MutableGraph)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Objects.requireNonNull (java.util.Objects.requireNonNull)2