sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-2692: Sqoop2: Use link name in shell
Date Tue, 15 Dec 2015 14:11:26 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 d89f64adc -> 3f8765837


SQOOP-2692: Sqoop2: Use link name in shell

(Colin Ma via Jarek Jarcec Cecho)


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

Branch: refs/heads/sqoop2
Commit: 3f87658372f0d672f8a2e1c2bb446c6570e6f7a8
Parents: d89f64a
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Tue Dec 15 15:10:55 2015 +0100
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Tue Dec 15 15:10:55 2015 +0100

----------------------------------------------------------------------
 .../org/apache/sqoop/shell/CloneLinkFunction.java |  8 ++++----
 .../org/apache/sqoop/shell/CreateJobFunction.java |  4 ++--
 .../apache/sqoop/shell/CreateLinkFunction.java    |  2 +-
 .../apache/sqoop/shell/DeleteLinkFunction.java    |  8 ++++----
 .../apache/sqoop/shell/DisableLinkFunction.java   |  8 ++++----
 .../apache/sqoop/shell/EnableLinkFunction.java    |  8 ++++----
 .../org/apache/sqoop/shell/ShowJobFunction.java   |  4 ++--
 .../org/apache/sqoop/shell/ShowLinkFunction.java  | 18 +++++++-----------
 .../apache/sqoop/shell/UpdateLinkFunction.java    |  8 ++++----
 .../org/apache/sqoop/shell/core/Constants.java    | 18 ++++++++----------
 .../src/main/resources/shell-resource.properties  | 16 ++++++++--------
 .../org/apache/sqoop/shell/TestCloneCommand.java  | 14 +++++++-------
 .../org/apache/sqoop/shell/TestDeleteCommand.java | 12 ++++++------
 .../apache/sqoop/shell/TestDisableCommand.java    | 12 ++++++------
 .../org/apache/sqoop/shell/TestEnableCommand.java | 12 ++++++------
 .../org/apache/sqoop/shell/TestShowCommand.java   | 11 ++++++-----
 .../org/apache/sqoop/shell/TestUpdateCommand.java | 14 +++++++-------
 17 files changed, 86 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java
