falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srik...@apache.org
Subject [3/3] incubator-falcon git commit: FALCON-914 Add option to search for Entities. Contributed by Ajay Yadav
Date Fri, 26 Dec 2014 05:32:13 GMT
FALCON-914 Add option to search for Entities. Contributed by Ajay Yadav


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

Branch: refs/heads/master
Commit: 463f854890d14c0d6b64f00c89827347f58ede52
Parents: 45a7b98
Author: srikanth.sundarrajan <sriksun@apache.org>
Authored: Fri Dec 26 10:49:48 2014 +0530
Committer: srikanth.sundarrajan <sriksun@apache.org>
Committed: Fri Dec 26 10:49:48 2014 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  3 ++
 .../java/org/apache/falcon/cli/FalconCLI.java   |  7 ++-
 .../org/apache/falcon/client/FalconClient.java  | 22 ++++----
 docs/src/site/twiki/restapi/EntityList.twiki    |  3 ++
 .../falcon/resource/AbstractEntityManager.java  | 48 +++++++++++++++---
 .../AbstractSchedulableEntityManager.java       |  2 +-
 .../proxy/SchedulableEntityManagerProxy.java    |  5 +-
 .../falcon/resource/EntityManagerTest.java      | 53 ++++++++++++++++----
 .../resource/SchedulableEntityManager.java      |  7 +--
 .../java/org/apache/falcon/cli/FalconCLIIT.java |  5 ++
 10 files changed, 124 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5575219..e8e82d2 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,9 @@ Trunk (Unreleased)
   NEW FEATURES
 
   IMPROVEMENTS
+   FALCON-914 Add option to search for Entities. (Ajay Yadav via Srikanth
+   Sundarrajan) 
+
    FALCON-256 Create new API for Process dependency graph DAG which captures 
    process connected via feeds. (Ajay Yadav via Srikanth Sundarrajan)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/cli/FalconCLI.java b/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
