Return-Path: X-Original-To: apmail-falcon-commits-archive@minotaur.apache.org Delivered-To: apmail-falcon-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 32B8018A19 for ; Tue, 21 Jul 2015 12:14:45 +0000 (UTC) Received: (qmail 18519 invoked by uid 500); 21 Jul 2015 12:14:44 -0000 Delivered-To: apmail-falcon-commits-archive@falcon.apache.org Received: (qmail 18476 invoked by uid 500); 21 Jul 2015 12:14:44 -0000 Mailing-List: contact commits-help@falcon.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@falcon.apache.org Delivered-To: mailing list commits@falcon.apache.org Received: (qmail 18466 invoked by uid 99); 21 Jul 2015 12:14:44 -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; Tue, 21 Jul 2015 12:14:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9FE11DFFD5; Tue, 21 Jul 2015 12:14:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ajayyadava@apache.org To: commits@falcon.apache.org Message-Id: <83adae71ca9d458e9d0f779d6d3db2f8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: falcon git commit: FALCON-1320 Adding equals() and hashCode() method in LineageGraphResult.Edge. Contributed by Pragya Mittal Date: Tue, 21 Jul 2015 12:14:44 +0000 (UTC) Repository: falcon Updated Branches: refs/heads/master 5b4cf24b7 -> 281e9e34b FALCON-1320 Adding equals() and hashCode() method in LineageGraphResult.Edge. Contributed by Pragya Mittal Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/281e9e34 Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/281e9e34 Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/281e9e34 Branch: refs/heads/master Commit: 281e9e34bdfb2f645fff20b5bc89e06d6e18d1e0 Parents: 5b4cf24 Author: Ajay Yadava Authored: Tue Jul 21 17:44:21 2015 +0530 Committer: Ajay Yadava Committed: Tue Jul 21 17:44:21 2015 +0530 ---------------------------------------------------------------------- CHANGES.txt | 2 + .../falcon/resource/LineageGraphResult.java | 26 ++++++++++ .../falcon/resource/LineageGraphResultTest.java | 50 ++++++++++++++++++++ 3 files changed, 78 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/281e9e34/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 5723867..0c8e31a 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -9,6 +9,8 @@ Trunk (Unreleased) FALCON-796 Enable users to triage data processing issues through falcon (Ajay Yadava) IMPROVEMENTS + FALCON-1320 Adding equals() and hashCode() method in LineageGraphResult.Edge(Pragya Mittal via Ajay Yadava) + FALCON-1139 Validation issues in Falcon UI(Pallavi Rao via Ajay Yadava) FALCON-1204 Expose default configs for feed late data handling in runtime.properties(Balu Vellanki via Ajay Yadava) http://git-wip-us.apache.org/repos/asf/falcon/blob/281e9e34/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java ---------------------------------------------------------------------- diff --git a/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java b/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java index 0e20b7e..0e10e38 100644 --- a/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java +++ b/client/src/main/java/org/apache/falcon/resource/LineageGraphResult.java @@ -118,6 +118,32 @@ public class LineageGraphResult { return getDotNotation(); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + Edge that = (Edge) o; + if (StringUtils.equals(that.getLabel(), label) && StringUtils.equals(that.getFrom(), from) + && StringUtils.equals(that.getTo(), to)) { + return true; + } + return false; + } + + @Override + public int hashCode() { + int result = from != null ? from.hashCode() : 0; + result = 31 * result + (to != null ? to.hashCode() : 0); + result = 31 * result + (label != null ? label.hashCode() : 0); + return result; + } + } http://git-wip-us.apache.org/repos/asf/falcon/blob/281e9e34/client/src/test/java/org/apache/falcon/resource/LineageGraphResultTest.java ---------------------------------------------------------------------- diff --git a/client/src/test/java/org/apache/falcon/resource/LineageGraphResultTest.java b/client/src/test/java/org/apache/falcon/resource/LineageGraphResultTest.java new file mode 100644 index 0000000..058d097 --- /dev/null +++ b/client/src/test/java/org/apache/falcon/resource/LineageGraphResultTest.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.falcon.resource; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Test frequency. + */ +@Test +public class LineageGraphResultTest { + + @Test + public void testEquals() { + Set set1 = new HashSet<>(); + Set set2 = new HashSet<>(); + + List from = Arrays.asList(new String[]{"from1", "from2", "from3"}); + List to = Arrays.asList(new String[]{"to1", "to2", "to3"}); + List label = Arrays.asList(new String[]{"label1", "label2", "label3"}); + + for (int i = 0; i < 3; i++) { + set1.add(new LineageGraphResult.Edge(from.get(i), to.get(i), label.get(i))); + set2.add(new LineageGraphResult.Edge(from.get(i), to.get(i), label.get(i))); + } + Assert.assertEquals(set1, set2); + } +}