diff options
author | pwielebs <piotr.wielebski@nokia.com> | 2019-02-06 10:49:41 +0100 |
---|---|---|
committer | pwielebs <piotr.wielebski@nokia.com> | 2019-02-07 11:20:26 +0100 |
commit | 72aa0aaf4561f0cfd9c7e1dbe47a13f8571bf1db (patch) | |
tree | 0e215467c6351cd9219a9c10fd2a731ccc1a65f8 /prh-app-server/src/test/java/org | |
parent | abb323766704953f3706dd921692290a26678de3 (diff) |
Add additional fields to PRH
* patch version updated
Change-Id: I32f8a0ec090a2559ef3324f937601e71670b30cf
Issue-ID: DCAEGEN2-1173
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server/src/test/java/org')
4 files changed, 185 insertions, 139 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 01ce7419..591276b0 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,40 +42,45 @@ class DmaapConsumerJsonParserTest { void whenPassingCorrectJson_validationNotThrowingAnException() { //given String 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\"" - + "}}}]"; + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + + " \"oamV4IpAddress\": \"10.16.123.234\"," + + " \"sw-version\": \"v4.5.0.1\"," + + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + + "}}}]"; String parsed = "{\"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\"" - + "}}}"; + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + + " \"unitFamily\": \"BBU\"," + + " \"oamV4IpAddress\": \"10.16.123.234\"," + + " \"sw-version\": \"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") - .correlationId("NOKQTFCOC540002E").build(); + ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder() + .ipv4("10.16.123.234") + .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") + .correlationId("NOKQTFCOC540002E") + .serialNumber("QTFCOC540002E") + .equipVendor("nokia") + .equipModel("3310") + .equipType("type") + .nfRole("role") + .swVersion("v4.5.0.1") + .build(); //when DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser()); JsonElement jsonElement = new JsonParser().parse(parsed); @@ -92,34 +97,32 @@ class DmaapConsumerJsonParserTest { void whenPassingCorrectJsonWithoutIpv4_validationNotThrowingAnException() { //given String message = "[{\"event\": {" - + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," - + "\"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\"" - + "}}}]"; + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + + " \"unitFamily\": \"BBU\"," + + " \"sw-version\": \"v4.5.0.1\"," + + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + + "}}}]"; String parsed = "{\"event\": {" - + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," - + "\"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\"" - + "}}}"; + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + + " \"unitFamily\": \"BBU\"," + + " \"sw-version\": \"v4.5.0.1\"," + + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + + "}}}"; //when DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser()); @@ -130,9 +133,17 @@ class DmaapConsumerJsonParserTest { ConsumerDmaapModel consumerDmaapModel = dmaapConsumerJsonParser.getJsonObject(Mono.just((message))) .blockFirst(); //then - ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("") - .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .correlationId("NOKQTFCOC540002E").build(); + ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder() + .ipv4("") + .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") + .correlationId("NOKQTFCOC540002E") + .serialNumber("QTFCOC540002E") + .equipVendor("nokia") + .equipModel("3310") + .equipType("type") + .nfRole("role") + .swVersion("v4.5.0.1") + .build(); Assertions.assertNotNull(consumerDmaapModel); Assertions.assertEquals(expectedObject, consumerDmaapModel); } @@ -141,37 +152,44 @@ class DmaapConsumerJsonParserTest { void whenPassingCorrectJsonWithoutIpv6_validationNotThrowingAnException() { //given String 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\"" - + "}}}]"; + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + + " \"unitFamily\": \"BBU\"," + + " \"oamV4IpAddress\": \"10.16.123.234\"," + + " \"sw-version\": \"v4.5.0.1\"" + + "}}}]"; String parsed = "{\"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\"" - + "}}}"; + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + + " \"unitFamily\": \"BBU\"," + + " \"oamV4IpAddress\": \"10.16.123.234\"," + + " \"sw-version\": \"v4.5.0.1\"" + + "}}}"; - ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234").ipv6("") - .correlationId("NOKQTFCOC540002E").build(); + ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder() + .ipv4("10.16.123.234") + .ipv6("") + .correlationId("NOKQTFCOC540002E") + .serialNumber("QTFCOC540002E") + .equipVendor("nokia") + .equipModel("3310") + .equipType("type") + .nfRole("role") + .swVersion("v4.5.0.1") + .build(); //when DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser()); JsonElement jsonElement = new JsonParser().parse(parsed); @@ -390,43 +408,47 @@ class DmaapConsumerJsonParserTest { } @Test - void whenPassingCorrectJsoArraynWithoutIpv4_validationNotThrowingAnException() { + void whenPassingCorrectJsoArrayWithoutIpv4_validationNotThrowingAnException() { //given - String 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\"" - + "}}}," - + "{\"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\"" - + "}}}" - + "]"; + String message = + "[{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + + " \"unitFamily\": \"BBU\"," + + " \"sw-version\": \"v4.5.0.1\"," + + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + + "}}}," + + "{\"event\": {" + + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + + "\"pnfRegistrationFields\": {" + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + + " \"pnfRegistrationFieldsVersion\": \"2.0\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + + " \"unitFamily\": \"BBU\"," + + " \"sw-version\": \"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") - .correlationId("NOKQTFCOC540002E").build(); + ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder() + .ipv4("") + .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") + .correlationId("NOKQTFCOC540002E") + .serialNumber("QTFCOC540002E") + .equipVendor("nokia") + .equipModel("3310") + .equipType("type") + .nfRole("role") + .swVersion("v4.5.0.1") + .build(); //when DmaapConsumerJsonParser dmaapConsumerJsonParser = new DmaapConsumerJsonParser(); 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 32e66386..24d89df2 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 @@ -31,6 +31,7 @@ import static org.mockito.Mockito.when; import javax.net.ssl.SSLException; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -64,9 +65,17 @@ class AaiProducerTaskImplTest { void setUp() { clientResponse = mock(ClientResponse.class); aaiClientConfiguration = TestAppConfiguration.createDefaultAaiClientConfiguration(); - consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") - .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .correlationId("NOKQTFCOC540002E").build(); + consumerDmaapModel = ImmutableConsumerDmaapModel.builder() + .ipv4("10.16.123.234") + .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") + .correlationId("NOKQTFCOC540002E") + .serialNumber("QTFCOC540002E") + .equipVendor("nokia") + .equipModel("3310") + .equipType("type") + .nfRole("role") + .swVersion("v4.5.0.1") + .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 fc85b98b..a2f08078 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 @@ -59,30 +59,37 @@ class DmaapConsumerTaskImplTest { static void setUp() { dmaapConsumerConfiguration = createDefaultDmaapConsumerConfiguration(); - consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") + consumerDmaapModel = ImmutableConsumerDmaapModel.builder() + .ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .correlationId("NOKQTFCOC540002E").build(); + .correlationId("NOKQTFCOC540002E") + .serialNumber("QTFCOC540002E") + .equipVendor("nokia") + .equipModel("3310") + .equipType("type") + .nfRole("role") + .swVersion("v4.5.0.1") + .build(); appConfig = mock(AppConfig.class); message = "[{\"event\": {" + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"}," + "\"pnfRegistrationFields\": {" - + " \"unitType\": \"AirScale\"," - + " \"serialNumber\": \"QTFCOC540002E\"," + + " \"equip-vendor\": \"nokia\"," + + " \"serial-number\": \"QTFCOC540002E\"," + " \"pnfRegistrationFieldsVersion\": \"2.0\"," - + " \"manufactureDate\": \"1535014037024\"," - + " \"modelNumber\": \"7BEA\",\n" - + " \"lastServiceDate\": \"1535014037024\"," + + " \"equip-model\": \"3310\"," + + " \"equip-type\": \"type\",\n" + + " \"nf-role\": \"role\"," + " \"unitFamily\": \"BBU\"," - + " \"vendorName\": \"Nokia\"," + " \"oamV4IpAddress\": \"10.16.123.234\"," - + " \"softwareVersion\": \"v4.5.0.1\"," + + " \"sw-version\": \"v4.5.0.1\"," + " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\"" + "}}}]"; } @Test - void whenPassedObjectDoesntFit_DoesNotThrowPrhTaskException() throws Exception { + void whenPassedObjectDoesNotFit_DoesNotThrowPrhTaskException() throws Exception { //given prepareMocksForDmaapConsumer(Optional.empty()); 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 f4a1c2e6..33a05772 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 @@ -60,9 +60,17 @@ class DmaapPublisherTaskImplTest { @BeforeAll static void setUp() { dmaapPublisherConfiguration = createDefaultDmaapPublisherConfiguration(); - consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") - .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .correlationId("NOKQTFCOC540002E").build(); + consumerDmaapModel = ImmutableConsumerDmaapModel.builder() + .ipv4("10.16.123.234") + .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") + .correlationId("NOKQTFCOC540002E") + .serialNumber("QTFCOC540002E") + .equipVendor("nokia") + .equipModel("3310") + .equipType("type") + .nfRole("role") + .swVersion("v4.5.0.1") + .build(); appConfig = mock(AppConfig.class); } |