index 73928a5..52217cf 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java
@@ -45,18 +45,18 @@ public class CloneLinkFunction extends SqoopFunction {
   @SuppressWarnings("static-access")
   public CloneLinkFunction() {
     this.addOption(OptionBuilder
-      .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
-      .withLongOpt(Constants.OPT_LID)
+      .withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
+      .withLongOpt(Constants.OPT_NAME)
       .hasArg()
       .isRequired()
-      .create(Constants.OPT_LID_CHAR)
+      .create(Constants.OPT_NAME_CHAR)
     );
   }
 
   @Override
   @SuppressWarnings("unchecked")
   public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException
{
-    return cloneLink(line.getOptionValue(Constants.OPT_LID), line.getArgList(), isInteractive);
+    return cloneLink(line.getOptionValue(Constants.OPT_NAME), line.getArgList(), isInteractive);
   }
 
   private Status cloneLink(String linkArg, List<String> args, boolean isInteractive)
throws IOException {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
index a6f9219..7addd68 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
@@ -47,14 +47,14 @@ public class CreateJobFunction extends  SqoopFunction {
   @SuppressWarnings("static-access")
   public CreateJobFunction() {
     this.addOption(OptionBuilder
-      .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
+      .withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
       .withLongOpt(Constants.OPT_FROM)
       .isRequired()
       .hasArg()
       .create(Constants.OPT_FROM_CHAR)
     );
     this.addOption(OptionBuilder
-      .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
+      .withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
       .withLongOpt(Constants.OPT_TO)
       .isRequired()
       .hasArg()

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java
index 77bfabc..8710339 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java
@@ -106,7 +106,7 @@ public class CreateLinkFunction extends SqoopFunction {
     }
 
     ConfigDisplayer.displayConfigWarning(link);
-    printlnResource(Constants.RES_CREATE_LINK_SUCCESSFUL, status.name(), link.getPersistenceId());
+    printlnResource(Constants.RES_CREATE_LINK_SUCCESSFUL, status.name(), link.getName());
 
     return status;
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java
index 1d45b62..8dcdda5 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java
@@ -34,16 +34,16 @@ public class DeleteLinkFunction extends SqoopFunction {
   @SuppressWarnings("static-access")
   public DeleteLinkFunction() {
     this.addOption(OptionBuilder
-      .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
-      .withLongOpt(Constants.OPT_LID)
+      .withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
+      .withLongOpt(Constants.OPT_NAME)
       .isRequired()
       .hasArg()
-      .create(Constants.OPT_LID_CHAR));
+      .create(Constants.OPT_NAME_CHAR));
   }
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.deleteLink(line.getOptionValue(Constants.OPT_LID));
+    client.deleteLink(line.getOptionValue(Constants.OPT_NAME));
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java
index 50cec54..a34a2f3 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java
@@ -34,16 +34,16 @@ public class DisableLinkFunction extends SqoopFunction {
   @SuppressWarnings("static-access")
   public DisableLinkFunction() {
     this.addOption(OptionBuilder
-      .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
-      .withLongOpt(Constants.OPT_LID)
+      .withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
+      .withLongOpt(Constants.OPT_NAME)
       .isRequired()
       .hasArg()
-      .create(Constants.OPT_LID_CHAR));
+      .create(Constants.OPT_NAME_CHAR));
   }
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.enableLink(line.getOptionValue(Constants.OPT_LID), false);
+    client.enableLink(line.getOptionValue(Constants.OPT_NAME), false);
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java
index 6e3a5df..70e242c 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java
@@ -34,16 +34,16 @@ public class EnableLinkFunction extends SqoopFunction {
   @SuppressWarnings("static-access")
   public EnableLinkFunction() {
     this.addOption(OptionBuilder
-      .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
-      .withLongOpt(Constants.OPT_LID)
+      .withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
+      .withLongOpt(Constants.OPT_NAME)
       .isRequired()
       .hasArg()
-      .create(Constants.OPT_LID_CHAR));
+      .create(Constants.OPT_NAME_CHAR));
   }
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.enableLink(line.getOptionValue(Constants.OPT_LID), true);
+    client.enableLink(line.getOptionValue(Constants.OPT_NAME), true);
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
index a60dd0c..ebbfe82 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
@@ -136,11 +136,11 @@ public class ShowJobFunction extends SqoopFunction {
 
     displayConfig(job.getDriverConfig().getConfigs(),
             client.getDriverConfigBundle());
-    printlnResource(Constants.RES_SHOW_PROMPT_JOB_FROM_LID_INFO,
+    printlnResource(Constants.RES_SHOW_PROMPT_JOB_FROM_LN_INFO,
         job.getFromLinkName());
     displayConfig(job.getFromJobConfig().getConfigs(),
                  client.getConnectorConfigBundle(job.getFromConnectorName()));
-    printlnResource(Constants.RES_SHOW_PROMPT_JOB_TO_LID_INFO,
+    printlnResource(Constants.RES_SHOW_PROMPT_JOB_TO_LN_INFO,
             job.getToLinkName());
     displayConfig(job.getToJobConfig().getConfigs(),
                  client.getConnectorConfigBundle(job.getToConnectorName()));

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java
index d997f73..25bd1db 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java
@@ -49,18 +49,18 @@ public class ShowLinkFunction extends SqoopFunction {
         .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_ALL_LINKS))
         .withLongOpt(Constants.OPT_ALL)
         .create(Constants.OPT_ALL_CHAR));
-    this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_LID)
-        .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_LINK_LID))
-        .withLongOpt(Constants.OPT_LID)
-        .create(Constants.OPT_LID_CHAR));
+    this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_NAME)
+        .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_LINK_LN))
+        .withLongOpt(Constants.OPT_NAME)
+        .create(Constants.OPT_NAME_CHAR));
   }
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
     if (line.hasOption(Constants.OPT_ALL)) {
       showLinks();
-    } else if (line.hasOption(Constants.OPT_LID)) {
-      showLink(line.getOptionValue(Constants.OPT_LID));
+    } else if (line.hasOption(Constants.OPT_NAME)) {
+      showLink(line.getOptionValue(Constants.OPT_NAME));
     } else {
       showSummary();
     }
