From 93fa0f8e4d58f4dd9043db8798765e4c15e38434 Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Tue, 19 May 2020 16:37:06 +0200 Subject: Include secure communication to DMaaP Include secure communication from mountpoint-registrar to DMaaP for PNF Registration and fault VES messages consumption Issue-ID: SDNC-1190 Signed-off-by: Ravi Pendurty Change-Id: I4f8c74f5179b55d6f3bcedcb02727239e56a7f42 --- .../test/PNFRegistrationConfigTest.java | 9 +- .../test/TestDMaaPFaultVESMsgConsumer.java | 4 - .../test/TestDMaaPPNFRegVESMsgConsumer.java | 317 ++++++++++----------- .../test/TestDMaaPVESMsgConsumerMain.java | 3 +- .../mountpointregistrar/test/TestFaultConfig.java | 9 +- .../test/TestFaultNotificationClient.java | 2 +- .../wt/mountpointregistrar/test/TestMapping.java | 6 +- .../test/TestMountpointRegistrarImpl.java | 24 -- .../test/TestPNFMountPointClient.java | 2 +- .../test/mock/odlapi/DataBrokerMountpointMock.java | 76 ----- .../test/mock/odlapi/DataBrokerNetconfMock.java | 75 ----- .../test/mock/odlapi/MountPointMock.java | 90 ------ .../test/mock/odlapi/MountPointServiceMock.java | 55 ---- .../odlapi/NotificationPublishServiceMock.java | 50 ---- .../test/mock/odlapi/RpcConsumerRegistryMock.java | 39 --- .../test/mock/odlapi/RpcProviderRegistryMock.java | 60 ---- 16 files changed, 179 insertions(+), 642 deletions(-) delete mode 100644 sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerMountpointMock.java delete mode 100644 sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerNetconfMock.java delete mode 100644 sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointMock.java delete mode 100644 sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointServiceMock.java delete mode 100644 sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/NotificationPublishServiceMock.java delete mode 100644 sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcConsumerRegistryMock.java delete mode 100644 sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcProviderRegistryMock.java (limited to 'sdnr/wt/mountpoint-registrar/provider/src/test/java') diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java index 29da7ad85..1049bf902 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java @@ -18,7 +18,7 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; @@ -36,6 +36,9 @@ public class PNFRegistrationConfigTest { private static final String TESTCONFIG_CONTENT="[pnfRegistration]\n" + "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer\n" + "TransportType=HTTPNOAUTH\n" + + "Protocol=http\n" + + "username=username\n" + + "password=password\n" + "host=onap-dmap:3904\n" + "topic=unauthenticated.VES_PNFREG_OUTPUT\n" + "contenttype=application/json\n" + @@ -65,6 +68,10 @@ public class PNFRegistrationConfigTest { assertEquals("20000", pnfCfg.getTimeout()); assertEquals("10000", pnfCfg.getLimit()); assertEquals("5000", pnfCfg.getFetchPause()); + assertEquals("http", pnfCfg.getProtocol()); + assertEquals("username", pnfCfg.getUsername()); + assertEquals("password", pnfCfg.getPassword()); + } catch (IOException e) { // TODO Auto-generated catch block diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java index cdc641f10..b5544dfa4 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java @@ -18,13 +18,9 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import static org.junit.Assert.*; - import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer; -import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultNotificationClient; -import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointClient; public class TestDMaaPFaultVESMsgConsumer extends DMaaPFaultVESMsgConsumer { diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java index 54439150c..eda372d77 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java @@ -18,10 +18,7 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import org.junit.After; -import org.junit.Before; import org.junit.Test; - import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointClient; @@ -30,30 +27,30 @@ public class TestDMaaPPNFRegVESMsgConsumer extends DMaaPPNFRegVESMsgConsumer { private static final String DEFAULT_SDNRUSER = "admin"; private static final String DEFAULT_SDNRPASSWD = "admin"; private static final String DEFAULT_SDNRBASEURL = "http://localhost:8181"; - - private static final String pnfRegMsg_TLS = "{\n" + - " \"event\": {\n" + - " \"commonEventHeader\": {\n" + - " \"domain\": \"pnfRegistration\",\n" + - " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + - " \"eventName\": \"pnfRegistration_EventType5G\",\n" + - " \"eventType\": \"EventType5G\",\n" + - " \"sequence\": 0,\n" + - " \"priority\": \"Low\",\n" + - " \"reportingEntityId\": \"\",\n" + - " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + - " \"sourceId\": \"\",\n" + - " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + - " \"startEpochMicrosec\": 1571300004203,\n" + - " \"lastEpochMicrosec\": 1571300004203,\n" + - " \"nfNamingCode\": \"1234\",\n" + - " \"nfVendorName\": \"VENDORA\",\n" + - " \"timeZoneOffset\": \"+00:00\",\n" + - " \"version\": \"4.0.1\",\n" + - " \"vesEventListenerVersion\":\"7.0.1\"\n" + - " },\n" + - " \"pnfRegistrationFields\": {\n" + - " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + + + private static final String pnfRegMsg_TLS = "{\n" + + " \"event\": {\n" + + " \"commonEventHeader\": {\n" + + " \"domain\": \"pnfRegistration\",\n" + + " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + + " \"eventName\": \"pnfRegistration_EventType5G\",\n" + + " \"eventType\": \"EventType5G\",\n" + + " \"sequence\": 0,\n" + + " \"priority\": \"Low\",\n" + + " \"reportingEntityId\": \"\",\n" + + " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + + " \"sourceId\": \"\",\n" + + " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + + " \"startEpochMicrosec\": 1571300004203,\n" + + " \"lastEpochMicrosec\": 1571300004203,\n" + + " \"nfNamingCode\": \"1234\",\n" + + " \"nfVendorName\": \"VENDORA\",\n" + + " \"timeZoneOffset\": \"+00:00\",\n" + + " \"version\": \"4.0.1\",\n" + + " \"vesEventListenerVersion\":\"7.0.1\"\n" + + " },\n" + + " \"pnfRegistrationFields\": {\n" + + " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + " \"additionalFields\": \n" + " { \n" + " \"protocol\":\"TLS\",\n"+ @@ -68,46 +65,46 @@ public class TestDMaaPPNFRegVESMsgConsumer extends DMaaPPNFRegVESMsgConsumer { " \"username\":\"netconf\",\n" + " \"tcpOnly\":\"false\"\n" + " },\n" + - " \"lastServiceDate\":\"2019-08-16\",\n" + - " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + - " \"manufactureDate\":\"2019-08-16\",\n" + - " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + - " \"oamV4IpAddress\": \"10.10.10.11\",\n" + + " \"lastServiceDate\":\"2019-08-16\",\n" + + " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + + " \"manufactureDate\":\"2019-08-16\",\n" + + " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + + " \"oamV4IpAddress\": \"10.10.10.11\",\n" + " \"oamPort\":\"17380\",\n" + - " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + - " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + - " \"softwareVersion\": \"2.3.5\",\n" + - " \"unitFamily\": \"VENDORA-1234\",\n" + - " \"unitType\": \"1234\",\n" + - " \"vendorName\": \"VENDORA\"\n" + - " }\n" + - " }\n" + - "}\n" + + " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + + " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + + " \"softwareVersion\": \"2.3.5\",\n" + + " \"unitFamily\": \"VENDORA-1234\",\n" + + " \"unitType\": \"1234\",\n" + + " \"vendorName\": \"VENDORA\"\n" + + " }\n" + + " }\n" + + "}\n" + ""; - - private static final String pnfRegMsg_SSH = "{\n" + - " \"event\": {\n" + - " \"commonEventHeader\": {\n" + - " \"domain\": \"pnfRegistration\",\n" + - " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + - " \"eventName\": \"pnfRegistration_EventType5G\",\n" + - " \"eventType\": \"EventType5G\",\n" + - " \"sequence\": 0,\n" + - " \"priority\": \"Low\",\n" + - " \"reportingEntityId\": \"\",\n" + - " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + - " \"sourceId\": \"\",\n" + - " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + - " \"startEpochMicrosec\": 1571300004203,\n" + - " \"lastEpochMicrosec\": 1571300004203,\n" + - " \"nfNamingCode\": \"1234\",\n" + - " \"nfVendorName\": \"VENDORA\",\n" + - " \"timeZoneOffset\": \"+00:00\",\n" + - " \"version\": \"4.0.1\",\n" + - " \"vesEventListenerVersion\":\"7.0.1\"\n" + - " },\n" + - " \"pnfRegistrationFields\": {\n" + - " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + + + private static final String pnfRegMsg_SSH = "{\n" + + " \"event\": {\n" + + " \"commonEventHeader\": {\n" + + " \"domain\": \"pnfRegistration\",\n" + + " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + + " \"eventName\": \"pnfRegistration_EventType5G\",\n" + + " \"eventType\": \"EventType5G\",\n" + + " \"sequence\": 0,\n" + + " \"priority\": \"Low\",\n" + + " \"reportingEntityId\": \"\",\n" + + " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + + " \"sourceId\": \"\",\n" + + " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + + " \"startEpochMicrosec\": 1571300004203,\n" + + " \"lastEpochMicrosec\": 1571300004203,\n" + + " \"nfNamingCode\": \"1234\",\n" + + " \"nfVendorName\": \"VENDORA\",\n" + + " \"timeZoneOffset\": \"+00:00\",\n" + + " \"version\": \"4.0.1\",\n" + + " \"vesEventListenerVersion\":\"7.0.1\"\n" + + " },\n" + + " \"pnfRegistrationFields\": {\n" + + " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + " \"additionalFields\": \n" + " { \n" + " \"protocol\":\"SSH\",\n"+ @@ -122,46 +119,46 @@ public class TestDMaaPPNFRegVESMsgConsumer extends DMaaPPNFRegVESMsgConsumer { " \"username\":\"netconf\",\n" + " \"tcpOnly\":\"false\"\n" + " },\n" + - " \"lastServiceDate\":\"2019-08-16\",\n" + - " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + - " \"manufactureDate\":\"2019-08-16\",\n" + - " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + - " \"oamV4IpAddress\": \"10.10.10.11\",\n" + + " \"lastServiceDate\":\"2019-08-16\",\n" + + " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + + " \"manufactureDate\":\"2019-08-16\",\n" + + " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + + " \"oamV4IpAddress\": \"10.10.10.11\",\n" + " \"oamPort\":\"17380\",\n" + - " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + - " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + - " \"softwareVersion\": \"2.3.5\",\n" + - " \"unitFamily\": \"VENDORA-1234\",\n" + - " \"unitType\": \"1234\",\n" + - " \"vendorName\": \"VENDORA\"\n" + - " }\n" + - " }\n" + - "}\n" + + " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + + " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + + " \"softwareVersion\": \"2.3.5\",\n" + + " \"unitFamily\": \"VENDORA-1234\",\n" + + " \"unitType\": \"1234\",\n" + + " \"vendorName\": \"VENDORA\"\n" + + " }\n" + + " }\n" + + "}\n" + ""; - private static final String pnfRegMsg_OTHER = "{\n" + - " \"event\": {\n" + - " \"commonEventHeader\": {\n" + - " \"domain\": \"pnfRegistration\",\n" + - " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + - " \"eventName\": \"pnfRegistration_EventType5G\",\n" + - " \"eventType\": \"EventType5G\",\n" + - " \"sequence\": 0,\n" + - " \"priority\": \"Low\",\n" + - " \"reportingEntityId\": \"\",\n" + - " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + - " \"sourceId\": \"\",\n" + - " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + - " \"startEpochMicrosec\": 1571300004203,\n" + - " \"lastEpochMicrosec\": 1571300004203,\n" + - " \"nfNamingCode\": \"1234\",\n" + - " \"nfVendorName\": \"VENDORA\",\n" + - " \"timeZoneOffset\": \"+00:00\",\n" + - " \"version\": \"4.0.1\",\n" + - " \"vesEventListenerVersion\":\"7.0.1\"\n" + - " },\n" + - " \"pnfRegistrationFields\": {\n" + - " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + + private static final String pnfRegMsg_OTHER = "{\n" + + " \"event\": {\n" + + " \"commonEventHeader\": {\n" + + " \"domain\": \"pnfRegistration\",\n" + + " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + + " \"eventName\": \"pnfRegistration_EventType5G\",\n" + + " \"eventType\": \"EventType5G\",\n" + + " \"sequence\": 0,\n" + + " \"priority\": \"Low\",\n" + + " \"reportingEntityId\": \"\",\n" + + " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + + " \"sourceId\": \"\",\n" + + " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + + " \"startEpochMicrosec\": 1571300004203,\n" + + " \"lastEpochMicrosec\": 1571300004203,\n" + + " \"nfNamingCode\": \"1234\",\n" + + " \"nfVendorName\": \"VENDORA\",\n" + + " \"timeZoneOffset\": \"+00:00\",\n" + + " \"version\": \"4.0.1\",\n" + + " \"vesEventListenerVersion\":\"7.0.1\"\n" + + " },\n" + + " \"pnfRegistrationFields\": {\n" + + " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + " \"additionalFields\": \n" + " { \n" + " \"protocol\":\"OTHER\",\n"+ @@ -176,92 +173,92 @@ public class TestDMaaPPNFRegVESMsgConsumer extends DMaaPPNFRegVESMsgConsumer { " \"username\":\"netconf\",\n" + " \"tcpOnly\":\"false\"\n" + " },\n" + - " \"lastServiceDate\":\"2019-08-16\",\n" + - " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + - " \"manufactureDate\":\"2019-08-16\",\n" + - " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + - " \"oamV4IpAddress\": \"10.10.10.11\",\n" + + " \"lastServiceDate\":\"2019-08-16\",\n" + + " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + + " \"manufactureDate\":\"2019-08-16\",\n" + + " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + + " \"oamV4IpAddress\": \"10.10.10.11\",\n" + " \"oamPort\":\"17380\",\n" + - " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + - " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + - " \"softwareVersion\": \"2.3.5\",\n" + - " \"unitFamily\": \"VENDORA-1234\",\n" + - " \"unitType\": \"1234\",\n" + - " \"vendorName\": \"VENDORA\"\n" + - " }\n" + - " }\n" + - "}\n" + + " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + + " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + + " \"softwareVersion\": \"2.3.5\",\n" + + " \"unitFamily\": \"VENDORA-1234\",\n" + + " \"unitType\": \"1234\",\n" + + " \"vendorName\": \"VENDORA\"\n" + + " }\n" + + " }\n" + + "}\n" + ""; - private static final String pnfRegMsg = "{\n" + - " \"event\": {\n" + - " \"commonEventHeader\": {\n" + - " \"domain\": \"pnfRegistration\",\n" + - " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + - " \"eventName\": \"pnfRegistration_EventType5G\",\n" + - " \"eventType\": \"EventType5G\",\n" + - " \"sequence\": 0,\n" + - " \"priority\": \"Low\",\n" + - " \"reportingEntityId\": \"\",\n" + - " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + - " \"sourceId\": \"\",\n" + - " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + - " \"startEpochMicrosec\": 1571300004203,\n" + - " \"lastEpochMicrosec\": 1571300004203,\n" + - " \"nfNamingCode\": \"1234\",\n" + - " \"nfVendorName\": \"VENDORA\",\n" + - " \"timeZoneOffset\": \"+00:00\",\n" + - " \"version\": \"4.0.1\",\n" + - " \"vesEventListenerVersion\":\"7.0.1\"\n" + - " },\n" + - " \"pnfRegistrationFields\": {\n" + - " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + - " \"lastServiceDate\":\"2019-08-16\",\n" + - " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + - " \"manufactureDate\":\"2019-08-16\",\n" + - " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + - " \"oamV4IpAddress\": \"10.10.10.11\",\n" + + private static final String pnfRegMsg = "{\n" + + " \"event\": {\n" + + " \"commonEventHeader\": {\n" + + " \"domain\": \"pnfRegistration\",\n" + + " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + + " \"eventName\": \"pnfRegistration_EventType5G\",\n" + + " \"eventType\": \"EventType5G\",\n" + + " \"sequence\": 0,\n" + + " \"priority\": \"Low\",\n" + + " \"reportingEntityId\": \"\",\n" + + " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + + " \"sourceId\": \"\",\n" + + " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + + " \"startEpochMicrosec\": 1571300004203,\n" + + " \"lastEpochMicrosec\": 1571300004203,\n" + + " \"nfNamingCode\": \"1234\",\n" + + " \"nfVendorName\": \"VENDORA\",\n" + + " \"timeZoneOffset\": \"+00:00\",\n" + + " \"version\": \"4.0.1\",\n" + + " \"vesEventListenerVersion\":\"7.0.1\"\n" + + " },\n" + + " \"pnfRegistrationFields\": {\n" + + " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + + " \"lastServiceDate\":\"2019-08-16\",\n" + + " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + + " \"manufactureDate\":\"2019-08-16\",\n" + + " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + + " \"oamV4IpAddress\": \"10.10.10.11\",\n" + " \"oamPort\":\"17380\",\n" + - " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + - " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + - " \"softwareVersion\": \"2.3.5\",\n" + - " \"unitFamily\": \"VENDORA-1234\",\n" + - " \"unitType\": \"1234\",\n" + - " \"vendorName\": \"VENDORA\"\n" + - " }\n" + - " }\n" + - "}\n" + + " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + + " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + + " \"softwareVersion\": \"2.3.5\",\n" + + " \"unitFamily\": \"VENDORA-1234\",\n" + + " \"unitType\": \"1234\",\n" + + " \"vendorName\": \"VENDORA\"\n" + + " }\n" + + " }\n" + + "}\n" + ""; - + @Test public void processMsgTest() { - + DMaaPPNFRegVESMsgConsumer pnfRegMsgConsumer = new TestDMaaPPNFRegVESMsgConsumer(); try { pnfRegMsgConsumer.processMsg(pnfRegMsg); pnfRegMsgConsumer.processMsg(pnfRegMsg_SSH); pnfRegMsgConsumer.processMsg(pnfRegMsg_TLS); - pnfRegMsgConsumer.processMsg(pnfRegMsg_OTHER); + pnfRegMsgConsumer.processMsg(pnfRegMsg_OTHER); } catch (Exception e) { e.printStackTrace(); System.out.println("Exception while processing PNF Registration Message - "+e.getMessage()); } } - + @Override public PNFMountPointClient getPNFMountPointClient(String baseUrl) { return new TestPNFMountPointClient(); } - + @Override public String getSDNRUser() { return DEFAULT_SDNRUSER; } - + @Override public String getSDNRPasswd() { return DEFAULT_SDNRPASSWD; } - + @Override public String getBaseUrl() { return DEFAULT_SDNRBASEURL; diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java index aefeddb0d..774ca2085 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java @@ -18,7 +18,7 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import java.io.File; import java.nio.charset.StandardCharsets; @@ -27,7 +27,6 @@ import java.util.List; import java.util.Map; import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration; import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java index e8573e4e7..73cd5aaba 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java @@ -18,7 +18,7 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; @@ -28,7 +28,6 @@ import org.junit.After; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultConfig; -import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFRegistrationConfig; import com.google.common.io.Files; @@ -37,6 +36,9 @@ public class TestFaultConfig { private static final String TESTCONFIG_CONTENT="[fault]\n" + "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer\n" + "TransportType=HTTPNOAUTH\n" + + "Protocol=http\n" + + "username=username\n" + + "password=password\n" + "host=onap-dmap:3904\n" + "topic=unauthenticated.SEC_FAULT_OUTPUT\n" + "contenttype=application/json\n" + @@ -67,6 +69,9 @@ public class TestFaultConfig { assertEquals("20000", faultCfg.getTimeout()); assertEquals("10000", faultCfg.getLimit()); assertEquals("5000", faultCfg.getFetchPause()); + assertEquals("http", faultCfg.getProtocol()); + assertEquals("username", faultCfg.getUsername()); + assertEquals("password", faultCfg.getPassword()); } catch (IOException e) { // TODO Auto-generated catch block diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java index 68bcb5ee4..b09b54f7e 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java @@ -18,7 +18,7 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.IOException; import java.util.Map; diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java index 9790a9ccc..3259f2e4c 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java @@ -17,14 +17,16 @@ ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Optional; + import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInputBuilder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + public class TestMapping { private final ObjectMapper mapper = new ObjectMapper(); diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java index b048c201c..af47f3d33 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java @@ -28,29 +28,16 @@ import java.nio.file.Path; import java.nio.file.Paths; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.MountpointRegistrarImpl; -import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.ClusterSingletonServiceProviderMock; -import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.DataBrokerNetconfMock; -import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.MountPointServiceMock; -import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.NotificationPublishServiceMock; -import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.RpcProviderRegistryMock; -import org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@SuppressWarnings("deprecation") public class TestMountpointRegistrarImpl { private static Path KARAF_ETC = Paths.get("etc"); private static MountpointRegistrarImpl mountpointRegistrar; - private static DataBrokerNetconfMock dataBrokerNetconf; private static final Logger LOG = LoggerFactory.getLogger(TestMountpointRegistrarImpl.class); @@ -68,21 +55,10 @@ public class TestMountpointRegistrarImpl { Files.createDirectories(etc); // Create mocks - dataBrokerNetconf = new DataBrokerNetconfMock(); - ClusterSingletonServiceProvider clusterSingletonService = new ClusterSingletonServiceProviderMock(); - MountPointService mountPointService = new MountPointServiceMock(null); - NotificationPublishService notificationPublishService = new NotificationPublishServiceMock(); - RpcProviderRegistry rpcProviderRegistry = new RpcProviderRegistryMock(); // start using blueprint interface try { mountpointRegistrar = new MountpointRegistrarImpl(); - - mountpointRegistrar.setDataBroker(dataBrokerNetconf); - mountpointRegistrar.setMountPointService(mountPointService); - mountpointRegistrar.setNotificationPublishService(notificationPublishService); - mountpointRegistrar.setRpcProviderRegistry(rpcProviderRegistry); - mountpointRegistrar.setClusterSingletonService(clusterSingletonService); mountpointRegistrar.init(); } catch (Exception e) { StringWriter sw = new StringWriter(); diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java index ca61d9c1c..5a68e15bc 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java @@ -18,7 +18,7 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.IOException; import java.util.Map; diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerMountpointMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerMountpointMock.java deleted file mode 100644 index a2e115d59..000000000 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerMountpointMock.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi; - -import org.opendaylight.controller.md.sal.binding.api.BindingService; -import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class DataBrokerMountpointMock implements DataBroker, BindingService { - - ReadOnlyTransaction readOnlyTransaction; - - public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) { - this.readOnlyTransaction = readOnlyTransaction; - } - - @Override - public > ListenerRegistration registerDataTreeChangeListener( - DataTreeIdentifier arg0, L arg1) { - return null; - } - - @Override - public BindingTransactionChain createTransactionChain(TransactionChainListener listener) { - return null; - } - - @Override - public ReadOnlyTransaction newReadOnlyTransaction() { - return readOnlyTransaction; - } - - @Override - public ReadWriteTransaction newReadWriteTransaction() { - return null; - } - - @Override - public WriteTransaction newWriteOnlyTransaction() { - return null; - } - - - -} diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerNetconfMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerNetconfMock.java deleted file mode 100644 index e504ef166..000000000 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerNetconfMock.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi; - -import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class DataBrokerNetconfMock implements DataBroker { - - - ReadOnlyTransaction readOnlyTransaction; - - public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) { - this.readOnlyTransaction = readOnlyTransaction; - } - - @Override - public > ListenerRegistration registerDataTreeChangeListener( - DataTreeIdentifier arg0, L arg1) { - return null; - } - - @Override - public BindingTransactionChain createTransactionChain(TransactionChainListener listener) { - return null; - } - - @Override - public ReadOnlyTransaction newReadOnlyTransaction() { - return readOnlyTransaction; - } - - @Override - public ReadWriteTransaction newReadWriteTransaction() { - return null; - } - - @Override - public WriteTransaction newWriteOnlyTransaction() { - return null; - } - - -} diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointMock.java deleted file mode 100644 index 1a7cc50a5..000000000 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointMock.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi; - -import com.google.common.base.Optional; -import org.opendaylight.controller.md.sal.binding.api.BindingService; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class MountPointMock implements MountPoint { - - private boolean databrokerAbsent = true; - private final DataBrokerMountpointMock dataBroker = new DataBrokerMountpointMock(); - private final RpcConsumerRegistryMock rpcConsumerRegistry = new RpcConsumerRegistryMock(); - private NotificationService setReadOnlyTransaction; - - private static final InstanceIdentifier NETCONF_TOPO_IID = - InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, - new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName()))); - - @Override - public InstanceIdentifier getIdentifier() { - return NETCONF_TOPO_IID; - } - - @SuppressWarnings("unchecked") - @Override - public Optional getService(Class service) { - - System.out.println("Requested mountpoint service: "+service.getSimpleName()+" databrokerAbsent state: "+databrokerAbsent); - - Optional res; - if (service.isInstance(dataBroker)) { - System.out.println("Delivering databroker"); - res = databrokerAbsent ? Optional.absent() : Optional.of(dataBroker); - } else if (service.isInstance(rpcConsumerRegistry)) { - System.out.println("Delivering RpcConsumerRegistryMock"); - res = Optional.of(rpcConsumerRegistry); - } else if (service.isInstance(setReadOnlyTransaction)) { - System.out.println("Delivering notificationService"); - res = Optional.of(setReadOnlyTransaction); - } else { - System.out.println("Delivering no service"); - res = Optional.absent(); - } - return (Optional)res; - } - - public void setDatabrokerAbsent( boolean state) { - this.databrokerAbsent = state; - } - - public void setReadOnlyTransaction(T readOnlyTransaction) { - this.setReadOnlyTransaction = readOnlyTransaction; - dataBroker.setReadOnlyTransaction(readOnlyTransaction); - } - - -} diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointServiceMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointServiceMock.java deleted file mode 100644 index 433324737..000000000 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointServiceMock.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi; - -import com.google.common.base.Optional; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class MountPointServiceMock implements MountPointService { - - private final MountPointMock mountpoint; - - public MountPointServiceMock(MountPointMock mountpoint) { - this.mountpoint = mountpoint; - } - - @Override - public Optional getMountPoint(InstanceIdentifier mountPoint) { - - Optional optional = Optional.of(mountpoint); - return optional; - } - - @Override - public ListenerRegistration registerListener(InstanceIdentifier path, - T listener) { - return null; - } - -} diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/NotificationPublishServiceMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/NotificationPublishServiceMock.java deleted file mode 100644 index cf4ab0e9b..000000000 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/NotificationPublishServiceMock.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi; - -import com.google.common.util.concurrent.ListenableFuture; -import java.util.concurrent.TimeUnit; -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.yangtools.yang.binding.Notification; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class NotificationPublishServiceMock implements NotificationPublishService { - - @Override - public ListenableFuture offerNotification(Notification notification) { - return null; - } - - @Override - public ListenableFuture offerNotification(Notification notification, int timeout, TimeUnit unit) - throws InterruptedException { - return null; - } - - @Override - public void putNotification(Notification notification) throws InterruptedException { - } - -} diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcConsumerRegistryMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcConsumerRegistryMock.java deleted file mode 100644 index a33012b8b..000000000 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcConsumerRegistryMock.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi; - -import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; -import org.opendaylight.yangtools.yang.binding.RpcService; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class RpcConsumerRegistryMock implements RpcConsumerRegistry { - - @Override - public T getRpcService(Class serviceInterface) { - return null; - } - -} diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcProviderRegistryMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcProviderRegistryMock.java deleted file mode 100644 index 7d556df98..000000000 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcProviderRegistryMock.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi; - -import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.RpcService; - -@SuppressWarnings("deprecation") -public class RpcProviderRegistryMock implements RpcProviderRegistry { - - @Override - public T getRpcService(Class serviceInterface) { - return null; - } - - @Override - public >> ListenerRegistration registerRouteChangeListener( - L listener) { - return null; - } - - - @Override - public RoutedRpcRegistration addRoutedRpcImplementation(Class serviceInterface, - T implementation) throws IllegalStateException { - return null; - } - - @Override - public RpcRegistration addRpcImplementation(Class serviceInterface, T implementation) - throws IllegalStateException { - System.out.println("Register class "+serviceInterface); - return null; - } - -} -- cgit 1.2.3-korg