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 E0A761047C for ; Thu, 17 Oct 2013 16:24:09 +0000 (UTC) Received: (qmail 86393 invoked by uid 500); 17 Oct 2013 16:24:09 -0000 Delivered-To: apmail-falcon-commits-archive@falcon.apache.org Received: (qmail 86354 invoked by uid 500); 17 Oct 2013 16:24:07 -0000 Mailing-List: contact commits-help@falcon.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@falcon.incubator.apache.org Delivered-To: mailing list commits@falcon.incubator.apache.org Received: (qmail 86346 invoked by uid 99); 17 Oct 2013 16:24:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2013 16:24:05 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 17 Oct 2013 16:24:01 +0000 Received: (qmail 85563 invoked by uid 99); 17 Oct 2013 16:23:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2013 16:23:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1D55B917162; Thu, 17 Oct 2013 16:23:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sriksun@apache.org To: commits@falcon.incubator.apache.org Message-Id: <03f37cb4f5ce4475bbba9311239f277a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: FALCON-104 FALCON-86 introduces a backward incompatible change. Contributed by Venkatesh Seetharam Date: Thu, 17 Oct 2013 16:23:39 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Updated Branches: refs/heads/FALCON-85 39b84d73c -> fa41a1e78 FALCON-104 FALCON-86 introduces a backward incompatible change. Contributed by Venkatesh Seetharam Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/fa41a1e7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/fa41a1e7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/fa41a1e7 Branch: refs/heads/FALCON-85 Commit: fa41a1e78ff79b10f5b05dc4177b119d946dd189 Parents: 39b84d7 Author: srikanth.sundarrajan Authored: Thu Oct 17 21:53:09 2013 +0530 Committer: srikanth.sundarrajan Committed: Thu Oct 17 21:53:09 2013 +0530 ---------------------------------------------------------------------- CHANGES.txt | 3 ++ .../entity/parser/ClusterEntityParser.java | 13 +++--- .../entity/parser/ClusterEntityParserTest.java | 23 ++++++++++- .../config/cluster/cluster-bad-registry.xml | 43 ++++++++++++++++++++ .../resource/ClusterEntityValidationIT.java | 1 + 5 files changed, 76 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fa41a1e7/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index f69677e..64961c1 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,9 @@ Trunk (Unreleased) INCOMPATIBLE CHANGES NEW FEATURES + FALCON-104 FALCON-86 introduces a backward incompatible change. + (Venkatesh Seetharam via Srikanth Sundarrajan) + FALCON-113 Update documentation for Hive integration. (Venkatesh Seetharam via Srikanth Sundarrajan) http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fa41a1e7/common/src/main/java/org/apache/falcon/entity/parser/ClusterEntityParser.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/falcon/entity/parser/ClusterEntityParser.java b/common/src/main/java/org/apache/falcon/entity/parser/ClusterEntityParser.java index 96fc6f4..e633838 100644 --- a/common/src/main/java/org/apache/falcon/entity/parser/ClusterEntityParser.java +++ b/common/src/main/java/org/apache/falcon/entity/parser/ClusterEntityParser.java @@ -58,7 +58,8 @@ public class ClusterEntityParser extends EntityParser { validateScheme(cluster, Interfacetype.WRITE); validateScheme(cluster, Interfacetype.WORKFLOW); validateScheme(cluster, Interfacetype.MESSAGING); - if (ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY) != null) { + if (CatalogServiceFactory.isEnabled() + && ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY) != null) { validateScheme(cluster, Interfacetype.REGISTRY); } @@ -156,16 +157,18 @@ public class ClusterEntityParser extends EntityParser { } private void validateRegistryInterface(Cluster cluster) throws ValidationException { + final boolean isCatalogRegistryEnabled = CatalogServiceFactory.isEnabled(); + if (!isCatalogRegistryEnabled) { + return; // ignore the registry interface for backwards compatibility + } + + // continue validation only if a catalog service is provided final Interface catalogInterface = ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY); if (catalogInterface == null) { LOG.info("Catalog service is not enabled for cluster: " + cluster.getName()); return; } - if (!CatalogServiceFactory.isEnabled()) { - throw new ValidationException("Catalog registry implementation is not defined: catalog.service.impl"); - } - final String catalogUrl = catalogInterface.getEndpoint(); LOG.info("Validating catalog registry interface: " + catalogUrl); http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fa41a1e7/common/src/test/java/org/apache/falcon/entity/parser/ClusterEntityParserTest.java ---------------------------------------------------------------------- diff --git a/common/src/test/java/org/apache/falcon/entity/parser/ClusterEntityParserTest.java b/common/src/test/java/org/apache/falcon/entity/parser/ClusterEntityParserTest.java index 6bf1df8..050efe1 100644 --- a/common/src/test/java/org/apache/falcon/entity/parser/ClusterEntityParserTest.java +++ b/common/src/test/java/org/apache/falcon/entity/parser/ClusterEntityParserTest.java @@ -26,6 +26,7 @@ import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import org.apache.falcon.FalconException; +import org.apache.falcon.catalog.CatalogServiceFactory; import org.apache.falcon.cluster.util.EmbeddedCluster; import org.apache.falcon.entity.AbstractTestBase; import org.apache.falcon.entity.ClusterHelper; @@ -92,18 +93,36 @@ public class ClusterEntityParserTest extends AbstractTestBase { @Test public void testParseClusterWithoutRegistry() throws IOException, FalconException, JAXBException { - InputStream stream = this.getClass().getResourceAsStream("/config/cluster/cluster-no-registry.xml"); + StartupProperties.get().setProperty(CatalogServiceFactory.CATALOG_SERVICE, "thrift://localhost:9083"); + Assert.assertTrue(CatalogServiceFactory.isEnabled()); + InputStream stream = this.getClass().getResourceAsStream("/config/cluster/cluster-no-registry.xml"); Cluster cluster = parser.parse(stream); Interface catalog = ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY); Assert.assertNull(catalog); - StartupProperties.get().setProperty("catalog.service.impl", ""); + StartupProperties.get().remove(CatalogServiceFactory.CATALOG_SERVICE); + Assert.assertFalse(CatalogServiceFactory.isEnabled()); + catalog = ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY); Assert.assertNull(catalog); } + @Test + public void testParseClusterWithBadRegistry() throws Exception { + // disable catalog service + StartupProperties.get().remove(CatalogServiceFactory.CATALOG_SERVICE); + Assert.assertFalse(CatalogServiceFactory.isEnabled()); + + InputStream stream = this.getClass().getResourceAsStream("/config/cluster/cluster-bad-registry.xml"); + Cluster cluster = parser.parse(stream); + + Interface catalog = ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY); + Assert.assertEquals(catalog.getEndpoint(), "Hcat"); + Assert.assertEquals(catalog.getVersion(), "0.1"); + } + /** * A positive test for validating tags key value pair regex: key=value, key=value. * @throws FalconException http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fa41a1e7/common/src/test/resources/config/cluster/cluster-bad-registry.xml ---------------------------------------------------------------------- diff --git a/common/src/test/resources/config/cluster/cluster-bad-registry.xml b/common/src/test/resources/config/cluster/cluster-bad-registry.xml new file mode 100644 index 0000000..1417d15 --- /dev/null +++ b/common/src/test/resources/config/cluster/cluster-bad-registry.xml @@ -0,0 +1,43 @@ + + + + + consumer=consumer@xyz.com, owner=producer@xyz.com, department=forecasting + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fa41a1e7/webapp/src/test/java/org/apache/falcon/resource/ClusterEntityValidationIT.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/falcon/resource/ClusterEntityValidationIT.java b/webapp/src/test/java/org/apache/falcon/resource/ClusterEntityValidationIT.java index b96c994..ee4d44e 100644 --- a/webapp/src/test/java/org/apache/falcon/resource/ClusterEntityValidationIT.java +++ b/webapp/src/test/java/org/apache/falcon/resource/ClusterEntityValidationIT.java @@ -79,6 +79,7 @@ public class ClusterEntityValidationIT { {Interfacetype.MESSAGING, "tcp://messaging-interface:9999"}, {Interfacetype.REGISTRY, "catalog-interface:9999"}, {Interfacetype.REGISTRY, "http://catalog-interface:9999"}, + {Interfacetype.REGISTRY, "Hcat"}, }; }