From 4f90ea87a898f2ca3adc2c8fb42df97d71a35122 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Tue, 23 Oct 2018 10:33:52 +0200 Subject: [PATCH] INGEST: Rename Pipeline Processor Param. * `name` is more readable/ergnomic than having `pipeline` twice --- .../test/ingest/210_pipeline_processor.yml | 6 +++--- .../rest-api-spec/test/ingest/90_simulate.yml | 10 +++++----- .../elasticsearch/ingest/PipelineProcessor.java | 2 +- .../ingest/PipelineProcessorTests.java | 16 ++++++++-------- .../ingest/TrackingResultProcessorTests.java | 8 ++++---- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/210_pipeline_processor.yml b/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/210_pipeline_processor.yml index c7c5df1e06f99..4efaaeb4091fa 100644 --- a/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/210_pipeline_processor.yml +++ b/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/210_pipeline_processor.yml @@ -44,7 +44,7 @@ teardown: "processors" : [ { "pipeline" : { - "pipeline": "inner" + "name": "inner" } } ] @@ -78,7 +78,7 @@ teardown: "processors" : [ { "pipeline" : { - "pipeline": "inner" + "name": "inner" } } ] @@ -94,7 +94,7 @@ teardown: "processors" : [ { "pipeline" : { - "pipeline": "outer" + "name": "outer" } } ] diff --git a/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/90_simulate.yml b/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/90_simulate.yml index 46c4fb0a69e58..bdcfdc7f6b18b 100644 --- a/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/90_simulate.yml +++ b/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/90_simulate.yml @@ -617,7 +617,7 @@ teardown: "processors" : [ { "pipeline" : { - "pipeline": "inner" + "name": "inner" } } ] @@ -633,7 +633,7 @@ teardown: "processors" : [ { "pipeline" : { - "pipeline": "outer" + "name": "outer" } } ] @@ -650,7 +650,7 @@ teardown: "processors" : [ { "pipeline" : { - "pipeline": "outer" + "name": "outer" } } ] @@ -686,7 +686,7 @@ teardown: }, { "pipeline": { - "pipeline": "pipeline2" + "name": "pipeline2" } } ] @@ -724,7 +724,7 @@ teardown: }, { "pipeline": { - "pipeline": "pipeline1" + "name": "pipeline1" } } ] diff --git a/server/src/main/java/org/elasticsearch/ingest/PipelineProcessor.java b/server/src/main/java/org/elasticsearch/ingest/PipelineProcessor.java index 918ff6b8aefee..624925cc4d773 100644 --- a/server/src/main/java/org/elasticsearch/ingest/PipelineProcessor.java +++ b/server/src/main/java/org/elasticsearch/ingest/PipelineProcessor.java @@ -65,7 +65,7 @@ public Factory(IngestService ingestService) { public PipelineProcessor create(Map registry, String processorTag, Map config) throws Exception { String pipeline = - ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "pipeline"); + ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "name"); return new PipelineProcessor(processorTag, pipeline, ingestService); } } diff --git a/server/src/test/java/org/elasticsearch/ingest/PipelineProcessorTests.java b/server/src/test/java/org/elasticsearch/ingest/PipelineProcessorTests.java index 018ded346d4fc..7c2a219daf06c 100644 --- a/server/src/test/java/org/elasticsearch/ingest/PipelineProcessorTests.java +++ b/server/src/test/java/org/elasticsearch/ingest/PipelineProcessorTests.java @@ -62,7 +62,7 @@ public String getTag() { when(ingestService.getPipeline(pipelineId)).thenReturn(pipeline); PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService); Map config = new HashMap<>(); - config.put("pipeline", pipelineId); + config.put("name", pipelineId); factory.create(Collections.emptyMap(), null, config).execute(testIngestDocument); assertEquals(testIngestDocument, invoked.get()); } @@ -72,7 +72,7 @@ public void testThrowsOnMissingPipeline() throws Exception { IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService); Map config = new HashMap<>(); - config.put("pipeline", "missingPipelineId"); + config.put("name", "missingPipelineId"); IllegalStateException e = expectThrows( IllegalStateException.class, () -> factory.create(Collections.emptyMap(), null, config).execute(testIngestDocument) @@ -88,21 +88,21 @@ public void testThrowsOnRecursivePipelineInvocations() throws Exception { IngestService ingestService = mock(IngestService.class); IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); Map 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 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) @@ -117,7 +117,7 @@ public void testAllowsRepeatedPipelineInvocations() throws Exception { IngestService ingestService = mock(IngestService.class); IngestDocument testIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); Map 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() @@ -136,11 +136,11 @@ public void testPipelineProcessorWithPipelineChain() throws Exception { PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService); Map pipeline1ProcessorConfig = new HashMap<>(); - pipeline1ProcessorConfig.put("pipeline", pipeline2Id); + pipeline1ProcessorConfig.put("name", pipeline2Id); PipelineProcessor pipeline1Processor = factory.create(Collections.emptyMap(), null, pipeline1ProcessorConfig); Map pipeline2ProcessorConfig = new HashMap<>(); - pipeline2ProcessorConfig.put("pipeline", pipeline3Id); + pipeline2ProcessorConfig.put("name", pipeline3Id); PipelineProcessor pipeline2Processor = factory.create(Collections.emptyMap(), null, pipeline2ProcessorConfig); Clock clock = mock(Clock.class); diff --git a/server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java b/server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java index 7a7f9b773727f..fbb46fc8787af 100644 --- a/server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java +++ b/server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java @@ -158,7 +158,7 @@ public void testActualPipelineProcessor() throws Exception { String pipelineId = "pipeline1"; IngestService ingestService = mock(IngestService.class); Map pipelineConfig = new HashMap<>(); - pipelineConfig.put("pipeline", pipelineId); + pipelineConfig.put("name", pipelineId); PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService); String key1 = randomAlphaOfLength(10); @@ -204,7 +204,7 @@ public void testActualPipelineProcessorWithHandledFailure() throws Exception { String pipelineId = "pipeline1"; IngestService ingestService = mock(IngestService.class); Map pipelineConfig = new HashMap<>(); - pipelineConfig.put("pipeline", pipelineId); + pipelineConfig.put("name", pipelineId); PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService); String key1 = randomAlphaOfLength(10); @@ -256,7 +256,7 @@ public void testActualPipelineProcessorWithCycle() throws Exception { String pipelineId = "pipeline1"; IngestService ingestService = mock(IngestService.class); Map 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); @@ -277,7 +277,7 @@ public void testActualPipelineProcessorRepeatedInvocation() throws Exception { String pipelineId = "pipeline1"; IngestService ingestService = mock(IngestService.class); Map pipelineConfig = new HashMap<>(); - pipelineConfig.put("pipeline", pipelineId); + pipelineConfig.put("name", pipelineId); PipelineProcessor.Factory factory = new PipelineProcessor.Factory(ingestService); String key1 = randomAlphaOfLength(10);