summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/main
diff options
context:
space:
mode:
author6092002067 <wu.youbo@zte.com.cn>2017-03-14 19:36:20 +0800
committer6092002067 <wu.youbo@zte.com.cn>2017-03-14 19:36:20 +0800
commit68d0b52af532f4cde355b642593e76cf737aeb21 (patch)
tree001111a6823f2c29ab1cb3430cb0c9909c989157 /holmes-actions/src/main
parent29bf80d11209d1c4294cd0738f288e65f1be4a41 (diff)
Add UT for actions
Change-Id: Ic2dd7c4326111d9d3b8565a6b7e83b4f46bc197d Issue-ID: HOLMES-50 Signed-off-by: youbowu <wu.youbo@zte.com.cn>
Diffstat (limited to 'holmes-actions/src/main')
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java5
-rw-r--r--holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java8
2 files changed, 7 insertions, 6 deletions
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java b/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java
index eb9deef..c8e03e9 100644
--- a/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java
+++ b/holmes-actions/src/main/java/org/openo/holmes/common/msb/MicroserviceBusRest.java
@@ -26,10 +26,11 @@ import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
@Path("/openoapi/microservices/v1/services")
public interface MicroserviceBusRest {
+
@Path("")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- public ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate,
- ServiceRegisterEntity entity) throws Exception;
+ ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate,
+ ServiceRegisterEntity entity);
}
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 91e28a6..f7825e7 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
@@ -35,7 +35,7 @@ public class MSBRegisterUtil {
while (!flag && retry < 20) {
log.info("Holmes microservice register. retry:" + retry);
retry++;
- flag = inner_register(entity);
+ flag = innerRegister(entity);
if (!flag) {
log.warn("micro service register failed, sleep 30S and try again.");
threadSleep(30000);
@@ -47,7 +47,7 @@ public class MSBRegisterUtil {
log.info("holmes micro service register end.");
}
- private boolean inner_register(ServiceRegisterEntity entity) {
+ private boolean innerRegister(ServiceRegisterEntity entity) {
try {
log.info("msbServerAddr:" + MicroServiceConfig.getMsbServerAddr());
log.info("entity:" + entity);
@@ -55,7 +55,7 @@ public class MSBRegisterUtil {
MicroServiceConfig.getMsbServerAddr(), MicroserviceBusRest.class);
resourceserviceproxy.registerServce("false", entity);
} catch (Exception error) {
- log.error("microservice register failed!" + error.getMessage());
+ log.error("microservice register failed!" + error.getMessage(), error);
return false;
}
return true;
@@ -66,7 +66,7 @@ public class MSBRegisterUtil {
try {
Thread.sleep(second);
} catch (InterruptedException error) {
- log.error("thread sleep error.errorMsg:" + error.getMessage());
+ log.error("thread sleep error.errorMsg:" + error.getMessage(), error);
}
log.info("sleep end .");
}