You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by ve...@apache.org on 2014/09/09 20:50:37 UTC

[3/3] git commit: FALCON-590 Update to ACLs added to process is not handled. Contributed by Venkatesh Seetharam

FALCON-590 Update to ACLs added to process is not handled. 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/2e3eebdf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/2e3eebdf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/2e3eebdf

Branch: refs/heads/master
Commit: 2e3eebdff8d0446b5444c0b728c871265d70fe56
Parents: e9e849e
Author: Venkatesh Seetharam <ve...@apache.org>
Authored: Tue Sep 9 11:50:21 2014 -0700
Committer: Venkatesh Seetharam <ve...@apache.org>
Committed: Tue Sep 9 11:50:21 2014 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  3 ++
 .../org/apache/falcon/update/UpdateHelper.java  |  5 ++--
 .../apache/falcon/update/UpdateHelperTest.java  | 31 ++++++++++++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/2e3eebdf/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4884512..7c98113 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -77,6 +77,9 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+   FALCON-590 Update to ACLs added to process is not handled
+   (Venkatesh Seetharam)
+
    FALCON-694 StringIndexOutOfBoundsException while updating graph DB for
    replicated instance (Sowmya Ramesh via Venkatesh Seetharam)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/2e3eebdf/common/src/main/java/org/apache/falcon/update/UpdateHelper.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/update/UpdateHelper.java b/common/src/main/java/org/apache/falcon/update/UpdateHelper.java
index b6e2893..af93180 100644
--- a/common/src/main/java/org/apache/falcon/update/UpdateHelper.java
+++ b/common/src/main/java/org/apache/falcon/update/UpdateHelper.java
@@ -55,11 +55,12 @@ public final class UpdateHelper {
 
     private static final String[] FEED_FIELDS = new String[]{"partitions", "groups", "lateArrival.cutOff",
                                                              "schema.location", "schema.provider",
-                                                             "ACL.group", "ACL.owner", "ACL.permission", };
+                                                             "group", "owner", "permission", };
     private static final String[] PROCESS_FIELDS = new String[]{"retry.policy", "retry.delay", "retry.attempts",
                                                                 "lateProcess.policy", "lateProcess.delay",
                                                                 "lateProcess.lateInputs[\\d+].input",
-                                                                "lateProcess.lateInputs[\\d+].workflowPath", };
+                                                                "lateProcess.lateInputs[\\d+].workflowPath",
+                                                                "owner", "group", "permission", };
 
     private UpdateHelper() {}
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/2e3eebdf/common/src/test/java/org/apache/falcon/update/UpdateHelperTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/falcon/update/UpdateHelperTest.java b/common/src/test/java/org/apache/falcon/update/UpdateHelperTest.java
index 6366aca..71f251b 100644
--- a/common/src/test/java/org/apache/falcon/update/UpdateHelperTest.java
+++ b/common/src/test/java/org/apache/falcon/update/UpdateHelperTest.java
@@ -298,6 +298,37 @@ public class UpdateHelperTest extends AbstractTestBase {
         Assert.assertTrue(UpdateHelper.isEntityUpdated(oldProcess, newProcess, cluster, procPath));
     }
 
+    @Test
+    public void testIsEntityACLUpdated() throws Exception {
+        Feed oldFeed = parser.parseAndValidate(this.getClass().getResourceAsStream(FEED_XML));
+        String cluster = "testCluster";
+        Feed newFeed = (Feed) oldFeed.copy();
+        Cluster clusterEntity = ConfigurationStore.get().get(EntityType.CLUSTER, cluster);
+
+        Path feedPath = EntityUtil.getNewStagingPath(clusterEntity, oldFeed);
+        Assert.assertFalse(UpdateHelper.isEntityUpdated(oldFeed, newFeed, cluster, feedPath));
+
+        Assert.assertFalse(UpdateHelper.isEntityUpdated(oldFeed, newFeed, cluster, feedPath));
+        newFeed.getACL().setOwner("new-user");
+        newFeed.getACL().setGroup("new-group");
+        Assert.assertNotEquals(oldFeed.getACL().getOwner(), newFeed.getACL().getOwner());
+        Assert.assertNotEquals(oldFeed.getACL().getGroup(), newFeed.getACL().getGroup());
+        Assert.assertTrue(UpdateHelper.isEntityUpdated(oldFeed, newFeed, cluster, feedPath));
+
+        Process oldProcess = processParser.parseAndValidate(this.getClass().getResourceAsStream(PROCESS_XML));
+        prepare(oldProcess);
+        Process newProcess = (Process) oldProcess.copy();
+        Path procPath = EntityUtil.getNewStagingPath(clusterEntity, oldProcess);
+
+        Assert.assertFalse(UpdateHelper.isEntityUpdated(oldProcess, newProcess, cluster, procPath));
+        org.apache.falcon.entity.v0.process.ACL processACL =
+                new org.apache.falcon.entity.v0.process.ACL();
+        processACL.setOwner("owner");
+        processACL.setOwner("group");
+        newProcess.setACL(processACL);
+        Assert.assertTrue(UpdateHelper.isEntityUpdated(oldProcess, newProcess, cluster, procPath));
+    }
+
     private static Location getLocation(Feed feed, LocationType type, String cluster) {
         org.apache.falcon.entity.v0.feed.Cluster feedCluster = FeedHelper.getCluster(feed, cluster);
         if (feedCluster.getLocations() != null) {