falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject falcon git commit: FALCON-1414 Add all fields in filterBy to the entity list output. Contributed by Narayan Periwal.
Date Tue, 08 Sep 2015 15:38:23 GMT
Repository: falcon
Updated Branches:
  refs/heads/master 222cbbee8 -> 2624fe8ef


FALCON-1414 Add all fields in filterBy to the entity list output. Contributed by Narayan Periwal.


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/2624fe8e
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/2624fe8e
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/2624fe8e

Branch: refs/heads/master
Commit: 2624fe8ef15faa21e5a811e2fa0fb27c0cb96994
Parents: 222cbbe
Author: Ajay Yadava <ajayyadava@apache.org>
Authored: Tue Sep 8 20:17:37 2015 +0530
Committer: Ajay Yadava <ajayyadava@apache.org>
Committed: Tue Sep 8 20:17:37 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../falcon/resource/AbstractEntityManager.java  |  5 ++++
 .../falcon/resource/EntityManagerTest.java      | 28 ++++++++++++++++++++
 3 files changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/2624fe8e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 67999aa..aaced5f 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,8 @@ Trunk (Unreleased)
   NEW FEATURES
 
   IMPROVEMENTS
+    FALCON-1414 Add all fields in filterBy to the entity list output.(Narayan Periwal via
Ajay Yadava)
+
     FALCON-1430 Exclude designer from source tarball(Ajay Yadava)
     
     FALCON-1250 Throw error when keys in startup.properties do not start with "*." or domain+"."(Narayan
Periwal via Ajay Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/2624fe8e/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
index f8f36b2..06ab4d9 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
@@ -599,6 +599,11 @@ public abstract class AbstractEntityManager {
 
         HashSet<String> fields = new HashSet<String>(Arrays.asList(fieldStr.toUpperCase().split(",")));
         Map<String, List<String>> filterByFieldsValues = getFilterByFieldsValues(filterBy);
+        for (String  key : filterByFieldsValues.keySet()) {
+            if (!key.toUpperCase().equals("NAME") && !key.toUpperCase().equals("CLUSTER"))
{
+                fields.add(key.toUpperCase());
+            }
+        }
         validateEntityFilterByClause(filterByFieldsValues);
         if (StringUtils.isNotEmpty(filterTags)) {
             filterByFieldsValues.put(EntityList.EntityFilterByFields.TAGS.name(), Arrays.asList(filterTags));

http://git-wip-us.apache.org/repos/asf/falcon/blob/2624fe8e/prism/src/test/java/org/apache/falcon/resource/EntityManagerTest.java
----------------------------------------------------------------------
diff --git a/prism/src/test/java/org/apache/falcon/resource/EntityManagerTest.java b/prism/src/test/java/org/apache/falcon/resource/EntityManagerTest.java
index cce8737..ea2c40f 100644
--- a/prism/src/test/java/org/apache/falcon/resource/EntityManagerTest.java
+++ b/prism/src/test/java/org/apache/falcon/resource/EntityManagerTest.java
@@ -167,6 +167,34 @@ public class EntityManagerTest extends AbstractEntityManager {
     }
 
     @Test
+    public void testGetEntityListFilterBy() throws Exception {
+
+        Entity process2 = buildProcess("processAuthUserFilterBy", System.getProperty("user.name"),
"", "USER-DATA");
+        configStore.publish(EntityType.PROCESS, process2);
+
+        EntityList entityList = this.getEntityList("", "", "", "process", "", "PIPELINES:USER-DATA",
"", "asc", 0, 10);
+        Assert.assertNotNull(entityList.getElements());
+        Assert.assertEquals(entityList.getElements().length, 1);
+        Assert.assertNotNull(entityList.getElements()[0].pipeline);
+        Assert.assertEquals(entityList.getElements()[0].pipeline.get(0), "USER-DATA");
+
+        /*
+         * Both entities should be returned when the user is SuperUser.
+         */
+        StartupProperties.get().setProperty("falcon.security.authorization.enabled", "true");
+        CurrentUser.authenticate(System.getProperty("user.name"));
+        entityList = this.getEntityList("", "", "", "process", "", "PIPELINES:USER-DATA",
"", "desc", 0, 10);
+        Assert.assertNotNull(entityList.getElements());
+        Assert.assertEquals(entityList.getElements().length, 1);
+        Assert.assertNotNull(entityList.getElements()[0].pipeline);
+        Assert.assertEquals(entityList.getElements()[0].pipeline.get(0), "USER-DATA");
+
+        // reset values
+        StartupProperties.get().setProperty("falcon.security.authorization.enabled", "false");
+        CurrentUser.authenticate(System.getProperty("user.name"));
+    }
+
+    @Test
     public void testNumberOfResults() {
         Assert.assertEquals(getRequiredNumberOfResults(10000, 0, 10000), 10000);
         Assert.assertEquals(getRequiredNumberOfResults(10000, 0, 4000), 4000);


Mime
View raw message