summaryrefslogtreecommitdiffstats
path: root/prh-app-server
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2018-08-23 11:58:45 +0200
committerpwielebs <piotr.wielebski@nokia.com>2018-08-23 11:58:45 +0200
commit0a64f9a3f976a2472c42729353773839deea5e02 (patch)
tree9bf718efaa2d13cbb6d0a56943747c6ad083dbbd /prh-app-server
parent11a8eaf768babfdd0eaef985981a73947177f594 (diff)
Fix for PRH against VES 7.0
Change-Id: I1e4ca7d1a163eed6fadb1f52d0cc9fc675ea6b7f Issue-ID: DCAEGEN2-600 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java5
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java331
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java56
3 files changed, 188 insertions, 204 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
index 53c370f1..17b1ef67 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
@@ -39,6 +39,7 @@ import reactor.core.publisher.Mono;
*/
public class DmaapConsumerJsonParser {
+ private static final String EVENT = "event";
private static final String PNF_REGISTRATION_FIELDS = "pnfRegistrationFields";
private static final String OAM_IPV_4_ADDRESS = "oamV4IpAddress";
private static final String OAM_IPV_6_ADDRESS = "oamV6IpAddress";
@@ -89,7 +90,7 @@ public class DmaapConsumerJsonParser {
}
private Mono<ConsumerDmaapModel> transform(JsonObject monoJsonP) {
- monoJsonP = monoJsonP.getAsJsonObject(PNF_REGISTRATION_FIELDS);
+ monoJsonP = monoJsonP.getAsJsonObject(EVENT).getAsJsonObject(PNF_REGISTRATION_FIELDS);
String pnfVendorName = getValueFromJson(monoJsonP, VENDOR_NAME);
String pnfSerialNumber = getValueFromJson(monoJsonP, SERIAL_NUMBER);
String pnfOamIpv4Address = getValueFromJson(monoJsonP, OAM_IPV_4_ADDRESS);
@@ -118,7 +119,7 @@ public class DmaapConsumerJsonParser {
}
private boolean containsHeader(JsonObject jsonObject) {
- return jsonObject.has(PNF_REGISTRATION_FIELDS);
+ return jsonObject.has(EVENT) && jsonObject.getAsJsonObject(EVENT).has(PNF_REGISTRATION_FIELDS);
}
private String printMessage(String vendorName, String serialNumber, String oamIpv4Address, String oamIpv6Address) {
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java
index 8cf7bcec..e0eccc36 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java
@@ -42,36 +42,33 @@ class DmaapConsumerJsonParserTest {
@Test
void whenPassingCorrectJson_validationNotThrowingAnException() {
//given
+ String message = "[{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"oamV4IpAddress\": \"10.16.123.234\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ + "}}}]";
- String message = "[{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV4IpAddress\":\"10.16.123.234\","
- + "\"oamV6IpAddress\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"v4.5.0.1\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}]";
-
- String parsed = "{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV4IpAddress\":\"10.16.123.234\","
- + "\"oamV6IpAddress\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"v4.5.0.1\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}";
+ String parsed = "{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"oamV4IpAddress\": \"10.16.123.234\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ + "}}}";
ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234")
.ipv6("0:0:0:0:0:FFFF:0A10:7BEA")
@@ -91,31 +88,31 @@ class DmaapConsumerJsonParserTest {
@Test
void whenPassingCorrectJsonWithoutIpv4_validationNotThrowingAnException() {
//given
- String message = "[{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\",\"modelNumber\":\"7BEA\","
- + "\"oamV6IpAddress\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"1517206400\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\",\"vendorName\":\"Nokia\""
- + "}}]";
+ String message = "[{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ + "}}}]";
- String parsed = "{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV6IpAddress\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"1517206400\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}";
+ String parsed = "{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ + "}}}";
//when
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
@@ -136,33 +133,31 @@ class DmaapConsumerJsonParserTest {
@Test
void whenPassingCorrectJsonWithoutIpv6_validationNotThrowingAnException() {
//given
- String message = "[{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV4IpAddress\":\"10.16.123.234\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"1517206400\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}]";
+ String message = "[{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"oamV4IpAddress\": \"10.16.123.234\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}]";
- String parsed = "{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV4IpAddress\":\"10.16.123.234\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"1517206400\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}";
+ String parsed = "{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"oamV4IpAddress\": \"10.16.123.234\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}";
ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234").ipv6("")
.pnfName("NOKQTFCOC540002E").build();
@@ -180,31 +175,29 @@ class DmaapConsumerJsonParserTest {
@Test
void whenPassingCorrectJsonWithoutIpv4andIpv6_validationThrowingAnException() {
- String message = "[{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"1517206400\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}]";
+ String message = "[{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}]";
- String parsed = "{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"1517206400\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}";
+ String parsed = "{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}";
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
JsonElement jsonElement = new JsonParser().parse(parsed);
@@ -217,69 +210,63 @@ class DmaapConsumerJsonParserTest {
@Test
void whenPassingJsonWithoutMandatoryHeaderInformation_validationThrowingAnException() {
- String parsed = "{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"1517206400\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\""
- + "}}";
+ String parsed = "{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}";
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
JsonElement jsonElement = new JsonParser().parse(parsed);
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject()))
.when(dmaapConsumerJsonParser).getJsonObjectFromAnArray(jsonElement);
- String incorrectMessage = "[{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"1517206400\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\""
- + "}}]";
+ String incorrectMessage = "[{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}]";
StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(incorrectMessage)))
.expectSubscription().expectError(DmaapNotFoundException.class).verify();
}
@Test
void whenPassingJsonWithoutSerialNumberOrVendorName_validationThrowingAnException() {
- String parsed = "{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV4IpAddress\":\"10.16.123.234\","
- + "\"oamV6IpAddress\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"softwareVersion\":\"v4.5.0.1\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\""
- + "}}";
+ String parsed = "{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"oamV4IpAddress\": \"10.16.123.234\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ + "}}}";
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
JsonElement jsonElement = new JsonParser().parse(parsed);
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject()))
.when(dmaapConsumerJsonParser).getJsonObjectFromAnArray(jsonElement);
String jsonWithoutVendorAndSerialNumber =
- "[{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV4IpAddress\":\"10.16.123.234\","
- + "\"oamV6IpAddress\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"softwareVersion\":\"v4.5.0.1\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\""
- + "}}]";
+ "[{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"oamV4IpAddress\": \"10.16.123.234\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ + "}}}]";
StepVerifier
.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(jsonWithoutVendorAndSerialNumber)))
.expectSubscription().expectError(DmaapNotFoundException.class).verify();
@@ -288,36 +275,34 @@ class DmaapConsumerJsonParserTest {
@Test
void whenPassingJsonWithoutIpInformation_validationThrowingAnException() {
String parsed =
- "{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"v4.5.0.1\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}";
+ "{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}";
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
JsonElement jsonElement = new JsonParser().parse(parsed);
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject()))
.when(dmaapConsumerJsonParser).getJsonObjectFromAnArray(jsonElement);
String jsonWithoutIpInformation =
- "[{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"v4.5.0.1\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}]";
+ "[{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}]";
StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(jsonWithoutIpInformation)))
.expectSubscription().expectError(DmaapNotFoundException.class).verify();
}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
index c8676c7c..d1ef97b5 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
@@ -70,35 +70,33 @@ class DmaapConsumerTaskImplTest {
.pnfName("NOKQTFCOC540002E").build();
appConfig = mock(AppConfig.class);
- message = "[{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV4IpAddress\":\"10.16.123.234\","
- + "\"oamV6IpAddress\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"v4.5.0.1\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}]";
-
- parsed = "{\"pnfRegistrationFields\":{"
- + "\"lastServiceDate\":\"1517206400\","
- + "\"macAddress\":\"FFFF:0A10:7BEA\","
- + "\"manufactureDate\":\"1517206400\","
- + "\"modelNumber\":\"7BEA\","
- + "\"oamV4IpAddress\":\"10.16.123.234\","
- + "\"oamV6IpAddress\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
- + "\"pnfRegistrationFieldsVersion\":\"1517206400\","
- + "\"serialNumber\":\"QTFCOC540002E\","
- + "\"softwareVersion\":\"v4.5.0.1\","
- + "\"unitFamily\":\"BBU\","
- + "\"unitType\":\"AirScale\","
- + "\"vendorName\":\"Nokia\""
- + "}}";
+ message = "[{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"oamV4IpAddress\": \"10.16.123.234\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ + "}}}]";
+
+ parsed = "{\"event\": {\"pnfRegistrationFields\": {"
+ + " \"unitType\": \"AirScale\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"manufactureDate\": \"1535014037024\","
+ + " \"modelNumber\": \"7BEA\",\n"
+ + " \"lastServiceDate\": \"1535014037024\","
+ + " \"unitFamily\": \"BBU\","
+ + " \"vendorName\": \"Nokia\","
+ + " \"oamV4IpAddress\": \"10.16.123.234\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ + "}}}";
}
@Test