index 5797bbe..ca514c1 100644
--- a/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
+++ b/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
@@ -93,6 +93,7 @@ public class FalconCLI {
     public static final String OFFSET_OPT = "offset";
     public static final String NUM_RESULTS_OPT = "numResults";
     public static final String NUM_INSTANCES_OPT = "numInstances";
+    public static final String PATTERN_OPT = "pattern";
 
     public static final String INSTANCE_CMD = "instance";
     public static final String START_OPT = "start";
@@ -374,6 +375,7 @@ public class FalconCLI {
         String sortOrder = commandLine.getOptionValue(SORT_ORDER_OPT);
         String filterBy = commandLine.getOptionValue(FILTER_BY_OPT);
         String filterTags = commandLine.getOptionValue(TAGS_OPT);
+        String searchPattern = commandLine.getOptionValue(PATTERN_OPT);
         String fields = commandLine.getOptionValue(FIELDS_OPT);
         Integer offset = parseIntegerInput(commandLine.getOptionValue(OFFSET_OPT), 0, "offset");
         Integer numResults = parseIntegerInput(commandLine.getOptionValue(NUM_RESULTS_OPT),
@@ -437,7 +439,7 @@ public class FalconCLI {
             validateOrderBy(orderBy, entityAction);
             validateFilterBy(filterBy, entityAction);
             EntityList entityList = client.getEntityList(entityType, fields, filterBy,
-                    filterTags, orderBy, sortOrder, offset, numResults);
+                    filterTags, orderBy, sortOrder, offset, numResults, searchPattern);
             result = entityList != null ? entityList.toString() : "No entity of type (" +
entityType + ") found.";
         }  else if (optionsList.contains(SUMMARY_OPT)) {
             validateEntityTypeForSummary(entityType);
@@ -646,6 +648,8 @@ public class FalconCLI {
         Option fields = new Option(FIELDS_OPT, true, "Entity fields to show for a request");
         Option filterBy = new Option(FILTER_BY_OPT, true,
                 "Filter returned entities by the specified status");
+        Option searchPattern = new Option(PATTERN_OPT, true,
+                "Filter entities by fuzzy matching with specified pattern");
         Option filterTags = new Option(TAGS_OPT, true, "Filter returned entities by the specified
tags");
         Option orderBy = new Option(ORDER_BY_OPT, true,
                 "Order returned entities by this field");
@@ -668,6 +672,7 @@ public class FalconCLI {
         entityOptions.addOption(end);
         entityOptions.addOption(fields);
         entityOptions.addOption(filterBy);
+        entityOptions.addOption(searchPattern);
         entityOptions.addOption(filterTags);
         entityOptions.addOption(orderBy);
         entityOptions.addOption(sortOrder);

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/client/src/main/java/org/apache/falcon/client/FalconClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/client/FalconClient.java b/client/src/main/java/org/apache/falcon/client/FalconClient.java
index a748c58..7f1bc27 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconClient.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconClient.java
@@ -366,10 +366,10 @@ public class FalconClient {
     //SUSPEND CHECKSTYLE CHECK ParameterNumberCheck
 
     public EntityList getEntityList(String entityType, String fields, String filterBy, String
filterTags,
-                                    String orderBy, String sortOrder,
-                                    Integer offset, Integer numResults) throws FalconCLIException
{
+                                    String orderBy, String sortOrder, Integer offset,
+                                    Integer numResults, String searchPattern) throws FalconCLIException
{
         return sendListRequest(Entities.LIST, entityType, fields, filterBy,
-                filterTags, orderBy, sortOrder, offset, numResults);
+                filterTags, orderBy, sortOrder, offset, numResults, searchPattern);
     }
 
     public EntitySummaryResult getEntitySummary(String entityType, String cluster, String
start, String end,
@@ -589,8 +589,8 @@ public class FalconClient {
     private WebResource addParamsToResource(WebResource resource,
                                             String start, String end, String runId, String
colo,
                                             String fields, String filterBy, String tags,
-                                            String orderBy, String sortOrder,
-                                            Integer offset, Integer numResults, Integer numInstances)
{
+                                            String orderBy, String sortOrder, Integer offset,
+                                            Integer numResults, Integer numInstances, String
searchPattern) {
 
         if (!StringUtils.isEmpty(fields)) {
             resource = resource.queryParam("fields", fields);
@@ -628,6 +628,10 @@ public class FalconClient {
         if (numInstances != null) {
             resource = resource.queryParam("numInstances", numInstances.toString());
         }
+
+        if (!StringUtils.isEmpty(searchPattern)) {
+            resource = resource.queryParam("pattern", searchPattern);
+        }
         return resource;
 
     }
@@ -645,7 +649,7 @@ public class FalconClient {
         resource = addParamsToResource(resource, start, end, null, null,
                 fields, filterBy, filterTags,
                 orderBy, sortOrder,
-                offset, numResults, numInstances);
+                offset, numResults, numInstances, null);
 
         ClientResponse clientResponse = resource
                 .header("Cookie", AUTH_COOKIE_EQ + authenticationToken)
@@ -725,7 +729,7 @@ public class FalconClient {
                 .path(entity);
 
         resource = addParamsToResource(resource, start, end, runid, colo,
-                null, filterBy, null, orderBy, sortOrder, offset, numResults, null);
+                null, filterBy, null, orderBy, sortOrder, offset, numResults, null, null);
 
         if (lifeCycles != null) {
             checkLifeCycleOption(lifeCycles, type);
@@ -778,11 +782,11 @@ public class FalconClient {
     //SUSPEND CHECKSTYLE CHECK ParameterNumberCheck
     private EntityList sendListRequest(Entities entities, String entityType, String fields,
String filterBy,
                                        String filterTags, String orderBy, String sortOrder,
Integer offset,
-                                       Integer numResults) throws FalconCLIException {
+                                       Integer numResults, String searchPattern) throws FalconCLIException
{
         WebResource resource = service.path(entities.path)
                 .path(entityType);
         resource = addParamsToResource(resource, null, null, null, null, fields, filterBy,
filterTags,
-                orderBy, sortOrder, offset, numResults, null);
+                orderBy, sortOrder, offset, numResults, null, searchPattern);
 
         ClientResponse clientResponse = resource
                 .header("Cookie", AUTH_COOKIE_EQ + authenticationToken)

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/docs/src/site/twiki/restapi/EntityList.twiki
----------------------------------------------------------------------
diff --git a/docs/src/site/twiki/restapi/EntityList.twiki b/docs/src/site/twiki/restapi/EntityList.twiki
index b569ade..5e11691 100644
--- a/docs/src/site/twiki/restapi/EntityList.twiki
+++ b/docs/src/site/twiki/restapi/EntityList.twiki
@@ -11,6 +11,9 @@ Get list of the entities.
    * :entity-type Valid options are cluster, feed or process.
    * fields <optional param> Fields of entity that the user wants to view, separated
by commas.
       * Valid options are STATUS, TAGS, PIPELINES.
+   * pattern <optional param> Find string which contains this sequence of characters.
Example: pattern=abc
+     * matching is case insensitive.
+     * For example a pattern mhs will match a process named New-My-Hourly-Summary.
    * filterBy <optional param> Filter results by list of field:value pairs. Example:
filterBy=STATUS:RUNNING,PIPELINES:clickLogs
       * Supported filter fields are NAME, STATUS, PIPELINES, CLUSTER.
       * Query will do an AND among filterBy fields.

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/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 8ec9e2d..4a686e7 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
@@ -32,7 +32,10 @@ import org.apache.falcon.entity.parser.EntityParserFactory;
 import org.apache.falcon.entity.parser.ValidationException;
 import org.apache.falcon.entity.store.ConfigurationStore;
 import org.apache.falcon.entity.store.EntityAlreadyExistsException;
-import org.apache.falcon.entity.v0.*;
+import org.apache.falcon.entity.v0.Entity;
+import org.apache.falcon.entity.v0.EntityGraph;
+import org.apache.falcon.entity.v0.EntityIntegrityChecker;
+import org.apache.falcon.entity.v0.EntityType;
 import org.apache.falcon.entity.v0.cluster.Cluster;
 import org.apache.falcon.resource.APIResult.Status;
 import org.apache.falcon.resource.EntityList.EntityElement;
@@ -51,7 +54,18 @@ import javax.ws.rs.core.Response;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Constructor;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
 
 /**
  * A base class for managing Entity operations.
@@ -524,13 +538,15 @@ public abstract class AbstractEntityManager {
      * @return EntityList
      */
     public EntityList getEntityList(String type, String fieldStr, String filterBy, String
filterTags,
-                                    String orderBy, String sortOrder, Integer offset, Integer
resultsPerPage) {
+                                    String orderBy, String sortOrder, Integer offset, Integer
resultsPerPage,
+                                    String pattern) {
 
         HashSet<String> fields = new HashSet<String>(Arrays.asList(fieldStr.toLowerCase().split(",")));
         validateEntityFilterByClause(filterBy);
         List<Entity> entities;
         try {
-            entities = getEntities(type, "", "", "", filterBy, filterTags, orderBy, sortOrder,
offset, resultsPerPage);
+            entities = getEntities(type, "", "", "", filterBy, filterTags, orderBy, sortOrder,
offset,
+                    resultsPerPage, pattern);
         } catch (Exception e) {
             LOG.error("Failed to get entity list", e);
             throw FalconWebException.newException(e, Response.Status.BAD_REQUEST);
@@ -554,8 +570,8 @@ public abstract class AbstractEntityManager {
     }
 
     protected List<Entity> getEntities(String type, String startDate, String endDate,
String cluster,
-                                       String filterBy, String filterTags, String orderBy,
String sortOrder,
-                                       int offset, int resultsPerPage) throws FalconException,
IOException {
+                                       String filterBy, String filterTags, String orderBy,
String sortOrder, int offset,
+                                       int resultsPerPage, String pattern) throws FalconException,
IOException {
         final Map<String, String> filterByFieldsValues = getFilterByFieldsValues(filterBy);
         final List<String> filterByTags = getFilterByTags(filterTags);
 
@@ -593,6 +609,10 @@ public abstract class AbstractEntityManager {
                     filterByFieldsValues, filterByTags, tags, pipelines)) {
                 continue;
             }
+
+            if (StringUtils.isNotBlank(pattern) && !fuzzySearch(entity.getName(),
pattern)) {
+                continue;
+            }
             entities.add(entity);
         }
         // Sort entities before returning a subset of entity elements.
@@ -607,6 +627,22 @@ public abstract class AbstractEntityManager {
     }
     //RESUME CHECKSTYLE CHECK ParameterNumberCheck
 
+    boolean fuzzySearch(String enityName, String pattern) {
+        int currentIndex = 0; // current index in pattern which is to be matched
+        char[] searchPattern = pattern.toLowerCase().toCharArray();
+        String name = enityName.toLowerCase();
+
+        for (Character c : name.toCharArray()) {
+            if (currentIndex < searchPattern.length && c == searchPattern[currentIndex])
{
+                currentIndex++;
+            }
+            if (currentIndex == searchPattern.length) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     private boolean filterEntityByDatesAndCluster(Entity entity, String startDate, String
endDate, String cluster)
         throws FalconException {
         if (StringUtils.isEmpty(cluster)) {

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
b/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
index d994e25..a4d1f8b 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java
@@ -185,7 +185,7 @@ public abstract class AbstractSchedulableEntityManager extends AbstractInstanceM
             entities = getEntities(type,
                     SchemaHelper.getDateFormat().format(startAndEndDates.first),
                     SchemaHelper.getDateFormat().format(startAndEndDates.second),
-                    cluster, filterBy, filterTags, orderBy, sortOrder, offset, resultsPerPage);
+                    cluster, filterBy, filterTags, orderBy, sortOrder, offset, resultsPerPage,
"");
             colo = ((Cluster) configStore.get(EntityType.CLUSTER, cluster)).getColo();
         } catch (Exception e) {
             LOG.error("Failed to get entities", e);

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
b/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
index 075cb64..cfa70a0 100644
--- a/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
+++ b/prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java
@@ -399,8 +399,9 @@ public class SchedulableEntityManagerProxy extends AbstractSchedulableEntityMana
                                     @DefaultValue("asc") @QueryParam("sortOrder") String
sortOrder,
                                     @DefaultValue("0") @QueryParam("offset") Integer offset,
                                     @DefaultValue(DEFAULT_NUM_RESULTS)
-                                    @QueryParam("numResults") Integer resultsPerPage) {
-        return super.getEntityList(type, fields, filterBy, tags, orderBy, sortOrder, offset,
resultsPerPage);
+                                    @QueryParam("numResults") Integer resultsPerPage,
+                                    @QueryParam("pattern") String pattern) {
+        return super.getEntityList(type, fields, filterBy, tags, orderBy, sortOrder, offset,
resultsPerPage, pattern);
     }
 
     @GET

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/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 1862e39..470f866 100644
--- a/prism/src/test/java/org/apache/falcon/resource/EntityManagerTest.java
+++ b/prism/src/test/java/org/apache/falcon/resource/EntityManagerTest.java
@@ -18,6 +18,7 @@
 package org.apache.falcon.resource;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.falcon.FalconException;
 import org.apache.falcon.FalconWebException;
 import org.apache.falcon.entity.v0.Entity;
 import org.apache.falcon.entity.v0.EntityType;
@@ -125,7 +126,7 @@ public class EntityManagerTest extends AbstractEntityManager {
          * Only one entity should be returned when the auth is enabled.
          */
         try {
-            getEntityList("process", "", "", "", "", "", 0, 10);
+            getEntityList("process", "", "", "", "", "", 0, 10, "");
             Assert.fail();
         } catch (Throwable ignore) {
             // do nothing
@@ -142,7 +143,7 @@ public class EntityManagerTest extends AbstractEntityManager {
         Entity process2 = buildProcess("processAuthUser", System.getProperty("user.name"),
"", "");
         configStore.publish(EntityType.PROCESS, process2);
 
-        EntityList entityList = this.getEntityList("process", "", "", "", "", "asc", 0, 10);
+        EntityList entityList = this.getEntityList("process", "", "", "", "", "asc", 0, 10,
"");
         Assert.assertNotNull(entityList.getElements());
         Assert.assertEquals(entityList.getElements().length, 1);
 
@@ -151,7 +152,7 @@ public class EntityManagerTest extends AbstractEntityManager {
          */
         StartupProperties.get().setProperty("falcon.security.authorization.enabled", "true");
         CurrentUser.authenticate(System.getProperty("user.name"));
-        entityList = this.getEntityList("process", "", "", "", "", "desc", 0, 10);
+        entityList = this.getEntityList("process", "", "", "", "", "desc", 0, 10, "");
         Assert.assertNotNull(entityList.getElements());
         Assert.assertEquals(entityList.getElements().length, 1);
 
@@ -188,7 +189,7 @@ public class EntityManagerTest extends AbstractEntityManager {
         configStore.publish(EntityType.PROCESS, process4);
 
         EntityList entityList = this.getEntityList("process", "tags", "PIPELINES:dataReplicationPipeline",
-                "", "name", "desc", 1, 1);
+                "", "name", "desc", 1, 1, "");
         Assert.assertNotNull(entityList.getElements());
         Assert.assertEquals(entityList.getElements().length, 1);
         Assert.assertEquals(entityList.getElements()[0].name, "process1");
@@ -198,7 +199,7 @@ public class EntityManagerTest extends AbstractEntityManager {
 
 
         entityList = this.getEntityList("process", "pipelines", "",
-                "consumer=consumer@xyz.com, owner=producer@xyz.com", "name", "", 0, 2);
+                "consumer=consumer@xyz.com, owner=producer@xyz.com", "name", "", 0, 2, "");
         Assert.assertNotNull(entityList.getElements());
         Assert.assertEquals(entityList.getElements().length, 2);
         Assert.assertEquals(entityList.getElements()[1].name, "process2");
@@ -207,17 +208,17 @@ public class EntityManagerTest extends AbstractEntityManager {
         Assert.assertEquals(entityList.getElements()[0].tag, null);
 
         entityList = this.getEntityList("process", "pipelines", "",
-                "consumer=consumer@xyz.com, owner=producer@xyz.com", "name", "", 10, 2);
+                "consumer=consumer@xyz.com, owner=producer@xyz.com", "name", "", 10, 2, "");
         Assert.assertEquals(entityList.getElements().length, 0);
 
         entityList = this.getEntityList("process", "pipelines", "",
-                "owner=producer@xyz.com", "name", "", 1, 2);
+                "owner=producer@xyz.com", "name", "", 1, 2, "");
         Assert.assertEquals(entityList.getElements().length, 2);
 
         // Test negative value for numResults, should throw an exception.
         try {
             this.getEntityList("process", "pipelines", "",
-                    "consumer=consumer@xyz.com, owner=producer@xyz.com", "name", "", 10,
-1);
+                    "consumer=consumer@xyz.com, owner=producer@xyz.com", "name", "", 10,
-1, "");
             Assert.assertTrue(false);
         } catch (Throwable e) {
             Assert.assertTrue(true);
@@ -226,13 +227,47 @@ public class EntityManagerTest extends AbstractEntityManager {
         // Test invalid entry for sortOrder
         try {
             this.getEntityList("process", "pipelines", "",
-                    "consumer=consumer@xyz.com, owner=producer@xyz.com", "name", "invalid",
10, 2);
+                    "consumer=consumer@xyz.com, owner=producer@xyz.com", "name", "invalid",
10, 2, "");
             Assert.assertTrue(false);
         } catch (Throwable e) {
             Assert.assertTrue(true);
         }
     }
 
+    @Test
+    public void testSearch() throws FalconException {
+        Assert.assertTrue(fuzzySearch("My-Hourly-Summary", "mhs"));
+        Assert.assertTrue(fuzzySearch("New-My-Hourly-Summary", "MHs"));
+        Assert.assertFalse(fuzzySearch("My-Hourly-Summary", "moh"));
+    }
+
+    @Test
+    public void testGetEntityListWithPattern() throws FalconException {
+        String user = System.getProperty("user.name");
+
+        Entity process1 = buildProcess("New-My-Hourly-Summary", user,
+                "consumer=consumer@xyz.com, owner=producer@xyz.com",
+                "testPipeline,dataReplicationPipeline");
+        configStore.publish(EntityType.PROCESS, process1);
+
+        Entity process2 = buildProcess("Random-Summary-Generator", user,
+                "consumer=consumer@xyz.com, owner=producer@xyz.com",
+                "testPipeline,dataReplicationPipeline");
+        configStore.publish(EntityType.PROCESS, process2);
+
+        Entity process3 = buildProcess("My-Hourly-Summary", user, "", "testPipeline");
+        configStore.publish(EntityType.PROCESS, process3);
+
+        Entity process4 = buildProcess("sample-process4", user, "owner=producer@xyz.com",
"");
+        configStore.publish(EntityType.PROCESS, process4);
+
+        EntityList entityList = this.getEntityList("process", "tags", "PIPELINES:dataReplicationPipeline",
+                "", "name", "desc", 0, 10, "mhs");
+        Assert.assertNotNull(entityList.getElements());
+        Assert.assertEquals(entityList.getElements().length, 1);
+
+    }
+
     private Entity buildProcess(String name, String username, String tags, String pipelines)
{
         ACL acl = new ACL();
         acl.setOwner(username);

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
b/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
index 5f4f495..d8d8bfc 100644
--- a/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
+++ b/webapp/src/main/java/org/apache/falcon/resource/SchedulableEntityManager.java
@@ -57,7 +57,7 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
     @GET
     @Path("list/{type}")
     @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
-    @Monitored(event = "dependencies")
+    @Monitored(event = "list")
     @Override
     public EntityList getEntityList(@Dimension("type") @PathParam("type") String type,
                                     @DefaultValue("") @QueryParam("fields") String fields,
@@ -67,8 +67,9 @@ public class SchedulableEntityManager extends AbstractSchedulableEntityManager
{
                                     @DefaultValue("asc") @QueryParam("sortOrder") String
sortOrder,
                                     @DefaultValue("0") @QueryParam("offset") Integer offset,
                                     @DefaultValue(DEFAULT_NUM_RESULTS)
-                                    @QueryParam("numResults") Integer resultsPerPage) {
-        return super.getEntityList(type, fields, filterBy, tags, orderBy, sortOrder, offset,
resultsPerPage);
+                                    @QueryParam("numResults") Integer resultsPerPage,
+                                    @QueryParam("pattern") String pattern) {
+        return super.getEntityList(type, fields, filterBy, tags, orderBy, sortOrder, offset,
resultsPerPage, pattern);
     }
 
     @GET

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/463f8548/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java b/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
index b50999d..118003f 100644
--- a/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
+++ b/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
@@ -547,6 +547,11 @@ public class FalconCLIIT {
 
         // test entity List cli
         Assert.assertEquals(executeWithURL("entity -list -type cluster" + " -offset 0 -numResults
1"), 0);
+
+        Assert.assertEquals(executeWithURL("entity -list -type process -fields status "
+                + " -filterBy STATUS:SUBMITTED,TYPE:process -orderBy name "
+                + " -sortOrder asc -offset 1 -numResults 1 -pattern abc"), 0);
+
         Assert.assertEquals(executeWithURL("entity -list -type process -fields status "
                 + " -filterBy STATUS:SUBMITTED,TYPE:process -orderBy name "
                 + " -sortOrder asc -offset 1 -numResults 1"), 0);


Mime
View raw message