@@ -72,24 +72,21 @@ public class ShowLinkFunction extends SqoopFunction {
     List<MLink> links = client.getLinks();
 
     List<String> header = new LinkedList<String>();
-    header.add(resourceString(Constants.RES_TABLE_HEADER_ID));
     header.add(resourceString(Constants.RES_TABLE_HEADER_NAME));
     header.add(resourceString(Constants.RES_TABLE_HEADER_CONNECTOR_NAME));
     header.add(resourceString(Constants.RES_TABLE_HEADER_ENABLED));
 
-    List<String> ids = new LinkedList<String>();
     List<String> names = new LinkedList<String>();
     List<String> connectorNames = new LinkedList<String>();
     List<String> availabilities = new LinkedList<String>();
 
     for (MLink link : links) {
-      ids.add(String.valueOf(link.getPersistenceId()));
       names.add(link.getName());
       connectorNames.add(link.getConnectorName());
       availabilities.add(String.valueOf(link.getEnabled()));
     }
 
-    TableDisplayer.display(header, ids, names, connectorNames, availabilities);
+    TableDisplayer.display(header, names, connectorNames, availabilities);
   }
 
   private void showLinks() {
@@ -114,7 +111,6 @@ public class ShowLinkFunction extends SqoopFunction {
     DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
 
     printlnResource(Constants.RES_SHOW_PROMPT_LINK_INFO,
-      link.getPersistenceId(),
       link.getName(),
       link.getEnabled(),
       link.getCreationUser(),

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java
index aef500c..a72b6ad 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java
@@ -45,17 +45,17 @@ public class UpdateLinkFunction extends SqoopFunction {
   @SuppressWarnings("static-access")
   public UpdateLinkFunction() {
     this.addOption(OptionBuilder
-      .withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
-      .withLongOpt(Constants.OPT_LID)
+      .withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
+      .withLongOpt(Constants.OPT_NAME)
       .isRequired()
       .hasArg()
-      .create(Constants.OPT_LID_CHAR));
+      .create(Constants.OPT_NAME_CHAR));
   }
 
   @Override
   @SuppressWarnings("unchecked")
   public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException
{
-    return updateLink(line.getOptionValue(Constants.OPT_LID), line.getArgList(), isInteractive);
+    return updateLink(line.getOptionValue(Constants.OPT_NAME), line.getArgList(), isInteractive);
   }
 
   private Status updateLink(String linkArg, List<String> args, boolean isInteractive)
throws IOException {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java b/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java
index 9e2b3e2..c516ea7 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java
@@ -34,7 +34,6 @@ public class Constants {
 
   // Options
 
-  public static final String OPT_LID = "lid";
   public static final String OPT_FROM = "from";
   public static final String OPT_TO = "to";
   public static final String OPT_ALL = "all";
@@ -61,7 +60,6 @@ public class Constants {
   public static final String OPT_WITH_GRANT = "with-grant";
   public static final String OPT_WITH_JOB = "job";
 
-  public static final char OPT_LID_CHAR = 'l';
   public static final char OPT_FROM_CHAR = 'f';
   public static final char OPT_TO_CHAR = 't';
   public static final char OPT_ALL_CHAR = 'a';
@@ -162,8 +160,8 @@ public class Constants {
   public static final String RES_ARGS_VALUE_MISSING =
       "args.value_missing";
 
-  public static final String RES_PROMPT_LINK_ID =
-      "prompt.link_id";
+  public static final String RES_PROMPT_LINK_NAME =
+      "prompt.link_name";
   public static final String RES_PROMPT_JOB_NAME =
       "prompt.job_name";
   public static final String RES_CONNECTOR_NAME =
@@ -257,8 +255,8 @@ public class Constants {
 
   public static final String RES_SHOW_PROMPT_DISPLAY_ALL_LINKS =
       "show.prompt_display_all_links";
-  public static final String RES_SHOW_PROMPT_DISPLAY_LINK_LID =
-      "show.prompt_display_link_lid";
+  public static final String RES_SHOW_PROMPT_DISPLAY_LINK_LN =
+      "show.prompt_display_link_name";
   public static final String RES_SHOW_PROMPT_LINKS_TO_SHOW =
       "show.prompt_links_to_show";
   public static final String RES_SHOW_PROMPT_LINK_INFO =
@@ -294,10 +292,10 @@ public class Constants {
       "show.prompt_jobs_to_show";
   public static final String RES_SHOW_PROMPT_JOB_INFO =
       "show.prompt_job_info";
-  public static final String RES_SHOW_PROMPT_JOB_FROM_LID_INFO =
-      "show.prompt_job_from_lid_info";
-  public static final String RES_SHOW_PROMPT_JOB_TO_LID_INFO =
-      "show.prompt_job_to_lid_info";
+  public static final String RES_SHOW_PROMPT_JOB_FROM_LN_INFO =
+      "show.prompt_job_from_ln_info";
+  public static final String RES_SHOW_PROMPT_JOB_TO_LN_INFO =
+      "show.prompt_job_to_ln_info";
 
   public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS =
       "show.prompt_display_all_submissions";

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/main/resources/shell-resource.properties
----------------------------------------------------------------------
diff --git a/shell/src/main/resources/shell-resource.properties b/shell/src/main/resources/shell-resource.properties
index 0ff853f..df3e7f1 100644
--- a/shell/src/main/resources/shell-resource.properties
+++ b/shell/src/main/resources/shell-resource.properties
@@ -41,7 +41,7 @@ args.name_missing = Required argument --name is missing.
 args.value_missing = Required argument --value is missing.
 
 ## Generic description of various ids, types etc
-prompt.link_id = Link Id
+prompt.link_name = Link Name
 prompt.connector_name = Connector Name
 prompt.job_name = Job Name
 prompt.job_type = Job type
@@ -57,7 +57,7 @@ job object
 
 # Update command
 update.description = Update objects in Sqoop repository
-update.link = Updating link with id {0}
+update.link = Updating link with name {0}
 update.job = Updating job with name {0}
 update.link_successful = link was successfully updated with status {0}
 update.job_successful = Job was successfully updated with status {0}
@@ -74,12 +74,12 @@ clone.cloning_job = Cloning job with name {0}
 # Create command
 create.description = Create new object in Sqoop repository
 create.link_successful = New link was successfully created with \
-  validation status {0} and persistent id {1}
+  validation status {0} and name {1}
 create.job_successful = New job was successfully created with validation \
   status {0}  and name {1}
 create.role_successful = New role was successfully created with name {0}
 create.creating_link = Creating link for connector with name {0}
-create.creating_job = Creating job for links with from id {0} and to id {1}
+create.creating_job = Creating job for links with from name {0} and to name {1}
 
 # Delete command
 delete.description = Delete existing object in Sqoop repository
@@ -129,10 +129,10 @@ set.server_ignored = --host, --port or --webapp option is ignored, because
--url
 # Show command
 show.description = Display various objects and configuration options
 show.prompt_display_all_links = Display all links
-show.prompt_display_link_lid = Display the link with lid
+show.prompt_display_link_name = Display the link with name
 show.link_usage = Usage: show link
 show.prompt_links_to_show = @|bold {0} link(s) to show: |@
-show.prompt_link_info = link with id {0} and name {1} (Enabled: {2}, Created by {3} at {4},
Updated by {5} at {6})
+show.prompt_link_info = link with name {0} (Enabled: {1}, Created by {2} at {3}, Updated
by {4} at {5})
 show.prompt_link_cn_info = Using Connector @|bold {0}|@ with name @|bold {1}|@
 
 show.prompt_display_all_connectors = Display all connectors
@@ -153,8 +153,8 @@ show.prompt_display_job_name = Display job with given name
 show.job_usage = Usage: show job
 show.prompt_jobs_to_show = @|bold {0} job(s) to show: |@
 show.prompt_job_info = Job with name {0} (Enabled: {1}, Created by {2} at {3}, Updated by
{4} at {5})
-show.prompt_job_from_lid_info = From link: {0}
-show.prompt_job_to_lid_info = To link: {0}
+show.prompt_job_from_ln_info = From link: {0}
+show.prompt_job_to_ln_info = To link: {0}
 
 show.prompt_display_all_submissions = Display all submissions
 show.prompt_display_all_submissions_jn = Display all submissions given job name

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
index 3826dd5..ec6f18f 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
@@ -93,22 +93,22 @@ public class TestCloneCommand {
     when(client.saveLink(link)).thenReturn(Status.OK);
 
     // clone link -lid link_test
-    Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
+    Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
     assertTrue(status != null && status == Status.OK);
 
-    // Missing argument for option lid
+    // Missing argument for option name
     try {
-      cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
+      cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
       fail("Update link should fail as parameters aren't complete!");
     } catch (SqoopException e) {
       assertEquals(ShellError.SHELL_0003, e.getErrorCode());
       assertTrue(e.getMessage().contains("Missing argument for option"));
     }
 
-    // Missing option lid
+    // Missing option name
     try {
       cloneCmd.execute(Arrays.asList(Constants.FN_LINK));
-      fail("Update link should fail as option lid is missing");
+      fail("Update link should fail as option name is missing");
     } catch (SqoopException e) {
       assertEquals(ShellError.SHELL_0003, e.getErrorCode());
       assertTrue(e.getMessage().contains("Missing required option"));
@@ -125,7 +125,7 @@ public class TestCloneCommand {
     when(client.saveLink(link)).thenReturn(Status.OK);
     when(client.getConnector(any(Long.class))).thenReturn(new MConnector("", "", "", null,
null, null));
 
-    // clone link -lid link_test
+    // clone link -name link_test
     initData("linkname\r" +         // link name
         "abc\r" +                   // for input with name "String"
         "12345\r" +                 // for input with name "Integer"
@@ -135,7 +135,7 @@ public class TestCloneCommand {
         "0\r" +                     // for input with name "Enum"
         "l1\rl2\rl3\r\r" +          // for input with name "List"
         "12345678\r");              // for input with name "DateTime"
-    Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
+    Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
     assertTrue(status != null && status == Status.OK);
     assertEquals(link.getName(), "linkname");
     assertEquals(link.getConnectorLinkConfig("CONFIGFROMNAME").getStringInput("CONFIGFROMNAME.String").getValue(),
"abc");

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/test/java/org/apache/sqoop/shell/TestDeleteCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestDeleteCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestDeleteCommand.java
index f80ec1f..4165bf0 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestDeleteCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestDeleteCommand.java
@@ -54,14 +54,14 @@ public class TestDeleteCommand {
   public void testDeleteLink() {
     doNothing().when(client).deleteLink("link_test");
 
-    // delete link -l link_test
-    Status status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-l", "link_test"));
+    // delete link -name link_test
+    Status status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-name",
"link_test"));
     Assert.assertTrue(status != null && status == Status.OK);
 
-    // Missing argument for option lid
+    // Missing argument for option name
     try {
-      status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
-      Assert.fail("Delete link should fail as link id/name is missing!");
+      status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
+      Assert.fail("Delete link should fail as link name is missing!");
     } catch (SqoopException e) {
       Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode());
       Assert.assertTrue(e.getMessage().contains("Missing argument for option"));
@@ -73,7 +73,7 @@ public class TestDeleteCommand {
     doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "link doesn't exist")).when(client).deleteLink(any(String.class));
 
     try {
-      deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
+      deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
       Assert.fail("Delete link should fail as requested link doesn't exist!");
     } catch (SqoopException e) {
       Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/test/java/org/apache/sqoop/shell/TestDisableCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestDisableCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestDisableCommand.java
index 1ce63d5..a236685 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestDisableCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestDisableCommand.java
@@ -53,14 +53,14 @@ public class TestDisableCommand {
   public void testDisableLink() {
     doNothing().when(client).enableLink("link_test", false);
 
-    // disable link -l link_test
-    Status status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-l", "link_test"));
+    // disable link -name link_test
+    Status status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name",
"link_test"));
     Assert.assertTrue(status != null && status == Status.OK);
 
-    // Missing argument for option lid
+    // Missing argument for option name
     try {
-      status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
-      Assert.fail("Disable link should fail as link id/name is missing!");
+      status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
+      Assert.fail("Disable link should fail as link name is missing!");
     } catch (SqoopException e) {
       Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode());
       Assert.assertTrue(e.getMessage().contains("Missing argument for option"));
@@ -72,7 +72,7 @@ public class TestDisableCommand {
     doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "link doesn't exist")).when(client).enableLink(any(String.class),
any(Boolean.class));
 
     try {
-      disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
+      disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
       Assert.fail("Disable link should fail as requested link doesn't exist!");
     } catch (SqoopException e) {
       Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/test/java/org/apache/sqoop/shell/TestEnableCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestEnableCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestEnableCommand.java
index 1014dc2..6ce78eb 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestEnableCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestEnableCommand.java
@@ -53,14 +53,14 @@ public class TestEnableCommand {
   public void testEnableLink() {
     doNothing().when(client).enableLink("link_test", true);
 
-    // enable link -l link_test
-    Status status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-l", "link_test"));
+    // enable link -name link_test
+    Status status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name",
"link_test"));
     Assert.assertTrue(status != null && status == Status.OK);
 
-    // Missing argument for option lid
+    // Missing argument for option name
     try {
-      status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
-      Assert.fail("Enable link should fail as link id/name is missing!");
+      status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
+      Assert.fail("Enable link should fail as link name is missing!");
     } catch (SqoopException e) {
       Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode());
       Assert.assertTrue(e.getMessage().contains("Missing argument for option"));
@@ -72,7 +72,7 @@ public class TestEnableCommand {
     doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "link doesn't exist")).when(client).enableLink(any(String.class),
any(Boolean.class));
 
     try {
-      enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
+      enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
       Assert.fail("Enable link should fail as requested link doesn't exist!");
     } catch (SqoopException e) {
       Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
index 05b4e52..000f518 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
@@ -201,15 +201,16 @@ public class TestShowCommand {
 
   @Test
   public void testShowLink() {
+    MLink fakeLink = new MLink("connector_test", new MLinkConfig(new ArrayList<MConfig>(),
new ArrayList<MValidator>()));
+    fakeLink.setName("linkName");
     when(client.getLinks()).thenReturn(new ArrayList<MLink>());
-    when(client.getLink(any(String.class))).thenReturn(new MLink("connector_test", new MLinkConfig(new
ArrayList<MConfig>(), new ArrayList<MValidator>())));
+    when(client.getLink(any(String.class))).thenReturn(fakeLink);
 
     // show link summary
     out.reset();
     Status status = (Status) showCmd.execute(Arrays.asList(Constants.FN_LINK));
     Assert.assertTrue(status != null && status == Status.OK);
     String str = new String(out.toByteArray());
-    Assert.assertTrue(str.contains("Id"));
     Assert.assertTrue(str.contains("Name"));
     Assert.assertTrue(str.contains("Connector Name"));
     Assert.assertTrue(str.contains("Enabled"));
@@ -221,12 +222,12 @@ public class TestShowCommand {
     str = new String(out.toByteArray());
     Assert.assertTrue(str.contains("link(s) to show:"));
 
-    // show link -lid 1
+    // show link -name linkName
     out.reset();
-    status = (Status) showCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "1"));
+    status = (Status) showCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "linkName"));
     Assert.assertTrue(status != null && status == Status.OK);
     str = new String(out.toByteArray());
-    Assert.assertTrue(str.contains("link with id"));
+    Assert.assertTrue(str.contains("link with name"));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f876583/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
index 412d493..4b1f5ad 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
@@ -110,20 +110,20 @@ public class TestUpdateCommand {
     when(client.getConnectorConfigBundle("connector_test")).thenReturn(new MapResourceBundle(new
HashMap()));
     when(client.updateLink(any(MLink.class))).thenReturn(Status.OK);
 
-    // update link -lid link_test
-    Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
+    // update link -name link_test
+    Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-name",
"link_test"));
     assertTrue(status != null && status == Status.OK);
 
-    // Missing argument for option lid
+    // Missing argument for option name
     try {
-      updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
+      updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
       fail("Update link should fail as parameters aren't complete!");
     } catch (SqoopException e) {
       assertEquals(ShellError.SHELL_0003, e.getErrorCode());
       assertTrue(e.getMessage().contains("Missing argument for option"));
     }
 
-    // Missing option lid
+    // Missing option name
     try {
       updateCmd.execute(Arrays.asList(Constants.FN_LINK));
       fail("Update link should fail as option lid is missing");
@@ -143,7 +143,7 @@ public class TestUpdateCommand {
     when(client.updateLink(any(MLink.class))).thenReturn(Status.OK);
     when(client.getConnectorConfigBundle(any(String.class))).thenReturn(resourceBundle);
 
-    // update link -lid link_test
+    // update link -name link_test
     initData("linkname\r" +         // link name
         "abc\r" +                   // for input with name "String"
         "12345\r" +                 // for input with name "Integer"
@@ -153,7 +153,7 @@ public class TestUpdateCommand {
         "0\r" +                     // for input with name "Enum"
         "l1\rl2\rl3\r\r" +          // for input with name "List"
         "12345678\r");              // for input with name "DateTime"
-    Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
+    Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-name",
"link_test"));
     assertTrue(status != null && status == Status.OK);
     assertEquals(link.getName(), "linkname");
     assertEquals(link.getConnectorLinkConfig("CONFIGFROMNAME").getStringInput("CONFIGFROMNAME.String").getValue(),
"abc");


Mime
View raw message