falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject [2/2] falcon git commit: FALCON-1609 Add entity commands to falcon spring-shell CLI
Date Wed, 06 Jul 2016 11:05:17 GMT
FALCON-1609 Add entity commands to falcon spring-shell CLI

Author: Rajat Khandelwal <rajatgupta59@gmail.com>

Reviewers: Ajay Yadava <ajayyadava@apache.org>, Balu Vellanki<balu@apache.org>

Closes #14 from prongs/FALCON-1609


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

Branch: refs/heads/master
Commit: b2526d8f4b8043ed0e1c005b89533683815e2373
Parents: 60e2f68
Author: Rajat Khandelwal <rajatgupta59@gmail.com>
Authored: Wed Jul 6 16:10:28 2016 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Wed Jul 6 16:10:28 2016 +0530

----------------------------------------------------------------------
 .../org/apache/falcon/cli/FalconAdminCLI.java   |   2 +-
 .../java/org/apache/falcon/cli/FalconCLI.java   |  58 +++-
 .../falcon/cli/FalconCLIRuntimeException.java   |  37 ---
 .../org/apache/falcon/cli/FalconEntityCLI.java  | 208 +++++++------
 .../apache/falcon/cli/FalconExtensionCLI.java   |   5 +-
 .../apache/falcon/cli/FalconInstanceCLI.java    |   6 +-
 .../apache/falcon/cli/FalconMetadataCLI.java    |  16 +-
 .../falcon/cli/commands/BaseFalconCommands.java |  40 ++-
 .../cli/commands/FalconConnectionCommands.java  |   2 +
 .../cli/commands/FalconEntityCommands.java      | 300 +++++++++++++++++++
 .../cli/commands/FalconInstanceCommands.java    |   3 +
 .../falcon/cli/commands/FalconCLITest.java      |  67 +++++
 .../commands/FalconConnectionCommandsTest.java  |  47 +++
 client/pom.xml                                  |   8 +
 .../org/apache/falcon/FalconCLIConstants.java   |   6 +-
 .../falcon/client/AbstractFalconClient.java     |  95 +++---
 .../falcon/client/FalconCLIException.java       |   7 +-
 .../org/apache/falcon/client/FalconClient.java  | 163 +++++-----
 .../org/apache/falcon/resource/EntityList.java  |   4 +-
 .../falcon/resource/AbstractEntityManager.java  |   4 +-
 .../apache/falcon/unit/FalconUnitClient.java    |  79 ++---
 21 files changed, 813 insertions(+), 344 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java
