diff options
author | pwielebs <piotr.wielebski@nokia.com> | 2018-08-23 11:58:45 +0200 |
---|---|---|
committer | pwielebs <piotr.wielebski@nokia.com> | 2018-08-23 11:58:45 +0200 |
commit | 0a64f9a3f976a2472c42729353773839deea5e02 (patch) | |
tree | 9bf718efaa2d13cbb6d0a56943747c6ad083dbbd /prh-app-server/src/test/java | |
parent | 11a8eaf768babfdd0eaef985981a73947177f594 (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/src/test/java')
2 files changed, 185 insertions, 202 deletions
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 |