Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INGEST: Rename Pipeline Processor Param. #34733

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ teardown:
"processors" : [
{
"pipeline" : {
"pipeline": "inner"
"name": "inner"
}
}
]
Expand Down Expand Up @@ -78,7 +78,7 @@ teardown:
"processors" : [
{
"pipeline" : {
"pipeline": "inner"
"name": "inner"
}
}
]
Expand All @@ -94,7 +94,7 @@ teardown:
"processors" : [
{
"pipeline" : {
"pipeline": "outer"
"name": "outer"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ teardown:
"processors" : [
{
"pipeline" : {
"pipeline": "inner"
"name": "inner"
}
}
]
Expand All @@ -633,7 +633,7 @@ teardown:
"processors" : [
{
"pipeline" : {
"pipeline": "outer"
"name": "outer"
}
}
]
Expand All @@ -650,7 +650,7 @@ teardown:
"processors" : [
{
"pipeline" : {
"pipeline": "outer"
"name": "outer"
}
}
]
Expand Down Expand Up @@ -686,7 +686,7 @@ teardown:
},
{
"pipeline": {
"pipeline": "pipeline2"
"name": "pipeline2"
}
}
]
Expand Down Expand Up @@ -724,7 +724,7 @@ teardown:
},
{
"pipeline": {
"pipeline": "pipeline1"
"name": "pipeline1"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Factory(IngestService ingestService) {
public PipelineProcessor create(Map<String, Processor.Factory> registry, String processorTag,
Map<String, Object> config) throws Exception {
String pipeline =
ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "pipeline");
ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "name");
return new PipelineProcessor(processorTag, pipeline, ingestService);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public String getTag() {
when(ingestService.getPipeline(pipelineId)).thenReturn(pipeline);
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
Map<String, Object> config = new HashMap<>();
config.put("pipeline", pipelineId);
config.put("name", pipelineId);
factory.create(Collections.emptyMap(), null, config).execute(testIngestDocument);
assertEquals(testIngestDocument, invoked.get());
}
Expand All @@ -72,7 +72,7 @@ public void testThrowsOnMissingPipeline() throws Exception {
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
Map<String, Object> config = new HashMap<>();
config.put("pipeline", "missingPipelineId");
config.put("name", "missingPipelineId");
IllegalStateException e = expectThrows(
IllegalStateException.class,
() -> factory.create(Collections.emptyMap(), null, config).execute(testIngestDocument)
Expand All @@ -88,21 +88,21 @@ public void testThrowsOnRecursivePipelineInvocations() throws Exception {
IngestService ingestService = mock(IngestService.class);
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
Map<String, Object> outerConfig = new HashMap<>();
outerConfig.put("pipeline", innerPipelineId);
outerConfig.put("name", innerPipelineId);
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
Pipeline outer = new Pipeline(
outerPipelineId, null, null,
new CompoundProcessor(factory.create(Collections.emptyMap(), null, outerConfig))
);
Map<String, Object> innerConfig = new HashMap<>();
innerConfig.put("pipeline", outerPipelineId);
innerConfig.put("name", outerPipelineId);
Pipeline inner = new Pipeline(
innerPipelineId, null, null,
new CompoundProcessor(factory.create(Collections.emptyMap(), null, innerConfig))
);
when(ingestService.getPipeline(outerPipelineId)).thenReturn(outer);
when(ingestService.getPipeline(innerPipelineId)).thenReturn(inner);
outerConfig.put("pipeline", innerPipelineId);
outerConfig.put("name", innerPipelineId);
ElasticsearchException e = expectThrows(
ElasticsearchException.class,
() -> factory.create(Collections.emptyMap(), null, outerConfig).execute(testIngestDocument)
Expand All @@ -117,7 +117,7 @@ public void testAllowsRepeatedPipelineInvocations() throws Exception {
IngestService ingestService = mock(IngestService.class);
IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
Map<String, Object> outerConfig = new HashMap<>();
outerConfig.put("pipeline", innerPipelineId);
outerConfig.put("name", innerPipelineId);
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);
Pipeline inner = new Pipeline(
innerPipelineId, null, null, new CompoundProcessor()
Expand All @@ -136,11 +136,11 @@ public void testPipelineProcessorWithPipelineChain() throws Exception {
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);

Map<String, Object> pipeline1ProcessorConfig = new HashMap<>();
pipeline1ProcessorConfig.put("pipeline", pipeline2Id);
pipeline1ProcessorConfig.put("name", pipeline2Id);
PipelineProcessor pipeline1Processor = factory.create(Collections.emptyMap(), null, pipeline1ProcessorConfig);

Map<String, Object> pipeline2ProcessorConfig = new HashMap<>();
pipeline2ProcessorConfig.put("pipeline", pipeline3Id);
pipeline2ProcessorConfig.put("name", pipeline3Id);
PipelineProcessor pipeline2Processor = factory.create(Collections.emptyMap(), null, pipeline2ProcessorConfig);

Clock clock = mock(Clock.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void testActualPipelineProcessor() throws Exception {
String pipelineId = "pipeline1";
IngestService ingestService = mock(IngestService.class);
Map<String, Object> pipelineConfig = new HashMap<>();
pipelineConfig.put("pipeline", pipelineId);
pipelineConfig.put("name", pipelineId);
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);

String key1 = randomAlphaOfLength(10);
Expand Down Expand Up @@ -204,7 +204,7 @@ public void testActualPipelineProcessorWithHandledFailure() throws Exception {
String pipelineId = "pipeline1";
IngestService ingestService = mock(IngestService.class);
Map<String, Object> pipelineConfig = new HashMap<>();
pipelineConfig.put("pipeline", pipelineId);
pipelineConfig.put("name", pipelineId);
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);

String key1 = randomAlphaOfLength(10);
Expand Down Expand Up @@ -256,7 +256,7 @@ public void testActualPipelineProcessorWithCycle() throws Exception {
String pipelineId = "pipeline1";
IngestService ingestService = mock(IngestService.class);
Map<String, Object> pipelineConfig = new HashMap<>();
pipelineConfig.put("pipeline", pipelineId);
pipelineConfig.put("name", pipelineId);
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);

PipelineProcessor pipelineProcessor = factory.create(Collections.emptyMap(), null, pipelineConfig);
Expand All @@ -277,7 +277,7 @@ public void testActualPipelineProcessorRepeatedInvocation() throws Exception {
String pipelineId = "pipeline1";
IngestService ingestService = mock(IngestService.class);
Map<String, Object> pipelineConfig = new HashMap<>();
pipelineConfig.put("pipeline", pipelineId);
pipelineConfig.put("name", pipelineId);
PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService);

String key1 = randomAlphaOfLength(10);
Expand Down