From: youbowu Date: Thu, 9 Mar 2017 12:51:50 +0000 (+0800) Subject: Add the static variable HTTP X-Git-Tag: release/mercury~11^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=holmes%2Fcommon.git;a=commitdiff_plain;h=1c5dbb19bae635260fdd81615f57242c3ca85ec6 Add the static variable HTTP Issue-ID: HOLMES-50 Change-Id: I4fad7c622f4aada0657f60063f38ce3f624611a2 Signed-off-by: youbowu --- diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java b/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java index 9c6ab3c..c17ad4a 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java @@ -28,7 +28,7 @@ public class MicroServiceConfig { } public static String getMsbServerAddr() { - return getProperty("MSB_ADDR") + ":" + AlarmConst.MICRO_SERVICE_PORT; + return AlarmConst.HTTP+getProperty("MSB_ADDR") + ":" + AlarmConst.MICRO_SERVICE_PORT; } public static String getServiceIp() { diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java b/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java index 40e15eb..9e83d4c 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java @@ -36,4 +36,6 @@ public interface AlarmConst { int MICRO_SERVICE_STATUS_SUCCESS = 201; int MICRO_SERVICE_PORT = 8086; + + String HTTP = "http://"; } diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java index 5e806e4..9f66178 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java @@ -40,7 +40,7 @@ public class MSBRegisterUtil { try { ObjectMapper mapper = new ObjectMapper(); String content = mapper.writeValueAsString(entity); - HttpPost httpPost = new HttpPost("http://" + MicroServiceConfig.getMsbServerAddr() + HttpPost httpPost = new HttpPost(MicroServiceConfig.getMsbServerAddr() + "/api/microservices/v1/services?createOrUpdate=false"); if (StringUtils.isNotEmpty(content)) { httpPost.setEntity(new ByteArrayEntity(content.getBytes()));