diff options
author | pwielebs <piotr.wielebski@nokia.com> | 2018-09-14 16:43:00 +0200 |
---|---|---|
committer | pwielebs <piotr.wielebski@nokia.com> | 2018-09-14 16:44:34 +0200 |
commit | cf8e9ac4d54b9deb7a8411fa2a3035fb706769d8 (patch) | |
tree | 71a540151a20ddefbbc4b5caf4be93137f47835f /prh-commons/src | |
parent | 3799b36b4cd0a342eafcf388eed7facbc9a17d50 (diff) |
Bug fix 'sourceName' -> 'correlationId'
In case of PNF_REGISTRATION event components
like SO and Dmaap are expecting to get
'correlationId' parameter rather than
'sourceName'.
This change simply maps 'sourceName' to 'correlationId'
Change-Id: Ic99ffc6cd61a76f1a8c46c50da7c16660b1b7acf
Issue-ID: DCAEGEN2-744
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-commons/src')
5 files changed, 10 insertions, 10 deletions
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java index 83a078df..20820fce 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java @@ -40,6 +40,6 @@ public class CommonFunctions { GsonBuilder gsonBuilder = new GsonBuilder(); ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory); return gsonBuilder.create().toJson(ImmutableConsumerDmaapModel.builder().ipv4(consumerDmaapModel.getIpv4()) - .ipv6(consumerDmaapModel.getIpv6()).sourceName(consumerDmaapModel.getSourceName()).build()); + .ipv6(consumerDmaapModel.getIpv6()).correlationId(consumerDmaapModel.getCorrelationId()).build()); } }
\ No newline at end of file diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java index f34256c5..6d488c85 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java @@ -32,8 +32,8 @@ import org.immutables.value.Value; @Gson.TypeAdapters(fieldNamingStrategy = true) public interface ConsumerDmaapModel { - @SerializedName(value = "sourceName", alternate = "sourceName") - String getSourceName(); + @SerializedName(value = "correlationId", alternate = "correlationId") + String getCorrelationId(); @SerializedName(value = "ipaddress-v4-oam", alternate = "ipaddress-v4-oam") String getIpv4(); diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java index 339ddb6d..8a0699c7 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java @@ -22,7 +22,7 @@ package org.onap.dcaegen2.services.prh.model; public class ConsumerDmaapModelForUnitTest implements ConsumerDmaapModel { - private final String sourceName; + private final String correlationId; private final String ipv4; private final String ipv6; @@ -30,14 +30,14 @@ public class ConsumerDmaapModelForUnitTest implements ConsumerDmaapModel { * Class for testing serialization of ConsumerDmaapModel. */ public ConsumerDmaapModelForUnitTest() { - this.sourceName = "NOKnhfsadhff"; + this.correlationId = "NOKnhfsadhff"; this.ipv4 = "256.22.33.155"; this.ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"; } - public String getSourceName() { - return sourceName; + public String getCorrelationId() { + return correlationId; } public String getIpv4() { diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java index 90b32a09..b1cc01a6 100644 --- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java +++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java @@ -28,7 +28,7 @@ class CommonFunctionsTest { @Test void createJsonBody_shouldReturnJsonInString() { - String expectedResult = "{\"sourceName\":\"NOKnhfsadhff\",\"ipaddress-v4-oam\":\"256.22.33.155\"" + String expectedResult = "{\"correlationId\":\"NOKnhfsadhff\",\"ipaddress-v4-oam\":\"256.22.33.155\"" + ",\"ipaddress-v6-oam\":\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\"}"; assertEquals(expectedResult, CommonFunctions.createJsonBody(new ConsumerDmaapModelForUnitTest())); } diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java index ed8d5293..4c4c345f 100644 --- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java +++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java @@ -34,14 +34,14 @@ class ConsumerDmaapModelTest { String ipv4 = "11.22.33.155"; String ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"; ConsumerDmaapModel consumerDmaapModel = ImmutableConsumerDmaapModel.builder() - .sourceName(sourceName) + .correlationId(sourceName) .ipv4(ipv4) .ipv6(ipv6) .build(); // Then Assertions.assertNotNull(consumerDmaapModel); - Assertions.assertEquals(sourceName, consumerDmaapModel.getSourceName()); + Assertions.assertEquals(sourceName, consumerDmaapModel.getCorrelationId()); Assertions.assertEquals(ipv4, consumerDmaapModel.getIpv4()); Assertions.assertEquals(ipv6, consumerDmaapModel.getIpv6()); } |