aboutsummaryrefslogtreecommitdiffstats
path: root/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-12-10 18:55:03 +0200
committerTal Gitelman <tg851x@intl.att.com>2017-12-10 19:33:38 +0200
commit51d50f0ef642e0f996a1c8b8d2ef4838bdfec892 (patch)
tree3ac236a864d74d19b0f5c9020891a7a7e5c31b44 /common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java
parentb5cc2e0695f195716d6ccdc65e73807a6632ec70 (diff)
Final commit to master merge from
Change-Id: Ib464f9a8828437c86fe6def8af238aaf83473507 Issue-ID: SDC-714 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java')
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java
new file mode 100644
index 0000000000..e0d5206066
--- /dev/null
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java
@@ -0,0 +1,42 @@
+package org.openecomp.sdc.common.util;
+
+import java.util.List;
+
+import org.openecomp.sdc.common.api.HealthCheckInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HealthCheckUtil {
+
+ private static Logger log = LoggerFactory.getLogger(HealthCheckUtil.class.getName());
+
+ public static boolean getAggregateStatus(List<HealthCheckInfo> healthCheckInfos) {
+
+ boolean status = true;
+
+ for (HealthCheckInfo healthCheckInfo : healthCheckInfos) {
+ if (healthCheckInfo.getHealthCheckStatus().equals(HealthCheckInfo.HealthCheckStatus.DOWN)) {
+ log.debug("Component {} is reported as DOWN - Aggregated HC will be DOWN", healthCheckInfo.getHealthCheckComponent());
+ status = false;
+ break;
+ }
+ }
+
+ return status;
+ }
+
+ public static String getAggregateDescription(List<HealthCheckInfo> healthCheckInfos, String parentDescription) {
+
+ StringBuilder sb = new StringBuilder();
+ healthCheckInfos.forEach(x -> {
+ if (x.getHealthCheckStatus() == HealthCheckInfo.HealthCheckStatus.DOWN) {
+ sb.append("Component ").append(x.getHealthCheckComponent()).append(" is Down, ");
+ }
+ });
+
+ return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : "";
+
+// return description;
+ }
+
+}