From 263d1a481bd5378e59b804425bc8a9bdc9bebb9a Mon Sep 17 00:00:00 2001 From: elinuxhenrik Date: Wed, 26 Sep 2018 16:03:45 +0200 Subject: Fix delivery to DataRouter The messages to the DataRouter was not actually sent. Change-Id: I5748ee0cc19a5049ca4d965caefb5cdf2204419f Issue-ID: DCAEGEN2-841 Signed-off-by: elinuxhenrik --- .../dcaegen2/collectors/datafile/model/ConsumerDmaapModel.java | 7 +++++-- .../datafile/model/ConsumerDmaapModelForUnitTest.java | 7 +++++++ .../collectors/datafile/model/CommonFunctionsTest.java | 6 +++--- .../collectors/datafile/model/ConsumerDmaapModelTest.java | 10 +++++----- 4 files changed, 20 insertions(+), 10 deletions(-) (limited to 'datafile-commons') diff --git a/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModel.java b/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModel.java index 94e7ccd7..d9c146f1 100644 --- a/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModel.java +++ b/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModel.java @@ -16,11 +16,11 @@ package org.onap.dcaegen2.collectors.datafile.model; +import com.google.gson.annotations.SerializedName; + import org.immutables.gson.Gson; import org.immutables.value.Value; -import com.google.gson.annotations.SerializedName; - /** * @author Przemysław Wąsala on 5/8/18 * @author Henrik Andersson @@ -30,6 +30,9 @@ import com.google.gson.annotations.SerializedName; @Gson.TypeAdapters public interface ConsumerDmaapModel { + @SerializedName("name") + String getName(); + @SerializedName("location") String getLocation(); diff --git a/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelForUnitTest.java b/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelForUnitTest.java index 103a70e8..62e6b1bf 100644 --- a/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelForUnitTest.java +++ b/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelForUnitTest.java @@ -17,18 +17,25 @@ package org.onap.dcaegen2.collectors.datafile.model; public class ConsumerDmaapModelForUnitTest implements ConsumerDmaapModel { + private final String name; private final String location; private final String compression; private final String fileFormatType; private final String fileFormatVersion; public ConsumerDmaapModelForUnitTest() { + this.name = "A20161224.1030-1045.bin.gz"; this.location = "target/A20161224.1030-1045.bin.gz"; this.compression = "gzip"; this.fileFormatType = "org.3GPP.32.435#measCollec"; this.fileFormatVersion = "V10"; } + @Override + public String getName() { + return name; + } + @Override public String getLocation() { return location; diff --git a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java index 062724e7..f27e3b6c 100644 --- a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java +++ b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java @@ -21,11 +21,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; class CommonFunctionsTest { - // Given private ConsumerDmaapModel model = new ConsumerDmaapModelForUnitTest(); private static final String EXPECTED_RESULT = - "{\"location\":\"target/A20161224.1030-1045.bin.gz\",\"compression\":\"gzip\"," - + "\"fileFormatType\":\"org.3GPP.32.435#measCollec\",\"fileFormatVersion\":\"V10\"}"; + "{\"name\":\"A20161224.1030-1045.bin.gz\",\"location\":\"target/A20161224.1030-1045.bin.gz\"," + + "\"compression\":\"gzip\",\"fileFormatType\":\"org.3GPP.32.435#measCollec\"," + + "\"fileFormatVersion\":\"V10\"}"; @Test void createJsonBody_shouldReturnJsonInString() { diff --git a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java index 5b028973..e80670d3 100644 --- a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java +++ b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test; public class ConsumerDmaapModelTest { + private static final String NAME = "A20161224.1030-1045.bin.gz"; private static final String LOCATION = "target/A20161224.1030-1045.bin.gz"; private static final String COMPRESSION = "gzip"; private static final String FILE_FORMAT_TYPE = "org.3GPP.32.435#measCollec"; @@ -29,13 +30,12 @@ public class ConsumerDmaapModelTest { @Test public void consumerDmaapModelBuilder_shouldBuildAnObject() { - // When - // Given - ConsumerDmaapModel consumerDmaapModel = ImmutableConsumerDmaapModel.builder().location(LOCATION).compression(COMPRESSION) - .fileFormatType(FILE_FORMAT_TYPE).fileFormatVersion(FILE_FORMAT_VERSION).build(); + ConsumerDmaapModel consumerDmaapModel = + ImmutableConsumerDmaapModel.builder().name(NAME).location(LOCATION).compression(COMPRESSION) + .fileFormatType(FILE_FORMAT_TYPE).fileFormatVersion(FILE_FORMAT_VERSION).build(); - // Then Assertions.assertNotNull(consumerDmaapModel); + Assertions.assertEquals(NAME, consumerDmaapModel.getName()); Assertions.assertEquals(LOCATION, consumerDmaapModel.getLocation()); Assertions.assertEquals(COMPRESSION, consumerDmaapModel.getCompression()); Assertions.assertEquals(FILE_FORMAT_TYPE, consumerDmaapModel.getFileFormatType()); -- cgit 1.2.3-korg