Modify port
authoryoubowu <wu.youbo@zte.com.cn>
Thu, 9 Mar 2017 11:20:43 +0000 (19:20 +0800)
committer6092002067 <wu.youbo@zte.com.cn>
Thu, 9 Mar 2017 11:20:43 +0000 (19:20 +0800)
Issue-ID: HOLMES-50

Change-Id: I872a0def568da1be5d98b042b932f13e02c5f3df
Signed-off-by: youbowu <wu.youbo@zte.com.cn>
holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java
holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java
holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java

index ba55562..9c6ab3c 100644 (file)
  */\r
 package org.openo.holmes.common.config;\r
 \r
+import org.openo.holmes.common.constant.AlarmConst;\r
+\r
 public class MicroServiceConfig {\r
 \r
-  private static String getProperty(String name) {\r
-    String value = System.getenv(name);\r
-    if (value == null) {\r
-      value = System.getProperty(name);\r
+    private static String getProperty(String name) {\r
+        String value = System.getenv(name);\r
+        if (value == null) {\r
+            value = System.getProperty(name);\r
+        }\r
+        return value;\r
     }\r
-    return value;\r
-  }\r
 \r
-  public static String getMsbServerAddr() {\r
-    return getProperty("MSB_ADDR");\r
-  }\r
+    public static String getMsbServerAddr() {\r
+        return getProperty("MSB_ADDR") + ":" + AlarmConst.MICRO_SERVICE_PORT;\r
+    }\r
 \r
-  public static String getServiceIp() {\r
-    return getProperty("SERVICE_IP");\r
-  }\r
+    public static String getServiceIp() {\r
+        return getProperty("SERVICE_IP");\r
+    }\r
 \r
 }\r
index 3894bf3..40e15eb 100644 (file)
@@ -34,4 +34,6 @@ public interface AlarmConst {
     String ADMIN = "admin";\r
 \r
     int MICRO_SERVICE_STATUS_SUCCESS = 201;\r
+\r
+    int MICRO_SERVICE_PORT = 8086;\r
 }\r
index 826fbd0..5e806e4 100644 (file)
@@ -41,7 +41,7 @@ public class MSBRegisterUtil {
             ObjectMapper mapper = new ObjectMapper();\r
             String content = mapper.writeValueAsString(entity);\r
             HttpPost httpPost = new HttpPost("http://" + MicroServiceConfig.getMsbServerAddr()\r
-                    + ":8086/api/microservices/v1/services?createOrUpdate=false");\r
+                    + "/api/microservices/v1/services?createOrUpdate=false");\r
             if (StringUtils.isNotEmpty(content)) {\r
                 httpPost.setEntity(new ByteArrayEntity(content.getBytes()));\r
             }\r