diff options
author | pwielebs <piotr.wielebski@nokia.com> | 2018-08-30 12:02:31 +0200 |
---|---|---|
committer | pwielebs <piotr.wielebski@nokia.com> | 2018-08-30 12:02:31 +0200 |
commit | ed4d45332691282e7e0dc4bb413d20f46e1a0a66 (patch) | |
tree | 5bb2c06ef453ae8868cbd0f1b04ce9375c165459 /prh-app-server/src | |
parent | 4fbb9e8ad097c9ec3c3434ba257e887fb3a64699 (diff) |
Introduction of a new parameter "sourceName"
- used instead of pnf-name (correlationId)
Change-Id: Iabcbfacbc029bd6d229080c2064a291e17c7f4f8
Issue-ID: DCAEGEN2-744
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server/src')
5 files changed, 148 insertions, 64 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 17b1ef67..8742d872 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 @@ -40,11 +40,11 @@ import reactor.core.publisher.Mono; public class DmaapConsumerJsonParser { private static final String EVENT = "event"; + private static final String COMMON_EVENT_HEADER = "commonEventHeader"; 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"; - private static final String VENDOR_NAME = "vendorName"; - private static final String SERIAL_NUMBER = "serialNumber"; + private static final String SOURCE_NAME = "sourceName"; private final Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -89,20 +89,23 @@ public class DmaapConsumerJsonParser { : transform(monoJsonP)); } - private Mono<ConsumerDmaapModel> transform(JsonObject monoJsonP) { - 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); - String pnfOamIpv6Address = getValueFromJson(monoJsonP, OAM_IPV_6_ADDRESS); - return - (!vendorAndSerialNotEmpty(pnfSerialNumber, pnfVendorName) || !ipPropertiesNotEmpty(pnfOamIpv4Address, - pnfOamIpv6Address)) + private Mono<ConsumerDmaapModel> transform(JsonObject responseFromDmaap) { + + JsonObject commonEventHeader = responseFromDmaap.getAsJsonObject(EVENT) + .getAsJsonObject(COMMON_EVENT_HEADER); + JsonObject pnfRegistrationFields = responseFromDmaap.getAsJsonObject(EVENT) + .getAsJsonObject(PNF_REGISTRATION_FIELDS); + + String pnfSourceName = getValueFromJson(commonEventHeader, SOURCE_NAME); + String pnfOamIpv4Address = getValueFromJson(pnfRegistrationFields, OAM_IPV_4_ADDRESS); + String pnfOamIpv6Address = getValueFromJson(pnfRegistrationFields, OAM_IPV_6_ADDRESS); + + return ( StringUtils.isEmpty(pnfSourceName) || !ipPropertiesNotEmpty(pnfOamIpv4Address, pnfOamIpv6Address) ) ? Mono.error(new DmaapNotFoundException("Incorrect json, consumerDmaapModel can not be created: " - + printMessage(pnfVendorName, pnfSerialNumber, pnfOamIpv4Address, pnfOamIpv6Address))) : + + printMessage(pnfSourceName, pnfOamIpv4Address, pnfOamIpv6Address))) : Mono.just(ImmutableConsumerDmaapModel.builder() - .pnfName(pnfVendorName.substring(0, Math.min(pnfVendorName.length(), 3)).toUpperCase() - .concat(pnfSerialNumber)).ipv4(pnfOamIpv4Address) + .sourceName(pnfSourceName) + .ipv4(pnfOamIpv4Address) .ipv6(pnfOamIpv6Address).build()); } @@ -110,10 +113,6 @@ public class DmaapConsumerJsonParser { return jsonObject.has(jsonKey) ? jsonObject.get(jsonKey).getAsString() : ""; } - private boolean vendorAndSerialNotEmpty(String pnfSerialNumber, String pnfVendorName) { - return (!StringUtils.isEmpty(pnfSerialNumber) && !StringUtils.isEmpty(pnfVendorName)); - } - private boolean ipPropertiesNotEmpty(String ipv4, String ipv6) { return (!StringUtils.isEmpty(ipv4)) || !(StringUtils.isEmpty(ipv6)); } @@ -122,12 +121,11 @@ public class DmaapConsumerJsonParser { return jsonObject.has(EVENT) && jsonObject.getAsJsonObject(EVENT).has(PNF_REGISTRATION_FIELDS); } - private String printMessage(String vendorName, String serialNumber, String oamIpv4Address, String oamIpv6Address) { + private String printMessage(String sourceName, String oamIpv4Address, String oamIpv6Address) { return String.format("%n{" - + "\"" + VENDOR_NAME + " : \"%s\"," - + "\"" + SERIAL_NUMBER + "\": \"%s\"," - + "\"" + OAM_IPV_4_ADDRESS + "\": \"%s\"," - + "\"" + OAM_IPV_6_ADDRESS + "\": \"%s\"" - + "%n}", vendorName, serialNumber, oamIpv4Address, oamIpv6Address); + + "\"" + SOURCE_NAME + "\": \"%s\"," + + "\"" + OAM_IPV_4_ADDRESS + "\": \"%s\"," + + "\"" + OAM_IPV_6_ADDRESS + "\": \"%s\"" + + "%n}", sourceName, oamIpv4Address, 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 e0eccc36..2cbb6800 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,7 +42,9 @@ class DmaapConsumerJsonParserTest { @Test void whenPassingCorrectJson_validationNotThrowingAnException() { //given - String message = "[{\"event\": {\"pnfRegistrationFields\": {" + String message = "[{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -56,7 +58,9 @@ class DmaapConsumerJsonParserTest { + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + "}}}]"; - String parsed = "{\"event\": {\"pnfRegistrationFields\": {" + String parsed = "{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -72,7 +76,7 @@ class DmaapConsumerJsonParserTest { ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .pnfName("NOKQTFCOC540002E").build(); + .sourceName("NOKQTFCOC540002E").build(); //when DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser()); JsonElement jsonElement = new JsonParser().parse(parsed); @@ -88,7 +92,9 @@ class DmaapConsumerJsonParserTest { @Test void whenPassingCorrectJsonWithoutIpv4_validationNotThrowingAnException() { //given - String message = "[{\"event\": {\"pnfRegistrationFields\": {" + String message = "[{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -101,7 +107,9 @@ class DmaapConsumerJsonParserTest { + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + "}}}]"; - String parsed = "{\"event\": {\"pnfRegistrationFields\": {" + String parsed = "{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -125,7 +133,7 @@ class DmaapConsumerJsonParserTest { //then ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .pnfName("NOKQTFCOC540002E").build(); + .sourceName("NOKQTFCOC540002E").build(); Assertions.assertNotNull(consumerDmaapModel); Assertions.assertEquals(expectedObject, consumerDmaapModel); } @@ -133,7 +141,9 @@ class DmaapConsumerJsonParserTest { @Test void whenPassingCorrectJsonWithoutIpv6_validationNotThrowingAnException() { //given - String message = "[{\"event\": {\"pnfRegistrationFields\": {" + String message = "[{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -146,7 +156,9 @@ class DmaapConsumerJsonParserTest { + " \"softwareVersion\": \"v4.5.0.1\"" + "}}}]"; - String parsed = "{\"event\": {\"pnfRegistrationFields\": {" + String parsed = "{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -160,7 +172,7 @@ class DmaapConsumerJsonParserTest { + "}}}"; ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234").ipv6("") - .pnfName("NOKQTFCOC540002E").build(); + .sourceName("NOKQTFCOC540002E").build(); //when DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser()); JsonElement jsonElement = new JsonParser().parse(parsed); @@ -175,7 +187,10 @@ class DmaapConsumerJsonParserTest { @Test void whenPassingCorrectJsonWithoutIpv4andIpv6_validationThrowingAnException() { - String message = "[{\"event\": {\"pnfRegistrationFields\": {" + //given + String message = "[{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -187,7 +202,9 @@ class DmaapConsumerJsonParserTest { + " \"softwareVersion\": \"v4.5.0.1\"" + "}}}]"; - String parsed = "{\"event\": {\"pnfRegistrationFields\": {" + String parsed = "{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -210,13 +227,17 @@ class DmaapConsumerJsonParserTest { @Test void whenPassingJsonWithoutMandatoryHeaderInformation_validationThrowingAnException() { - String parsed = "{\"event\": {\"pnfRegistrationFields\": {" + String parsed = "{\"event\": {" + + "\"commonEventHeader\": {}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + " \"manufactureDate\": \"1535014037024\"," + " \"modelNumber\": \"7BEA\",\n" + " \"lastServiceDate\": \"1535014037024\"," + " \"unitFamily\": \"BBU\"," + + " \"vendorName\": \"Nokia\"," + " \"softwareVersion\": \"v4.5.0.1\"" + "}}}"; @@ -224,13 +245,17 @@ class DmaapConsumerJsonParserTest { JsonElement jsonElement = new JsonParser().parse(parsed); Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())) .when(dmaapConsumerJsonParser).getJsonObjectFromAnArray(jsonElement); - String incorrectMessage = "[{\"event\": {\"pnfRegistrationFields\": {" + String incorrectMessage = "[{\"event\": {" + + "\"commonEventHeader\": {}," + + "\"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(incorrectMessage))) @@ -238,15 +263,18 @@ class DmaapConsumerJsonParserTest { } @Test - void whenPassingJsonWithoutSerialNumberOrVendorName_validationThrowingAnException() { - String parsed = "{\"event\": {\"pnfRegistrationFields\": {" + void whenPassingJsonWithoutSourceName_validationThrowingAnException() { + String parsed = "{\"event\": {" + + "\"commonEventHeader\": {}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + " \"manufactureDate\": \"1535014037024\"," + " \"modelNumber\": \"7BEA\",\n" + " \"lastServiceDate\": \"1535014037024\"," + " \"unitFamily\": \"BBU\"," - + " \"oamV4IpAddress\": \"10.16.123.234\"," + + " \"vendorName\": \"Nokia\"," + " \"softwareVersion\": \"v4.5.0.1\"," + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + "}}}"; @@ -255,27 +283,32 @@ class DmaapConsumerJsonParserTest { JsonElement jsonElement = new JsonParser().parse(parsed); Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())) .when(dmaapConsumerJsonParser).getJsonObjectFromAnArray(jsonElement); - String jsonWithoutVendorAndSerialNumber = - "[{\"event\": {\"pnfRegistrationFields\": {" + String jsonWithoutSourceName = + "[{\"event\": {" + + "\"commonEventHeader\": {}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + " \"manufactureDate\": \"1535014037024\"," + " \"modelNumber\": \"7BEA\",\n" + " \"lastServiceDate\": \"1535014037024\"," + " \"unitFamily\": \"BBU\"," - + " \"oamV4IpAddress\": \"10.16.123.234\"," + + " \"vendorName\": \"Nokia\"," + " \"softwareVersion\": \"v4.5.0.1\"," + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + "}}}]"; StepVerifier - .create(dmaapConsumerJsonParser.getJsonObject(Mono.just(jsonWithoutVendorAndSerialNumber))) + .create(dmaapConsumerJsonParser.getJsonObject(Mono.just(jsonWithoutSourceName))) .expectSubscription().expectError(DmaapNotFoundException.class).verify(); } @Test void whenPassingJsonWithoutIpInformation_validationThrowingAnException() { String parsed = - "{\"event\": {\"pnfRegistrationFields\": {" + "{\"event\": {" + + "\"commonEventHeader\": {\"sourceName\": \"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -284,7 +317,9 @@ class DmaapConsumerJsonParserTest { + " \"lastServiceDate\": \"1535014037024\"," + " \"unitFamily\": \"BBU\"," + " \"vendorName\": \"Nokia\"," - + " \"softwareVersion\": \"v4.5.0.1\"" + + " \"softwareVersion\": \"v4.5.0.1\"," + + " \"oamV4IpAddress\": \"\"," + + " \"oamV6IpAddress\": \"\"" + "}}}"; DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser()); @@ -292,7 +327,9 @@ class DmaapConsumerJsonParserTest { Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())) .when(dmaapConsumerJsonParser).getJsonObjectFromAnArray(jsonElement); String jsonWithoutIpInformation = - "[{\"event\": {\"pnfRegistrationFields\": {" + "[{\"event\": {" + + "\"commonEventHeader\": {\"sourceName\": \"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," @@ -301,9 +338,54 @@ class DmaapConsumerJsonParserTest { + " \"lastServiceDate\": \"1535014037024\"," + " \"unitFamily\": \"BBU\"," + " \"vendorName\": \"Nokia\"," - + " \"softwareVersion\": \"v4.5.0.1\"" + + " \"softwareVersion\": \"v4.5.0.1\"," + + " \"oamV4IpAddress\": \"\"," + + " \"oamV6IpAddress\": \"\"" + "}}}]"; StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(jsonWithoutIpInformation))) .expectSubscription().expectError(DmaapNotFoundException.class).verify(); } + + @Test + void whenPassingJsonWithoutSourceNameValue_validationThrowingAnException() { + String parsed = + "{\"event\": {" + + "\"commonEventHeader\": {\"sourceName\": \"\"}," + + "\"pnfRegistrationFields\": {" + + " \"unitType\": \"AirScale\"," + + " \"serialNumber\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"manufactureDate\": \"1535014037024\"," + + " \"modelNumber\": \"7BEA\",\n" + + " \"lastServiceDate\": \"1535014037024\"," + + " \"unitFamily\": \"BBU\"," + + " \"vendorName\": \"Nokia\"," + + " \"softwareVersion\": \"v4.5.0.1\"," + + " \"oamV4IpAddress\": \"10.16.123.234\"," + + " \"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 jsonWithoutIpInformation = + "[{\"event\": {" + + "\"commonEventHeader\": {\"sourceName\": \"\"}," + + "\"pnfRegistrationFields\": {" + + " \"unitType\": \"AirScale\"," + + " \"serialNumber\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"manufactureDate\": \"1535014037024\"," + + " \"modelNumber\": \"7BEA\",\n" + + " \"lastServiceDate\": \"1535014037024\"," + + " \"unitFamily\": \"BBU\"," + + " \"vendorName\": \"Nokia\"," + + " \"softwareVersion\": \"v4.5.0.1\"," + + " \"oamV4IpAddress\": \"10.16.123.234\"," + + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + + "}}}]"; + 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/AaiProducerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java index e3d8fe2f..4589341e 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java @@ -76,7 +76,7 @@ class AaiProducerTaskImplTest { .build(); consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .pnfName("NOKQTFCOC540002E").build(); + .sourceName("NOKQTFCOC540002E").build(); appConfig = mock(AppConfig.class); } 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 d1ef97b5..6bcd9b2c 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 @@ -67,24 +67,28 @@ class DmaapConsumerTaskImplTest { consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .pnfName("NOKQTFCOC540002E").build(); + .sourceName("NOKQTFCOC540002E").build(); appConfig = mock(AppConfig.class); - 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\"" + message = "[{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"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\": {" + parsed = "{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + " \"unitType\": \"AirScale\"," + " \"serialNumber\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java index 662a3947..453679df 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java @@ -64,7 +64,7 @@ class DmaapPublisherTaskImplTest { .dmaapTopicName("unauthenticated.SEC_OTHER_OUTPUT").build(); consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .pnfName("NOKQTFCOC540002E").build(); + .sourceName("NOKQTFCOC540002E").build(); appConfig = mock(AppConfig.class); } |