Add unit tests to increase sonar coverage
[aai/esr-server.git] / esr-mgr / src / test / java / org / onap / aai / esr / externalservice / aai / ExternalSystemProxyTest.java
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxyTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxyTest.java
new file mode 100644 (file)
index 0000000..8f7cc92
--- /dev/null
@@ -0,0 +1,98 @@
+/**\r
+ * Copyright 2016-2017 ZTE Corporation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.onap.aai.esr.externalservice.aai;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.onap.aai.esr.common.MsbConfig;\r
+import org.onap.aai.esr.entity.aai.EsrEmsDetail;\r
+import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail;\r
+import org.onap.aai.esr.entity.aai.EsrVnfmDetail;\r
+import org.onap.aai.esr.exception.ExtsysException;\r
+\r
+public class ExternalSystemProxyTest {\r
+\r
+    ExternalSystemProxy externalSystemProxy;\r
+\r
+    @Before\r
+    public void init() {\r
+        MsbConfig.setMsbServerAddr("http://msb-server");\r
+        externalSystemProxy = new ExternalSystemProxy();\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testRegisterVnfm() throws ExtsysException{\r
+        EsrVnfmDetail detail = new EsrVnfmDetail();\r
+        ExternalSystemProxy.registerVnfm("vnfm-1", detail);\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testQueryVnfmDetail() throws ExtsysException{\r
+        ExternalSystemProxy.queryVnfmDetail("vnfm-1");\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testQueryVnfmList() throws ExtsysException{\r
+        ExternalSystemProxy.queryVnfmList();\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testDeleteVnfm() throws ExtsysException{\r
+        ExternalSystemProxy.deleteVnfm("vnfm-1", "version-1");\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testRegisterSdnc() throws ExtsysException{\r
+        EsrThirdpartySdncDetail detail = new EsrThirdpartySdncDetail();\r
+        ExternalSystemProxy.registerSdnc("sdnc-1", detail);\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testQueryThirdpartySdncDetail() throws ExtsysException{\r
+        ExternalSystemProxy.queryThirdpartySdncDetail("sdnc-1");\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testQuerySdncList() throws ExtsysException{\r
+        ExternalSystemProxy.querySdncList();\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testDeleteThirdpartySdnc() throws ExtsysException{\r
+        ExternalSystemProxy.deleteThirdpartySdnc("sdnc-1", "version-1");\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testRegisterEms() throws ExtsysException{\r
+        EsrEmsDetail detail = new EsrEmsDetail();\r
+        ExternalSystemProxy.registerEms("ems-1",detail);\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testQueryEmsDetail() throws ExtsysException{\r
+        ExternalSystemProxy.queryEmsDetail("ems-1");\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testQueryEmsList() throws ExtsysException{\r
+        ExternalSystemProxy.queryEmsList();\r
+    }\r
+\r
+    @Test(expected = ExtsysException.class)\r
+    public void testDeleteEms() throws ExtsysException{\r
+        ExternalSystemProxy.deleteEms("ems-1", "version-1");\r
+    }\r
+}\r