Repository: sqoop Updated Branches: refs/heads/sqoop2 81778c37a -> a53e682f0
SQOOP-2734: Sqoop2: Use job 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/a53e682f Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/a53e682f Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/a53e682f Branch: refs/heads/sqoop2 Commit: a53e682f08d219555a72668d532016c890421157 Parents: 81778c3 Author: Jarek Jarcec Cecho <[email protected]> Authored: Sat Dec 12 09:16:10 2015 +0100 Committer: Jarek Jarcec Cecho <[email protected]> Committed: Sat Dec 12 09:16:10 2015 +0100 ---------------------------------------------------------------------- .../org/apache/sqoop/shell/CloneJobFunction.java | 8 ++++---- .../org/apache/sqoop/shell/CreateJobFunction.java | 2 +- .../org/apache/sqoop/shell/DeleteJobFunction.java | 8 ++++---- .../apache/sqoop/shell/DisableJobFunction.java | 12 ++++++------ .../org/apache/sqoop/shell/EnableJobFunction.java | 8 ++++---- .../org/apache/sqoop/shell/ShowJobFunction.java | 13 ++++++------- .../apache/sqoop/shell/ShowJobStatusFunction.java | 12 ++++++------ .../sqoop/shell/ShowSubmissionFunction.java | 16 ++++++++-------- .../org/apache/sqoop/shell/StartJobFunction.java | 18 ++++++++---------- .../org/apache/sqoop/shell/StopJobFunction.java | 13 ++++++------- .../org/apache/sqoop/shell/UpdateJobFunction.java | 8 ++++---- .../org/apache/sqoop/shell/core/Constants.java | 16 ++++++++-------- .../src/main/resources/shell-resource.properties | 14 +++++++------- .../org/apache/sqoop/shell/TestCloneCommand.java | 16 ++++++++-------- .../org/apache/sqoop/shell/TestDeleteCommand.java | 12 ++++++------ .../apache/sqoop/shell/TestDisableCommand.java | 10 +++++----- .../org/apache/sqoop/shell/TestEnableCommand.java | 8 ++++---- .../org/apache/sqoop/shell/TestShowCommand.java | 16 ++++++++-------- .../org/apache/sqoop/shell/TestStartCommand.java | 12 ++++++------ .../org/apache/sqoop/shell/TestStatusCommand.java | 8 ++++---- .../org/apache/sqoop/shell/TestStopCommand.java | 8 ++++---- .../org/apache/sqoop/shell/TestUpdateCommand.java | 16 ++++++++-------- 22 files changed, 125 insertions(+), 129 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java index 5191f43..0c8bec8 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java @@ -47,16 +47,16 @@ public class CloneJobFunction extends SqoopFunction { @SuppressWarnings("static-access") public CloneJobFunction() { this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID)) - .withLongOpt(Constants.OPT_JID) + .withDescription(resourceString(Constants.RES_PROMPT_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) .isRequired() .hasArg() - .create(Constants.OPT_JID_CHAR)); + .create(Constants.OPT_NAME_CHAR)); } @SuppressWarnings("unchecked") public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException { - return cloneJob(line.getOptionValue(Constants.OPT_JID), line.getArgList(), isInteractive); + return cloneJob(line.getOptionValue(Constants.OPT_NAME), line.getArgList(), isInteractive); } private Status cloneJob(String jobArg, List<String> args, boolean isInteractive) throws IOException { http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 4f1d51d..a6f9219 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java @@ -131,7 +131,7 @@ public class CreateJobFunction extends SqoopFunction { } ConfigDisplayer.displayConfigWarning(job); - printlnResource(Constants.RES_CREATE_JOB_SUCCESSFUL, status.name(), job.getPersistenceId()); + printlnResource(Constants.RES_CREATE_JOB_SUCCESSFUL, status.name(), job.getName()); return status; } http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java index 7f3a76f..eed4ff6 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java @@ -34,16 +34,16 @@ public class DeleteJobFunction extends SqoopFunction { @SuppressWarnings("static-access") public DeleteJobFunction() { this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID)) - .withLongOpt(Constants.OPT_JID) + .withDescription(resourceString(Constants.RES_PROMPT_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) .isRequired() .hasArg() - .create(Constants.OPT_JID_CHAR)); + .create(Constants.OPT_NAME_CHAR)); } @Override public Object executeFunction(CommandLine line, boolean isInteractive) { - client.deleteJob(line.getOptionValue(Constants.OPT_JID)); + client.deleteJob(line.getOptionValue(Constants.OPT_NAME)); return Status.OK; } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java index df693eb..380e830 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java @@ -34,16 +34,16 @@ public class DisableJobFunction extends SqoopFunction { @SuppressWarnings("static-access") public DisableJobFunction() { this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID)) - .withLongOpt(Constants.OPT_JID) + .withDescription(resourceString(Constants.RES_PROMPT_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) .hasArg() - .create('j')); + .create(Constants.OPT_NAME_CHAR)); } @Override public boolean validateArgs(CommandLine line) { - if (!line.hasOption(Constants.OPT_JID)) { - printlnResource(Constants.RES_ARGS_JID_MISSING); + if (!line.hasOption(Constants.OPT_NAME)) { + printlnResource(Constants.RES_ARGS_NAME_MISSING); return false; } return true; @@ -51,7 +51,7 @@ public class DisableJobFunction extends SqoopFunction { @Override public Object executeFunction(CommandLine line, boolean isInteractive) { - client.enableJob(line.getOptionValue(Constants.OPT_JID), false); + client.enableJob(line.getOptionValue(Constants.OPT_NAME), false); return Status.OK; } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java index 73962bb..dacb45b 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java @@ -34,16 +34,16 @@ public class EnableJobFunction extends SqoopFunction { @SuppressWarnings("static-access") public EnableJobFunction() { this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID)) - .withLongOpt(Constants.OPT_JID) + .withDescription(resourceString(Constants.RES_PROMPT_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) .isRequired() .hasArg() - .create('j')); + .create(Constants.OPT_NAME_CHAR)); } @Override public Object executeFunction(CommandLine line, boolean isInteractive) { - client.enableJob(line.getOptionValue(Constants.OPT_JID), true); + client.enableJob(line.getOptionValue(Constants.OPT_NAME), true); return Status.OK; } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 786cac7..a60dd0c 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java @@ -51,10 +51,10 @@ public class ShowJobFunction extends SqoopFunction { .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_JOBS_CN)) .withLongOpt(Constants.OPT_CONNECTOR_NAME) .create(Constants.OPT_CONNECTOR_NAME_CHAR)); - this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_JID) - .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_JOB_JID)) - .withLongOpt(Constants.OPT_JID) - .create(Constants.OPT_JID_CHAR)); + this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_NAME) + .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) + .create(Constants.OPT_NAME_CHAR)); } @Override @@ -63,8 +63,8 @@ public class ShowJobFunction extends SqoopFunction { showJobs(null); } else if (line.hasOption(Constants.OPT_CONNECTOR_NAME)) { showJobs(line.getOptionValue(Constants.OPT_CONNECTOR_NAME)); - } else if (line.hasOption(Constants.OPT_JID)) { - showJob(line.getOptionValue(Constants.OPT_JID)); + } else if (line.hasOption(Constants.OPT_NAME)) { + showJob(line.getOptionValue(Constants.OPT_NAME)); } else { showSummary(); } @@ -126,7 +126,6 @@ public class ShowJobFunction extends SqoopFunction { printlnResource( Constants.RES_SHOW_PROMPT_JOB_INFO, - job.getPersistenceId(), job.getName(), job.getEnabled(), job.getCreationUser(), http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java index d0cb213..5fd5e60 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java @@ -34,16 +34,16 @@ public class ShowJobStatusFunction extends SqoopFunction { @SuppressWarnings("static-access") public ShowJobStatusFunction() { - this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_JID) - .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID)) - .withLongOpt(Constants.OPT_JID) - .create(Constants.OPT_JID_CHAR)); + this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_NAME) + .withDescription(resourceString(Constants.RES_PROMPT_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) + .create(Constants.OPT_NAME_CHAR)); } @Override public Object executeFunction(CommandLine line, boolean isInteractive) { - if (line.hasOption(Constants.OPT_JID)) { - MSubmission submission = client.getJobStatus(line.getOptionValue(Constants.OPT_JID)); + if (line.hasOption(Constants.OPT_NAME)) { + MSubmission submission = client.getJobStatus(line.getOptionValue(Constants.OPT_NAME)); if(submission.getStatus().isFailure() || submission.getStatus().equals(SubmissionStatus.SUCCEEDED)) { SubmissionDisplayer.displayHeader(submission); SubmissionDisplayer.displayFooter(submission); http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java index c4d30cb..45f3bdd 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java @@ -40,23 +40,23 @@ public class ShowSubmissionFunction extends SqoopFunction { .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS)) .withLongOpt(Constants.OPT_DETAIL) .create(Constants.OPT_DETAIL_CHAR)); - this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_JID) - .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS_JOB_ID)) - .withLongOpt(Constants.OPT_JID) - .create(Constants.OPT_JID_CHAR)); + this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_WITH_JOB) + .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS_JN)) + .withLongOpt(Constants.OPT_WITH_JOB) + .create(Constants.OPT_WITH_JOB_CHAR)); } @Override public Object executeFunction(CommandLine line, boolean isInteractive) { if (line.hasOption(Constants.OPT_DETAIL)) { - if (line.hasOption(Constants.OPT_JID)) { - showSubmissions(line.getOptionValue(Constants.OPT_JID)); + if (line.hasOption(Constants.OPT_WITH_JOB)) { + showSubmissions(line.getOptionValue(Constants.OPT_WITH_JOB)); } else { showSubmissions(null); } } else { - if (line.hasOption(Constants.OPT_JID)) { - showSummary(line.getOptionValue(Constants.OPT_JID)); + if (line.hasOption(Constants.OPT_WITH_JOB)) { + showSummary(line.getOptionValue(Constants.OPT_WITH_JOB)); } else { showSummary(null); } http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java index 136893e..d283bd8 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java @@ -39,10 +39,10 @@ public class StartJobFunction extends SqoopFunction { @SuppressWarnings("static-access") public StartJobFunction() { - this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_JID) - .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID)) - .withLongOpt(Constants.OPT_JID) - .create(Constants.OPT_JID_CHAR)); + this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_NAME) + .withDescription(resourceString(Constants.RES_PROMPT_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) + .create(Constants.OPT_NAME_CHAR)); this.addOption(OptionBuilder .withDescription(resourceString(Constants.RES_PROMPT_SYNCHRONOUS)) .withLongOpt(Constants.OPT_SYNCHRONOUS) @@ -52,18 +52,16 @@ public class StartJobFunction extends SqoopFunction { @Override public Object executeFunction(CommandLine line, boolean isInteractive) { // Poll until finished - if (line.hasOption(Constants.OPT_SYNCHRONOUS) && line.hasOption(Constants.OPT_JID)) { + if (line.hasOption(Constants.OPT_SYNCHRONOUS) && line.hasOption(Constants.OPT_NAME)) { long pollTimeout = getPollTimeout(); try { - //client.startJob(getLong(line, Constants.OPT_JID), callback, pollTimeout); - client.startJob(line.getOptionValue(Constants.OPT_JID), new SJFCallback(), pollTimeout); + client.startJob(line.getOptionValue(Constants.OPT_NAME), new SJFCallback(), pollTimeout); } catch (InterruptedException e) { throw new SqoopException(ShellError.SHELL_0007, e); } - } else if (line.hasOption(Constants.OPT_JID)) { - //MSubmission submission = client.startJob(getLong(line, Constants.OPT_JID)); - MSubmission submission = client.startJob(line.getOptionValue(Constants.OPT_JID)); + } else if (line.hasOption(Constants.OPT_NAME)) { + MSubmission submission = client.startJob(line.getOptionValue(Constants.OPT_NAME)); if(submission.getStatus().isFailure()) { SubmissionDisplayer.displayFooter(submission); } else { http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java index fe77903..098b4cd 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java @@ -33,17 +33,16 @@ public class StopJobFunction extends SqoopFunction { @SuppressWarnings("static-access") public StopJobFunction() { - this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_JID) - .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID)) - .withLongOpt(Constants.OPT_JID) - .create(Constants.OPT_JID_CHAR)); + this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_NAME) + .withDescription(resourceString(Constants.RES_PROMPT_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) + .create(Constants.OPT_NAME_CHAR)); } @Override public Object executeFunction(CommandLine line, boolean isInteractive) { - if (line.hasOption(Constants.OPT_JID)) { - //MSubmission submission = client.stopJob(getLong(line, Constants.OPT_JID)); - MSubmission submission = client.stopJob(line.getOptionValue(Constants.OPT_JID)); + if (line.hasOption(Constants.OPT_NAME)) { + MSubmission submission = client.stopJob(line.getOptionValue(Constants.OPT_NAME)); if(submission.getStatus().isFailure()) { SubmissionDisplayer.displayFooter(submission); } else { http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java index ff23a68..0b6ff01 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java @@ -47,17 +47,17 @@ public class UpdateJobFunction extends SqoopFunction { @SuppressWarnings("static-access") public UpdateJobFunction() { this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_PROMPT_JOB_ID)) - .withLongOpt(Constants.OPT_JID) + .withDescription(resourceString(Constants.RES_PROMPT_JOB_NAME)) + .withLongOpt(Constants.OPT_NAME) .isRequired() .hasArg() - .create(Constants.OPT_JID_CHAR)); + .create(Constants.OPT_NAME_CHAR)); } @Override @SuppressWarnings("unchecked") public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException { - return updateJob(line.getOptionValue(Constants.OPT_JID), line.getArgList(), isInteractive); + return updateJob(line.getOptionValue(Constants.OPT_NAME), line.getArgList(), isInteractive); } private Status updateJob(String jobArg, List<String> args, boolean isInteractive) throws IOException { http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 6854500..9e2b3e2 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 @@ -38,7 +38,6 @@ public class Constants { public static final String OPT_FROM = "from"; public static final String OPT_TO = "to"; public static final String OPT_ALL = "all"; - public static final String OPT_JID = "jid"; public static final String OPT_NAME = "name"; public static final String OPT_CONNECTOR_NAME = "connector"; public static final String OPT_VALUE = "value"; @@ -60,12 +59,12 @@ public class Constants { public static final String OPT_PRINCIPAL = "principal"; public static final String OPT_PRINCIPAL_TYPE = "principal-type"; 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'; - public static final char OPT_JID_CHAR = 'j'; public static final char OPT_NAME_CHAR = 'n'; public static final char OPT_CONNECTOR_NAME_CHAR = 'c'; public static final char OPT_VALUE_CHAR = 'v'; @@ -82,6 +81,7 @@ public class Constants { public static final char OPT_ROLE_CHAR = 'r'; public static final char OPT_ACTION_CHAR = 'a'; public static final char OPT_WITH_GRANT_CHAR = 'g'; + public static final char OPT_WITH_JOB_CHAR = 'j'; // Resource keys for various commands, command options, // functions and descriptions @@ -164,8 +164,8 @@ public class Constants { public static final String RES_PROMPT_LINK_ID = "prompt.link_id"; - public static final String RES_PROMPT_JOB_ID = - "prompt.job_id"; + public static final String RES_PROMPT_JOB_NAME = + "prompt.job_name"; public static final String RES_CONNECTOR_NAME = "prompt.connector_name"; public static final String RES_PROMPT_UPDATE_LINK_CONFIG = @@ -288,8 +288,8 @@ public class Constants { "show.prompt_display_all_jobs"; public static final String RES_SHOW_PROMPT_DISPLAY_JOBS_CN = "show.prompt_display_all_jobs_cn"; - public static final String RES_SHOW_PROMPT_DISPLAY_JOB_JID = - "show.prompt_display_job_jid"; + public static final String RES_SHOW_PROMPT_DISPLAY_JOB_NAME = + "show.prompt_display_job_name"; public static final String RES_SHOW_PROMPT_JOBS_TO_SHOW = "show.prompt_jobs_to_show"; public static final String RES_SHOW_PROMPT_JOB_INFO = @@ -301,8 +301,8 @@ public class Constants { public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS = "show.prompt_display_all_submissions"; - public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS_JOB_ID = - "show.prompt_display_all_submissions_jid"; + public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS_JN = + "show.prompt_display_all_submissions_jn"; public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SERVERS = "show.prompt_display_all_servers"; http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 cfd07ad..0ff853f 100644 --- a/shell/src/main/resources/shell-resource.properties +++ b/shell/src/main/resources/shell-resource.properties @@ -43,7 +43,7 @@ args.value_missing = Required argument --value is missing. ## Generic description of various ids, types etc prompt.link_id = Link Id prompt.connector_name = Connector Name -prompt.job_id = Job Id +prompt.job_name = Job Name prompt.job_type = Job type ## Prompt messages for updating, filling entity info @@ -58,7 +58,7 @@ job object # Update command update.description = Update objects in Sqoop repository update.link = Updating link with id {0} -update.job = Updating job with id {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} @@ -69,14 +69,14 @@ clone.link.successful = link was successfully created with validation \ clone.job.successful = Job was successfully created with validation \ status {0} and persistent id {1} clone.cloning_link = Cloning link with id {0} -clone.cloning_job = Cloning job with id {0} +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} create.job_successful = New job was successfully created with validation \ - status {0} and persistent id {1} + 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} @@ -149,15 +149,15 @@ show.prompt_driver_opts = @|bold Driver specific options: |@\nPersistent id: {0} show.prompt_display_all_jobs = Display all jobs show.prompt_display_all_jobs_cn = Display all jobs with given connector name -show.prompt_display_job_jid = Display job with given jid +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 id {0} and name {1} (Enabled: {2}, Created by {3} at {4}, Updated by {5} at {6}) +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_display_all_submissions = Display all submissions -show.prompt_display_all_submissions_jid = Display all submissions given jid +show.prompt_display_all_submissions_jn = Display all submissions given job name show.prompt_display_all_servers = Display all server information show.prompt_display_server_host = Display server host name http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 89f9fbb..3826dd5 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java @@ -165,23 +165,23 @@ public class TestCloneCommand { when(client.saveJob(job)).thenReturn(Status.OK); when(client.getConnector(any(Long.class))).thenReturn(new MConnector("", "", "", null, null, null)); - // clone job -jid job_test - Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + // clone job -name job_test + Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); assertTrue(status != null && status == Status.OK); - // Missing argument for option jid + // Missing argument for option name try { - cloneCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid")); + cloneCmd.execute(Arrays.asList(Constants.FN_JOB, "-name")); fail("Update job 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 jid + // Missing option name try { cloneCmd.execute(Arrays.asList(Constants.FN_JOB)); - fail("Update job should fail as option jid is missing"); + fail("Update job should fail as option name is missing"); } catch (SqoopException e) { assertEquals(ShellError.SHELL_0003, e.getErrorCode()); assertTrue(e.getMessage().contains("Missing required option")); @@ -201,7 +201,7 @@ public class TestCloneCommand { when(client.getDriverConfigBundle()).thenReturn(resourceBundle); when(client.saveJob(job)).thenReturn(Status.OK); - // clone job -jid job_test + // clone job -name job_test initData("jobname\r" + // job name // From job config "abc\r" + // for input with name "String" @@ -232,7 +232,7 @@ public class TestCloneCommand { "0\r" + // for input with name "Enum" "l1\rl2\rl3\r\r" + // for input with name "List" "7654321\r"); // for input with name "DateTime" - Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); assertTrue(status != null && status == Status.OK); assertEquals(job.getName(), "jobname"); // check from job config http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 7b65f7e..f80ec1f 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestDeleteCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestDeleteCommand.java @@ -84,14 +84,14 @@ public class TestDeleteCommand { public void testDeleteJob() { doNothing().when(client).deleteJob("job_test"); - // delete job -j job_test - Status status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_JOB, "-j", "job_test")); + // delete job -name job_test + Status status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.assertTrue(status != null && status == Status.OK); - // Missing argument for option jid + // Missing argument for option name try { - status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid")); - Assert.fail("Delete job should fail as job id/name is missing!"); + status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_JOB, "-name")); + Assert.fail("Delete job should fail as job name is missing!"); } catch (SqoopException e) { Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode()); Assert.assertTrue(e.getMessage().contains("Missing argument for option")); @@ -103,7 +103,7 @@ public class TestDeleteCommand { doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "job doesn't exist")).when(client).deleteJob(any(String.class)); try { - deleteCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + deleteCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.fail("Delete job should fail as requested job doesn't exist!"); } catch (SqoopException e) { Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode()); http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 282f512..1ce63d5 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestDisableCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestDisableCommand.java @@ -84,13 +84,13 @@ public class TestDisableCommand { doNothing().when(client).enableJob("job_test", false); // disable job -j job_test - Status status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_JOB, "-j", "job_test")); + Status status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.assertTrue(status != null && status == Status.OK); - // Missing argument for option jid + // Missing argument for option name try { - status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid")); - Assert.fail("Disable job should fail as job id/name is missing!"); + status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_JOB, "-name")); + Assert.fail("Disable job should fail as job name is missing!"); } catch (SqoopException e) { Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode()); Assert.assertTrue(e.getMessage().contains("Missing argument for option")); @@ -102,7 +102,7 @@ public class TestDisableCommand { doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "job doesn't exist")).when(client).enableJob(any(String.class), any(Boolean.class)); try { - disableCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + disableCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.fail("Disable job should fail as requested job doesn't exist!"); } catch (SqoopException e) { Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode()); http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 d286251..1014dc2 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestEnableCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestEnableCommand.java @@ -84,12 +84,12 @@ public class TestEnableCommand { doNothing().when(client).enableJob("job_test", true); // enable job -j job_test - Status status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_JOB, "-j", "job_test")); + Status status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.assertTrue(status != null && status == Status.OK); - // Missing argument for option jid + // Missing argument for option name try { - status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid")); + status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_JOB, "-name")); Assert.fail("Enable job should fail as job id/name is missing!"); } catch (SqoopException e) { Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode()); @@ -102,7 +102,7 @@ public class TestEnableCommand { doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "job doesn't exist")).when(client).enableJob(any(String.class), any(Boolean.class)); try { - enableCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + enableCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.fail("Enable job should fail as requested job doesn't exist!"); } catch (SqoopException e) { Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode()); http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 cced476..05b4e52 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java @@ -233,7 +233,7 @@ public class TestShowCommand { public void testShowJob() { when(client.getJobs()).thenReturn(new ArrayList<MJob>()); when(client.getConnector(any(Long.class))).thenReturn(new MConnector("", "", "", null, null, null)); - when(client.getJob("1")).thenReturn(new MJob("fromConnectorName", "toConnectorName", "linkName1", "linkName2", + when(client.getJob("jobName")).thenReturn(new MJob("fromConnectorName", "toConnectorName", "linkName1", "linkName2", new MFromConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()), new MToConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()), new MDriverConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()))); @@ -260,12 +260,12 @@ public class TestShowCommand { str = new String(out.toByteArray()); Assert.assertTrue(str.contains("job(s) to show:")); - // show job -jid 1 + // show job -name jobName out.reset(); - status = (Status) showCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "1")); + status = (Status) showCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "jobName")); Assert.assertTrue(status != null && status == Status.OK); str = new String(out.toByteArray()); - Assert.assertTrue(str.contains("Job with id")); + Assert.assertTrue(str.contains("Job with name")); // show job -connector fromConnectorName out.reset(); @@ -280,9 +280,9 @@ public class TestShowCommand { when(client.getSubmissions()).thenReturn(Arrays.asList(new MSubmission(1L))); when(client.getSubmissionsForJob(any(String.class))).thenReturn(Arrays.asList(new MSubmission(1L))); - // show submission -details -jid 1 + // show submission -details -name jobName out.reset(); - Status status = (Status) showCmd.execute(Arrays.asList(Constants.FN_SUBMISSION, "-detail", "-jid", "1")); + Status status = (Status) showCmd.execute(Arrays.asList(Constants.FN_SUBMISSION, "-detail", "-name", "jobName")); Assert.assertTrue(status != null && status == Status.OK); String str = new String(out.toByteArray()); Assert.assertTrue(str.contains("Submission details")); @@ -294,9 +294,9 @@ public class TestShowCommand { str = new String(out.toByteArray()); Assert.assertTrue(str.contains("Submission details")); - // show submission -jid 1 + // show submission -job jobName out.reset(); - status = (Status) showCmd.execute(Arrays.asList(Constants.FN_SUBMISSION, "-jid", "1")); + status = (Status) showCmd.execute(Arrays.asList(Constants.FN_SUBMISSION, "-job", "jobName")); Assert.assertTrue(status != null && status == Status.OK); str = new String(out.toByteArray()); Assert.assertTrue(str.contains("Job Id")); http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/test/java/org/apache/sqoop/shell/TestStartCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestStartCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestStartCommand.java index 17ce291..b55b087 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestStartCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestStartCommand.java @@ -55,13 +55,13 @@ public class TestStartCommand { MSubmission submission = new MSubmission(); when(client.startJob(any(String.class))).thenReturn(submission); - // start job -jid job_test - Status status = (Status) startCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + // start job -name job_test + Status status = (Status) startCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.assertTrue(status != null && status == Status.OK); - // Missing argument for jid + // Missing argument for name try { - startCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid")); + startCmd.execute(Arrays.asList(Constants.FN_JOB, "-name")); Assert.fail("Start job should fail as parameters aren't complete!"); } catch (SqoopException e) { Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode()); @@ -73,8 +73,8 @@ public class TestStartCommand { public void testStartJobSynchronousEnabled() throws InterruptedException { when(client.startJob(any(String.class), any(SubmissionCallback.class), any(Long.class))).thenReturn(null); - // start job -jid job_test -synchronous - Status status = (Status) startCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test", "-synchronous")); + // start job -name job_test -synchronous + Status status = (Status) startCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test", "-synchronous")); Assert.assertTrue(status != null && status == Status.OK); } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/test/java/org/apache/sqoop/shell/TestStatusCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestStatusCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestStatusCommand.java index 894a2c3..9fac463 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestStatusCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestStatusCommand.java @@ -54,13 +54,13 @@ public class TestStatusCommand { MSubmission submission = new MSubmission(); when(client.getJobStatus(any(String.class))).thenReturn(submission); - // status job -jid job_test - Status status = (Status) statusCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + // status job -name job_test + Status status = (Status) statusCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.assertTrue(status != null && status == Status.OK); - // Missing argument for jid + // Missing argument for name try { - statusCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid")); + statusCmd.execute(Arrays.asList(Constants.FN_JOB, "-name")); Assert.fail("Get job status should fail as parameters aren't complete!"); } catch (SqoopException e) { Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode()); http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/shell/src/test/java/org/apache/sqoop/shell/TestStopCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestStopCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestStopCommand.java index cfb022a..e2bc6b8 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestStopCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestStopCommand.java @@ -54,13 +54,13 @@ public class TestStopCommand { MSubmission submission = new MSubmission(); when(client.stopJob(any(String.class))).thenReturn(submission); - // stop job -jid job_test - Status status = (Status) stopCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + // stop job -name job_test + Status status = (Status) stopCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); Assert.assertTrue(status != null && status == Status.OK); - // Missing argument for jid + // Missing argument for name try { - stopCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid")); + stopCmd.execute(Arrays.asList(Constants.FN_JOB, "-name")); Assert.fail("Stop job should fail as parameters aren't complete!"); } catch (SqoopException e) { Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode()); http://git-wip-us.apache.org/repos/asf/sqoop/blob/a53e682f/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 bb6b321..412d493 100644 --- a/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java +++ b/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java @@ -183,23 +183,23 @@ public class TestUpdateCommand { when(client.getDriverConfigBundle()).thenReturn(new MapResourceBundle(new HashMap())); when(client.updateJob(job)).thenReturn(Status.OK); - // update job -jid job_test - Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + // update job -name job_test + Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); assertTrue(status != null && status == Status.OK); - // Missing argument for option jid + // Missing argument for option name try { - updateCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid")); + updateCmd.execute(Arrays.asList(Constants.FN_JOB, "-name")); fail("Update job 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 jid + // Missing option name try { updateCmd.execute(Arrays.asList(Constants.FN_JOB)); - fail("Update job should fail as option jid is missing"); + fail("Update job should fail as option name is missing"); } catch (SqoopException e) { assertEquals(ShellError.SHELL_0003, e.getErrorCode()); assertTrue(e.getMessage().contains("Missing required option")); @@ -220,7 +220,7 @@ public class TestUpdateCommand { when(client.getDriverConfigBundle()).thenReturn(resourceBundle); when(client.updateJob(job)).thenReturn(Status.OK); - // update job -jid job_test + // update job -name job_test initData("jobname\r" + // job name // From job config "abc\r" + // for input with name "String" @@ -251,7 +251,7 @@ public class TestUpdateCommand { "0\r" + // for input with name "Enum" "l1\rl2\rl3\r\r" + // for input with name "List" "7654321\r"); // for input with name "DateTime" - Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_JOB, "-jid", "job_test")); + Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test")); assertTrue(status != null && status == Status.OK); assertEquals(job.getName(), "jobname"); // check from job config
