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: Revert "SQOOP-2740: Sqoop2: Use name instead of id for ValidationResultBean"
Date Thu, 17 Dec 2015 05:45:45 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 2fe4ff536 -> 733da6bc4


Revert "SQOOP-2740: Sqoop2: Use name instead of id for ValidationResultBean"

This reverts commit 060be9049cabc1c42536cd0e6883ce40392546d6.

I've mistakenly committed wrong version of the patch, so I'm reverting it and I'll commit
the right version.


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

Branch: refs/heads/sqoop2
Commit: 9ac461cc4108609ffaacd8a62d8b49f8924bbdb6
Parents: 2fe4ff5
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Thu Dec 17 06:43:30 2015 +0100
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Thu Dec 17 06:43:30 2015 +0100

----------------------------------------------------------------------
 .../org/apache/sqoop/client/SqoopClient.java     | 12 ++++++------
 .../apache/sqoop/json/ValidationResultBean.java  | 19 ++++++++++---------
 .../sqoop/json/TestValidationResultBean.java     | 14 +++++++-------
 .../apache/sqoop/handler/JobRequestHandler.java  |  2 +-
 .../apache/sqoop/handler/LinkRequestHandler.java |  2 +-
 5 files changed, 25 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/9ac461cc/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 bac7fe8..e71d3ef 100644
--- a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
+++ b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
@@ -806,9 +806,9 @@ public class SqoopClient {
     ConfigValidationResult linkConfig = bean.getValidationResults()[0];
     // Apply validation results
     ConfigUtils.applyValidation(link.getConnectorLinkConfig(), linkConfig);
-    String linkName = bean.getName();
-    if (linkName != null) {
-      link.setName(linkName);
+    Long id = bean.getId();
+    if (id != null) {
+      link.setPersistenceId(id);
     }
     return Status.getWorstStatus(linkConfig.getStatus());
   }
@@ -830,9 +830,9 @@ public class SqoopClient {
       driver
     );
 
-    String jobName = bean.getName();
-    if(jobName != null) {
-      job.setName(jobName);
+    Long id = bean.getId();
+    if(id != null) {
+      job.setPersistenceId(id);
     }
 
     return Status.getWorstStatus(fromConfig.getStatus(), toConfig.getStatus(), driver.getStatus());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/9ac461cc/common/src/main/java/org/apache/sqoop/json/ValidationResultBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/ValidationResultBean.java b/common/src/main/java/org/apache/sqoop/json/ValidationResultBean.java
index 09ea847..b328a25 100644
--- a/common/src/main/java/org/apache/sqoop/json/ValidationResultBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ValidationResultBean.java
@@ -38,11 +38,12 @@ import java.util.Set;
 public class ValidationResultBean implements JsonBean {
 
   private static final String VALIDATION_RESULT = "validation-result";
+  private static final String ID = "id";
   private static final String STATUS = "status";
   private static final String MESSAGE = "message";
 
   private ConfigValidationResult[] results;
-  private String name;
+  private Long id;
 
   public ValidationResultBean() {
     // Empty, for restore
@@ -59,12 +60,12 @@ public class ValidationResultBean implements JsonBean {
     return results.clone();
   }
 
-  public String getName() {
-    return name;
+  public void setId(Long id) {
+    this.id = id;
   }
 
-  public void setName(String name) {
-    this.name = name;
+  public Long getId() {
+    return id;
   }
 
   @SuppressWarnings("unchecked")
@@ -79,8 +80,8 @@ public class ValidationResultBean implements JsonBean {
 
     JSONObject object = new JSONObject();
     object.put(VALIDATION_RESULT, array);
-    if(name != null) {
-      object.put(NAME, name);
+    if(id != null) {
+      object.put(ID, id);
     }
     return object;
   }
@@ -123,8 +124,8 @@ public class ValidationResultBean implements JsonBean {
     for(Object item : array) {
       results[i++] = restoreValidationResult((JSONObject) item);
     }
-    if(jsonObject.containsKey(NAME)) {
-      name = JSONUtils.getString(jsonObject, NAME);
+    if(jsonObject.containsKey(ID)) {
+      id = JSONUtils.getLong(jsonObject, ID);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/9ac461cc/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java b/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
index 8b50797..0381c7d 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
@@ -71,11 +71,11 @@ public class TestValidationResultBean {
 
   @Test
   public void testId() {
-    String name = transfer("testName");
-    assertEquals("testName", name);
+    long id = transfer(10L);
+    assertEquals(10L, id);
 
-    String nameNull = transfer((String)null);
-    assertNull(nameNull);
+    Long idNull = transfer((Long)null);
+    assertNull(idNull);
   }
 
   public void verifyResultA(ConfigValidationResult result) {
@@ -107,9 +107,9 @@ public class TestValidationResultBean {
   }
 
 
-  private String transfer(String name) {
+  private Long transfer(Long id) {
     ValidationResultBean bean = new ValidationResultBean(new ConfigValidationResult[0]);
-    bean.setName(name);
+    bean.setId(id);
     JSONObject json = bean.extract(false);
 
     String string = json.toString();
@@ -118,7 +118,7 @@ public class TestValidationResultBean {
     ValidationResultBean retrievedBean = new ValidationResultBean();
     retrievedBean.restore(retrievedJson);
 
-    return retrievedBean.getName();
+    return retrievedBean.getId();
   }
 
   private ConfigValidationResult[] transfer(ConfigValidationResult [] results) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/9ac461cc/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 7fa6a3b..666116e 100644
--- a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
@@ -250,7 +250,7 @@ public class JobRequestHandler implements RequestHandler {
         postedJob.setCreationUser(username);
         postedJob.setLastUpdateUser(username);
         repository.createJob(postedJob);
-        validationResultBean.setName(postedJob.getName());
+        validationResultBean.setId(postedJob.getPersistenceId());
       } else {
         AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
             ctx.getRequest().getRemoteAddr(), "update", "job",

http://git-wip-us.apache.org/repos/asf/sqoop/blob/9ac461cc/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java b/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
index 189293a..cc07fc8 100644
--- a/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
@@ -174,7 +174,7 @@ public class LinkRequestHandler implements RequestHandler {
         postedLink.setCreationUser(username);
         postedLink.setLastUpdateUser(username);
         repository.createLink(postedLink);
-        linkValidationBean.setName(postedLink.getName());
+        linkValidationBean.setId(postedLink.getPersistenceId());
       } else {
         AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
             ctx.getRequest().getRemoteAddr(), "update", "link",


Mime
View raw message