brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [4/5] brooklyn-server git commit: display nicer message when required child/quorum not healthy
Date Mon, 24 Jul 2017 16:34:52 GMT
display nicer message when required child/quorum not healthy


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/14565cd1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/14565cd1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/14565cd1

Branch: refs/heads/master
Commit: 14565cd13e74082f8e6494deff40683d51b5978e
Parents: 4d82412
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Mon Jul 24 16:50:29 2017 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Mon Jul 24 17:08:24 2017 +0100

----------------------------------------------------------------------
 .../core/entity/lifecycle/ServiceStateLogic.java    | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/14565cd1/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java
b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java
index ba08a44..0ce9169 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java
@@ -611,8 +611,20 @@ public class ServiceStateLogic {
             }
 
             return "Required entit"+Strings.ies(onesNotHealthy.size())+" not healthy: "+
-                (onesNotHealthy.size()>3 ? onesNotHealthy.get(0)+" and "+(onesNotHealthy.size()-1)+"
others"
-                    : Strings.join(onesNotHealthy, ", "));
+                (onesNotHealthy.size()>3 ? nameOfEntity(onesNotHealthy.get(0))+" and "+(onesNotHealthy.size()-1)+"
others"
+                    : Strings.join(nameOfEntity(onesNotHealthy), ", "));
+        }
+
+        private List<String> nameOfEntity(List<Entity> entities) {
+            List<String> result = MutableList.of();
+            for (Entity e: entities) result.add(nameOfEntity(e));
+            return result;
+        }
+
+        private String nameOfEntity(Entity entity) {
+            String name = entity.getDisplayName();
+            if (name.contains(entity.getId())) return name;
+            else return name + " ("+entity.getId()+")";
         }
 
         protected void updateMapSensor(AttributeSensor<Map<String, Object>> sensor,
Object value) {


Mime
View raw message