Fixed MSB Registration Failure
[holmes/common.git] / holmes-actions / src / test / java / org / onap / holmes / common / config / MicroServiceConfigTest.java
index a87ba67..fbc22e5 100644 (file)
@@ -43,23 +43,27 @@ public class MicroServiceConfigTest {
 \r
     @Test\r
     public void getMsbServerAddrTest() {\r
-        System.setProperty(MSB_ADDR, "test:80");\r
-        assertThat("http://test:80", equalTo(getMsbServerAddrWithHttpPrefix()));\r
-        System.clearProperty(MicroServiceConfig.MSB_ADDR);\r
+        System.setProperty(MSB_IAG_SERVICE_HOST, "test");\r
+        System.setProperty(MSB_IAG_SERVICE_PORT, "443");\r
+        assertThat("http://test:443", equalTo(getMsbServerAddrWithHttpPrefix()));\r
+        System.clearProperty(MicroServiceConfig.MSB_IAG_SERVICE_PORT);\r
+        System.clearProperty(MicroServiceConfig.MSB_IAG_SERVICE_HOST);\r
     }\r
 \r
     @Test\r
     public void getMsbServerIpTest() {\r
-        System.setProperty(MSB_ADDR, "10.54.23.79:80");\r
+        System.setProperty(MSB_IAG_SERVICE_HOST, "10.54.23.79");\r
+        System.setProperty(MSB_IAG_SERVICE_PORT, "443");\r
         System.setProperty(HOSTNAME, "rule-mgmt");\r
         PowerMock.mockStaticPartial(MicroServiceConfig.class, "getServiceConfigInfoFromCBS", String.class);\r
         EasyMock.expect(MicroServiceConfig.getServiceConfigInfoFromCBS(System.getProperty(HOSTNAME)))\r
-                .andReturn("{\"msb.hostname\": \"10.54.23.79:80\"}").times(2);\r
+                .andReturn("{\"msb.hostname\": \"10.54.23.79:443\"}").times(2);\r
         PowerMock.replayAll();\r
         assertThat("10.54.23.79", equalTo(getMsbIpAndPort()[0]));\r
-        assertThat("80", equalTo(getMsbIpAndPort()[1]));\r
+        assertThat("443", equalTo(getMsbIpAndPort()[1]));\r
         System.clearProperty(MicroServiceConfig.HOSTNAME);\r
-        System.clearProperty(MSB_ADDR);\r
+        System.clearProperty(MicroServiceConfig.MSB_IAG_SERVICE_PORT);\r
+        System.clearProperty(MicroServiceConfig.MSB_IAG_SERVICE_HOST);\r
     }\r
 \r
     @Test\r
@@ -159,7 +163,8 @@ public class MicroServiceConfigTest {
 \r
     @Ignore\r
     public void getMsbAddrInfo_msb_registered() throws Exception {\r
-        System.setProperty(MSB_ADDR, "10.74.5.8:1545");\r
+        System.setProperty(MSB_IAG_SERVICE_HOST, "10.74.5.8");\r
+        System.setProperty(MSB_IAG_SERVICE_PORT, "1545");\r
         System.setProperty(HOSTNAME, "rule-mgmt");\r
         PowerMock.mockStaticPartial(MicroServiceConfig.class, "getServiceConfigInfoFromCBS", String.class);\r
         EasyMock.expect(MicroServiceConfig.getServiceConfigInfoFromCBS(System.getProperty(HOSTNAME)))\r
@@ -173,12 +178,14 @@ public class MicroServiceConfigTest {
         assertThat(msbInfo[1], equalTo("5432"));\r
 \r
         System.clearProperty(HOSTNAME);\r
-        System.clearProperty(MSB_ADDR);\r
+        System.clearProperty(MSB_IAG_SERVICE_PORT);\r
+        System.clearProperty(MSB_IAG_SERVICE_HOST);\r
     }\r
 \r
     @Ignore\r
     public void getMsbAddrInfo_msb_not_registered() throws Exception {\r
-        System.setProperty(MSB_ADDR, "10.74.5.8:1545");\r
+        System.setProperty(MSB_IAG_SERVICE_HOST, "10.74.5.8");\r
+        System.setProperty(MSB_IAG_SERVICE_PORT, "1545");\r
         System.setProperty(HOSTNAME, "rule-mgmt");\r
         PowerMock.mockStaticPartial(MicroServiceConfig.class, "getServiceConfigInfoFromCBS", String.class);\r
         EasyMock.expect(MicroServiceConfig.getServiceConfigInfoFromCBS(System.getProperty(HOSTNAME)))\r
@@ -192,7 +199,8 @@ public class MicroServiceConfigTest {
         assertThat(msbInfo[1], equalTo("1545"));\r
 \r
         System.clearProperty(HOSTNAME);\r
-        System.clearProperty(MSB_ADDR);\r
+        System.clearProperty(MSB_IAG_SERVICE_PORT);\r
+        System.clearProperty(MSB_IAG_SERVICE_HOST);\r
     }\r
 \r
     @Test\r
@@ -249,7 +257,7 @@ public class MicroServiceConfigTest {
         assertThat(msbInfo[0], equalTo(ip));\r
         assertThat(msbInfo[1], equalTo(port));\r
 \r
-        System.clearProperty(MSB_ADDR);\r
+        System.clearProperty(HOSTNAME);\r
     }\r
 \r
     @Test\r
@@ -268,7 +276,7 @@ public class MicroServiceConfigTest {
         assertThat(msbInfo[0], equalTo(ip));\r
         assertThat(msbInfo[1], equalTo("80"));\r
 \r
-        System.clearProperty(MSB_ADDR);\r
+        System.clearProperty(HOSTNAME);\r
     }\r
 \r
     @Test\r
@@ -287,7 +295,7 @@ public class MicroServiceConfigTest {
         assertThat(msbInfo[0], equalTo(ip));\r
         assertThat(msbInfo[1], equalTo("80"));\r
 \r
-        System.clearProperty(MSB_ADDR);\r
+        System.clearProperty(HOSTNAME);\r
     }\r
 \r
     @Test\r
@@ -307,7 +315,7 @@ public class MicroServiceConfigTest {
         assertThat(msbInfo[0], equalTo(ip));\r
         assertThat(msbInfo[1], equalTo(port));\r
 \r
-        System.clearProperty(MSB_ADDR);\r
+        System.clearProperty(HOSTNAME);\r
     }\r
 \r
     @Test\r
@@ -342,7 +350,7 @@ public class MicroServiceConfigTest {
 \r
     @Test\r
     public void isValidIpAddress_invalid_ip_with_port() throws Exception {\r
-        boolean res = WhiteboxImpl.invokeMethod(MicroServiceConfig.class, "isIpAddress", "holmes-rule-mgmt:80");\r
+        boolean res = WhiteboxImpl.invokeMethod(MicroServiceConfig.class, "isIpAddress", "holmes-rule-mgmt:443");\r
         assertThat(res, is(false));\r
     }\r
 \r
@@ -354,7 +362,7 @@ public class MicroServiceConfigTest {
 \r
     @Test\r
     public void isValidIpAddress_invalid_ip_with_port_with_https_prefix() throws Exception {\r
-        boolean res = WhiteboxImpl.invokeMethod(MicroServiceConfig.class, "isIpAddress", "https://holmes-rule-mgmt:80");\r
+        boolean res = WhiteboxImpl.invokeMethod(MicroServiceConfig.class, "isIpAddress", "https://holmes-rule-mgmt:443");\r
         assertThat(res, is(false));\r
     }\r
 }
\ No newline at end of file