summaryrefslogtreecommitdiffstats
path: root/holmes-actions
diff options
context:
space:
mode:
authoryoubowu <wu.youbo@zte.com.cn>2017-03-09 19:20:43 +0800
committer6092002067 <wu.youbo@zte.com.cn>2017-03-09 19:20:43 +0800
commit31c419d91ab4f6b5644e1cb9c7a477038fbd3dea (patch)
tree812d1c5de3e1203d6b8fda87ca22715b03e0b3bf /holmes-actions
parentd5cf1ebde715bd1ee802deded28afecb01c496b3 (diff)
Modify port
Issue-ID: HOLMES-50 Change-Id: I872a0def568da1be5d98b042b932f13e02c5f3df Signed-off-by: youbowu <wu.youbo@zte.com.cn>
Diffstat (limited to 'holmes-actions')
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java26
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java2
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java2
3 files changed, 17 insertions, 13 deletions
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 ba55562..9c6ab3c 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
@@ -15,22 +15,24 @@
*/
package org.openo.holmes.common.config;
+import org.openo.holmes.common.constant.AlarmConst;
+
public class MicroServiceConfig {
- private static String getProperty(String name) {
- String value = System.getenv(name);
- if (value == null) {
- value = System.getProperty(name);
+ private static String getProperty(String name) {
+ String value = System.getenv(name);
+ if (value == null) {
+ value = System.getProperty(name);
+ }
+ return value;
}
- return value;
- }
- public static String getMsbServerAddr() {
- return getProperty("MSB_ADDR");
- }
+ public static String getMsbServerAddr() {
+ return getProperty("MSB_ADDR") + ":" + AlarmConst.MICRO_SERVICE_PORT;
+ }
- public static String getServiceIp() {
- return getProperty("SERVICE_IP");
- }
+ public static String getServiceIp() {
+ return getProperty("SERVICE_IP");
+ }
}
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 3894bf3..40e15eb 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
@@ -34,4 +34,6 @@ public interface AlarmConst {
String ADMIN = "admin";
int MICRO_SERVICE_STATUS_SUCCESS = 201;
+
+ int MICRO_SERVICE_PORT = 8086;
}
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 826fbd0..5e806e4 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
@@ -41,7 +41,7 @@ public class MSBRegisterUtil {
ObjectMapper mapper = new ObjectMapper();
String content = mapper.writeValueAsString(entity);
HttpPost httpPost = new HttpPost("http://" + MicroServiceConfig.getMsbServerAddr()
- + ":8086/api/microservices/v1/services?createOrUpdate=false");
+ + "/api/microservices/v1/services?createOrUpdate=false");
if (StringUtils.isNotEmpty(content)) {
httpPost.setEntity(new ByteArrayEntity(content.getBytes()));
}