sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-2713: Sqoop2: Use link name in MJob
Date Wed, 09 Dec 2015 09:46:27 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 e70b9c259 -> 3f5b33d0d


SQOOP-2713: Sqoop2: Use link name in MJob

(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/3f5b33d0
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/3f5b33d0
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/3f5b33d0

Branch: refs/heads/sqoop2
Commit: 3f5b33d0d97d713366fabc3f415282524aaef0c5
Parents: e70b9c2
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Wed Dec 9 10:45:46 2015 +0100
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Wed Dec 9 10:45:46 2015 +0100

----------------------------------------------------------------------
 .../org/apache/sqoop/client/SqoopClient.java    |  4 +-
 .../java/org/apache/sqoop/json/JobBean.java     | 16 ++++----
 .../main/java/org/apache/sqoop/model/MJob.java  | 41 ++++++++++----------
 .../java/org/apache/sqoop/json/TestJobBean.java |  4 +-
 .../org/apache/sqoop/json/TestJobsBean.java     |  4 +-
 .../apache/sqoop/json/util/BeanTestUtil.java    |  2 +-
 .../java/org/apache/sqoop/model/TestMJob.java   |  3 +-
 .../org/apache/sqoop/driver/JobManager.java     | 12 +++---
 .../org/apache/sqoop/driver/TestJobManager.java | 18 ++++-----
 .../sqoop/repository/TestJdbcRepository.java    | 38 +++++++++++-------
 .../common/CommonRepositoryHandler.java         | 34 ++++++++++++----
 ...RepositoryInsertUpdateDeleteSelectQuery.java | 13 ++++++-
 .../sqoop/repository/derby/TestJobHandling.java |  2 +-
 .../repository/mysql/MySqlTestCase.java         |  4 +-
 .../postgresql/PostgresqlTestCase.java          |  4 +-
 .../apache/sqoop/handler/JobRequestHandler.java |  7 ++--
 .../org/apache/sqoop/shell/ShowJobFunction.java | 21 ++--------
 .../apache/sqoop/shell/TestCloneCommand.java    |  5 ++-
 .../apache/sqoop/shell/TestCreateCommand.java   |  6 ++-
 .../org/apache/sqoop/shell/TestShowCommand.java |  6 +--
 .../apache/sqoop/shell/TestUpdateCommand.java   |  5 ++-
 .../BlacklistedConnectorTest.java               |  4 +-
 22 files changed, 144 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
index f39ea6a..e71d3ef 100644
--- a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
+++ b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
@@ -395,8 +395,8 @@ public class SqoopClient {
     return new MJob(
       connectorForFromLink.getUniqueName(),
       connectorForToLink.getUniqueName(),
-      fromLink.getPersistenceId(),
-      toLink.getPersistenceId(),
+      fromLinkName,
+      toLinkName,
       connectorForFromLink.getFromConfig().clone(false),
       connectorForToLink.getToConfig().clone(false),
       getDriverConfig()

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/common/src/main/java/org/apache/sqoop/json/JobBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/JobBean.java b/common/src/main/java/org/apache/sqoop/json/JobBean.java
index 2a59c25..9d3a416 100644
--- a/common/src/main/java/org/apache/sqoop/json/JobBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JobBean.java
@@ -48,8 +48,8 @@ import org.json.simple.JSONObject;
 @InterfaceStability.Unstable
 public class JobBean implements JsonBean {
 
-  static final String FROM_LINK_ID = "from-link-id";
-  static final String TO_LINK_ID = "to-link-id";
+  static final String FROM_LINK_NAME = "from-link-name";
+  static final String TO_LINK_NAME = "to-link-name";
   static final String FROM_CONNECTOR_NAME = "from-connector-name";
   static final String TO_CONNECTOR_NAME = "to-connector-name";
   static final String FROM_CONFIG_VALUES = "from-config-values";
@@ -137,8 +137,8 @@ public class JobBean implements JsonBean {
     object.put(FROM_CONNECTOR_NAME, job.getFromConnectorName());
     object.put(TO_CONNECTOR_NAME, job.getToConnectorName());
     // job associated links
-    object.put(FROM_LINK_ID, job.getFromLinkId());
-    object.put(TO_LINK_ID, job.getToLinkId());
+    object.put(FROM_LINK_NAME, job.getFromLinkName());
+    object.put(TO_LINK_NAME, job.getToLinkName());
     // job configs
     MFromConfig fromConfigList = job.getFromJobConfig();
     object.put(FROM_CONFIG_VALUES, extractConfigList(fromConfigList, skipSensitive));
@@ -170,8 +170,8 @@ public class JobBean implements JsonBean {
     JSONObject object = (JSONObject) obj;
     String fromConnectorName = JSONUtils.getString(object, FROM_CONNECTOR_NAME);
     String toConnectorName = JSONUtils.getString(object, TO_CONNECTOR_NAME);
-    long fromConnectionId = JSONUtils.getLong(object, FROM_LINK_ID);
-    long toConnectionId = JSONUtils.getLong(object, TO_LINK_ID);
+    String fromLinkName = JSONUtils.getString(object, FROM_LINK_NAME);
+    String toLinkName = JSONUtils.getString(object, TO_LINK_NAME);
     JSONObject fromConfigJson = JSONUtils.getJSONObject(object, FROM_CONFIG_VALUES);
     JSONObject toConfigJson = JSONUtils.getJSONObject(object, TO_CONFIG_VALUES);
     JSONObject driverConfigJson = JSONUtils.getJSONObject(object, DRIVER_CONFIG_VALUES);
@@ -188,8 +188,8 @@ public class JobBean implements JsonBean {
     MJob job = new MJob(
       fromConnectorName,
       toConnectorName,
-      fromConnectionId,
-      toConnectionId,
+      fromLinkName,
+      toLinkName,
       new MFromConfig(fromConfigs, fromValidators),
       new MToConfig(toConfigs, toValidators),
       new MDriverConfig(driverConfigs, driverValidators)

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/common/src/main/java/org/apache/sqoop/model/MJob.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MJob.java b/common/src/main/java/org/apache/sqoop/model/MJob.java
index 59bc646..71fc357 100644
--- a/common/src/main/java/org/apache/sqoop/model/MJob.java
+++ b/common/src/main/java/org/apache/sqoop/model/MJob.java
@@ -37,9 +37,8 @@ public class MJob extends MAccountableEntity implements MClonable {
    */
   private final String fromConnectorName;
   private final String toConnectorName;
-  private final long fromLinkId;
-  private final long toLinkId;
-
+  private final String fromLinkName;
+  private final String toLinkName;
   private final MFromConfig fromConfig;
   private final MToConfig toConfig;
   private final MDriverConfig driverConfig;
@@ -49,23 +48,23 @@ public class MJob extends MAccountableEntity implements MClonable {
    *
    * @param fromConnectorId FROM Connector id
    * @param toConnectorId TO Connector id
-   * @param fromLinkId FROM Link id
-   * @param toLinkId TO Link id
+   * @param fromLinkName FROM Link name
+   * @param toLinkName TO Link name
    * @param fromConfig FROM job config
    * @param toConfig TO job config
    * @param driverConfig driver config
    */
   public MJob(String fromConnectorName,
               String toConnectorName,
-              long fromLinkId,
-              long toLinkId,
+              String fromLinkName,
+              String toLinkName,
               MFromConfig fromConfig,
               MToConfig toConfig,
               MDriverConfig driverConfig) {
     this.fromConnectorName = fromConnectorName;
     this.toConnectorName = toConnectorName;
-    this.fromLinkId = fromLinkId;
-    this.toLinkId = toLinkId;
+    this.fromLinkName = fromLinkName;
+    this.toLinkName = toLinkName;
     this.fromConfig = fromConfig;
     this.toConfig = toConfig;
     this.driverConfig = driverConfig;
@@ -99,8 +98,8 @@ public class MJob extends MAccountableEntity implements MClonable {
 
     this.fromConnectorName = other.getFromConnectorName();
     this.toConnectorName = other.getToConnectorName();
-    this.fromLinkId = other.getFromLinkId();
-    this.toLinkId = other.getToLinkId();
+    this.fromLinkName = other.getFromLinkName();
+    this.toLinkName = other.getToLinkName();
     this.fromConfig = fromConfig;
     this.toConfig = toConfig;
     this.driverConfig = driverConfig;
@@ -117,12 +116,12 @@ public class MJob extends MAccountableEntity implements MClonable {
     return sb.toString();
   }
 
-  public long getFromLinkId() {
-    return fromLinkId;
+  public String getFromLinkName() {
+    return fromLinkName;
   }
 
-  public long getToLinkId() {
-    return toLinkId;
+  public String getToLinkName() {
+    return toLinkName;
   }
 
   public String getFromConnectorName() {
@@ -153,8 +152,8 @@ public class MJob extends MAccountableEntity implements MClonable {
       return new MJob(
           getFromConnectorName(),
           getToConnectorName(),
-          getFromLinkId(),
-          getToLinkId(),
+          getFromLinkName(),
+          getToLinkName(),
           getFromJobConfig().clone(false),
           getToJobConfig().clone(false),
           getDriverConfig().clone(false));
@@ -174,8 +173,8 @@ public class MJob extends MAccountableEntity implements MClonable {
     MJob job = (MJob)object;
     return (job.getFromConnectorName().equals(this.getFromConnectorName()))
         && (job.getToConnectorName().equals(this.getToConnectorName()))
-        && (job.getFromLinkId() == this.getFromLinkId())
-        && (job.getToLinkId() == this.getToLinkId())
+        && (job.getFromLinkName().equals(this.getFromLinkName()))
+        && (job.getToLinkName().equals(this.getToLinkName()))
         && (job.getPersistenceId() == this.getPersistenceId())
         && (job.getFromJobConfig().equals(this.getFromJobConfig()))
         && (job.getToJobConfig().equals(this.getToJobConfig()))
@@ -186,8 +185,8 @@ public class MJob extends MAccountableEntity implements MClonable {
   public int hashCode() {
     int result = fromConnectorName != null ? fromConnectorName.hashCode() : 0;
     result = 31 * result + (toConnectorName != null ? toConnectorName.hashCode() : 0);
-    result = 31 * result + (int) (fromLinkId ^ (fromLinkId >>> 32));
-    result = 31 * result + (int) (toLinkId ^ (toLinkId >>> 32));
+    result = 31 * result + (fromLinkName != null ? fromLinkName.hashCode() : 0);
+    result = 31 * result + (toLinkName != null ? toLinkName.hashCode() : 0);
     result = 31 * result + (fromConfig != null ? fromConfig.hashCode() : 0);
     result = 31 * result + (toConfig != null ? toConfig.hashCode() : 0);
     result = 31 * result + (driverConfig != null ? driverConfig.hashCode() : 0);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
index 0e8933e..c193096 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
@@ -61,8 +61,8 @@ public class TestJobBean {
     assertEquals(22L, target.getPersistenceId());
     assertEquals("The big Job", target.getName());
 
-    assertEquals(target.getFromLinkId(), 1);
-    assertEquals(target.getToLinkId(), 2);
+    assertEquals(target.getFromLinkName(), "fromLinkName");
+    assertEquals(target.getToLinkName(), "toLinkName");
     assertEquals(target.getFromConnectorName(), "from_ahoj");
     assertEquals(target.getToConnectorName(), "to_ahoj");
     assertEquals(created, target.getCreationDate());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/common/src/test/java/org/apache/sqoop/json/TestJobsBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestJobsBean.java b/common/src/test/java/org/apache/sqoop/json/TestJobsBean.java
index 2849497..e9c969b 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestJobsBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestJobsBean.java
@@ -72,8 +72,8 @@ public class TestJobsBean {
     assertEquals(44L, retrievedJob2.getPersistenceId());
     assertEquals("The small Job", retrievedJob2.getName());
 
-    assertEquals(retrievedJob1.getFromLinkId(), 1);
-    assertEquals(retrievedJob1.getToLinkId(), 2);
+    assertEquals(retrievedJob1.getFromLinkName(), "fromLinkName");
+    assertEquals(retrievedJob1.getToLinkName(), "toLinkName");
     assertEquals(retrievedJob1.getFromConnectorName(), "from_ahoj");
     assertEquals(retrievedJob1.getToConnectorName(), "to_ahoj");
     assertEquals(created, retrievedJob1.getCreationDate());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/common/src/test/java/org/apache/sqoop/json/util/BeanTestUtil.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/util/BeanTestUtil.java b/common/src/test/java/org/apache/sqoop/json/util/BeanTestUtil.java
index 90435c6..1d4bc05 100644
--- a/common/src/test/java/org/apache/sqoop/json/util/BeanTestUtil.java
+++ b/common/src/test/java/org/apache/sqoop/json/util/BeanTestUtil.java
@@ -79,7 +79,7 @@ public class BeanTestUtil {
   public static MJob getJob(String connectorName) {
     String fromConnectorName = "from_" + connectorName;
     String toConnectorName = "to_" + connectorName;
-    return new MJob(fromConnectorName, toConnectorName, 1, 2, getConnector(1L, fromConnectorName).getFromConfig(),
+    return new MJob(fromConnectorName, toConnectorName, "fromLinkName", "toLinkName", getConnector(1L, fromConnectorName).getFromConfig(),
             getConnector(2L, toConnectorName).getToConfig(), ConfigTestUtil.getDriverConfig());
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/common/src/test/java/org/apache/sqoop/model/TestMJob.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMJob.java b/common/src/test/java/org/apache/sqoop/model/TestMJob.java
index 7d1c2c1..1f0f018 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMJob.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMJob.java
@@ -98,7 +98,8 @@ public class TestMJob {
         .getConfig("CONFIGFROMNAME").getInput("STRING-INPUT").getValue());  }
 
   private MJob job() {
-    MJob job = new MJob("fromConnectorName", "toConnectorName", 1L, 2L, fromConfig(), toConfig(), driverConfig());
+    MJob job = new MJob("fromConnectorName", "toConnectorName", "fromLinkName", "toLinkName",
+            fromConfig(), toConfig(), driverConfig());
     job.setName("Vampire");
     job.setCreationUser("Buffy");
     return job;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/core/src/main/java/org/apache/sqoop/driver/JobManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/driver/JobManager.java b/core/src/main/java/org/apache/sqoop/driver/JobManager.java
index 021aafe..4f4b9d3 100644
--- a/core/src/main/java/org/apache/sqoop/driver/JobManager.java
+++ b/core/src/main/java/org/apache/sqoop/driver/JobManager.java
@@ -339,8 +339,8 @@ public class JobManager implements Reconfigurable {
 
   private JobRequest createJobRequest(MSubmission submission, MJob job) {
     // get from/to connections for the job
-    MLink fromLink = getLink(job.getFromLinkId());
-    MLink toLink = getLink(job.getToLinkId());
+    MLink fromLink = getLink(job.getFromLinkName());
+    MLink toLink = getLink(job.getToLinkName());
 
     // get from/to connectors for the connection
     SqoopConnector fromConnector = getSqoopConnector(fromLink.getConnectorName());
@@ -486,9 +486,9 @@ public class JobManager implements Reconfigurable {
     }
   }
 
-  MLink getLink(long linkId) {
+  MLink getLink(String linkName) {
     MLink link = RepositoryManager.getInstance().getRepository()
-        .findLink(linkId);
+        .findLink(linkName);
     if (!link.getEnabled()) {
       throw new SqoopException(DriverError.DRIVER_0010, "Connection: "
           + link.getName());
@@ -585,8 +585,8 @@ public class JobManager implements Reconfigurable {
       SqoopConnector fromConnector = getSqoopConnector(job.getFromConnectorName());
       SqoopConnector toConnector = getSqoopConnector(job.getToConnectorName());
 
-      MLink fromConnection = getLink(job.getFromLinkId());
-      MLink toConnection = getLink(job.getToLinkId());
+      MLink fromConnection = getLink(job.getFromLinkName());
+      MLink toConnection = getLink(job.getToLinkName());
 
       Object fromLinkConfig = ClassUtils.instantiate(fromConnector.getLinkConfigurationClass());
       ConfigUtils.fromConfigs(fromConnection.getConnectorLinkConfig().getConfigs(), fromLinkConfig);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
index ef4d359..8da759e 100644
--- a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
+++ b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
@@ -109,19 +109,19 @@ public class TestJobManager {
 
   @Test
   public void testGetLink() {
-    MLink testLink = new MLink("connector_test", null);
+    MLink testLink = new MLink("linkName", null);
     testLink.setEnabled(true);
     MLink mConnectionSpy = org.mockito.Mockito.spy(testLink);
     when(repositoryManagerMock.getRepository()).thenReturn(jdbcRepoMock);
-    when(jdbcRepoMock.findLink(123l)).thenReturn(mConnectionSpy);
-    assertEquals(jobManager.getLink(123l), mConnectionSpy);
+    when(jdbcRepoMock.findLink("linkName")).thenReturn(mConnectionSpy);
+    assertEquals(jobManager.getLink("linkName"), mConnectionSpy);
     verify(repositoryManagerMock, times(1)).getRepository();
-    verify(jdbcRepoMock, times(1)).findLink(123l);
+    verify(jdbcRepoMock, times(1)).findLink("linkName");
   }
 
   @Test
   public void testDisabledLink() {
-    MLink testConnection = new MLink("connector_test", null);
+    MLink testConnection = new MLink("linkName", null);
     testConnection.setPersistenceId(1234);
     testConnection.setEnabled(false);
     SqoopException exception = new SqoopException(DriverError.DRIVER_0010, "Connection: "
@@ -129,13 +129,13 @@ public class TestJobManager {
 
     MLink mConnectionSpy = org.mockito.Mockito.spy(testConnection);
     when(repositoryManagerMock.getRepository()).thenReturn(jdbcRepoMock);
-    when(jdbcRepoMock.findLink(123l)).thenReturn(mConnectionSpy);
+    when(jdbcRepoMock.findLink("linkName")).thenReturn(mConnectionSpy);
     try {
-      jobManager.getLink(123l);
+      jobManager.getLink("linkName");
     } catch (SqoopException ex) {
       assertEquals(ex.getMessage(), exception.getMessage());
       verify(repositoryManagerMock, times(1)).getRepository();
-      verify(jdbcRepoMock, times(1)).findLink(123l);
+      verify(jdbcRepoMock, times(1)).findLink("linkName");
     }
   }
 
@@ -188,7 +188,7 @@ public class TestJobManager {
   }
 
   private MJob job(String jobName, String fromConnectorName, String toConnectorName) {
-    MJob job = new MJob(fromConnectorName, toConnectorName, 1L, 2L, null, null, null);
+    MJob job = new MJob(fromConnectorName, toConnectorName, "fromLinkName", "toLinkName", null, null, null);
     job.setName(jobName);
     job.setCreationUser("Buffy");
     return job;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
index 04c88c6..0ffc645 100644
--- a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
+++ b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
@@ -229,7 +229,8 @@ public class TestJdbcRepository {
     // prepare the links and jobs
     // the connector Id for both are the same
     List<MLink> linkList = links(link(1, "LA", oldConnector.getUniqueName()), link(2, "LB", oldConnector.getUniqueName()));
-    List<MJob> jobList = jobs(job(1, "JA", "A1", "A1", 1, 1), job(2, "JB", "A1", "A1", 2, 2));
+    List<MJob> jobList = jobs(job(1, "JA", "A1", "A1", "linkName1", "linkName1"),
+            job(2, "JB", "A1", "A1", "linkName2", "linkName2"));
 
     // mock necessary methods for upgradeConnector() procedure
     doReturn(linkList).when(repoSpy).findLinksForConnectorUpgrade(anyString());
@@ -277,7 +278,8 @@ public class TestJdbcRepository {
 
     when(driverMock.getConfigurableUpgrader(DriverBean.CURRENT_DRIVER_VERSION)).thenReturn(driverUpgraderMock);
     when(driverMock.getDriverJobConfigurationClass()).thenReturn(ValidConfiguration.class);
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
 
     doReturn(jobList).when(repoSpy).findJobs();
     doNothing().when(repoSpy).updateLink(any(MLink.class), any(RepositoryTransaction.class));
@@ -315,7 +317,8 @@ public class TestJdbcRepository {
 
     when(driverMock.getConfigurableUpgrader(DriverBean.CURRENT_DRIVER_VERSION)).thenReturn(driverUpgraderMock);
     when(driverMock.getDriverJobConfigurationClass()).thenReturn(InvalidConfiguration.class);
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
 
     doReturn(jobList).when(repoSpy).findJobs();
     doNothing().when(repoSpy).updateJob(any(MJob.class), any(RepositoryTransaction.class));
@@ -425,7 +428,8 @@ public class TestJdbcRepository {
     when(connectorMgrMock.getSqoopConnector(anyString())).thenReturn(sqconnector);
 
     List<MLink> linkList = links(link(1, "LA", oldConnector.getUniqueName()), link(2, "LB", oldConnector.getUniqueName()));
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
     doReturn(linkList).when(repoHandlerMock).findLinksForConnectorUpgrade(anyString(), any(Connection.class));
     doReturn(jobList).when(repoHandlerMock).findJobsForConnectorUpgrade
       (anyLong(), any(Connection.class));
@@ -463,7 +467,8 @@ public class TestJdbcRepository {
     when(connectorMgrMock.getSqoopConnector(anyString())).thenReturn(sqconnector);
 
     List<MLink> linkList = links(link(1, "LA", oldConnector.getUniqueName()), link(2, "LB", oldConnector.getUniqueName()));
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
     doReturn(linkList).when(repoHandlerMock).findLinksForConnectorUpgrade(anyString(), any(Connection.class));
     doReturn(jobList).when(repoHandlerMock).findJobsForConnectorUpgrade(anyLong(), any(Connection.class));
     doNothing().when(repoHandlerMock).deleteJobInputs(anyString(), any(Connection.class));
@@ -501,7 +506,8 @@ public class TestJdbcRepository {
     when(connectorMgrMock.getSqoopConnector(anyString())).thenReturn(sqconnector);
 
     List<MLink> linkList = links(link(1, "LA", oldConnector.getUniqueName()), link(2, "LB", oldConnector.getUniqueName()));
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
     doReturn(linkList).when(repoHandlerMock).findLinksForConnectorUpgrade(anyString(), any(Connection.class));
     doReturn(jobList).when(repoHandlerMock).findJobsForConnectorUpgrade(anyLong(), any(Connection.class));
     doNothing().when(repoHandlerMock).deleteJobInputs(anyString(), any(Connection.class));
@@ -543,7 +549,8 @@ public class TestJdbcRepository {
     when(connectorMgrMock.getSqoopConnector(anyString())).thenReturn(sqconnector);
 
     List<MLink> linkList = links(link(1, "LA", oldConnector.getUniqueName()), link(2, "LB", oldConnector.getUniqueName()));
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
     doReturn(linkList).when(repoHandlerMock).findLinksForConnectorUpgrade(anyString(), any(Connection.class));
     doReturn(jobList).when(repoHandlerMock).findJobsForConnectorUpgrade(anyLong(), any(Connection.class));
     doNothing().when(repoHandlerMock).deleteJobInputs(anyString(), any(Connection.class));
@@ -589,7 +596,8 @@ public class TestJdbcRepository {
     when(connectorMgrMock.getSqoopConnector(anyString())).thenReturn(sqconnector);
 
     List<MLink> linkList = links(link(1, "LA", oldConnector.getUniqueName()), link(2, "LB", oldConnector.getUniqueName()));;
-    List<MJob> jobList = jobs(job(1, "JA", "A1", "A1", 1, 1), job(2, "JB", "A1", "A1", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "A1", "A1", "linkName1", "linkName1"),
+            job(2, "JB", "A1", "A1", "linkName2", "linkName1"));
     doReturn(linkList).when(repoHandlerMock).findLinksForConnectorUpgrade(anyString(), any(Connection.class));
     doReturn(jobList).when(repoHandlerMock).findJobsForConnectorUpgrade(anyLong(), any(Connection.class));
     doNothing().when(repoHandlerMock).deleteJobInputs(anyString(), any(Connection.class));
@@ -659,7 +667,8 @@ public class TestJdbcRepository {
 
     when(driverMock.getConfigurableUpgrader(DriverBean.CURRENT_DRIVER_VERSION)).thenReturn(driverUpgraderMock);
 
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
     doReturn(jobList).when(repoHandlerMock).findJobs(any(Connection.class));
 
     SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
@@ -689,7 +698,8 @@ public class TestJdbcRepository {
 
     when(driverMock.getConfigurableUpgrader(DriverBean.CURRENT_DRIVER_VERSION)).thenReturn(driverUpgraderMock);
 
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
     doReturn(jobList).when(repoHandlerMock).findJobs(any(Connection.class));
     doNothing().when(repoHandlerMock).deleteJobInputs(anyString(), any(Connection.class));
     doNothing().when(repoHandlerMock).deleteLinkInputs(anyString(), any(Connection.class));
@@ -723,7 +733,8 @@ public class TestJdbcRepository {
 
     when(driverMock.getConfigurableUpgrader(DriverBean.CURRENT_DRIVER_VERSION)).thenReturn(driverUpgraderMock);
     when(driverMock.getDriverJobConfigurationClass()).thenReturn(ValidConfiguration.class);
-    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", 1, 1), job(2, "JB", "fromConnectorName", "toConnectorName", 2, 1));
+    List<MJob> jobList = jobs(job(1, "JA", "fromConnectorName", "toConnectorName", "linkName1", "linkName1"),
+            job(2, "JB", "fromConnectorName", "toConnectorName", "linkName2", "linkName1"));
     doReturn(jobList).when(repoHandlerMock).findJobs(any(Connection.class));
     doNothing().when(repoHandlerMock).deleteJobInputs(anyString(), any(Connection.class));
     doNothing().when(repoHandlerMock).upgradeDriverAndConfigs(any(MDriver.class), any(Connection.class));
@@ -782,8 +793,9 @@ public class TestJdbcRepository {
     return link;
   }
 
-  private MJob job(long id, String jobName, String fromConnectorName, String toConnectorName, long fromLinkId, long toLinkId) {
-    MJob job = new MJob(fromConnectorName, toConnectorName, fromLinkId, toLinkId,
+  private MJob job(long id, String jobName, String fromConnectorName, String toConnectorName,
+                   String fromLinkName, String toLinkName) {
+    MJob job = new MJob(fromConnectorName, toConnectorName, fromLinkName, toLinkName,
         new MFromConfig(new LinkedList<MConfig>(), new LinkedList<MValidator>()),
         new MToConfig(new LinkedList<MConfig>(), new LinkedList<MValidator>()),
         new MDriverConfig(new LinkedList<MConfig>(), new LinkedList<MValidator>()));

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java
----------------------------------------------------------------------
diff --git a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java
index 7db8718..13d8242 100644
--- a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java
+++ b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryHandler.java
@@ -624,15 +624,34 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
     }
   }
 
+  public Long findLinkIdByName(String linkName, Connection conn) {
+    try (PreparedStatement stmt = conn.prepareStatement(crudQueries.getStmtSelectLinkIdByName())) {
+      stmt.setString(1,linkName);
+      try (ResultSet rs = stmt.executeQuery()) {
+        if (rs.next()) {
+          return rs.getLong(1);
+        } else {
+          throw new SqoopException(CommonRepositoryError.COMMON_0020);
+        }
+      }
+    } catch (SQLException ex) {
+      logException(ex);
+      throw new SqoopException(CommonRepositoryError.COMMON_0036, ex);
+    }
+  }
+
   /**
    * {@inheritDoc}
    */
   public void createJob(MJob job, Connection conn) {
     int result;
+    // get link id to create job
+    Long fromLinkId = findLinkIdByName(job.getFromLinkName(), conn);
+    Long toLinkId = findLinkIdByName(job.getToLinkName(), conn);
     try (PreparedStatement stmt = conn.prepareStatement(crudQueries.getStmtInsertJob(), Statement.RETURN_GENERATED_KEYS)) {
       stmt.setString(1, job.getName());
-      stmt.setLong(2, job.getFromLinkId());
-      stmt.setLong(3, job.getToLinkId());
+      stmt.setLong(2, fromLinkId);
+      stmt.setLong(3, toLinkId);
       stmt.setBoolean(4, job.getEnabled());
       stmt.setString(5, job.getCreationUser());
       stmt.setTimestamp(6, new Timestamp(job.getCreationDate().getTime()));
@@ -1615,8 +1634,6 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
         long toConnectorId = rsJob.getLong(2);
         long id = rsJob.getLong(3);
         String name = rsJob.getString(4);
-        long fromLinkId = rsJob.getLong(5);
-        long toLinkId = rsJob.getLong(6);
         boolean enabled = rsJob.getBoolean(7);
         String createBy = rsJob.getString(8);
         Date creationDate = rsJob.getTimestamp(9);
@@ -1624,6 +1641,8 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
         Date lastUpdateDate = rsJob.getTimestamp(11);
         String fromConnectorName = rsJob.getString(12);
         String toConnectorName = rsJob.getString(13);
+        String fromLinkName = rsJob.getString(14);
+        String toLinkName = rsJob.getString(15);
 
         fromConfigFetchStmt.setLong(1, fromConnectorId);
         toConfigFetchStmt.setLong(1,toConnectorId);
@@ -1653,7 +1672,7 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
 
         MJob job = new MJob(
             fromConnectorName, toConnectorName,
-            fromLinkId, toLinkId,
+                fromLinkName, toLinkName,
             new MFromConfig(fromConnectorFromJobConfig, Collections.EMPTY_LIST),
             new MToConfig(toConnectorToJobConfig, Collections.EMPTY_LIST),
             new MDriverConfig(driverConfig, Collections.EMPTY_LIST));
@@ -1706,7 +1725,8 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
         Date lastUpdateDate = rsJob.getTimestamp(11);
         String fromConnectorName = rsJob.getString(12);
         String toConnectorName = rsJob.getString(13);
-
+        String fromLinkName = rsJob.getString(14);
+        String toLinkName = rsJob.getString(15);
 
         driverConfigfetchStmt.setLong(1, driverId);
         jobInputFetchStmt.setLong(1, id);
@@ -1728,7 +1748,7 @@ public abstract class CommonRepositoryHandler extends JdbcRepositoryHandler {
 
         MJob job = new MJob(
           fromConnectorName, toConnectorName,
-          fromLinkId, toLinkId,
+          fromLinkName, toLinkName,
           new MFromConfig(mFromConfig.getConfigs(), Collections.EMPTY_LIST),
           new MToConfig(mToConfig.getConfigs(), Collections.EMPTY_LIST),
           new MDriverConfig(driverConfig, Collections.EMPTY_LIST));

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
----------------------------------------------------------------------
diff --git a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
index d1c3feb..fa5a1c1 100644
--- a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
+++ b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
@@ -335,6 +335,13 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
       STMT_SELECT_LINK_ALL
           + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + " = ?";
 
+  // DML Select link id by name
+  private static final String STMT_SELECT_LINK_ID_BY_NAME =
+      "SELECT "
+          + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID)
+          + " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_NAME)
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + " = ?";
+
   // DML: Select all links for a specific connector.
   private static final String STMT_SELECT_LINK_FOR_CONNECTOR_CONFIGURABLE =
       "SELECT "
@@ -442,7 +449,9 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
           + "JOB." + CommonRepoUtils.escapeColumnName(COLUMN_SQB_UPDATE_USER) + ", "
           + "JOB." + CommonRepoUtils.escapeColumnName(COLUMN_SQB_UPDATE_DATE) + ", "
           + "FROM_CONF_NAME." + CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME) + ", "
-          + "TO_CONF_NAME." + CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME)
+          + "TO_CONF_NAME." + CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME) + ", "
+          + "FROM_CONNECTOR." + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + ", "
+          + "TO_CONNECTOR." + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME)
           + " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_JOB_NAME) + " JOB"
           + " LEFT JOIN " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, TABLE_SQ_LINK_NAME) + " FROM_CONNECTOR"
           + " ON " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_FROM_LINK) + " = FROM_CONNECTOR." + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID)
@@ -800,6 +809,8 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
     return STMT_SELECT_LINK_SINGLE_BY_NAME;
   }
 
+  public String getStmtSelectLinkIdByName() {return STMT_SELECT_LINK_ID_BY_NAME;}
+
   public String getStmtSelectLinkAll() {
     return STMT_SELECT_LINK_ALL;
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
index acacaa9..ad8946b 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
@@ -343,7 +343,7 @@ public class TestJobHandling extends DerbyTestCase {
   }
 
   public MJob getJob() {
-    return new MJob("A", "A", 1, 1, handler.findConnector("A", derbyConnection).getFromConfig(),
+    return new MJob("A", "A", "CA", "CA", handler.findConnector("A", derbyConnection).getFromConfig(),
         handler.findConnector("A", derbyConnection).getToConfig(), handler.findDriver(
             MDriver.DRIVER_NAME, derbyConnection).getDriverConfig());
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/MySqlTestCase.java
----------------------------------------------------------------------
diff --git a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/MySqlTestCase.java b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/MySqlTestCase.java
index 90fffae..ede930f 100644
--- a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/MySqlTestCase.java
+++ b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/MySqlTestCase.java
@@ -106,8 +106,8 @@ abstract public class MySqlTestCase {
     MDriver driver = handler.findDriver(MDriver.DRIVER_NAME,
         provider.getConnection());
     MJob job = new MJob(connectorA.getUniqueName(),
-        connectorB.getUniqueName(), linkA.getPersistenceId(),
-        linkB.getPersistenceId(), connectorA.getFromConfig(),
+        connectorB.getUniqueName(), linkA.getName(),
+        linkB.getName(), connectorA.getFromConfig(),
         connectorB.getToConfig(), driver.getDriverConfig());
     job.setName(name);
     fillJob(job);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java
----------------------------------------------------------------------
diff --git a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java
index dae3760..1bab548 100644
--- a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java
+++ b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java
@@ -94,8 +94,8 @@ abstract public class PostgresqlTestCase {
     MJob job = new MJob(
         connectorA.getUniqueName(),
         connectorB.getUniqueName(),
-        linkA.getPersistenceId(),
-        linkB.getPersistenceId(),
+        linkA.getName(),
+        linkB.getName(),
         connectorA.getFromConfig(),
         connectorB.getToConfig(),
         driver.getDriverConfig());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
index ad67a23..c70f457 100644
--- a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
@@ -179,14 +179,13 @@ public class JobRequestHandler implements RequestHandler {
 
     // Job object
     MJob postedJob = jobs.get(0);
-    MLink fromLink = HandlerUtils.getLinkFromLinkId(postedJob.getFromLinkId());
-    MLink toLink = HandlerUtils.getLinkFromLinkId(postedJob.getToLinkId());
 
     // Authorization check
     if (create) {
-      AuthorizationEngine.createJob(ctx.getUserName(), fromLink.getName(), toLink.getName());
+      AuthorizationEngine.createJob(ctx.getUserName(), postedJob.getFromLinkName(), postedJob.getToLinkName());
     } else {
-      AuthorizationEngine.updateJob(ctx.getUserName(), fromLink.getName(), toLink.getName(), postedJob.getName());
+      AuthorizationEngine.updateJob(ctx.getUserName(), postedJob.getFromLinkName(), postedJob.getToLinkName(),
+              postedJob.getName());
     }
 
     // Verify that user is not trying to spoof us

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/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 e36a903..600de8b 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
@@ -92,22 +92,9 @@ public class ShowJobFunction extends SqoopFunction {
     for(MJob job : jobs) {
       ids.add(String.valueOf(job.getPersistenceId()));
       names.add(job.getName());
-
       // From link and connnector
-      String fromLinkName = "";
-      MLink fromLink = client.getLink(job.getFromLinkId());
-      if (fromLink != null) {
-        fromLinkName = fromLink.getName();
-      }
-      fromConnectors.add(fromLinkName + " (" + job.getFromConnectorName() + ")");
-
-      // To link and connector
-      String toLinkName = "";
-      MLink toLink = client.getLink(job.getToLinkId());
-      if (toLink != null) {
-        toLinkName = toLink.getName();
-      }
-      toConnectors.add(toLinkName + " (" + job.getToConnectorName() + ")");
+      fromConnectors.add(job.getFromLinkName() + " (" + job.getFromConnectorName() + ")");
+      toConnectors.add(job.getToLinkName() + " (" + job.getToConnectorName() + ")");
 
       availabilities.add(String.valueOf(job.getEnabled()));
     }
@@ -153,11 +140,11 @@ public class ShowJobFunction extends SqoopFunction {
     displayConfig(job.getDriverConfig().getConfigs(),
             client.getDriverConfigBundle());
     printlnResource(Constants.RES_SHOW_PROMPT_JOB_FROM_LID_INFO,
-        job.getFromLinkId());
+        job.getFromLinkName());
     displayConfig(job.getFromJobConfig().getConfigs(),
                  client.getConnectorConfigBundle(job.getFromConnectorName()));
     printlnResource(Constants.RES_SHOW_PROMPT_JOB_TO_LID_INFO,
-            job.getToLinkId());
+            job.getToLinkName());
     displayConfig(job.getToJobConfig().getConfigs(),
                  client.getConnectorConfigBundle(job.getToConnectorName()));
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/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 4cb855b..89f9fbb 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
@@ -155,7 +155,7 @@ public class TestCloneCommand {
   @Test
   public void testCloneJob() {
     ShellEnvironment.setInteractive(false);
-    MJob job = new MJob("fromConnectorName", "toConnectorName", 1L, 2L,
+    MJob job = 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>()));
@@ -192,7 +192,8 @@ public class TestCloneCommand {
   public void testCloneJobInteractive() {
     ShellEnvironment.setInteractive(true);
     initEnv();
-    MJob job = new MJob("fromConnectorName", "toConnectorName", 1, 2, new MFromConfig(getConfig("fromJobConfig"), new ArrayList<MValidator>()),
+    MJob job = new MJob("fromConnectorName", "toConnectorName", "linkName1", "linkName2",
+        new MFromConfig(getConfig("fromJobConfig"), new ArrayList<MValidator>()),
         new MToConfig(getConfig("toJobConfig"), new ArrayList<MValidator>()),
         new MDriverConfig(getConfig("driverConfig"), new ArrayList<MValidator>()));
     when(client.getJob("job_test")).thenReturn(job);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/shell/src/test/java/org/apache/sqoop/shell/TestCreateCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestCreateCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestCreateCommand.java
index f2e8fc0..11c670b 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestCreateCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestCreateCommand.java
@@ -182,7 +182,8 @@ public class TestCreateCommand {
     MConnector fromConnector = new MConnector("connector_from", "", "", null, new MFromConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()), null);
     MConnector toConnector = new MConnector("connector_to", "", "", null, null, new MToConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()));
     when(client.createJob("link_from", "link_to")).thenReturn(
-        new MJob("fromConnectorName", "toConnectorName", 1, 2, new MFromConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),
+            new MJob("fromConnectorName", "toConnectorName", "link_from", "link_to",
+            new MFromConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),
             new MToConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),
             new MDriverConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>())));
     when(client.getConnector("fromConnectorName")).thenReturn(fromConnector);
@@ -222,7 +223,8 @@ public class TestCreateCommand {
     initEnv();
     MConnector fromConnector = new MConnector("connector_from", "", "", null, new MFromConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()), null);
     MConnector toConnector = new MConnector("connector_to", "", "", null, null, new MToConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()));
-    MJob job = new MJob("fromConnectorName", "toConnectorName", 1, 2, new MFromConfig(getConfig("fromJobConfig"), new ArrayList<MValidator>()),
+    MJob job = new MJob("fromConnectorName", "toConnectorName", "link_from", "link_to",
+        new MFromConfig(getConfig("fromJobConfig"), new ArrayList<MValidator>()),
         new MToConfig(getConfig("toJobConfig"), new ArrayList<MValidator>()),
         new MDriverConfig(getConfig("driverConfig"), new ArrayList<MValidator>()));
     when(client.createJob("link_from", "link_to")).thenReturn(job);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/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 c7b57af..37c7cf6 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
@@ -235,12 +235,12 @@ 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", 1L, 2L,
+    when(client.getJob("1")).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>())));
-    when(client.getJobsByConnector("2")).thenReturn(Arrays.asList(new MJob("fromConnectorName", "toConnectorName", 1L, 2L,
-        new MFromConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),
+    when(client.getJobsByConnector("2")).thenReturn(Arrays.asList(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>()))));
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/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 d9f8c46..bb6b321 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
@@ -173,7 +173,7 @@ public class TestUpdateCommand {
   @Test
   public void testUpdateJob() throws InterruptedException {
     ShellEnvironment.setInteractive(false);
-    MJob job = new MJob("fromConnectorName", "toConnectorName", 1L, 2L,
+    MJob job = new MJob("fromConnectorName", "toConnectorName", "link_from", "link_to",
         new MFromConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),
         new MToConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),
         new MDriverConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()));
@@ -210,7 +210,8 @@ public class TestUpdateCommand {
   public void testUpdateJobInteractive() {
     ShellEnvironment.setInteractive(true);
     initEnv();
-    MJob job = new MJob("fromConnectorName", "toConnectorName", 1, 2, new MFromConfig(getConfig("fromJobConfig"), new ArrayList<MValidator>()),
+    MJob job = new MJob("fromConnectorName", "toConnectorName", "link_from", "link_to",
+        new MFromConfig(getConfig("fromJobConfig"), new ArrayList<MValidator>()),
         new MToConfig(getConfig("toJobConfig"), new ArrayList<MValidator>()),
         new MDriverConfig(getConfig("driverConfig"), new ArrayList<MValidator>()));
     when(client.getJob("job_test")).thenReturn(job);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3f5b33d0/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java b/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java
index 8b57d75..66c20a1 100644
--- a/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java
@@ -66,7 +66,9 @@ public class BlacklistedConnectorTest extends ConnectorTestCase {
 
   @AfterMethod
   public void stopCluster() throws Exception {
-    getCluster().stop();
+    if (getCluster() != null) {
+      getCluster().stop();
+    }
   }
 
   @Override


Mime
View raw message