diff options
author | Chengkai Yan <martin.c.yan@est.tech> | 2018-11-05 17:02:36 +0100 |
---|---|---|
committer | Chengkai Yan <martin.c.yan@est.tech> | 2018-11-16 14:49:14 +0100 |
commit | 69daf676c2eea017dbde3d7fdafb42dcbe730e75 (patch) | |
tree | 1f085216d4e5cd048fe8b3cac9bc3648f44f6514 /datafile-dmaap-client | |
parent | 598a0a928db52111744837e9d3daae4c3a5dbcdf (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-dmaap-client')
2 files changed, 21 insertions, 8 deletions
diff --git a/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java b/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java index b4c52693..380eac88 100644 --- a/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java +++ b/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java @@ -55,7 +55,7 @@ public class DmaapProducerReactiveHttpClient { private static final String X_ATT_DR_META = "X-ATT-DR-META"; private static final String NAME_JSON_TAG = "name"; - private static final String LOCATION_JSON_TAG = "location"; + private static final String INTERNAL_LOCATION_JSON_TAG = "internalLocation"; private static final String URI_SEPARATOR = "/"; private static final String DEFAULT_FEED_ID = "1"; @@ -104,7 +104,7 @@ public class DmaapProducerReactiveHttpClient { addUserCredentialsToHead(headers); IFileSystemResource fileSystemResource = getFileSystemResource(); - fileSystemResource.setPath(consumerDmaapModel.getLocation()); + fileSystemResource.setPath(consumerDmaapModel.getInternalLocation()); InputStream fileInputStream = fileSystemResource.getInputStream(); HttpEntity<byte[]> request = addFileToRequest(fileInputStream, headers); @@ -132,7 +132,7 @@ public class DmaapProducerReactiveHttpClient { private void addMetaDataToHead(ConsumerDmaapModel consumerDmaapModel, HttpHeaders headers) { JsonElement metaData = new JsonParser().parse(CommonFunctions.createJsonBody(consumerDmaapModel)); metaData.getAsJsonObject().remove(NAME_JSON_TAG).getAsString(); - metaData.getAsJsonObject().remove(LOCATION_JSON_TAG); + metaData.getAsJsonObject().remove(INTERNAL_LOCATION_JSON_TAG); headers.set(X_ATT_DR_META, metaData.toString()); } private HttpEntity<byte[]> addFileToRequest(InputStream inputStream, HttpHeaders headers) diff --git a/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java b/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java index 87c99f88..d8296e1c 100644 --- a/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java +++ b/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java @@ -58,7 +58,7 @@ import reactor.test.StepVerifier; class DmaapProducerReactiveHttpClientTest { private static final String FILE_NAME = "A20161224.1030-1045.bin.gz"; - private static final String LOCATION_JSON_TAG = "location"; + private static final String INTERNAL_LOCATION_JSON_TAG = "internalLocation"; private static final String NAME_JSON_TAG = "name"; private static final String X_ATT_DR_META = "X-ATT-DR-META"; @@ -92,9 +92,22 @@ class DmaapProducerReactiveHttpClientTest { when(dmaapPublisherConfigurationMock.dmaapContentType()).thenReturn(APPLICATION_OCTET_STREAM_CONTENT_TYPE); when(dmaapPublisherConfigurationMock.dmaapTopicName()).thenReturn(PUBLISH_TOPIC); - consumerDmaapModel = ImmutableConsumerDmaapModel.builder().name(FILE_NAME) - .location("target/A20161224.1030-1045.bin.gz").compression("gzip") - .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build(); + // @formatter:off + consumerDmaapModel = 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(); + //formatter:on dmaapProducerReactiveHttpClient = new DmaapProducerReactiveHttpClient(dmaapPublisherConfigurationMock); dmaapProducerReactiveHttpClient.setFileSystemResource(fileSystemResourceMock); @@ -117,7 +130,7 @@ class DmaapProducerReactiveHttpClientTest { JsonElement metaData = new JsonParser().parse(CommonFunctions.createJsonBody(consumerDmaapModel)); metaData.getAsJsonObject().remove(NAME_JSON_TAG).getAsString(); - metaData.getAsJsonObject().remove(LOCATION_JSON_TAG); + metaData.getAsJsonObject().remove(INTERNAL_LOCATION_JSON_TAG); headers.set(X_ATT_DR_META, metaData.toString()); String plainCreds = "dradmin" + ":" + "dradmin"; |