index e8ea06b..1b6d289 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java
@@ -74,7 +74,7 @@ public class FalconAdminCLI extends FalconCLI {
     }
 
     public int adminCommand(CommandLine commandLine, FalconClient client,
-                             String falconUrl) throws FalconCLIException, IOException {
+                             String falconUrl) throws IOException {
         String result;
         Set<String> optionsList = new HashSet<String>();
         for (Option option : commandLine.getOptions()) {

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java
index 2977e72..bff818a 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java
@@ -48,7 +48,45 @@ public class FalconCLI {
     public static final AtomicReference<PrintStream> ERR = new AtomicReference<PrintStream>(System.err);
     public static final AtomicReference<PrintStream> OUT = new AtomicReference<PrintStream>(System.out);
 
-    private static final String FALCON_URL = "FALCON_URL";
+    public static final String ENV_FALCON_DEBUG = "FALCON_DEBUG";
+    public static final String DEBUG_OPTION = "debug";
+    public static final String URL_OPTION = "url";
+    public static final String FALCON_URL = "FALCON_URL";
+
+    public static final String ADMIN_CMD = "admin";
+    public static final String HELP_CMD = "help";
+    public static final String METADATA_CMD = "metadata";
+    public static final String ENTITY_CMD = "entity";
+    public static final String INSTANCE_CMD = "instance";
+    public static final String RECIPE_CMD = "recipe";
+
+    public static final String TYPE_OPT = "type";
+    public static final String COLO_OPT = "colo";
+    public static final String CLUSTER_OPT = "cluster";
+    public static final String FEED_OPT = "feed";
+    public static final String PROCESS_OPT = "process";
+    public static final String ENTITY_NAME_OPT = "name";
+    public static final String FILE_PATH_OPT = "file";
+    public static final String VERSION_OPT = "version";
+    public static final String SCHEDULE_OPT = "schedule";
+    public static final String SUSPEND_OPT = "suspend";
+    public static final String RESUME_OPT = "resume";
+    public static final String STATUS_OPT = "status";
+    public static final String SUMMARY_OPT = "summary";
+    public static final String DEPENDENCY_OPT = "dependency";
+    public static final String LIST_OPT = "list";
+    public static final String SKIPDRYRUN_OPT = "skipDryRun";
+    public static final String FILTER_BY_OPT = "filterBy";
+    public static final String ORDER_BY_OPT = "orderBy";
+    public static final String SORT_ORDER_OPT = "sortOrder";
+    public static final String OFFSET_OPT = "offset";
+    public static final String NUM_RESULTS_OPT = "numResults";
+    public static final String START_OPT = "start";
+    public static final String END_OPT = "end";
+    public static final String CURRENT_COLO = "current.colo";
+    public static final String CLIENT_PROPERTIES = "/client.properties";
+    public static final String DO_AS_OPT = "doAs";
+
     private final Properties clientProperties;
 
     public FalconCLI() throws Exception {
@@ -155,8 +193,7 @@ public class FalconCLI {
         }
     }
 
-    protected Integer parseIntegerInput(String optionValue, Integer defaultVal, String optionName)
-        throws FalconCLIException {
+    protected Integer parseIntegerInput(String optionValue, Integer defaultVal, String optionName) {
         Integer integer = defaultVal;
         if (optionValue != null) {
             try {
@@ -169,7 +206,7 @@ public class FalconCLI {
         return integer;
     }
 
-    protected void validateEntityTypeForSummary(String type) throws FalconCLIException {
+    public static void validateEntityTypeForSummary(String type) {
         EntityType entityType = EntityType.getEnum(type);
         if (!entityType.isSchedulable()) {
             throw new FalconCLIException("Invalid entity type " + entityType
@@ -177,13 +214,13 @@ public class FalconCLI {
         }
     }
 
-    protected void validateNotEmpty(String paramVal, String paramName) throws FalconCLIException {
+    protected void validateNotEmpty(String paramVal, String paramName) {
         if (StringUtils.isBlank(paramVal)) {
             throw new FalconCLIException("Missing argument : " + paramName);
         }
     }
 
-    protected void validateSortOrder(String sortOrder) throws FalconCLIException {
+    protected void validateSortOrder(String sortOrder) {
         if (!StringUtils.isBlank(sortOrder)) {
             if (!sortOrder.equalsIgnoreCase("asc") && !sortOrder.equalsIgnoreCase("desc")) {
                 throw new FalconCLIException("Value for param sortOrder should be \"asc\" or \"desc\". It is  : "
@@ -192,7 +229,7 @@ public class FalconCLI {
         }
     }
 
-    protected String getColo(String colo) throws FalconCLIException, IOException {
+    protected String getColo(String colo) throws IOException {
         if (colo == null) {
             Properties prop = getClientProperties();
             colo = prop.getProperty(FalconCLIConstants.CURRENT_COLO, "*");
@@ -200,7 +237,7 @@ public class FalconCLI {
         return colo;
     }
 
-    protected void validateFilterBy(String filterBy, String filterType) throws FalconCLIException {
+    public static void validateFilterBy(String filterBy, String filterType) {
         if (StringUtils.isEmpty(filterBy)) {
             return;
         }
@@ -223,7 +260,7 @@ public class FalconCLI {
         }
     }
 
-    protected void validateOrderBy(String orderBy, String action) throws FalconCLIException {
+    public static void validateOrderBy(String orderBy, String action) {
         if (StringUtils.isBlank(orderBy)) {
             return;
         }
@@ -245,7 +282,8 @@ public class FalconCLI {
         throw new FalconCLIException("Invalid orderBy argument : " + orderBy);
     }
 
-    protected String getFalconEndpoint(CommandLine commandLine) throws FalconCLIException, IOException {
+
+    protected String getFalconEndpoint(CommandLine commandLine) throws IOException {
         String url = commandLine.getOptionValue(FalconCLIConstants.URL_OPTION);
         if (url == null) {
             url = System.getenv(FALCON_URL);

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/FalconCLIRuntimeException.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconCLIRuntimeException.java b/cli/src/main/java/org/apache/falcon/cli/FalconCLIRuntimeException.java
deleted file mode 100644
index b7fa4cd..0000000
--- a/cli/src/main/java/org/apache/falcon/cli/FalconCLIRuntimeException.java
+++ /dev/null
@@ -1,37 +0,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.
- */
-
-package org.apache.falcon.cli;
-
-/**
- * Runtime exception in CLI. Since most methods are invoked through reflection, checked exceptions
- * end up being thrown as UndeclaredThrowableException. Instead of that, let's throw our own RuntimeException.
- */
-public class FalconCLIRuntimeException extends RuntimeException {
-    public FalconCLIRuntimeException(Throwable e) {
-        super(e);
-    }
-
-    public FalconCLIRuntimeException(String message) {
-        super(message);
-    }
-
-    public FalconCLIRuntimeException(String message, Throwable cause) {
-        super(message, cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java
index 11aa2b4..facb147 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java
@@ -43,16 +43,65 @@ import java.util.Set;
  */
 public class FalconEntityCLI extends FalconCLI {
 
-    private static final String DEFINITION_OPT = "definition";
-    public static final String SLA_MISS_ALERT_OPT = "slaAlert";
+    public static final String SUBMIT_OPT_DESCRIPTION = "Submits an entity xml to Falcon";
+    public static final String UPDATE_OPT_DESCRIPTION = "Updates an existing entity";
+    public static final String DELETE_OPT_DESCRIPTION = "Deletes an entity in Falcon, and kills its instance from "
+            + "workflow engine";
+    public static final String SUBMIT_AND_SCHEDULE_OPT = "submitAndSchedule";
+    public static final String SUBMIT_AND_SCHEDULE_OPT_DESCRIPTION = "Submits an entity to Falcon and "
+            + "schedules it immediately";
+    public static final String VALIDATE_OPT = "validate";
+    public static final String VALIDATE_OPT_DESCRIPTION = "Validates an entity based on the entity type";
+    public static final String DEFINITION_OPT_DESCRIPTION = "Gets the Definition of entity";
+    public static final String SLA_MISS_ALERT_OPT_DESCRIPTION = "Get missing feed instances which missed SLA";
 
-    private static final String LOOKUP_OPT = "lookup";
-    private static final String PATH_OPT = "path";
-    private static final String TOUCH_OPT = "touch";
-    private static final String PROPS_OPT = "properties";
-    private static final String TAGS_OPT = "tags";
-    private static final String NUM_INSTANCES_OPT = "numInstances";
-    private static final String SHOWSCHEDULER_OPT = "showScheduler";
+
+    public static final String LOOKUP_OPT_DESCRIPTION = "Lookup a feed given its instance's path";
+    public static final String PATH_OPT = "path";
+    public static final String PATH_OPT_DESCRIPTION = "Path for a feed's instance";
+    public static final String TOUCH_OPT_DESCRIPTION = "Force update the entity in workflow engine"
+            + "(even without any changes to entity)";
+    public static final String PROPS_OPT = "properties";
+    public static final String PROPS_OPT_DESCRIPTION = "User supplied comma separated key value properties";
+    public static final String FIELDS_OPT = "fields";
+    public static final String FIELDS_OPT_DESCRIPTION = "Entity fields to show for a request";
+    public static final String TAGS_OPT = "tags";
+    public static final String TAGS_OPT_DESCRIPTION = "Filter returned entities by the specified tags";
+    public static final String NUM_INSTANCES_OPT = "numInstances";
+    public static final String NUM_INSTANCES_OPT_DESCRIPTION = "Number of instances to return per entity "
+            + "summary request";
+    public static final String NAMESEQ_OPT = "nameseq";
+    public static final String NAMESEQ_OPT_DESCRIPTION = "Subsequence of entity name";
+    public static final String TAGKEYS_OPT = "tagkeys";
+    public static final String TAGKEYS_OPT_DESCRIPTION = "Keywords in tags";
+    public static final String OFFSET_OPT_DESCRIPTION = "Start returning entities from this offset";
+    public static final String SHOWSCHEDULER_OPT = "showScheduler";
+    public static final String SHOWSCHEDULER_OPT_DESCRIPTION = "To return the scheduler "
+            + "on which the entity is scheduled.";
+    public static final String DEBUG_OPTION_DESCRIPTION = "Use debug mode to see debugging statements on stdout";
+    public static final String URL_OPTION_DESCRIPTION = "Falcon URL";
+    public static final String TYPE_OPT_DESCRIPTION = "Type of the entity. Valid entity types are: cluster, feed, "
+        + "process and datasource.";
+    public static final String COLO_OPT_DESCRIPTION = "Colo name";
+    public static final String END_OPT_DESCRIPTION = "End time is optional for summary";
+    public static final String CLUSTER_OPT_DESCRIPTION = "Cluster name";
+    public static final String ENTITY_NAME_OPT_DESCRIPTION = "Name of the entity, recommended but not mandatory "
+        + "to be unique.";
+    public static final String FILE_PATH_OPT_DESCRIPTION = "Path to entity xml file";
+    public static final String SCHEDULE_OPT_DESCRIPTION = "Schedules a submited entity in Falcon";
+    public static final String SUSPEND_OPT_DESCRIPTION = "Suspends a running entity in Falcon";
+    public static final String RESUME_OPT_DESCRIPTION = "Resumes a suspended entity in Falcon";
+    public static final String STATUS_OPT_DESCRIPTION = "Gets the status of entity";
+    public static final String SUMMARY_OPT_DESCRIPTION = "Get summary of instances for list of entities";
+    public static final String DEPENDENCY_OPT_DESCRIPTION = "Gets the dependencies of entity";
+    public static final String LIST_OPT_DESCRIPTION = "List entities registered for a type";
+    public static final String SKIPDRYRUN_OPT_DESCRIPTION = "skip dry run in workflow engine";
+    public static final String FILTER_BY_OPT_DESCRIPTION = "Filter returned entities by the specified status";
+    public static final String ORDER_BY_OPT_DESCRIPTION = "Order returned entities by this field";
+    public static final String SORT_ORDER_OPT_DESCRIPTION = "asc or desc order for results";
+    public static final String NUM_RESULTS_OPT_DESCRIPTION = "Number of results to return per request";
+    public static final String START_OPT_DESCRIPTION = "Start time is optional for summary";
+    public static final String DO_AS_OPT_DESCRIPTION = "doAs user";
 
     public FalconEntityCLI() throws Exception {
         super();
@@ -62,38 +111,26 @@ public class FalconEntityCLI extends FalconCLI {
 
         Options entityOptions = new Options();
 
-        Option submit = new Option(FalconCLIConstants.SUBMIT_OPT, false,
-                "Submits an entity xml to Falcon");
-        Option update = new Option(FalconCLIConstants.UPDATE_OPT, false,
-                "Updates an existing entity xml");
+        Option submit = new Option(FalconCLIConstants.SUBMIT_OPT, false, SUBMIT_OPT_DESCRIPTION);
+        Option update = new Option(FalconCLIConstants.UPDATE_OPT, false, UPDATE_OPT_DESCRIPTION);
+        Option schedule = new Option(FalconCLIConstants.SCHEDULE_OPT, false, SCHEDULE_OPT_DESCRIPTION);
+        Option suspend = new Option(FalconCLIConstants.SUSPEND_OPT, false, SUSPEND_OPT_DESCRIPTION);
+        Option resume = new Option(FalconCLIConstants.RESUME_OPT, false, RESUME_OPT_DESCRIPTION);
+        Option delete = new Option(FalconCLIConstants.DELETE_OPT, false, DELETE_OPT_DESCRIPTION);
+        Option submitAndSchedule = new Option(FalconCLIConstants.SUBMIT_AND_SCHEDULE_OPT, false,
+                SUBMIT_AND_SCHEDULE_OPT_DESCRIPTION);
+        Option validate = new Option(FalconCLIConstants.VALIDATE_OPT, false, VALIDATE_OPT_DESCRIPTION);
+        Option status = new Option(FalconCLIConstants.STATUS_OPT, false, STATUS_OPT_DESCRIPTION);
+        Option definition = new Option(FalconCLIConstants.DEFINITION_OPT, false, DEFINITION_OPT_DESCRIPTION);
+        Option dependency = new Option(FalconCLIConstants.DEPENDENCY_OPT, false, DEPENDENCY_OPT_DESCRIPTION);
+        Option list = new Option(FalconCLIConstants.LIST_OPT, false, LIST_OPT_DESCRIPTION);
+        Option lookup = new Option(FalconCLIConstants.LOOKUP_OPT, false, LOOKUP_OPT_DESCRIPTION);
+        Option slaAlert = new Option(FalconCLIConstants.SLA_MISS_ALERT_OPT, false, SLA_MISS_ALERT_OPT_DESCRIPTION);
+        Option entitySummary = new Option(FalconCLIConstants.SUMMARY_OPT, false, SUMMARY_OPT_DESCRIPTION);
+        Option touch = new Option(FalconCLIConstants.TOUCH_OPT, false, TOUCH_OPT_DESCRIPTION);
+
         Option updateClusterDependents = new Option(FalconCLIConstants.UPDATE_CLUSTER_DEPENDENTS_OPT, false,
                 "Updates dependent entities of a cluster in workflow engine");
-        Option schedule = new Option(FalconCLIConstants.SCHEDULE_OPT, false,
-                "Schedules a submited entity in Falcon");
-        Option suspend = new Option(FalconCLIConstants.SUSPEND_OPT, false,
-                "Suspends a running entity in Falcon");
-        Option resume = new Option(FalconCLIConstants.RESUME_OPT, false,
-                "Resumes a suspended entity in Falcon");
-        Option delete = new Option(FalconCLIConstants.DELETE_OPT, false,
-                "Deletes an entity in Falcon, and kills its instance from workflow engine");
-        Option submitAndSchedule = new Option(FalconCLIConstants.SUBMIT_AND_SCHEDULE_OPT, false,
-                "Submits and entity to Falcon and schedules it immediately");
-        Option validate = new Option(FalconCLIConstants.VALIDATE_OPT, false,
-                "Validates an entity based on the entity type");
-        Option status = new Option(FalconCLIConstants.STATUS_OPT, false,
-                "Gets the status of entity");
-        Option definition = new Option(DEFINITION_OPT, false,
-                "Gets the Definition of entity");
-        Option dependency = new Option(FalconCLIConstants.DEPENDENCY_OPT, false,
-                "Gets the dependencies of entity");
-        Option list = new Option(FalconCLIConstants.LIST_OPT, false,
-                "List entities registered for a type");
-        Option lookup = new Option(LOOKUP_OPT, false, "Lookup a feed given its instance's path");
-        Option slaAlert = new Option(SLA_MISS_ALERT_OPT, false, "Get missing feed instances which missed SLA");
-        Option entitySummary = new Option(FalconCLIConstants.SUMMARY_OPT, false,
-                "Get summary of instances for list of entities");
-        Option touch = new Option(TOUCH_OPT, false,
-                "Force update the entity in workflow engine(even without any changes to entity)");
 
         OptionGroup group = new OptionGroup();
         group.addOption(submit);
@@ -114,41 +151,32 @@ public class FalconEntityCLI extends FalconCLI {
         group.addOption(entitySummary);
         group.addOption(touch);
 
-        Option url = new Option(FalconCLIConstants.URL_OPTION, true, "Falcon URL");
-        Option entityType = new Option(FalconCLIConstants.TYPE_OPT, true,
-                "Entity type, can be cluster, feed or process xml");
-        Option filePath = new Option(FalconCLIConstants.FILE_PATH_OPT, true,
-                "Path to entity xml file");
-        Option entityName = new Option(FalconCLIConstants.ENTITY_NAME_OPT, true,
-                "Entity type, can be cluster, feed or process xml");
-        Option start = new Option(FalconCLIConstants.START_OPT, true, "Start time is optional for summary");
-        Option end = new Option(FalconCLIConstants.END_OPT, true, "End time is optional for summary");
-        Option colo = new Option(FalconCLIConstants.COLO_OPT, true, "Colo name");
-        Option cluster = new Option(FalconCLIConstants.CLUSTER_OPT, true, "Cluster name");
+        Option url = new Option(URL_OPTION, true, URL_OPTION_DESCRIPTION);
+        Option entityType = new Option(TYPE_OPT, true, TYPE_OPT_DESCRIPTION);
+        Option filePath = new Option(FILE_PATH_OPT, true, FILE_PATH_OPT_DESCRIPTION);
+        Option entityName = new Option(ENTITY_NAME_OPT, true, ENTITY_NAME_OPT_DESCRIPTION);
+        Option start = new Option(START_OPT, true, START_OPT_DESCRIPTION);
+        Option end = new Option(END_OPT, true, END_OPT_DESCRIPTION);
+        Option colo = new Option(COLO_OPT, true, COLO_OPT_DESCRIPTION);
+        Option cluster = new Option(CLUSTER_OPT, true, CLUSTER_OPT_DESCRIPTION);
         colo.setRequired(false);
-        Option fields = new Option(FalconCLIConstants.FIELDS_OPT, true, "Entity fields to show for a request");
-        Option filterBy = new Option(FalconCLIConstants.FILTER_BY_OPT, true,
-                "Filter returned entities by the specified status");
-        Option filterTags = new Option(TAGS_OPT, true, "Filter returned entities by the specified tags");
-        Option nameSubsequence = new Option(FalconCLIConstants.NAMESEQ_OPT, true, "Subsequence of entity name");
-        Option tagKeywords = new Option(FalconCLIConstants.TAGKEYS_OPT, true, "Keywords in tags");
-        Option orderBy = new Option(FalconCLIConstants.ORDER_BY_OPT, true,
-                "Order returned entities by this field");
-        Option sortOrder = new Option(FalconCLIConstants.SORT_ORDER_OPT, true, "asc or desc order for results");
-        Option offset = new Option(FalconCLIConstants.OFFSET_OPT, true,
-                "Start returning entities from this offset");
-        Option numResults = new Option(FalconCLIConstants.NUM_RESULTS_OPT, true,
-                "Number of results to return per request");
-        Option numInstances = new Option(NUM_INSTANCES_OPT, true,
-                "Number of instances to return per entity summary request");
-        Option path = new Option(PATH_OPT, true, "Path for a feed's instance");
-        Option skipDryRun = new Option(FalconCLIConstants.SKIPDRYRUN_OPT, false, "skip dry run in workflow engine");
-        Option doAs = new Option(FalconCLIConstants.DO_AS_OPT, true, "doAs user");
-        Option userProps = new Option(PROPS_OPT, true, "User supplied comma separated key value properties");
-        Option showScheduler = new Option(SHOWSCHEDULER_OPT, false, "To return the scheduler "
-                + "on which the entity is scheduled.");
-        Option debug = new Option(FalconCLIConstants.DEBUG_OPTION, false,
-                "Use debug mode to see debugging statements on stdout");
+
+        Option fields = new Option(FIELDS_OPT, true, FIELDS_OPT_DESCRIPTION);
+        Option filterBy = new Option(FILTER_BY_OPT, true, FILTER_BY_OPT_DESCRIPTION);
+        Option filterTags = new Option(TAGS_OPT, true, TAGS_OPT_DESCRIPTION);
+        Option nameSubsequence = new Option(NAMESEQ_OPT, true, NAMESEQ_OPT_DESCRIPTION);
+        Option tagKeywords = new Option(TAGKEYS_OPT, true, TAGKEYS_OPT_DESCRIPTION);
+        Option orderBy = new Option(ORDER_BY_OPT, true, ORDER_BY_OPT_DESCRIPTION);
+        Option sortOrder = new Option(SORT_ORDER_OPT, true, SORT_ORDER_OPT_DESCRIPTION);
+        Option offset = new Option(OFFSET_OPT, true, OFFSET_OPT_DESCRIPTION);
+        Option numResults = new Option(NUM_RESULTS_OPT, true, NUM_RESULTS_OPT_DESCRIPTION);
+        Option numInstances = new Option(NUM_INSTANCES_OPT, true, NUM_INSTANCES_OPT_DESCRIPTION);
+        Option path = new Option(PATH_OPT, true, PATH_OPT_DESCRIPTION);
+        Option skipDryRun = new Option(SKIPDRYRUN_OPT, false, SKIPDRYRUN_OPT_DESCRIPTION);
+        Option doAs = new Option(DO_AS_OPT, true, DO_AS_OPT_DESCRIPTION);
+        Option userProps = new Option(PROPS_OPT, true, PROPS_OPT_DESCRIPTION);
+        Option showScheduler = new Option(SHOWSCHEDULER_OPT, false, SHOWSCHEDULER_OPT_DESCRIPTION);
+        Option debug = new Option(DEBUG_OPTION, false, DEBUG_OPTION_DESCRIPTION);
 
         entityOptions.addOption(url);
         entityOptions.addOption(path);
@@ -179,12 +207,11 @@ public class FalconEntityCLI extends FalconCLI {
         return entityOptions;
     }
 
-    public void entityCommand(CommandLine commandLine, FalconClient client) throws FalconCLIException, IOException {
+    public void entityCommand(CommandLine commandLine, FalconClient client) throws IOException {
         Set<String> optionsList = new HashSet<String>();
         for (Option option : commandLine.getOptions()) {
             optionsList.add(option.getOpt());
         }
-
         String result = null;
         String entityType = commandLine.getOptionValue(FalconCLIConstants.TYPE_OPT);
         String entityName = commandLine.getOptionValue(FalconCLIConstants.ENTITY_NAME_OPT);
@@ -206,19 +233,16 @@ public class FalconEntityCLI extends FalconCLI {
         Integer numResults = parseIntegerInput(commandLine.getOptionValue(FalconCLIConstants.NUM_RESULTS_OPT),
                 null, "numResults");
         String doAsUser = commandLine.getOptionValue(FalconCLIConstants.DO_AS_OPT);
-
         Integer numInstances = parseIntegerInput(commandLine.getOptionValue(NUM_INSTANCES_OPT), 7, "numInstances");
         Boolean skipDryRun = null;
         if (optionsList.contains(FalconCLIConstants.SKIPDRYRUN_OPT)) {
             skipDryRun = true;
         }
-
         String userProps = commandLine.getOptionValue(PROPS_OPT);
         boolean showScheduler = false;
         if (optionsList.contains(SHOWSCHEDULER_OPT)) {
             showScheduler = true;
         }
-
         EntityType entityTypeEnum = null;
         if (optionsList.contains(FalconCLIConstants.LIST_OPT)
                 || optionsList.contains(FalconCLIConstants.UPDATE_CLUSTER_DEPENDENTS_OPT)) {
@@ -238,7 +262,7 @@ public class FalconEntityCLI extends FalconCLI {
         validateSortOrder(sortOrder);
         String entityAction = "entity";
 
-        if (optionsList.contains(SLA_MISS_ALERT_OPT)) {
+        if (optionsList.contains(FalconCLIConstants.SLA_MISS_ALERT_OPT)) {
             validateNotEmpty(entityType, FalconCLIConstants.TYPE_OPT);
             validateNotEmpty(start, FalconCLIConstants.START_OPT);
             parseDateString(start);
@@ -247,10 +271,10 @@ public class FalconEntityCLI extends FalconCLI {
                     entityName, start, end, colo);
             result = ResponseHelper.getString(response);
         } else if (optionsList.contains(FalconCLIConstants.SUBMIT_OPT)) {
-            validateNotEmpty(filePath, "file");
+            validateNotEmpty(filePath, FILE_PATH_OPT);
             validateColo(optionsList);
             result = client.submit(entityType, filePath, doAsUser).getMessage();
-        } else if (optionsList.contains(LOOKUP_OPT)) {
+        } else if (optionsList.contains(FalconCLIConstants.LOOKUP_OPT)) {
             validateNotEmpty(feedInstancePath, PATH_OPT);
             FeedLookupResult resp = client.reverseLookUp(entityType, feedInstancePath, doAsUser);
             result = ResponseHelper.getString(resp);
@@ -259,17 +283,21 @@ public class FalconEntityCLI extends FalconCLI {
             validateColo(optionsList);
             validateNotEmpty(entityName, FalconCLIConstants.ENTITY_NAME_OPT);
             result = client.update(entityType, entityName, filePath, skipDryRun, doAsUser).getMessage();
+        } else if (optionsList.contains(SUBMIT_AND_SCHEDULE_OPT)) {
+            validateNotEmpty(filePath, FILE_PATH_OPT);
+            validateColo(optionsList);
+            result = client.submitAndSchedule(entityType, filePath, skipDryRun, doAsUser, userProps).getMessage();
         }  else if (optionsList.contains(FalconCLIConstants.UPDATE_CLUSTER_DEPENDENTS_OPT)) {
             validateNotEmpty(cluster, FalconCLIConstants.CLUSTER_OPT);
             result = client.updateClusterDependents(cluster, skipDryRun, doAsUser).getMessage();
+        } else if (optionsList.contains(VALIDATE_OPT)) {
+            validateNotEmpty(filePath, FILE_PATH_OPT);
+            validateColo(optionsList);
+            result = client.validate(entityType, filePath, skipDryRun, doAsUser).getMessage();
         } else if (optionsList.contains(FalconCLIConstants.SUBMIT_AND_SCHEDULE_OPT)) {
             validateNotEmpty(filePath, "file");
             validateColo(optionsList);
             result = client.submitAndSchedule(entityType, filePath, skipDryRun, doAsUser, userProps).getMessage();
-        } else if (optionsList.contains(FalconCLIConstants.VALIDATE_OPT)) {
-            validateNotEmpty(filePath, "file");
-            validateColo(optionsList);
-            result = client.validate(entityType, filePath, skipDryRun, doAsUser).getMessage();
         } else if (optionsList.contains(FalconCLIConstants.SCHEDULE_OPT)) {
             validateNotEmpty(entityName, FalconCLIConstants.ENTITY_NAME_OPT);
             colo = getColo(colo);
@@ -290,7 +318,7 @@ public class FalconEntityCLI extends FalconCLI {
             validateNotEmpty(entityName, FalconCLIConstants.ENTITY_NAME_OPT);
             colo = getColo(colo);
             result = client.getStatus(entityTypeEnum, entityName, colo, doAsUser, showScheduler).getMessage();
-        } else if (optionsList.contains(DEFINITION_OPT)) {
+        } else if (optionsList.contains(FalconCLIConstants.DEFINITION_OPT)) {
             validateColo(optionsList);
             validateNotEmpty(entityName, FalconCLIConstants.ENTITY_NAME_OPT);
             result = client.getDefinition(entityType, entityName, doAsUser).toString();
@@ -315,7 +343,7 @@ public class FalconEntityCLI extends FalconCLI {
             result = ResponseHelper.getString(client.getEntitySummary(
                     entityType, cluster, start, end, fields, filterBy, filterTags,
                     orderBy, sortOrder, offset, numResults, numInstances, doAsUser));
-        } else if (optionsList.contains(TOUCH_OPT)) {
+        } else if (optionsList.contains(FalconCLIConstants.TOUCH_OPT)) {
             validateNotEmpty(entityName, FalconCLIConstants.ENTITY_NAME_OPT);
             colo = getColo(colo);
             result = client.touch(entityType, entityName, colo, skipDryRun, doAsUser).getMessage();
@@ -329,13 +357,13 @@ public class FalconEntityCLI extends FalconCLI {
         OUT.get().println(result);
     }
 
-    private void validateColo(Set<String> optionsList) throws FalconCLIException {
+    private void validateColo(Set<String> optionsList) {
         if (optionsList.contains(FalconCLIConstants.COLO_OPT)) {
             throw new FalconCLIException("Invalid argument : " + FalconCLIConstants.COLO_OPT);
         }
     }
 
-    private void validateEntityFields(String fields) throws FalconCLIException {
+    public static void validateEntityFields(String fields) {
         if (StringUtils.isEmpty(fields)) {
             return;
         }
@@ -349,7 +377,7 @@ public class FalconEntityCLI extends FalconCLI {
         }
     }
 
-    private Date parseDateString(String time) throws FalconCLIException {
+    private Date parseDateString(String time) {
         if (time != null && !time.isEmpty()) {
             try {
                 return SchemaHelper.parseDateUTC(time);

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java
index 393603e..a8a30ab 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java
@@ -57,7 +57,7 @@ public class FalconExtensionCLI {
     public FalconExtensionCLI() {
     }
 
-    public void extensionCommand(CommandLine commandLine, FalconClient client) throws FalconCLIException {
+    public void extensionCommand(CommandLine commandLine, FalconClient client) {
         Set<String> optionsList = new HashSet<>();
         for (Option option : commandLine.getOptions()) {
             optionsList.add(option.getOpt());
@@ -207,8 +207,7 @@ public class FalconExtensionCLI {
         return extensionOptions;
     }
 
-    private void validateRequiredParameter(final String parameter, final String parameterName)
-        throws FalconCLIException {
+    private void validateRequiredParameter(final String parameter, final String parameterName) {
         if (StringUtils.isBlank(parameter)) {
             throw new FalconCLIException("The parameter " + parameterName + " cannot be null or empty");
         }

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java
index 3b5d7ca..f882eb5 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java
@@ -190,7 +190,7 @@ public class FalconInstanceCLI extends FalconCLI {
         return instanceOptions;
     }
 
-    public void instanceCommand(CommandLine commandLine, FalconClient client) throws FalconCLIException, IOException {
+    public void instanceCommand(CommandLine commandLine, FalconClient client) throws IOException {
         Set<String> optionsList = new HashSet<String>();
         for (Option option : commandLine.getOptions()) {
             optionsList.add(option.getOpt());
@@ -307,7 +307,7 @@ public class FalconInstanceCLI extends FalconCLI {
 
     private void validateInstanceCommands(Set<String> optionsList,
                                           String entity, String type,
-                                          String colo) throws FalconCLIException {
+                                          String colo) {
 
         validateNotEmpty(entity, FalconCLIConstants.ENTITY_NAME_OPT);
         validateNotEmpty(type, FalconCLIConstants.TYPE_OPT);
@@ -338,7 +338,7 @@ public class FalconInstanceCLI extends FalconCLI {
         }
     }
 
-    private List<LifeCycle> getLifeCycle(String lifeCycleValue) throws FalconCLIException {
+    private List<LifeCycle> getLifeCycle(String lifeCycleValue) {
 
         if (lifeCycleValue != null) {
             String[] lifeCycleValues = lifeCycleValue.split(",");

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java
index d8cd124..98a29ef 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java
@@ -127,7 +127,7 @@ public class FalconMetadataCLI extends FalconCLI {
         return metadataOptions;
     }
 
-    public void metadataCommand(CommandLine commandLine, FalconClient client) throws FalconCLIException {
+    public void metadataCommand(CommandLine commandLine, FalconClient client) {
         Set<String> optionsList = new HashSet<String>();
         for (Option option : commandLine.getOptions()) {
             optionsList.add(option.getOpt());
@@ -196,13 +196,13 @@ public class FalconMetadataCLI extends FalconCLI {
         OUT.get().println(result);
     }
 
-    private void validatePipelineName(String pipeline) throws FalconCLIException {
+    private void validatePipelineName(String pipeline) {
         if (StringUtils.isEmpty(pipeline)) {
             throw new FalconCLIException("Invalid value for pipeline");
         }
     }
 
-    private void validateDimensionType(String dimensionType) throws FalconCLIException {
+    private void validateDimensionType(String dimensionType) {
         if (StringUtils.isEmpty(dimensionType)
                 ||  dimensionType.contains("INSTANCE")) {
             throw new FalconCLIException("Invalid value provided for queryParam \"type\" " + dimensionType);
@@ -214,13 +214,13 @@ public class FalconMetadataCLI extends FalconCLI {
         }
     }
 
-    private void validateDimensionName(String dimensionName, String action) throws FalconCLIException {
+    private void validateDimensionName(String dimensionName, String action) {
         if (StringUtils.isEmpty(dimensionName)) {
             throw new FalconCLIException("Dimension ID cannot be empty or null for action " + action);
         }
     }
 
-    private void validateScheduleEntity(String schedEntityType, String schedEntityName) throws FalconCLIException {
+    private void validateScheduleEntity(String schedEntityType, String schedEntityName) {
         if (StringUtils.isBlank(schedEntityType)) {
             throw new FalconCLIException("Entity must be schedulable type : -feed/process");
         }
@@ -230,13 +230,13 @@ public class FalconMetadataCLI extends FalconCLI {
         }
     }
 
-    private void validateId(String id) throws FalconCLIException {
+    private void validateId(String id) {
         if (id == null || id.length() == 0) {
             throw new FalconCLIException("Missing argument: id");
         }
     }
 
-    private void validateVerticesCommand(String key, String value) throws FalconCLIException {
+    private void validateVerticesCommand(String key, String value) {
         if (key == null || key.length() == 0) {
             throw new FalconCLIException("Missing argument: key");
         }
@@ -246,7 +246,7 @@ public class FalconMetadataCLI extends FalconCLI {
         }
     }
 
-    private void validateVertexEdgesCommand(String id, String direction) throws FalconCLIException {
+    private void validateVertexEdgesCommand(String id, String direction) {
         if (id == null || id.length() == 0) {
             throw new FalconCLIException("Missing argument: id");
         }

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java b/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java
index dbd28fb..acff70e 100644
--- a/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java
+++ b/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java
@@ -20,7 +20,7 @@ package org.apache.falcon.cli.commands;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.falcon.cli.FalconCLIRuntimeException;
+import org.apache.falcon.client.AbstractFalconClient;
 import org.apache.falcon.client.FalconCLIException;
 import org.apache.falcon.client.FalconClient;
 import org.springframework.shell.core.ExecutionProcessor;
@@ -30,18 +30,21 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Properties;
 
+import static org.apache.falcon.cli.FalconCLI.CURRENT_COLO;
+import static org.apache.falcon.cli.FalconCLI.FALCON_URL;
+
 /**
  * Common code for all falcon command classes.
  */
 public class BaseFalconCommands implements ExecutionProcessor {
-    private static final String FALCON_URL = "FALCON_URL";
     private static final String FALCON_URL_PROPERTY = "falcon.url";
     private static final String DO_AS = "DO_AS";
     private static final String DO_AS_PROPERTY = "do.as";
     private static final String CLIENT_PROPERTIES = "/client.properties";
+    protected static final String FALCON_URL_ABSENT = "Failed to get falcon url from environment or client properties";
     private static Properties clientProperties;
     private static Properties backupProperties = new Properties();
-    private static FalconClient client;
+    private static AbstractFalconClient client;
 
     protected static Properties getClientProperties() {
         if (clientProperties == null) {
@@ -54,7 +57,7 @@ public class BaseFalconCommands implements ExecutionProcessor {
                     try {
                         prop.load(inputStream);
                     } catch (IOException e) {
-                        throw new FalconCLIRuntimeException(e);
+                        throw new FalconCLIException(e);
                     }
                 }
             } finally {
@@ -65,7 +68,7 @@ public class BaseFalconCommands implements ExecutionProcessor {
                 prop.setProperty(FALCON_URL_PROPERTY, urlOverride);
             }
             if (prop.getProperty(FALCON_URL_PROPERTY) == null) {
-                throw new FalconCLIRuntimeException("Failed to get falcon url from environment or client properties");
+                throw new FalconCLIException(FALCON_URL_ABSENT);
             }
             String doAsOverride = System.getenv(DO_AS);
             if (doAsOverride != null) {
@@ -81,7 +84,7 @@ public class BaseFalconCommands implements ExecutionProcessor {
         Properties props;
         try {
             props = getClientProperties();
-        } catch (FalconCLIRuntimeException e) {
+        } catch (FalconCLIException e) {
             props = backupProperties;
         }
         if (StringUtils.isBlank(value)) {
@@ -93,18 +96,29 @@ public class BaseFalconCommands implements ExecutionProcessor {
         client = null;
     }
 
-    public static FalconClient getFalconClient() {
+    public static AbstractFalconClient getFalconClient() {
         if (client == null) {
-            try {
-                client = new FalconClient(getClientProperties().getProperty(FALCON_URL_PROPERTY),
-                        getClientProperties());
-            } catch (FalconCLIException e) {
-                throw new FalconCLIRuntimeException(e.getMessage(), e.getCause());
-            }
+            client = new FalconClient(getClientProperties().getProperty(FALCON_URL_PROPERTY), getClientProperties());
         }
         return client;
     }
 
+    public static void setFalconClient(AbstractFalconClient abstractFalconClient) {
+        client = abstractFalconClient;
+    }
+
+    protected String getColo(String colo) {
+        if (colo == null) {
+            Properties prop = getClientProperties();
+            colo = prop.getProperty(CURRENT_COLO, "*");
+        }
+        return colo;
+    }
+
+    protected String getDoAs() {
+        return getClientProperties().getProperty(DO_AS_PROPERTY);
+    }
+
     @Override
     public ParseResult beforeInvocation(ParseResult parseResult) {
         Object[] args = parseResult.getArguments();

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java b/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java
index cabe5a8..c1e7e30 100644
--- a/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java
+++ b/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java
@@ -23,12 +23,14 @@ package org.apache.falcon.cli.commands;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
+import org.springframework.stereotype.Component;
 
 import javax.annotation.Nonnull;
 
 /**
  * Connection Commands.
  */
+@Component
 public class FalconConnectionCommands extends BaseFalconCommands {
 
     @CliCommand(value = "get", help = "get properties")

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/commands/FalconEntityCommands.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/commands/FalconEntityCommands.java b/cli/src/main/java/org/apache/falcon/cli/commands/FalconEntityCommands.java
index 6e091ef..427ba1c 100644
--- a/cli/src/main/java/org/apache/falcon/cli/commands/FalconEntityCommands.java
+++ b/cli/src/main/java/org/apache/falcon/cli/commands/FalconEntityCommands.java
@@ -18,9 +18,309 @@
 
 package org.apache.falcon.cli.commands;
 
+import org.apache.falcon.ResponseHelper;
+import org.apache.falcon.entity.v0.EntityType;
+import org.apache.falcon.resource.EntityList;
+import org.apache.falcon.resource.FeedLookupResult;
+import org.apache.falcon.resource.SchedulableEntityInstanceResult;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+
+import static org.apache.falcon.FalconCLIConstants.DEFINITION_OPT;
+import static org.apache.falcon.FalconCLIConstants .DELETE_OPT;
+import static org.apache.falcon.FalconCLIConstants .LOOKUP_OPT;
+import static org.apache.falcon.FalconCLIConstants.SLA_MISS_ALERT_OPT;
+import static org.apache.falcon.FalconCLIConstants.SUBMIT_OPT;
+import static org.apache.falcon.FalconCLIConstants.UPDATE_OPT;
+import static org.apache.falcon.cli.FalconCLI.validateEntityTypeForSummary;
+import static org.apache.falcon.cli.FalconCLI.validateFilterBy;
+import static org.apache.falcon.cli.FalconCLI.validateOrderBy;
+import static org.apache.falcon.cli.FalconEntityCLI.CLUSTER_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.CLUSTER_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.COLO_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.COLO_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.DEFINITION_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.DELETE_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.DEPENDENCY_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.DEPENDENCY_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.END_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.END_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.ENTITY_NAME_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.ENTITY_NAME_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.FIELDS_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.FIELDS_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.FILE_PATH_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.FILE_PATH_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.FILTER_BY_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.FILTER_BY_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.LIST_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.LIST_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.LOOKUP_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.NAMESEQ_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.NAMESEQ_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.NUM_INSTANCES_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.NUM_INSTANCES_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.NUM_RESULTS_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.NUM_RESULTS_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.OFFSET_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.OFFSET_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.ORDER_BY_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.ORDER_BY_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.PATH_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.PATH_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.PROPS_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.PROPS_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.RESUME_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.RESUME_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SCHEDULE_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.SCHEDULE_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SHOWSCHEDULER_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.SHOWSCHEDULER_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SKIPDRYRUN_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.SKIPDRYRUN_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SLA_MISS_ALERT_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SORT_ORDER_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.SORT_ORDER_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.START_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.START_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.STATUS_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.STATUS_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SUBMIT_AND_SCHEDULE_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.SUBMIT_AND_SCHEDULE_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SUBMIT_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SUMMARY_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.SUMMARY_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.SUSPEND_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.SUSPEND_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.TAGKEYS_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.TAGKEYS_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.TAGS_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.TAGS_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.TYPE_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.TYPE_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.UPDATE_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.VALIDATE_OPT;
+import static org.apache.falcon.cli.FalconEntityCLI.VALIDATE_OPT_DESCRIPTION;
+import static org.apache.falcon.cli.FalconEntityCLI.validateEntityFields;
+
 /**
  * Entity Commands.
  */
+@Component
 public class FalconEntityCommands extends BaseFalconCommands {
+    public static final String ENTITY_PREFIX = "entity";
+    public static final String ENTITY_COMMAND_PREFIX = ENTITY_PREFIX + " ";
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + SLA_MISS_ALERT_OPT, help = SLA_MISS_ALERT_OPT_DESCRIPTION)
+    public String slaAlert(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = false, help = ENTITY_NAME_OPT_DESCRIPTION)
+            final String entityName,
+            @CliOption(key = {COLO_OPT}, mandatory = false, help = COLO_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "*") final String colo,
+            @CliOption(key = {START_OPT}, mandatory = true, help = START_OPT_DESCRIPTION) final String start,
+            @CliOption(key = {END_OPT}, mandatory = false, help = END_OPT_DESCRIPTION) final String end
+    ) {
+        SchedulableEntityInstanceResult response = getFalconClient()
+                .getFeedSlaMissPendingAlerts(entityType.name().toLowerCase(), entityName, start, end, getColo(colo));
+        return ResponseHelper.getString(response);
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + SUBMIT_OPT, help = SUBMIT_OPT_DESCRIPTION)
+    public String submit(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {FILE_PATH_OPT}, mandatory = true, help = FILE_PATH_OPT_DESCRIPTION) final File filePath
+    ) {
+
+        return getFalconClient().submit(entityType.name().toLowerCase(), filePath.getPath(), getDoAs()).getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + LOOKUP_OPT, help = LOOKUP_OPT_DESCRIPTION)
+    public String lookup(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {PATH_OPT}, mandatory = true, help = PATH_OPT_DESCRIPTION) final String feedInstancePath
+    ) {
+
+        FeedLookupResult resp = getFalconClient().reverseLookUp(entityType.name().toLowerCase(),
+                feedInstancePath, getDoAs());
+        return ResponseHelper.getString(resp);
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + UPDATE_OPT, help = UPDATE_OPT_DESCRIPTION)
+    public String update(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = true, help = ENTITY_NAME_OPT_DESCRIPTION)
+            final String entityName,
+            @CliOption(key = {FILE_PATH_OPT}, mandatory = true, help = FILE_PATH_OPT_DESCRIPTION)
+            final File filePath,
+            @CliOption(key = {SKIPDRYRUN_OPT}, mandatory = false, help = SKIPDRYRUN_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") boolean skipDryRun
+    ) {
+        return getFalconClient()
+                .update(entityType.name().toLowerCase(), entityName, filePath.getPath(), skipDryRun, getDoAs())
+                .getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + SUBMIT_AND_SCHEDULE_OPT, help = SUBMIT_AND_SCHEDULE_OPT_DESCRIPTION)
+    public String submitAndSchedule(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {FILE_PATH_OPT}, mandatory = true, help = FILE_PATH_OPT_DESCRIPTION) final File filePath,
+            @CliOption(key = {SKIPDRYRUN_OPT}, mandatory = false, help = SKIPDRYRUN_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") boolean skipDryRun,
+            @CliOption(key = {PROPS_OPT}, mandatory = false, help = PROPS_OPT_DESCRIPTION) final String properties
+    ) {
+
+        return getFalconClient()
+                .submitAndSchedule(entityType.name().toLowerCase(), filePath.getPath(), skipDryRun, getDoAs(),
+                        properties)
+                .getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + VALIDATE_OPT, help = VALIDATE_OPT_DESCRIPTION)
+    public String validate(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {FILE_PATH_OPT}, mandatory = true, help = FILE_PATH_OPT_DESCRIPTION) final File filePath,
+            @CliOption(key = {SKIPDRYRUN_OPT}, mandatory = false, help = SKIPDRYRUN_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") boolean skipDryRun
+    ) {
+
+        return getFalconClient()
+                .validate(entityType.name().toLowerCase(), filePath.getPath(), skipDryRun, getDoAs())
+                .getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + SCHEDULE_OPT, help = SCHEDULE_OPT_DESCRIPTION)
+    public String schedule(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = true, help = ENTITY_NAME_OPT_DESCRIPTION) String entityName,
+            @CliOption(key = {COLO_OPT}, mandatory = false, help = COLO_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "*") final String colo,
+            @CliOption(key = {SKIPDRYRUN_OPT}, mandatory = false, help = SKIPDRYRUN_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") boolean skipDryRun,
+            @CliOption(key = {PROPS_OPT}, mandatory = false, help = PROPS_OPT_DESCRIPTION) final String properties
+    ) {
+
+        return getFalconClient().schedule(entityType, entityName, colo, skipDryRun, getDoAs(), properties).getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + SUSPEND_OPT, help = SUSPEND_OPT_DESCRIPTION)
+    public String suspend(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = true, help = ENTITY_NAME_OPT_DESCRIPTION) String entityName,
+            @CliOption(key = {COLO_OPT}, mandatory = false, help = COLO_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "*") final String colo
+    ) {
+
+        return getFalconClient().suspend(entityType, entityName, colo, getDoAs()).getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + RESUME_OPT, help = RESUME_OPT_DESCRIPTION)
+    public String resume(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = true, help = ENTITY_NAME_OPT_DESCRIPTION) String entityName,
+            @CliOption(key = {COLO_OPT}, mandatory = false, help = COLO_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "*") final String colo
+    ) {
+
+        return getFalconClient().resume(entityType, entityName, colo, getDoAs()).getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + DELETE_OPT, help = DELETE_OPT_DESCRIPTION)
+    public String delete(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = true, help = ENTITY_NAME_OPT_DESCRIPTION) String entityName
+    ) {
+
+        return getFalconClient().delete(entityType, entityName, getDoAs()).getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + STATUS_OPT, help = STATUS_OPT_DESCRIPTION)
+    public String getStatus(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = true, help = ENTITY_NAME_OPT_DESCRIPTION) String entityName,
+            @CliOption(key = {COLO_OPT}, mandatory = false, help = COLO_OPT_DESCRIPTION,
+                    unspecifiedDefaultValue = "*") final String colo,
+            @CliOption(key = {SHOWSCHEDULER_OPT}, mandatory = true,
+                    help = SHOWSCHEDULER_OPT_DESCRIPTION) final boolean showScheduler
+    ) {
+
+        return getFalconClient().getStatus(entityType, entityName, colo, getDoAs(), showScheduler).getMessage();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + DEFINITION_OPT, help = DEFINITION_OPT_DESCRIPTION)
+    public String getDefinition(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = true, help = ENTITY_NAME_OPT_DESCRIPTION) String entityName
+    ) {
+
+        return getFalconClient().getDefinition(entityType.name().toLowerCase(), entityName, getDoAs()).toString();
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + DEPENDENCY_OPT, help = DEPENDENCY_OPT_DESCRIPTION)
+    public String getDependency(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {ENTITY_NAME_OPT}, mandatory = true, help = ENTITY_NAME_OPT_DESCRIPTION) String entityName
+    ) {
+
+        return getFalconClient().getDependency(entityType.name().toLowerCase(), entityName, getDoAs()).toString();
+    }
+
+    // SUSPEND CHECKSTYLE CHECK ParameterNumberCheck
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + LIST_OPT, help = LIST_OPT_DESCRIPTION)
+    public String list(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {FIELDS_OPT}, mandatory = false, help = FIELDS_OPT_DESCRIPTION) final String fields,
+            @CliOption(key = {ORDER_BY_OPT}, mandatory = false, help = ORDER_BY_OPT_DESCRIPTION) final String orderBy,
+            @CliOption(key = {SORT_ORDER_OPT}, mandatory = false,
+                    help = SORT_ORDER_OPT_DESCRIPTION) final String sortOrder,
+            @CliOption(key = {FILTER_BY_OPT}, mandatory = false,
+                    help = FILTER_BY_OPT_DESCRIPTION) final String filterBy,
+            @CliOption(key = {TAGS_OPT}, mandatory = false, help = TAGS_OPT_DESCRIPTION) final String filterTags,
+            @CliOption(key = {NAMESEQ_OPT}, mandatory = false,
+                    help = NAMESEQ_OPT_DESCRIPTION) final String nameSubsequence,
+            @CliOption(key = {TAGKEYS_OPT}, mandatory = false, help = TAGKEYS_OPT_DESCRIPTION) final String tagKeywords,
+            @CliOption(key = {OFFSET_OPT}, mandatory = false, help = OFFSET_OPT_DESCRIPTION) final Integer offset,
+            @CliOption(key = {NUM_RESULTS_OPT}, mandatory = false,
+                    help = NUM_RESULTS_OPT_DESCRIPTION) final Integer numResults
+
+    ) {
+        validateEntityFields(fields);
+        validateOrderBy(orderBy, ENTITY_PREFIX);
+        validateFilterBy(filterBy, ENTITY_PREFIX);
+        EntityList entityList = getFalconClient().getEntityList(entityType.name().toLowerCase(), fields,
+                nameSubsequence, tagKeywords, filterBy, filterTags, orderBy, sortOrder, offset, numResults, getDoAs());
+        return entityList != null ? entityList.toString() : "No entity of type (" + entityType + ") found.";
+    }
+
+    @CliCommand(value = ENTITY_COMMAND_PREFIX + SUMMARY_OPT, help = SUMMARY_OPT_DESCRIPTION)
+    public String summary(
+            @CliOption(key = {TYPE_OPT}, mandatory = true, help = TYPE_OPT_DESCRIPTION) final EntityType entityType,
+            @CliOption(key = {CLUSTER_OPT}, mandatory = true, help = CLUSTER_OPT_DESCRIPTION) final String cluster,
+            @CliOption(key = {START_OPT}, mandatory = false, help = START_OPT_DESCRIPTION) final String start,
+            @CliOption(key = {END_OPT}, mandatory = false, help = END_OPT_DESCRIPTION) final String end,
+            @CliOption(key = {FIELDS_OPT}, mandatory = false, help = FIELDS_OPT_DESCRIPTION) final String fields,
+            @CliOption(key = {ORDER_BY_OPT}, mandatory = false, help = ORDER_BY_OPT_DESCRIPTION) final String orderBy,
+            @CliOption(key = {SORT_ORDER_OPT}, mandatory = false,
+                    help = SORT_ORDER_OPT_DESCRIPTION) final String sortOrder,
+            @CliOption(key = {FILTER_BY_OPT}, mandatory = false, help = FILTER_BY_OPT_DESCRIPTION) final String filterBy,
+            @CliOption(key = {TAGS_OPT}, mandatory = false, help = TAGS_OPT_DESCRIPTION) final String filterTags,
+            @CliOption(key = {OFFSET_OPT}, mandatory = false, help = OFFSET_OPT_DESCRIPTION) final Integer offset,
+            @CliOption(key = {NUM_RESULTS_OPT}, mandatory = false,
+                    help = NUM_RESULTS_OPT_DESCRIPTION) final Integer numResults,
+            @CliOption(key = {NUM_INSTANCES_OPT}, mandatory = false,
+                    help = NUM_INSTANCES_OPT_DESCRIPTION) final Integer numInstances
 
+    ) {
+        validateEntityTypeForSummary(entityType.name().toLowerCase());
+        validateEntityFields(fields);
+        validateFilterBy(filterBy, ENTITY_PREFIX);
+        validateOrderBy(orderBy, ENTITY_PREFIX);
+        return ResponseHelper.getString(getFalconClient().getEntitySummary(
+                entityType.name().toLowerCase(), cluster, start, end, fields, filterBy, filterTags,
+                orderBy, sortOrder, offset, numResults, numInstances, getDoAs()));
+    }
+    // RESUME CHECKSTYLE CHECK ParameterNumberCheck
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/main/java/org/apache/falcon/cli/commands/FalconInstanceCommands.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/commands/FalconInstanceCommands.java b/cli/src/main/java/org/apache/falcon/cli/commands/FalconInstanceCommands.java
index 8f3a2fc..5b62cf0 100644
--- a/cli/src/main/java/org/apache/falcon/cli/commands/FalconInstanceCommands.java
+++ b/cli/src/main/java/org/apache/falcon/cli/commands/FalconInstanceCommands.java
@@ -18,9 +18,12 @@
 
 package org.apache.falcon.cli.commands;
 
+import org.springframework.stereotype.Component;
+
 /**
  * Instance commands.
  */
+@Component
 public class FalconInstanceCommands extends BaseFalconCommands {
 
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/test/java/org/apache/falcon/cli/commands/FalconCLITest.java
----------------------------------------------------------------------
diff --git a/cli/src/test/java/org/apache/falcon/cli/commands/FalconCLITest.java b/cli/src/test/java/org/apache/falcon/cli/commands/FalconCLITest.java
new file mode 100644
index 0000000..81b6e45
--- /dev/null
+++ b/cli/src/test/java/org/apache/falcon/cli/commands/FalconCLITest.java
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.cli.commands;
+
+import org.apache.falcon.client.FalconCLIException;
+import org.springframework.shell.Bootstrap;
+import org.springframework.shell.core.CommandResult;
+import org.springframework.shell.core.JLineShellComponent;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+
+/**
+ * Base class for falcon cli test cases.
+ */
+public class FalconCLITest {
+    protected static JLineShellComponent shell;
+
+    @BeforeClass
+    public static void startUp() throws InterruptedException {
+        Bootstrap bootstrap = new Bootstrap();
+        shell = bootstrap.getJLineShellComponent();
+    }
+
+
+    public <T> T execute(String command) throws Throwable {
+        CommandResult commandResult = shell.executeCommand(command);
+        if (commandResult.isSuccess()) {
+            return (T) commandResult.getResult();
+        }
+        if (commandResult.getException() != null) {
+            throw commandResult.getException();
+        }
+        throw new FalconCLIException("Result is not success and exception is null");
+    }
+
+    public <T> void execute(String command, T result) throws Throwable {
+        Assert.assertEquals(execute(command), result);
+    }
+
+    public <T> void execute(String command, T result, Throwable throwable) throws Throwable {
+        CommandResult commandResult = shell.executeCommand(command);
+        if (commandResult.isSuccess()) {
+            Assert.assertNull(throwable);
+            Assert.assertEquals(commandResult.getResult(), result);
+        } else {
+            Assert.assertNull(result);
+            Assert.assertEquals(commandResult.getException().getClass(), throwable.getClass());
+            Assert.assertEquals(commandResult.getException().getMessage(), throwable.getMessage());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/cli/src/test/java/org/apache/falcon/cli/commands/FalconConnectionCommandsTest.java
----------------------------------------------------------------------
diff --git a/cli/src/test/java/org/apache/falcon/cli/commands/FalconConnectionCommandsTest.java b/cli/src/test/java/org/apache/falcon/cli/commands/FalconConnectionCommandsTest.java
new file mode 100644
index 0000000..d6ad6f9
--- /dev/null
+++ b/cli/src/test/java/org/apache/falcon/cli/commands/FalconConnectionCommandsTest.java
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+package org.apache.falcon.cli.commands;
+
+import org.apache.falcon.client.FalconCLIException;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for Connection commands.
+ */
+public class FalconConnectionCommandsTest extends FalconCLITest {
+    @DataProvider(name = "params-commands", parallel = false)
+    public Object[][] provideCommands() {
+        FalconCLIException e = new FalconCLIException(BaseFalconCommands.FALCON_URL_ABSENT);
+        return new Object[][]{
+            {"get", null, e},
+            {"set a=b", null, null},
+            {"get", null, e},
+            {"get a", null, e},
+            {"set falcon.url=DUMMY", null, null},
+            {"get", "{a=b, falcon.url=DUMMY}", null},
+            {"get a", "b", null},
+        };
+    }
+
+    @Test(dataProvider = "params-commands")
+    public void testGetAndSetParams(String command, Object result, Throwable throwable) throws Throwable {
+        execute(command, result, throwable);
+    }
+}

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 6f35ca0..1087675 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -150,6 +150,14 @@
                     </plugins>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/client/src/main/java/org/apache/falcon/FalconCLIConstants.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/FalconCLIConstants.java b/client/src/main/java/org/apache/falcon/FalconCLIConstants.java
index 31ead63..bcf3fe6 100644
--- a/client/src/main/java/org/apache/falcon/FalconCLIConstants.java
+++ b/client/src/main/java/org/apache/falcon/FalconCLIConstants.java
@@ -28,7 +28,10 @@ public final class FalconCLIConstants {
     public static final String ENV_FALCON_DEBUG = "FALCON_DEBUG";
     public static final String DEBUG_OPTION = "debug";
     public static final String URL_OPTION = "url";
-
+    public static final String DEFINITION_OPT = "definition";
+    public static final String LOOKUP_OPT = "lookup";
+    public static final String SLA_MISS_ALERT_OPT = "slaAlert";
+    public static final String TOUCH_OPT = "touch";
     public static final String ADMIN_CMD = "admin";
     public static final String HELP_CMD = "help";
     public static final String METADATA_CMD = "metadata";
@@ -36,7 +39,6 @@ public final class FalconCLIConstants {
     public static final String INSTANCE_CMD = "instance";
     public static final String EXTENSION_CMD = "extension";
     public static final String SAFE_MODE_OPT = "setsafemode";
-
     public static final String TYPE_OPT = "type";
     public static final String COLO_OPT = "colo";
     public static final String CLUSTER_OPT = "cluster";


Mime
View raw message