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 61726200CBE for ; Fri, 7 Jul 2017 15:46:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5FF391691A6; Fri, 7 Jul 2017 13:46:19 +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 A607816919B for ; Fri, 7 Jul 2017 15:46:18 +0200 (CEST) Received: (qmail 92193 invoked by uid 500); 7 Jul 2017 13:46:17 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 92184 invoked by uid 99); 7 Jul 2017 13:46:17 -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; Fri, 07 Jul 2017 13:46:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9B5EADFC26; Fri, 7 Jul 2017 13:46:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ab@apache.org To: commits@lucene.apache.org Message-Id: <5c17bbe2904040dca71f0c2400998efb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: lucene-solr:jira/solr-10996: SOLR-10996 Add equals/hashCode to config beans. Date: Fri, 7 Jul 2017 13:46:17 +0000 (UTC) archived-at: Fri, 07 Jul 2017 13:46:19 -0000 Repository: lucene-solr Updated Branches: refs/heads/jira/solr-10996 2d8b22225 -> f3e277d38 SOLR-10996 Add equals/hashCode to config beans. Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f3e277d3 Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f3e277d3 Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f3e277d3 Branch: refs/heads/jira/solr-10996 Commit: f3e277d382f41236c6f4089e21ebb183df908dc6 Parents: 2d8b222 Author: Andrzej Bialecki Authored: Fri Jul 7 15:45:45 2017 +0200 Committer: Andrzej Bialecki Committed: Fri Jul 7 15:45:45 2017 +0200 ---------------------------------------------------------------------- .../cloud/autoscaling/AutoScalingConfig.java | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f3e277d3/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingConfig.java ---------------------------------------------------------------------- diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingConfig.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingConfig.java index e3176ad..407f6a2 100644 --- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingConfig.java +++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingConfig.java @@ -74,6 +74,34 @@ public class AutoScalingConfig { beforeActions = new HashSet<>(getList(AutoScalingParams.BEFORE_ACTION, properties)); afterActions = new HashSet<>(getList(AutoScalingParams.AFTER_ACTION, properties)); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + TriggerListenerConfig that = (TriggerListenerConfig) o; + + if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (trigger != null ? !trigger.equals(that.trigger) : that.trigger != null) return false; + if (!stages.equals(that.stages)) return false; + if (listenerClass != null ? !listenerClass.equals(that.listenerClass) : that.listenerClass != null) return false; + if (!beforeActions.equals(that.beforeActions)) return false; + if (!afterActions.equals(that.afterActions)) return false; + return properties.equals(that.properties); + } + + @Override + public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (trigger != null ? trigger.hashCode() : 0); + result = 31 * result + stages.hashCode(); + result = 31 * result + (listenerClass != null ? listenerClass.hashCode() : 0); + result = 31 * result + beforeActions.hashCode(); + result = 31 * result + afterActions.hashCode(); + result = 31 * result + properties.hashCode(); + return result; + } } /** @@ -90,6 +118,26 @@ public class AutoScalingConfig { this.eventType = AutoScaling.EventType.valueOf(event.toUpperCase(Locale.ROOT)); this.properties.putAll(properties); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + TriggerConfig that = (TriggerConfig) o; + + if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (eventType != that.eventType) return false; + return properties.equals(that.properties); + } + + @Override + public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + eventType.hashCode(); + result = 31 * result + properties.hashCode(); + return result; + } } public AutoScalingConfig(byte[] utf8) {