summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/test
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2019-02-13 16:06:53 +0100
committerpwielebs <piotr.wielebski@nokia.com>2019-02-13 16:06:53 +0100
commitdf2c17cd5619d6ca069f73342a9aaafbdf0bba59 (patch)
tree5e605cb30e53e3489796cf5ab5687f9c15c7f216 /prh-app-server/src/test
parent2ce68d3c8423d644056becc8ef1e3bb0df731c42 (diff)
Add additional fields to PRH (2)
* correct name of parameters Change-Id: I591ed6ba66691d3fe637b9d81b0956a635deac1c Issue-ID: DCAEGEN2-1173 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server/src/test')
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java198
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java18
2 files changed, 121 insertions, 95 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 591276b0..44651a54 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,31 +42,36 @@ class DmaapConsumerJsonParserTest {
void whenPassingCorrectJson_validationNotThrowingAnException() {
//given
String message = "[{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ + " \"unitFamily\": \"BBU\","
+ " \"oamV4IpAddress\": \"10.16.123.234\","
- + " \"sw-version\": \"v4.5.0.1\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ "}}}]";
String parsed = "{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ " \"unitFamily\": \"BBU\","
+ " \"oamV4IpAddress\": \"10.16.123.234\","
- + " \"sw-version\": \"v4.5.0.1\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ "}}}";
@@ -78,7 +83,7 @@ class DmaapConsumerJsonParserTest {
.equipVendor("nokia")
.equipModel("3310")
.equipType("type")
- .nfRole("role")
+ .nfRole("gNB")
.swVersion("v4.5.0.1")
.build();
//when
@@ -97,30 +102,34 @@ class DmaapConsumerJsonParserTest {
void whenPassingCorrectJsonWithoutIpv4_validationNotThrowingAnException() {
//given
String message = "[{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ " \"unitFamily\": \"BBU\","
- + " \"sw-version\": \"v4.5.0.1\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ "}}}]";
String parsed = "{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ " \"unitFamily\": \"BBU\","
- + " \"sw-version\": \"v4.5.0.1\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ "}}}";
@@ -141,7 +150,7 @@ class DmaapConsumerJsonParserTest {
.equipVendor("nokia")
.equipModel("3310")
.equipType("type")
- .nfRole("role")
+ .nfRole("gNB")
.swVersion("v4.5.0.1")
.build();
Assertions.assertNotNull(consumerDmaapModel);
@@ -152,33 +161,39 @@ class DmaapConsumerJsonParserTest {
void whenPassingCorrectJsonWithoutIpv6_validationNotThrowingAnException() {
//given
String message = "[{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ " \"unitFamily\": \"BBU\","
+ " \"oamV4IpAddress\": \"10.16.123.234\","
- + " \"sw-version\": \"v4.5.0.1\""
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ "}}}]";
+
String parsed = "{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ " \"unitFamily\": \"BBU\","
+ " \"oamV4IpAddress\": \"10.16.123.234\","
- + " \"sw-version\": \"v4.5.0.1\""
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ "}}}";
+
ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder()
.ipv4("10.16.123.234")
.ipv6("")
@@ -187,7 +202,7 @@ class DmaapConsumerJsonParserTest {
.equipVendor("nokia")
.equipModel("3310")
.equipType("type")
- .nfRole("role")
+ .nfRole("gNB")
.swVersion("v4.5.0.1")
.build();
//when
@@ -206,32 +221,34 @@ class DmaapConsumerJsonParserTest {
void whenPassingCorrectJsonWithoutIpv4andIpv6_validationAddingAnException() {
//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\""
- + "}}}]";
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ + "\"pnfRegistrationFields\": {"
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ + " \"unitFamily\": \"BBU\","
+ + " \"softwareVersion\": \"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\","
- + " \"softwareVersion\": \"v4.5.0.1\""
- + "}}}";
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ + "\"pnfRegistrationFields\": {"
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ + " \"pnfRegistrationFieldsVersion\": \"2.0\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ + " \"unitFamily\": \"BBU\","
+ + " \"softwareVersion\": \"v4.5.0.1\""
+ + "}}}";
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
JsonElement jsonElement = new JsonParser().parse(parsed);
@@ -410,34 +427,41 @@ class DmaapConsumerJsonParserTest {
@Test
void whenPassingCorrectJsoArrayWithoutIpv4_validationNotThrowingAnException() {
//given
- String message =
- "[{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ String message = "[{\"event\": {"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + " },"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ " \"unitFamily\": \"BBU\","
- + " \"sw-version\": \"v4.5.0.1\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ "}}},"
- + "{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ + " {\"event\": {"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ " \"unitFamily\": \"BBU\","
- + " \"sw-version\": \"v4.5.0.1\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ "}}}]";
+
+
+
+
ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder()
.ipv4("")
.ipv6("0:0:0:0:0:FFFF:0A10:7BEA")
@@ -446,7 +470,7 @@ class DmaapConsumerJsonParserTest {
.equipVendor("nokia")
.equipModel("3310")
.equipType("type")
- .nfRole("role")
+ .nfRole("gNB")
.swVersion("v4.5.0.1")
.build();
//when
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 a2f08078..87b037f1 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,23 +67,25 @@ class DmaapConsumerTaskImplTest {
.equipVendor("nokia")
.equipModel("3310")
.equipType("type")
- .nfRole("role")
+ .nfRole("gNB")
.swVersion("v4.5.0.1")
.build();
appConfig = mock(AppConfig.class);
message = "[{\"event\": {"
- + "\"commonEventHeader\": { \"sourceName\":\"NOKQTFCOC540002E\"},"
+ + "\"commonEventHeader\": { "
+ + " \"sourceName\":\"NOKQTFCOC540002E\","
+ + " \"nfNamingCode\":\"gNB\" "
+ + "},"
+ "\"pnfRegistrationFields\": {"
- + " \"equip-vendor\": \"nokia\","
- + " \"serial-number\": \"QTFCOC540002E\","
+ + " \"vendorName\": \"nokia\","
+ + " \"serialNumber\": \"QTFCOC540002E\","
+ " \"pnfRegistrationFieldsVersion\": \"2.0\","
- + " \"equip-model\": \"3310\","
- + " \"equip-type\": \"type\",\n"
- + " \"nf-role\": \"role\","
+ + " \"modelNumber\": \"3310\","
+ + " \"unitType\": \"type\",\n"
+ " \"unitFamily\": \"BBU\","
+ " \"oamV4IpAddress\": \"10.16.123.234\","
- + " \"sw-version\": \"v4.5.0.1\","
+ + " \"softwareVersion\": \"v4.5.0.1\","
+ " \"oamV6IpAddress\": \"0:0:0:0:0:FFFF:0A10:7BEA\""
+ "}}}]";
}