aboutsummaryrefslogtreecommitdiffstats
path: root/datafile-commons
diff options
context:
space:
mode:
authorChengkai Yan <martin.c.yan@est.tech>2018-11-05 17:02:36 +0100
committerChengkai Yan <martin.c.yan@est.tech>2018-11-16 14:49:14 +0100
commit69daf676c2eea017dbde3d7fdafb42dcbe730e75 (patch)
tree1f085216d4e5cd048fe8b3cac9bc3648f44f6514 /datafile-commons
parent598a0a928db52111744837e9d3daae4c3a5dbcdf (diff)
Update meta-data
Add commonEventHeader to X-ATT-DR-META Format code with formatter:off/on Change-Id: I490620af127a03face48bf7b2ad3abf0bb80d4fa Signed-off-by: Chengkai Yan <martin.c.yan@est.tech> Issue-ID: DCAEGEN2-935
Diffstat (limited to 'datafile-commons')
-rw-r--r--datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModel.java21
-rw-r--r--datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java36
-rw-r--r--datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java37
3 files changed, 81 insertions, 13 deletions
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 d9c146f1..62315602 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
@@ -30,12 +30,33 @@ import org.immutables.value.Value;
@Gson.TypeAdapters
public interface ConsumerDmaapModel {
+ @SerializedName("productName")
+ String getProductName();
+
+ @SerializedName("vendorName")
+ String getVendorName();
+
+ @SerializedName("lastEpochMicrosec")
+ String getLastEpochMicrosec();
+
+ @SerializedName("sourceName")
+ String getSourceName();
+
+ @SerializedName("startEpochMicrosec")
+ String getStartEpochMicrosec();
+
+ @SerializedName("timeZoneOffset")
+ String getTimeZoneOffset();
+
@SerializedName("name")
String getName();
@SerializedName("location")
String getLocation();
+ @SerializedName("internalLocation")
+ String getInternalLocation();
+
@SerializedName("compression")
String getCompression();
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 7ec6f50e..572bca85 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,14 +21,36 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class CommonFunctionsTest {
- private ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder().name("A20161224.1030-1045.bin.gz")
- .location("target/A20161224.1030-1045.bin.gz").compression("gzip")
- .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
+ // @formatter:off
+ private ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder()
+ .productName("NrRadio")
+ .vendorName("Ericsson")
+ .lastEpochMicrosec("8745745764578")
+ .sourceName("oteNB5309")
+ .startEpochMicrosec("8745745764578")
+ .timeZoneOffset("UTC+05:00")
+ .name("A20161224.1030-1045.bin.gz")
+ .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1145.bin.gz")
+ .internalLocation("target/A20161224.1030-1045.bin.gz")
+ .compression("gzip")
+ .fileFormatType("org.3GPP.32.435#measCollec")
+ .fileFormatVersion("V10")
+ .build();
+
private static final String EXPECTED_RESULT =
- "{\"name\":\"A20161224.1030-1045.bin.gz\",\"location\":\"target/A20161224.1030-1045.bin.gz\","
- + "\"compression\":\"gzip\",\"fileFormatType\":\"org.3GPP.32.435#measCollec\","
- + "\"fileFormatVersion\":\"V10\"}";
-
+ "{\"productName\":\"NrRadio\","
+ + "\"vendorName\":\"Ericsson\","
+ + "\"lastEpochMicrosec\":\"8745745764578\","
+ + "\"sourceName\":\"oteNB5309\","
+ + "\"startEpochMicrosec\":\"8745745764578\","
+ + "\"timeZoneOffset\":\"UTC+05:00\","
+ + "\"name\":\"A20161224.1030-1045.bin.gz\","
+ + "\"location\":\"ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1145.bin.gz\","
+ + "\"internalLocation\":\"target/A20161224.1030-1045.bin.gz\","
+ + "\"compression\":\"gzip\","
+ + "\"fileFormatType\":\"org.3GPP.32.435#measCollec\","
+ + "\"fileFormatVersion\":\"V10\"}";
+ // @formatter:on
@Test
void createJsonBody_shouldReturnJsonInString() {
assertEquals(EXPECTED_RESULT, CommonFunctions.createJsonBody(model));
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 e80670d3..21a27509 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
@@ -20,23 +20,48 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class ConsumerDmaapModelTest {
-
+ private static final String PRODUCT_NAME = "NrRadio";
+ private static final String VENDOR_NAME = "Ericsson";
+ private static final String LAST_EPOCH_MICROSEC = "8745745764578";
+ private static final String SOURCE_NAME = "oteNB5309";
+ private static final String START_EPOCH_MICROSEC = "8745745764578";
+ private static final String TIME_ZONE_OFFSET = "UTC+05:00";
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 LOCATION = "ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1145.bin.gz";
+ private static final String INTERNAL_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";
private static final String FILE_FORMAT_VERSION = "V10";
@Test
public void consumerDmaapModelBuilder_shouldBuildAnObject() {
-
- ConsumerDmaapModel consumerDmaapModel =
- ImmutableConsumerDmaapModel.builder().name(NAME).location(LOCATION).compression(COMPRESSION)
- .fileFormatType(FILE_FORMAT_TYPE).fileFormatVersion(FILE_FORMAT_VERSION).build();
+ // @formatter:off
+ ConsumerDmaapModel consumerDmaapModel = ImmutableConsumerDmaapModel.builder()
+ .productName(PRODUCT_NAME)
+ .vendorName(VENDOR_NAME)
+ .lastEpochMicrosec(LAST_EPOCH_MICROSEC)
+ .sourceName(SOURCE_NAME)
+ .startEpochMicrosec(START_EPOCH_MICROSEC)
+ .timeZoneOffset(TIME_ZONE_OFFSET)
+ .name(NAME)
+ .location(LOCATION)
+ .internalLocation(INTERNAL_LOCATION)
+ .compression(COMPRESSION)
+ .fileFormatType(FILE_FORMAT_TYPE)
+ .fileFormatVersion(FILE_FORMAT_VERSION)
+ .build();
+ // @formatter:on
Assertions.assertNotNull(consumerDmaapModel);
+ Assertions.assertEquals(PRODUCT_NAME, consumerDmaapModel.getProductName());
+ Assertions.assertEquals(VENDOR_NAME, consumerDmaapModel.getVendorName());
+ Assertions.assertEquals(LAST_EPOCH_MICROSEC, consumerDmaapModel.getLastEpochMicrosec());
+ Assertions.assertEquals(SOURCE_NAME, consumerDmaapModel.getSourceName());
+ Assertions.assertEquals(START_EPOCH_MICROSEC, consumerDmaapModel.getStartEpochMicrosec());
+ Assertions.assertEquals(TIME_ZONE_OFFSET, consumerDmaapModel.getTimeZoneOffset());
Assertions.assertEquals(NAME, consumerDmaapModel.getName());
Assertions.assertEquals(LOCATION, consumerDmaapModel.getLocation());
+ Assertions.assertEquals(INTERNAL_LOCATION, consumerDmaapModel.getInternalLocation());
Assertions.assertEquals(COMPRESSION, consumerDmaapModel.getCompression());
Assertions.assertEquals(FILE_FORMAT_TYPE, consumerDmaapModel.getFileFormatType());
Assertions.assertEquals(FILE_FORMAT_VERSION, consumerDmaapModel.getFileFormatVersion());