summaryrefslogtreecommitdiffstats
path: root/prh-commons/src/test
diff options
context:
space:
mode:
authorJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-03-21 14:15:10 +0100
committerJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-03-22 08:13:58 +0100
commitc85d30c68054fe76eb0ffc9e9264336a37476451 (patch)
tree17cad272907dfeea252eb474e865daa18105a07b /prh-commons/src/test
parentbccafdc99094a8ff9107f242b31f80e5a839b5c2 (diff)
Remove IP requirement
Remove the requirement of at least one IP present in VES event. Update IP information in AAI only if it is present and is not empty. Change-Id: I83ae8990d45d71de4c839e43b5065db89b6c6a3a Issue-ID: DCAEGEN2-1312 Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'prh-commons/src/test')
-rw-r--r--prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiJsonBodyBuilderTest.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiJsonBodyBuilderTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiJsonBodyBuilderTest.java
index d1995f33..60ce520c 100644
--- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiJsonBodyBuilderTest.java
+++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiJsonBodyBuilderTest.java
@@ -57,4 +57,58 @@ class AaiJsonBodyBuilderTest {
assertEquals(expectedResult, new AaiJsonBodyBuilderImpl().createJsonBody(model));
}
+
+ @Test
+ void createJsonBodyWithoutIPs_shouldReturnJsonInString() {
+
+ ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder()
+ .correlationId("NOKnhfsadhff")
+ .serialNumber("1234")
+ .equipVendor("NOKIA")
+ .equipModel("3310")
+ .equipType("cell")
+ .nfRole("role")
+ .swVersion("1.2.3")
+ .build();
+
+ String expectedResult = "{"
+ + "\"correlationId\":\"NOKnhfsadhff\","
+ + "\"serial-number\":\"1234\","
+ + "\"equip-vendor\":\"NOKIA\","
+ + "\"equip-model\":\"3310\","
+ + "\"equip-type\":\"cell\","
+ + "\"nf-role\":\"role\","
+ + "\"sw-version\":\"1.2.3\""
+ + "}";
+
+ assertEquals(expectedResult, new AaiJsonBodyBuilderImpl().createJsonBody(model));
+ }
+
+ @Test
+ void createJsonBodyWithEmptyIPs_shouldReturnJsonInString() {
+
+ ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder()
+ .correlationId("NOKnhfsadhff")
+ .ipv4("")
+ .ipv6("")
+ .serialNumber("1234")
+ .equipVendor("NOKIA")
+ .equipModel("3310")
+ .equipType("cell")
+ .nfRole("role")
+ .swVersion("1.2.3")
+ .build();
+
+ String expectedResult = "{"
+ + "\"correlationId\":\"NOKnhfsadhff\","
+ + "\"serial-number\":\"1234\","
+ + "\"equip-vendor\":\"NOKIA\","
+ + "\"equip-model\":\"3310\","
+ + "\"equip-type\":\"cell\","
+ + "\"nf-role\":\"role\","
+ + "\"sw-version\":\"1.2.3\""
+ + "}";
+
+ assertEquals(expectedResult, new AaiJsonBodyBuilderImpl().createJsonBody(model));
+ }
}