sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject [1/2] sqoop git commit: SQOOP-2758: Sqoop2: Add integration test for shell
Date Thu, 14 Jan 2016 20:06:50 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 88654b95f -> 67214a48c


http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/java/org/apache/sqoop/integration/shell/ShowCommandTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/shell/ShowCommandTest.java b/test/src/test/java/org/apache/sqoop/integration/shell/ShowCommandTest.java
new file mode 100644
index 0000000..9fd4811
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/shell/ShowCommandTest.java
@@ -0,0 +1,300 @@
+/**
+ * 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.sqoop.integration.shell;
+
+import org.apache.sqoop.shell.ShellEnvironment;
+import org.apache.sqoop.shell.ShowCommand;
+import org.apache.sqoop.shell.SqoopCommand;
+import org.apache.sqoop.shell.core.Constants;
+import org.apache.sqoop.test.infrastructure.Infrastructure;
+import org.apache.sqoop.test.infrastructure.providers.DatabaseInfrastructureProvider;
+import org.apache.sqoop.test.infrastructure.providers.SqoopInfrastructureProviderForShellTest;
+import org.apache.sqoop.test.testcases.ShellTestCase;
+import org.apache.sqoop.validation.Status;
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.codehaus.groovy.tools.shell.IO;
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+import static org.testng.Assert.*;
+
+@Infrastructure(dependencies = {SqoopInfrastructureProviderForShellTest.class, DatabaseInfrastructureProvider.class})
+public class ShowCommandTest extends ShellTestCase {
+  private ByteArrayOutputStream out;
+
+  protected SqoopCommand createCommand(Groovysh shell) {
+    return new ShowCommand(shell);
+  }
+
+  @Test
+  public void testShowOption() {
+    resetIO();
+
+    // show option -name verbose
+    Status status = (Status) execute(Arrays.asList(Constants.FN_OPTION, "-name", "verbose"));
+    assertTrue(status != null && status == Status.OK);
+    String str = new String(out.toByteArray());
+    assertTrue(str.contains("Verbose ="));
+
+    // show option -name poll-timeout
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_OPTION, "-name", "poll-timeout"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("Poll-timeout ="));
+
+    // show all options
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_OPTION));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("Verbose ="));
+    assertTrue(str.contains("Poll-timeout ="));
+  }
+
+  @Test
+  public void testShowServer() throws Exception {
+    resetIO();
+
+    // show server -host -port -webapp
+    Status status = (Status)  execute(Arrays.asList(Constants.FN_SERVER, "-host", "-port", "-webapp"));
+    assertTrue(status != null && status == Status.OK);
+    String outPuts = new String(out.toByteArray());
+    assertTrue(outPuts.contains("Server host:"));
+    assertTrue(outPuts.contains("Server port:"));
+    assertTrue(outPuts.contains("Server webapp:"));
+
+    // show server -all
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_SERVER, "-all"));
+    assertTrue(status != null && status == Status.OK);
+    outPuts = new String(out.toByteArray());
+    assertTrue(outPuts.contains("Server host:"));
+    assertTrue(outPuts.contains("Server port:"));
+    assertTrue(outPuts.contains("Server webapp:"));
+
+    // show server -host
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_SERVER, "-host"));
+    assertTrue(status != null && status == Status.OK);
+    outPuts = new String(out.toByteArray());
+    assertTrue(outPuts.contains("Server host:"));
+    assertFalse(outPuts.contains("Server port:"));
+    assertFalse(outPuts.contains("Server webapp:"));
+
+    // show server -port
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_SERVER, "-port"));
+    assertTrue(status != null && status == Status.OK);
+    outPuts = new String(out.toByteArray());
+    assertFalse(outPuts.contains("Server host:"));
+    assertTrue(outPuts.contains("Server port:"));
+    assertFalse(outPuts.contains("Server webapp:"));
+
+    // show server -webapp
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_SERVER, "-webapp"));
+    assertTrue(status != null && status == Status.OK);
+    outPuts = new String(out.toByteArray());
+    assertFalse(outPuts.contains("Server host:"));
+    assertFalse(outPuts.contains("Server port:"));
+    assertTrue(outPuts.contains("Server webapp:"));
+  }
+
+  @Test
+  public void testShowVersion() {
+    resetIO();
+
+    // show version -server -client -api
+    Status status = (Status) execute(Arrays.asList(Constants.FN_VERSION, "-server", "-client", "-api"));
+    assertTrue(status != null && status == Status.OK);
+    String str = new String(out.toByteArray());
+    assertTrue(str.contains("server version:"));
+    assertTrue(str.contains("client version:"));
+    assertTrue(str.contains("API versions:"));
+
+    // show version -all
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_VERSION, "-all"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("server version:"));
+    assertTrue(str.contains("client version:"));
+    assertTrue(str.contains("API versions:"));
+
+    // show client version when no option is specified
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_VERSION));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertFalse(str.contains("server version:"));
+    assertTrue(str.contains("client version:"));
+    assertFalse(str.contains("API versions:"));
+  }
+
+  @Test
+  public void testShowConnector() {
+    resetIO();
+
+    // show connector summary
+    Status status = (Status) execute(Arrays.asList(Constants.FN_CONNECTOR));
+    assertTrue(status != null && status == Status.OK);
+    String str = new String(out.toByteArray());
+    assertTrue(str.contains("Name"));
+    assertTrue(str.contains("Version"));
+    assertTrue(str.contains("Class"));
+    assertTrue(str.contains("Supported Directions"));
+
+    // show connector -all
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_CONNECTOR, "-all"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("connector(s) to show:"));
+
+    // show connector -name test_connector
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_CONNECTOR, "-name", "generic-jdbc-connector"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("Connector with Name: generic-jdbc-connector"));
+  }
+
+  @Test
+  public void testShowDriver() {
+    resetIO();
+
+    // show driver
+    Status status = (Status) execute(Arrays.asList(Constants.FN_DRIVER_CONFIG));
+    assertTrue(status != null && status == Status.OK);
+    String str = new String(out.toByteArray());
+    assertTrue(str.contains("Driver specific options:"));
+  }
+
+  @Test
+  public void testShowLink() {
+    createLink("linkName");
+    resetIO();
+
+    // show link summary
+    Status status = (Status) execute(Arrays.asList(Constants.FN_LINK));
+    assertTrue(status != null && status == Status.OK);
+    String str = new String(out.toByteArray());
+    assertTrue(str.contains("Name"));
+    assertTrue(str.contains("Connector Name"));
+    assertTrue(str.contains("Enabled"));
+
+    // show link -all
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_LINK, "-all"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("link(s) to show:"));
+
+    // show link -name linkName
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_LINK, "-name", "linkName"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("link with name"));
+  }
+
+  @Test
+  public void testShowJob() {
+    createJob("fromLink", "toLink", "jobName");
+    resetIO();
+
+    // show job summary
+    Status status = (Status) execute(Arrays.asList(Constants.FN_JOB));
+    assertTrue(status != null && status == Status.OK);
+    String str = new String(out.toByteArray());
+    assertTrue(str.contains("Id"));
+    assertTrue(str.contains("Name"));
+    assertTrue(str.contains("From Connector"));
+    assertTrue(str.contains("To Connector"));
+    assertTrue(str.contains("Enabled"));
+
+    // show job -all
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_JOB, "-all"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("job(s) to show:"));
+
+    // show job -name jobName
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_JOB, "-name", "jobName"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("Job with name"));
+
+    // show job -connector generic-jdbc-connector
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_JOB, "-connector", "generic-jdbc-connector"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("job(s) to show:"));
+  }
+
+  @Test
+  public void testShowSubmission() throws Exception {
+    createJob("fromLink", "toLink", "jobForShowCommand");
+    executeJob("jobForShowCommand", false);
+    resetIO();
+
+    // show submission -details -job jobName
+    Status status = (Status) execute(Arrays.asList(Constants.FN_SUBMISSION, "-detail", "-job", "jobForShowCommand"));
+    assertTrue(status != null && status == Status.OK);
+    String str = new String(out.toByteArray());
+    assertTrue(str.contains("Submission details"));
+
+    // show submission -details
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_SUBMISSION, "-detail"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("Submission details"));
+
+    // show submission -job jobName
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_SUBMISSION, "-job", "jobForShowCommand"));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("Job Name"));
+    assertTrue(str.contains("External Id"));
+    assertTrue(str.contains("Status"));
+    assertTrue(str.contains("Last Update Date"));
+
+    // show submission
+    out.reset();
+    status = (Status) execute(Arrays.asList(Constants.FN_SUBMISSION));
+    assertTrue(status != null && status == Status.OK);
+    str = new String(out.toByteArray());
+    assertTrue(str.contains("Job Name"));
+    assertTrue(str.contains("External Id"));
+    assertTrue(str.contains("Status"));
+    assertTrue(str.contains("Last Update Date"));
+  }
+
+  private void resetIO() {
+    out = new ByteArrayOutputStream();
+    ShellEnvironment.setIo(new IO(System.in, out, System.err));
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/java/org/apache/sqoop/integration/shell/StartCommandTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/shell/StartCommandTest.java b/test/src/test/java/org/apache/sqoop/integration/shell/StartCommandTest.java
new file mode 100644
index 0000000..5504586
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/shell/StartCommandTest.java
@@ -0,0 +1,77 @@
+/**
+ * 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.sqoop.integration.shell;
+
+import org.apache.sqoop.client.ClientError;
+import org.apache.sqoop.common.SqoopException;
+import org.apache.sqoop.model.MSubmission;
+import org.apache.sqoop.shell.SqoopCommand;
+import org.apache.sqoop.shell.StartCommand;
+import org.apache.sqoop.shell.core.Constants;
+import org.apache.sqoop.submission.SubmissionStatus;
+import org.apache.sqoop.test.infrastructure.Infrastructure;
+import org.apache.sqoop.test.infrastructure.providers.DatabaseInfrastructureProvider;
+import org.apache.sqoop.test.infrastructure.providers.SqoopInfrastructureProviderForShellTest;
+import org.apache.sqoop.test.testcases.ShellTestCase;
+import org.apache.sqoop.validation.Status;
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+@Infrastructure(dependencies = {SqoopInfrastructureProviderForShellTest.class, DatabaseInfrastructureProvider.class})
+public class StartCommandTest extends ShellTestCase {
+
+  protected SqoopCommand createCommand(Groovysh shell) {
+    return new StartCommand(shell);
+  }
+
+  @Test
+  public void testStartJob() throws Exception {
+    createJob("fromLink1", "toLink1", "jobForTestStartJob1");
+    Status status = (Status) execute(Arrays.asList(Constants.FN_JOB, "-name", "jobForTestStartJob1"));
+    assertTrue(status != null && status == Status.OK);
+
+    List<MSubmission> submissions = getClient().getSubmissionsForJob("jobForTestStartJob1");
+    assertEquals(submissions.size(), 1);
+
+    try {
+      execute(Arrays.asList(Constants.FN_JOB, "-name", "non-exist-job"));
+      fail("Start job should fail as job doesn't exist!");
+    } catch (SqoopException e) {
+      assertEquals(e.getErrorCode(), ClientError.CLIENT_0001);
+    }
+  }
+
+  @Test
+  public void testStartJobWithSyn() throws Exception {
+    createJob("fromLink2", "toLink2", "jobForTestStartJob2");
+    // start job with synchronous
+    Status status = (Status) execute(Arrays.asList(Constants.FN_JOB, "-name", "jobForTestStartJob2", "-synchronous"));
+    assertTrue(status != null && status == Status.OK);
+
+    List<MSubmission> submissions = getClient().getSubmissionsForJob("jobForTestStartJob2");
+    assertEquals(submissions.size(), 1);
+    assertTrue(submissions.get(0).getStatus() == SubmissionStatus.FAILED);
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/java/org/apache/sqoop/integration/shell/StatusCommandTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/shell/StatusCommandTest.java b/test/src/test/java/org/apache/sqoop/integration/shell/StatusCommandTest.java
new file mode 100644
index 0000000..7294b05
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/shell/StatusCommandTest.java
@@ -0,0 +1,80 @@
+/**
+ * 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.sqoop.integration.shell;
+
+import org.apache.sqoop.client.ClientError;
+import org.apache.sqoop.common.SqoopException;
+import org.apache.sqoop.shell.ShellEnvironment;
+import org.apache.sqoop.shell.SqoopCommand;
+import org.apache.sqoop.shell.StatusCommand;
+import org.apache.sqoop.shell.core.Constants;
+import org.apache.sqoop.test.infrastructure.Infrastructure;
+import org.apache.sqoop.test.infrastructure.providers.DatabaseInfrastructureProvider;
+import org.apache.sqoop.test.infrastructure.providers.SqoopInfrastructureProviderForShellTest;
+import org.apache.sqoop.test.testcases.ShellTestCase;
+import org.apache.sqoop.validation.Status;
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.codehaus.groovy.tools.shell.IO;
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+@Infrastructure(dependencies = {SqoopInfrastructureProviderForShellTest.class, DatabaseInfrastructureProvider.class})
+public class StatusCommandTest extends ShellTestCase {
+  private ByteArrayOutputStream out;
+
+  protected SqoopCommand createCommand(Groovysh shell) {
+    return new StatusCommand(shell);
+  }
+
+  @Test
+  public void testShowStatus() throws Exception {
+    resetIO();
+
+    createJob("fromLink", "toLink", "jobForStatusCommand");
+    executeJob("jobForStatusCommand", false);
+
+    Status status = (Status) execute(Arrays.asList(Constants.FN_JOB, "-name", "jobForStatusCommand"));
+    assertTrue(status != null && status == Status.OK);
+    String str = new String(out.toByteArray());
+    assertTrue(str.contains("Submission details"));
+    assertTrue(str.contains("Job Name: jobForStatusCommand"));
+    assertTrue(str.contains("Server URL"));
+    assertTrue(str.contains("Created by"));
+    assertTrue(str.contains("Creation date"));
+    assertTrue(str.contains("Lastly updated by"));
+    assertTrue(str.contains("Submission details"));
+
+    try {
+      execute(Arrays.asList(Constants.FN_JOB, "-name", "non-exist-job"));
+      fail("Show status should fail as job doesn't exist!");
+    } catch (SqoopException e) {
+      assertEquals(e.getErrorCode(), ClientError.CLIENT_0001);
+    }
+  }
+
+  private void resetIO() {
+    out = new ByteArrayOutputStream();
+    ShellEnvironment.setIo(new IO(System.in, out, System.err));
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/java/org/apache/sqoop/integration/shell/StopCommandTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/shell/StopCommandTest.java b/test/src/test/java/org/apache/sqoop/integration/shell/StopCommandTest.java
new file mode 100644
index 0000000..69110b2
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/shell/StopCommandTest.java
@@ -0,0 +1,63 @@
+/**
+ * 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.sqoop.integration.shell;
+
+import org.apache.sqoop.client.ClientError;
+import org.apache.sqoop.common.SqoopException;
+import org.apache.sqoop.shell.SqoopCommand;
+import org.apache.sqoop.shell.StopCommand;
+import org.apache.sqoop.shell.core.Constants;
+import org.apache.sqoop.test.infrastructure.Infrastructure;
+import org.apache.sqoop.test.infrastructure.providers.DatabaseInfrastructureProvider;
+import org.apache.sqoop.test.infrastructure.providers.SqoopInfrastructureProviderForShellTest;
+import org.apache.sqoop.test.testcases.ShellTestCase;
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+@Infrastructure(dependencies = {SqoopInfrastructureProviderForShellTest.class, DatabaseInfrastructureProvider.class})
+public class StopCommandTest extends ShellTestCase {
+
+  protected SqoopCommand createCommand(Groovysh shell) {
+    return new StopCommand(shell);
+  }
+
+  @Test
+  public void testStopCommand() throws Exception {
+    createJob("fromLink1", "toLink1", "jobForTestStopCommand");
+    // start job
+    getClient().startJob("jobForTestStopCommand");
+    try {
+      execute(Arrays.asList(Constants.FN_JOB, "-name", "jobForTestStopCommand"));
+      fail("The given job is not running!");
+    } catch (SqoopException e) {
+      assertEquals(e.getErrorCode(), ClientError.CLIENT_0001);
+    }
+
+    try {
+      execute(Arrays.asList(Constants.FN_JOB, "-name", "non-exist-job"));
+      fail("Stop job should fail as job doesn't exist!");
+    } catch (SqoopException e) {
+      assertEquals(e.getErrorCode(), ClientError.CLIENT_0001);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/java/org/apache/sqoop/integration/shell/UpdateCommandTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/shell/UpdateCommandTest.java b/test/src/test/java/org/apache/sqoop/integration/shell/UpdateCommandTest.java
new file mode 100644
index 0000000..f9a35fe
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/shell/UpdateCommandTest.java
@@ -0,0 +1,127 @@
+/**
+ * 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.sqoop.integration.shell;
+
+import org.apache.sqoop.client.ClientError;
+import org.apache.sqoop.common.SqoopException;
+import org.apache.sqoop.model.MJob;
+import org.apache.sqoop.model.MLink;
+import org.apache.sqoop.shell.ShellEnvironment;
+import org.apache.sqoop.shell.SqoopCommand;
+import org.apache.sqoop.shell.UpdateCommand;
+import org.apache.sqoop.shell.core.Constants;
+import org.apache.sqoop.test.infrastructure.Infrastructure;
+import org.apache.sqoop.test.infrastructure.providers.DatabaseInfrastructureProvider;
+import org.apache.sqoop.test.infrastructure.providers.SqoopInfrastructureProviderForShellTest;
+import org.apache.sqoop.test.testcases.ShellTestCase;
+import org.apache.sqoop.validation.Status;
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.testng.annotations.Test;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+@Infrastructure(dependencies = {SqoopInfrastructureProviderForShellTest.class, DatabaseInfrastructureProvider.class})
+public class UpdateCommandTest extends ShellTestCase {
+
+  protected SqoopCommand createCommand(Groovysh shell) {
+    return new UpdateCommand(shell);
+  }
+
+  @Test
+  public void testUpdateLink() throws UnsupportedEncodingException {
+    ShellEnvironment.setInteractive(true);
+    initEnv();
+
+    // creaet link
+    createLink("linkName");
+
+    // do the clone test
+    initData("Update\n" +                          // link name: append to the old link name
+            "linkConfig1\n" +            // link config1
+            "linkConfig2\n");            // link config2
+    Status status = (Status) execute(Arrays.asList(Constants.FN_LINK, "-name", "linkName"));
+    assertTrue(status != null && status != Status.ERROR);
+    try {
+      getClient().getLink("linkName");
+      fail("The origin link name is not work.");
+    } catch (SqoopException e) {}
+
+    MLink link = getClient().getLink("linkNameUpdate");
+    assertEquals(link.getName(), "linkNameUpdate");
+    assertEquals(link.getConnectorLinkConfig("testLinkConfigForShell").getInput("testLinkConfigForShell.linkConfig1").getValue(),
+            "linkConfig1");
+    assertEquals(link.getConnectorLinkConfig("testLinkConfigForShell").getInput("testLinkConfigForShell.linkConfig2").getValue(),
+            "linkConfig2");
+  }
+
+  @Test
+  public void testUpdateNonExistingLink() {
+    ShellEnvironment.setInteractive(false);
+    try {
+      execute(Arrays.asList(Constants.FN_LINK, "-name", "non-exist-link"));
+      fail("Update Link should fail as link doesn't exist!");
+    } catch (SqoopException e) {
+      assertEquals(e.getErrorCode(), ClientError.CLIENT_0001);
+    }
+  }
+
+  @Test
+  public void testUpdateJob() throws UnsupportedEncodingException {
+    ShellEnvironment.setInteractive(true);
+    initEnv();
+
+    createJob("fromLink", "toLink", "jobName");
+
+    // create job -f link_from -to link_to
+    initData("Update\n" +                              // job name
+            "fromJobConfig1\n" +                      // from job config1
+            "fromJobConfig2\n" +                      // from job config2
+            "toJobConfig1\n" +                        // to job config1
+            "toJobConfig2\n\n\n\n\n\n");              // to job config2 and nothing for driver
+    Status status = (Status) execute(Arrays.asList(Constants.FN_JOB, "-name", "jobName"));
+    assertTrue(status != null && status != Status.ERROR);
+
+    try {
+      getClient().getJob("jobName");
+      fail("The origin job name is not work.");
+    } catch (SqoopException e) {}
+
+    MJob job = getClient().getJob("jobNameUpdate");
+    assertEquals(job.getName(), "jobNameUpdate");
+    assertEquals(job.getFromJobConfig().getInput("testFromJobConfigForShell.fromJobConfig1").getValue(), "fromJobConfig1");
+    assertEquals(job.getFromJobConfig().getInput("testFromJobConfigForShell.fromJobConfig2").getValue(), "fromJobConfig2");
+    assertEquals(job.getToJobConfig().getInput("testToJobConfigForShell.toJobConfig1").getValue(), "toJobConfig1");
+    assertEquals(job.getToJobConfig().getInput("testToJobConfigForShell.toJobConfig2").getValue(), "toJobConfig2");
+  }
+
+  @Test
+  public void testUpdateNonExistingJob() {
+    ShellEnvironment.setInteractive(false);
+    try {
+      execute(Arrays.asList(Constants.FN_JOB, "-name", "non-exist-jobName"));
+      fail("Update Job should fail as job doesn't exist!");
+    } catch (SqoopException e) {
+      assertEquals(e.getErrorCode(), ClientError.CLIENT_0001);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestConnectorForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestConnectorForShell.java b/test/src/test/resources/TestConnectorForShell/TestConnectorForShell.java
new file mode 100644
index 0000000..4191d97
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestConnectorForShell.java
@@ -0,0 +1,85 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.connector.spi.ConnectorConfigurableUpgrader;
+import org.apache.sqoop.connector.spi.SqoopConnector;
+import org.apache.sqoop.job.etl.From;
+import org.apache.sqoop.job.etl.To;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * A connector that does not do anything
+ */
+public class TestConnectorForShell extends SqoopConnector {
+
+  private static final From FROM = new From(
+          TestFromInitializerForShell.class,
+          TestPartitionerForShell.class,
+          TestPartitionForShell.class,
+          TestExtractorForShell.class,
+          TestFromDestroyerForShell.class);
+
+  private static final To TO = new To(TestToInitializerForShell.class,
+    TestLoaderForShell.class,
+    TestToDestroyerForShell.class);
+
+  @Override
+  public String getVersion() {
+    return "1.0";
+  }
+
+  @Override
+  public ResourceBundle getBundle(Locale locale) {
+    return ResourceBundle.getBundle("test-connector-for-shell", locale);
+  }
+
+  @Override
+  public Class getLinkConfigurationClass() {
+    return TestLinkConfigurationForShell.class;
+  }
+
+  @Override
+  public Class getJobConfigurationClass(Direction direction) {
+    switch (direction) {
+      case FROM:
+        return TestFromJobConfigurationForShell.class;
+      case TO:
+        return TestToJobConfigurationForShell.class;
+      default:
+        return null;
+    }
+  }
+
+  @Override
+  public From getFrom() {
+    return FROM;
+  }
+
+  @Override
+  public To getTo() {
+    return TO;
+  }
+
+  @Override
+  public ConnectorConfigurableUpgrader getConfigurableUpgrader(String oldConnectorVersion) {
+    return null;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestExtractorForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestExtractorForShell.java b/test/src/test/resources/TestConnectorForShell/TestExtractorForShell.java
new file mode 100644
index 0000000..cfb832f
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestExtractorForShell.java
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.job.etl.Extractor;
+import org.apache.sqoop.job.etl.ExtractorContext;
+
+public class TestExtractorForShell extends Extractor<TestLinkConfigurationForShell, TestFromJobConfigurationForShell, TestPartitionForShell> {
+
+  @Override
+  public void extract(ExtractorContext context,
+      TestLinkConfigurationForShell linkConfiguration,
+      TestFromJobConfigurationForShell jobConfiguration,
+      TestPartitionForShell partition) {
+  }
+
+  @Override
+  public long getRowsRead() {
+    return 0;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestFromDestroyerForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestFromDestroyerForShell.java b/test/src/test/resources/TestConnectorForShell/TestFromDestroyerForShell.java
new file mode 100644
index 0000000..4520c39
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestFromDestroyerForShell.java
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.job.etl.Destroyer;
+import org.apache.sqoop.job.etl.DestroyerContext;
+
+public class TestFromDestroyerForShell extends Destroyer<TestLinkConfigurationForShell, TestFromJobConfigurationForShell> {
+  @Override
+  public void destroy(DestroyerContext context, TestLinkConfigurationForShell linkConfig,
+                      TestFromJobConfigurationForShell jobConfig) {
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestFromInitializerForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestFromInitializerForShell.java b/test/src/test/resources/TestConnectorForShell/TestFromInitializerForShell.java
new file mode 100644
index 0000000..82f0d47
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestFromInitializerForShell.java
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.job.etl.Initializer;
+import org.apache.sqoop.job.etl.InitializerContext;
+
+public class TestFromInitializerForShell extends Initializer<TestLinkConfigurationForShell, TestFromJobConfigurationForShell> {
+  @Override
+  public void initialize(InitializerContext context, TestLinkConfigurationForShell linkConfig,
+                         TestFromJobConfigurationForShell jobConfig) {
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestFromJobConfigForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestFromJobConfigForShell.java b/test/src/test/resources/TestConnectorForShell/TestFromJobConfigForShell.java
new file mode 100644
index 0000000..aa8d5c0
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestFromJobConfigForShell.java
@@ -0,0 +1,28 @@
+/**
+ * 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.
+ */
+import org.apache.sqoop.model.ConfigClass;
+import org.apache.sqoop.model.Input;
+
+@ConfigClass
+public class TestFromJobConfigForShell {
+  @Input
+  public String fromJobConfig1;
+
+  @Input
+  public String fromJobConfig2;
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestFromJobConfigurationForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestFromJobConfigurationForShell.java b/test/src/test/resources/TestConnectorForShell/TestFromJobConfigurationForShell.java
new file mode 100644
index 0000000..9fc9bbd
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestFromJobConfigurationForShell.java
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.model.ConfigurationClass;
+import org.apache.sqoop.model.Config;
+
+@ConfigurationClass
+public class TestFromJobConfigurationForShell {
+  @Config public TestFromJobConfigForShell testFromJobConfigForShell;
+
+  public TestFromJobConfigurationForShell() {
+    testFromJobConfigForShell = new TestFromJobConfigForShell();
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestLinkConfigForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestLinkConfigForShell.java b/test/src/test/resources/TestConnectorForShell/TestLinkConfigForShell.java
new file mode 100644
index 0000000..ebb4f94
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestLinkConfigForShell.java
@@ -0,0 +1,32 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.model.ConfigClass;
+import org.apache.sqoop.model.Input;
+
+/**
+ *
+ */
+@ConfigClass
+public class TestLinkConfigForShell {
+  @Input
+  public String linkConfig1;
+
+  @Input
+  public String linkConfig2;
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestLinkConfigurationForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestLinkConfigurationForShell.java b/test/src/test/resources/TestConnectorForShell/TestLinkConfigurationForShell.java
new file mode 100644
index 0000000..d512d77
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestLinkConfigurationForShell.java
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.model.ConfigurationClass;
+import org.apache.sqoop.model.Config;
+
+@ConfigurationClass
+public class TestLinkConfigurationForShell {
+  @Config public TestLinkConfigForShell testLinkConfigForShell;
+
+  public TestLinkConfigurationForShell() {
+    testLinkConfigForShell = new TestLinkConfigForShell();
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestLoaderForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestLoaderForShell.java b/test/src/test/resources/TestConnectorForShell/TestLoaderForShell.java
new file mode 100644
index 0000000..8f440f2
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestLoaderForShell.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.job.etl.Loader;
+import org.apache.sqoop.job.etl.LoaderContext;
+
+public class TestLoaderForShell extends Loader<TestLinkConfigurationForShell, TestToJobConfigurationForShell> {
+
+  @Override
+  public void load(LoaderContext context, TestLinkConfigurationForShell linkConfiguration,
+                   TestToJobConfigurationForShell toJobConfig) throws Exception {
+  }
+
+  @Override
+  public long getRowsWritten() {
+    return 0;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestPartitionForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestPartitionForShell.java b/test/src/test/resources/TestConnectorForShell/TestPartitionForShell.java
new file mode 100644
index 0000000..5f5b9a5
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestPartitionForShell.java
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.sqoop.job.etl.Partition;
+
+public class TestPartitionForShell extends Partition {
+  public TestPartitionForShell() {}
+
+  @Override
+  public void readFields(DataInput in) throws IOException {}
+
+  @Override
+  public void write(DataOutput out) throws IOException {}
+
+  @Override
+  public String toString() {return "";}
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestPartitionerForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestPartitionerForShell.java b/test/src/test/resources/TestConnectorForShell/TestPartitionerForShell.java
new file mode 100644
index 0000000..fa21a52
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestPartitionerForShell.java
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.sqoop.job.etl.Partition;
+import org.apache.sqoop.job.etl.Partitioner;
+import org.apache.sqoop.job.etl.PartitionerContext;
+
+public class TestPartitionerForShell extends Partitioner<TestLinkConfigurationForShell, TestFromJobConfigurationForShell> {
+  public TestPartitionerForShell() {
+  }
+
+  @Override
+  public List<Partition> getPartitions(PartitionerContext context,
+      TestLinkConfigurationForShell linkConfiguration, TestFromJobConfigurationForShell fromJobConfiguration) {
+    List<Partition> partitionList = new ArrayList<Partition>();
+    partitionList.add(new TestPartitionForShell());
+    return partitionList;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestToDestroyerForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestToDestroyerForShell.java b/test/src/test/resources/TestConnectorForShell/TestToDestroyerForShell.java
new file mode 100644
index 0000000..e172204
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestToDestroyerForShell.java
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.job.etl.Destroyer;
+import org.apache.sqoop.job.etl.DestroyerContext;
+
+public class TestToDestroyerForShell extends Destroyer<TestLinkConfigurationForShell, TestToJobConfigurationForShell> {
+  @Override
+  public void destroy(DestroyerContext context, TestLinkConfigurationForShell linkConfig,
+                      TestToJobConfigurationForShell jobConfig) {
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestToInitializerForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestToInitializerForShell.java b/test/src/test/resources/TestConnectorForShell/TestToInitializerForShell.java
new file mode 100644
index 0000000..950ef7e
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestToInitializerForShell.java
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.job.etl.Initializer;
+import org.apache.sqoop.job.etl.InitializerContext;
+
+public class TestToInitializerForShell extends Initializer<TestLinkConfigurationForShell, TestToJobConfigurationForShell> {
+  @Override
+  public void initialize(InitializerContext context, TestLinkConfigurationForShell linkConfig,
+                         TestToJobConfigurationForShell jobConfig) {
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestToJobConfigForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestToJobConfigForShell.java b/test/src/test/resources/TestConnectorForShell/TestToJobConfigForShell.java
new file mode 100644
index 0000000..08fa715
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestToJobConfigForShell.java
@@ -0,0 +1,30 @@
+import org.apache.sqoop.model.ConfigClass;
+import org.apache.sqoop.model.Input;
+
+/**
+ * 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.
+ */
+
+@ConfigClass
+public class TestToJobConfigForShell {
+  @Input
+  public String toJobConfig1;
+
+  @Input
+  public String toJobConfig2;
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/TestToJobConfigurationForShell.java
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/TestToJobConfigurationForShell.java b/test/src/test/resources/TestConnectorForShell/TestToJobConfigurationForShell.java
new file mode 100644
index 0000000..22664de
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/TestToJobConfigurationForShell.java
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import org.apache.sqoop.model.ConfigurationClass;
+import org.apache.sqoop.model.Config;
+
+@ConfigurationClass
+public class TestToJobConfigurationForShell {
+  @Config public TestToJobConfigForShell testToJobConfigForShell;
+
+  public TestToJobConfigurationForShell() {
+    testToJobConfigForShell = new TestToJobConfigForShell();
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/sqoopconnector.properties
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/sqoopconnector.properties b/test/src/test/resources/TestConnectorForShell/sqoopconnector.properties
new file mode 100644
index 0000000..24dfcad
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/sqoopconnector.properties
@@ -0,0 +1,18 @@
+# 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.
+
+# Test Connector Properties
+org.apache.sqoop.connector.class = TestConnectorForShell
+org.apache.sqoop.connector.name = test-connector-for-shell

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/TestConnectorForShell/test-connector-for-shell.properties
----------------------------------------------------------------------
diff --git a/test/src/test/resources/TestConnectorForShell/test-connector-for-shell.properties b/test/src/test/resources/TestConnectorForShell/test-connector-for-shell.properties
new file mode 100644
index 0000000..c0a4d2f
--- /dev/null
+++ b/test/src/test/resources/TestConnectorForShell/test-connector-for-shell.properties
@@ -0,0 +1,48 @@
+# 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.
+
+# Generic JDBC Connector Resources
+
+############################
+# Link Config
+#
+testLinkConfigForShell.label = Link configuration
+testLinkConfigForShell.help = help info
+
+testLinkConfigForShell.linkConfig1.label = link config1
+testLinkConfigForShell.linkConfig1.help = link config1 help
+
+testLinkConfigForShell.linkConfig2.label = link config2
+testLinkConfigForShell.linkConfig2.help = link config2 help
+
+# from job Config
+testFromJobConfigForShell.label = from job
+testFromJobConfigForShell.help = from job help
+
+testFromJobConfigForShell.fromJobConfig1.label = from job config1
+testFromJobConfigForShell.fromJobConfig1.help = from job config1 help
+
+testFromJobConfigForShell.fromJobConfig2.label = from job config2
+testFromJobConfigForShell.fromJobConfig2.help = from job config2 help
+
+# to job Config
+testToJobConfigForShell.label = to job
+testToJobConfigForShell.help = to job help
+
+testToJobConfigForShell.toJobConfig1.label = to job config1
+testToJobConfigForShell.toJobConfig1.help = to job config1 help
+
+testToJobConfigForShell.toJobConfig2.label = to job config2
+testToJobConfigForShell.toJobConfig2.help = to job config2 help

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67214a48/test/src/test/resources/shell-tests-suite.xml
----------------------------------------------------------------------
diff --git a/test/src/test/resources/shell-tests-suite.xml b/test/src/test/resources/shell-tests-suite.xml
new file mode 100644
index 0000000..e2c0b09
--- /dev/null
+++ b/test/src/test/resources/shell-tests-suite.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="ShellTests" verbose="2" parallel="false">
+
+    <listeners>
+        <listener class-name="org.apache.sqoop.test.testng.SqoopTestListener" />
+    </listeners>
+
+    <test name="ShellTests">
+        <packages>
+            <package name="org.apache.sqoop.integration.shell"/>
+        </packages>
+    </test>
+
+</suite>
\ No newline at end of file


Mime
View raw message