From eebd36ed5160e8aa48e60b9d30cf7f73d8fcb1d6 Mon Sep 17 00:00:00 2001 From: Shivani Shukla Date: Fri, 12 Nov 2021 12:47:09 -0600 Subject: [PATCH] Update PipelineModel to fix serialization Signed-off-by: Shivani Shukla --- .../model/configuration/PipelineModel.java | 24 +++++++++---------- .../configuration/PipelineModelTest.java | 24 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/data-prepper-api/src/main/java/com/amazon/dataprepper/model/configuration/PipelineModel.java b/data-prepper-api/src/main/java/com/amazon/dataprepper/model/configuration/PipelineModel.java index 2a4203bd3c..d887a22801 100644 --- a/data-prepper-api/src/main/java/com/amazon/dataprepper/model/configuration/PipelineModel.java +++ b/data-prepper-api/src/main/java/com/amazon/dataprepper/model/configuration/PipelineModel.java @@ -12,9 +12,9 @@ */ public class PipelineModel { - private final PluginModel sourcePluginModel; - private final List prepperPluginModel; - private final List sinkPluginModel; + private final PluginModel source; + private final List preppers; + private final List sinks; private final Integer workers; private final Integer readBatchDelay; @@ -25,23 +25,23 @@ public PipelineModel( @JsonProperty("sink") final List sinks, @JsonProperty("workers") final Integer workers, @JsonProperty("delay") final Integer delay) { - this.sourcePluginModel = source; - this.prepperPluginModel = preppers; - this.sinkPluginModel = sinks; + this.source = source; + this.preppers = preppers; + this.sinks = sinks; this.workers = workers; this.readBatchDelay = delay; } - public PluginModel getSourcePluginModel() { - return sourcePluginModel; + public PluginModel getSource() { + return source; } - public List getPrepperPluginModel() { - return prepperPluginModel; + public List getPreppers() { + return preppers; } - public List getSinkPluginModel() { - return sinkPluginModel; + public List getSinks() { + return sinks; } public Integer getWorkers() { diff --git a/data-prepper-api/src/test/java/com/amazon/dataprepper/model/configuration/PipelineModelTest.java b/data-prepper-api/src/test/java/com/amazon/dataprepper/model/configuration/PipelineModelTest.java index 0f858238ef..27ce89dd42 100644 --- a/data-prepper-api/src/test/java/com/amazon/dataprepper/model/configuration/PipelineModelTest.java +++ b/data-prepper-api/src/test/java/com/amazon/dataprepper/model/configuration/PipelineModelTest.java @@ -31,19 +31,19 @@ public void testPipelineModelCreation() { TEST_WORKERS, TEST_READ_BATCH_DELAY ); - final PluginModel originalSourcePluginModel = pipelineModel.getSourcePluginModel(); - final List originalPreppersPluginModel = pipelineModel.getPrepperPluginModel(); - final List originalSinksPluginModel = pipelineModel.getSinkPluginModel(); + final PluginModel originalSource = pipelineModel.getSource(); + final List originalPreppers = pipelineModel.getPreppers(); + final List originalSinks = pipelineModel.getSinks(); - assertThat(originalSourcePluginModel, notNullValue()); - assertThat(originalPreppersPluginModel, notNullValue()); - assertThat(originalSinksPluginModel, notNullValue()); - assertThat(originalSourcePluginModel.getPluginName(), is(equalTo(TEST_VALID_SOURCE_PLUGIN_MODEL.getPluginName()))); - assertThat(originalSourcePluginModel.getPluginSettings(), is(equalTo(TEST_VALID_SOURCE_PLUGIN_MODEL.getPluginSettings()))); - assertThat(originalPreppersPluginModel.get(0).getPluginName(), is(equalTo(TEST_VALID_PREPPERS_PLUGIN_MODEL.getPluginName()))); - assertThat(originalPreppersPluginModel.get(0).getPluginSettings(), is(equalTo(TEST_VALID_PREPPERS_PLUGIN_MODEL.getPluginSettings()))); - assertThat(originalSinksPluginModel.get(0).getPluginName(), is(equalTo(TEST_VALID_SINKS_PLUGIN_MODEL.getPluginName()))); - assertThat(originalSinksPluginModel.get(0).getPluginSettings(), is(equalTo(TEST_VALID_SINKS_PLUGIN_MODEL.getPluginSettings()))); + assertThat(originalSource, notNullValue()); + assertThat(originalPreppers, notNullValue()); + assertThat(originalSinks, notNullValue()); + assertThat(originalSource.getPluginName(), is(equalTo(TEST_VALID_SOURCE_PLUGIN_MODEL.getPluginName()))); + assertThat(originalSource.getPluginSettings(), is(equalTo(TEST_VALID_SOURCE_PLUGIN_MODEL.getPluginSettings()))); + assertThat(originalPreppers.get(0).getPluginName(), is(equalTo(TEST_VALID_PREPPERS_PLUGIN_MODEL.getPluginName()))); + assertThat(originalPreppers.get(0).getPluginSettings(), is(equalTo(TEST_VALID_PREPPERS_PLUGIN_MODEL.getPluginSettings()))); + assertThat(originalSinks.get(0).getPluginName(), is(equalTo(TEST_VALID_SINKS_PLUGIN_MODEL.getPluginName()))); + assertThat(originalSinks.get(0).getPluginSettings(), is(equalTo(TEST_VALID_SINKS_PLUGIN_MODEL.getPluginSettings()))); assertThat(pipelineModel.getWorkers(), is(TEST_WORKERS)); assertThat(pipelineModel.getReadBatchDelay(), is(TEST_READ_BATCH_DELAY)); }