From d5cf1ebde715bd1ee802deded28afecb01c496b3 Mon Sep 17 00:00:00 2001 From: youbowu Date: Thu, 9 Mar 2017 18:22:20 +0800 Subject: [PATCH] Fix micro service status code Issue-ID:HOLMES-50 Change-Id: Ibdee9acf13c85d554a50e9c758941c9025776a04 Signed-off-by: youbowu --- .../src/main/java/org/openo/holmes/common/constant/AlarmConst.java | 2 +- .../src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) 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 2ddf78f..3894bf3 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 @@ -33,5 +33,5 @@ public interface AlarmConst { String ADMIN = "admin"; - int RESPONSE_STATUS_OK = 200; + int MICRO_SERVICE_STATUS_SUCCESS = 201; } 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 30e411f..826fbd0 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 @@ -53,14 +53,13 @@ public class MSBRegisterUtil { log.warn("Registering the service to the bus failure", e); return false; } - if (response.getStatusLine().getStatusCode() == AlarmConst.RESPONSE_STATUS_OK) { + if (response.getStatusLine().getStatusCode() == AlarmConst.MICRO_SERVICE_STATUS_SUCCESS) { log.info("Registration successful service to the bus :" + response.getEntity()); return true; } else { log.warn( "Registering the service to the bus failure:" + response.getStatusLine().getStatusCode() + " " + - response.getStatusLine().getReasonPhrase() + response.getStatusLine() - .getProtocolVersion()); + response.getStatusLine().getReasonPhrase()); return false; } } finally { -- 2.16.6