summaryrefslogtreecommitdiffstats
path: root/prh-commons/src/test/java/org
diff options
context:
space:
mode:
authorJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-03-08 09:48:09 +0100
committerJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-03-12 10:59:06 +0100
commitc69d68d5669e45c969fd1293aa76c78d55a95dca (patch)
treefee7e38468fce8a49db12cf4fb2f2b1e0cefd9c5 /prh-commons/src/test/java/org
parentdf2c17cd5619d6ca069f73342a9aaafbdf0bba59 (diff)
Add AdditionalFields in PNF_Ready event
Enhance the PNF_Ready event with AdditionalFields contents and remove IP information Change-Id: Iacef7e11dd104868440984a0540b2ccd31c8b036 Issue-ID: DCAEGEN2-1312 Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'prh-commons/src/test/java/org')
-rw-r--r--prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java49
1 files changed, 25 insertions, 24 deletions
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 5e259a64..6b2ddf56 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
@@ -22,6 +22,8 @@ package org.onap.dcaegen2.services.prh.model;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
import org.junit.jupiter.api.Test;
class CommonFunctionsTest {
@@ -29,59 +31,58 @@ class CommonFunctionsTest {
@Test
void createJsonBody_shouldReturnJsonInString() {
+ JsonObject jsonObject = new JsonParser().parse("{\n"
+ + " \"attachmentPoint\": \"bla-bla-30-3\",\n"
+ + " \"cvlan\": \"678\",\n"
+ + " \"svlan\": \"1005\"\n"
+ + " }").getAsJsonObject();
+
ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder()
.correlationId("NOKnhfsadhff")
- .ipv4("256.22.33.155")
- .ipv6("200J:0db8:85a3:0000:0000:8a2e:0370:7334")
.serialNumber("1234")
.equipVendor("NOKIA")
.equipModel("3310")
.equipType("cell")
.nfRole("role")
.swVersion("1.2.3")
+ .additionalFields(jsonObject)
.build();
-
String expectedResult = "{"
+ "\"correlationId\":\"NOKnhfsadhff\","
- + "\"ipaddress-v4-oam\":\"256.22.33.155\","
- + "\"ipaddress-v6-oam\":\"200J:0db8:85a3:0000:0000:8a2e:0370:7334\","
+ "\"serial-number\":\"1234\","
+ "\"equip-vendor\":\"NOKIA\","
+ "\"equip-model\":\"3310\","
+ "\"equip-type\":\"cell\","
+ "\"nf-role\":\"role\","
- + "\"sw-version\":\"1.2.3\""
+ + "\"sw-version\":\"1.2.3\","
+ + "\"additionalFields\":{\"attachmentPoint\":\"bla-bla-30-3\",\"cvlan\":\"678\",\"svlan\":\"1005\"}"
+ "}";
assertEquals(expectedResult, new JsonBodyBuilderImpl().createJsonBody(model));
}
@Test
- void createJsonBodyWithEmptyAdditionalFields_shouldReturnJsonInString() {
+ void createJsonBodyWithEmptyOptionalPnfRegistrationFields_shouldReturnJsonInString() {
ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder()
.correlationId("NOKnhfsadhff")
- .ipv4("256.22.33.155")
- .ipv6("200J:0db8:85a3:0000:0000:8a2e:0370:7334")
- .serialNumber("1234")
- .equipVendor("NOKIA")
- .equipModel("3310")
- .equipType("cell")
- .nfRole("role")
- .swVersion("1.2.3")
+ .serialNumber("")
+ .equipVendor("")
+ .equipModel("")
+ .equipType("")
+ .nfRole("")
+ .swVersion("")
+ .additionalFields(new JsonObject())
.build();
-
String expectedResult = "{"
+ "\"correlationId\":\"NOKnhfsadhff\","
- + "\"ipaddress-v4-oam\":\"256.22.33.155\","
- + "\"ipaddress-v6-oam\":\"200J:0db8:85a3:0000:0000:8a2e:0370:7334\","
- + "\"serial-number\":\"1234\","
- + "\"equip-vendor\":\"NOKIA\","
- + "\"equip-model\":\"3310\","
- + "\"equip-type\":\"cell\","
- + "\"nf-role\":\"role\","
- + "\"sw-version\":\"1.2.3\""
+ + "\"serial-number\":\"\","
+ + "\"equip-vendor\":\"\","
+ + "\"equip-model\":\"\","
+ + "\"equip-type\":\"\","
+ + "\"nf-role\":\"\","
+ + "\"sw-version\":\"\""
+ "}";
assertEquals(expectedResult, new JsonBodyBuilderImpl().createJsonBody(model));