Add unit tests to increase sonar coverage
[aai/esr-server.git] / esr-mgr / src / test / java / org / onap / aai / esr / common / MsbConfigTest.java
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/common/MsbConfigTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/common/MsbConfigTest.java
new file mode 100644 (file)
index 0000000..5203ee4
--- /dev/null
@@ -0,0 +1,54 @@
+/**\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.common;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.onap.aai.esr.ExtsysAppConfiguration;\r
+\r
+public class MsbConfigTest {\r
+\r
+    @Test\r
+    public void testAllMethods(){\r
+        MsbConfig.setMsbServerAddr("msb-server");\r
+        Assert.assertEquals(MsbConfig.getMsbServerAddr(), "msb-server");\r
+\r
+        MsbConfig.setCloudInfrastructureAddr("cloud-1");\r
+        Assert.assertEquals(MsbConfig.cloudInfrastructureAddr, "cloud-1");\r
+        Assert.assertEquals(MsbConfig.getCloudInfrastructureAddr(), "msb-server/api/aai-cloudInfrastructure/v11");\r
+\r
+        MsbConfig.setExternalSystemAddr("external-addr");\r
+        Assert.assertEquals(MsbConfig.externalSystemAddr, "external-addr");\r
+        Assert.assertEquals(MsbConfig.getExternalSystemAddr(), "msb-server/api/aai-externalSystem/v11");\r
+\r
+        MsbConfig.setMultiCloudAddr("multicloud-address");\r
+        Assert.assertEquals(MsbConfig.multiCloudAddr, "multicloud-address");\r
+        Assert.assertEquals(MsbConfig.getMultiCloudAddr(), "msb-server/api/multicloud/v0");\r
+\r
+        MsbConfig.setMsbDiscoveryIp("discovery://1111");\r
+        Assert.assertEquals(MsbConfig.getMsbDiscoveryIp(), "discovery://1111");\r
+\r
+        MsbConfig.setMsbDiscoveryPort("4040");\r
+        Assert.assertEquals(MsbConfig.getMsbDiscoveryPort(), "4040");\r
+    }\r
+\r
+    @Test\r
+    public void testConfigClass(){\r
+        ExtsysAppConfiguration configur = new ExtsysAppConfiguration();\r
+        Config.setConfigration(configur);\r
+        Assert.assertEquals(Config.getConfigration(), configur);\r
+    }\r
+}\r