Introduce MSB Java SDK
[holmes/common.git] / holmes-actions / src / test / java / org / onap / holmes / common / config / MicroServiceConfigTest.java
index 33431ff..b29e490 100644 (file)
@@ -18,6 +18,7 @@ package org.onap.holmes.common.config;
 \r
 import static org.hamcrest.core.IsEqual.equalTo;\r
 import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.assertTrue;\r
 \r
 import org.junit.Test;\r
 \r
@@ -30,6 +31,32 @@ public class MicroServiceConfigTest {
         System.clearProperty("MSB_ADDR");\r
     }\r
 \r
+    @Test\r
+    public void getMsbServerIpTest() {\r
+        System.setProperty("MSB_ADDR", "10.54.23.79");\r
+        assertThat("10.54.23.79", equalTo(MicroServiceConfig.getMsbServerIp()));\r
+        System.clearProperty("MSB_ADDR");\r
+    }\r
+\r
+    @Test\r
+    public void getMsbPortTest() {\r
+        System.setProperty("MSB_PORT", "110");\r
+        assertTrue(110 == MicroServiceConfig.getMsbServerPort());\r
+        System.clearProperty("MSB_PORT");\r
+    }\r
+\r
+    @Test\r
+    public void getMsbPortTestNonnumeric() {\r
+        System.setProperty("MSB_PORT", "test");\r
+        assertTrue(80 == MicroServiceConfig.getMsbServerPort());\r
+        System.clearProperty("MSB_PORT");\r
+    }\r
+\r
+    @Test\r
+    public void getMsbPortTestNullValue() {\r
+        assertTrue(80 == MicroServiceConfig.getMsbServerPort());\r
+    }\r
+\r
     @Test\r
     public void getServiceIpTest() {\r
         System.setProperty("SERVICE_IP", "test");\r