falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srik...@apache.org
Subject git commit: FALCON-104 FALCON-86 introduces a backward incompatible change. Contributed by Venkatesh Seetharam
Date Thu, 17 Oct 2013 16:23:39 GMT
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 <srikanth.sundarrajan@inmobi.com>
Authored: Thu Oct 17 21:53:09 2013 +0530
Committer: srikanth.sundarrajan <srikanth.sundarrajan@inmobi.com>
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<Cluster> {
         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<Cluster>
{
     }
 
     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 @@
+<?xml version="1.0"?>
+<!--~
+  ~ 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.
+  -->
+
+<cluster colo="default" description="" name="testCluster" xmlns="uri:falcon:cluster:0.1">
+    <tags>consumer=consumer@xyz.com, owner=producer@xyz.com, department=forecasting</tags>
+    <interfaces>
+        <interface type="readonly" endpoint="hftp://localhost:50010"
+                   version="0.20.2"/>
+        <interface type="write" endpoint="hdfs://localhost:8020"
+                   version="0.20.2"/>
+        <interface type="execute" endpoint="localhost:8021" version="0.20.2"/>
+        <interface type="workflow" endpoint="http://localhost:11000/oozie/"
+                   version="3.1"/>
+        <interface type="registry" endpoint="Hcat" version="0.1"/>
+        <interface type="messaging" endpoint="tcp://localhost:61616?daemon=true"
+                   version="5.1.6"/>
+    </interfaces>
+    <locations>
+        <location name="staging" path="/projects/falcon/staging"/>
+        <location name="temp" path="/tmp"/>
+        <location name="working" path="/projects/falcon/working"/>
+    </locations>
+    <properties>
+        <property name="field1" value="value1"/>
+        <property name="field2" value="value2"/>
+    </properties>
+</cluster>

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"},
         };
     }
 


Mime
View raw message