Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4BC5C200CCF for ; Mon, 24 Jul 2017 18:34:53 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 49EF1165640; Mon, 24 Jul 2017 16:34:53 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 38C4416564C for ; Mon, 24 Jul 2017 18:34:52 +0200 (CEST) Received: (qmail 42119 invoked by uid 500); 24 Jul 2017 16:34:51 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 42004 invoked by uid 99); 24 Jul 2017 16:34:50 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jul 2017 16:34:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6377AE96A5; Mon, 24 Jul 2017 16:34:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: heneveld@apache.org To: commits@brooklyn.apache.org Date: Mon, 24 Jul 2017 16:34:52 -0000 Message-Id: In-Reply-To: <71dd3f5b682148369f67061c74d4fcff@git.apache.org> References: <71dd3f5b682148369f67061c74d4fcff@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/5] brooklyn-server git commit: display nicer message when required child/quorum not healthy archived-at: Mon, 24 Jul 2017 16:34:53 -0000 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 Authored: Mon Jul 24 16:50:29 2017 +0100 Committer: Alex Heneveld 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 nameOfEntity(List entities) { + List 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> sensor, Object value) {