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-2608: Sqoop2: MNamedElement should inherit from MValidatedElement
Date Mon, 12 Oct 2015 18:26:15 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 38de9dde8 -> 3d004facd


SQOOP-2608: Sqoop2: MNamedElement should inherit from MValidatedElement

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

Branch: refs/heads/sqoop2
Commit: 3d004facd871f06da1a9c664d08feaa12d718965
Parents: 38de9dd
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Mon Oct 12 11:25:34 2015 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Mon Oct 12 11:25:34 2015 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/sqoop/client/SqoopClient.java |  8 ++++----
 .../main/java/org/apache/sqoop/model/ConfigUtils.java  | 13 +++++++------
 .../org/apache/sqoop/model/MAccountableEntity.java     |  2 +-
 .../src/main/java/org/apache/sqoop/model/MConfig.java  |  2 +-
 .../main/java/org/apache/sqoop/model/MConfigList.java  |  2 +-
 .../src/main/java/org/apache/sqoop/model/MInput.java   |  2 +-
 .../java/org/apache/sqoop/model/MNamedElement.java     |  2 +-
 .../java/org/apache/sqoop/model/MValidatedElement.java |  5 ++---
 .../org/apache/sqoop/model/TestMValidatedElement.java  |  1 -
 .../org/apache/sqoop/shell/utils/ConfigFiller.java     |  2 +-
 10 files changed, 19 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/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 2e09516..60e0d00 100644
--- a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
+++ b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
@@ -810,7 +810,7 @@ public class SqoopClient {
   private Status applyLinkValidations(ValidationResultBean bean, MLink link) {
     ConfigValidationResult linkConfig = bean.getValidationResults()[0];
     // Apply validation results
-    ConfigUtils.applyValidation(link.getConnectorLinkConfig().getConfigs(), linkConfig);
+    ConfigUtils.applyValidation(link.getConnectorLinkConfig(), linkConfig);
     Long id = bean.getId();
     if (id != null) {
       link.setPersistenceId(id);
@@ -825,13 +825,13 @@ public class SqoopClient {
     ConfigValidationResult driver = bean.getValidationResults()[2];
 
     ConfigUtils.applyValidation(
-        job.getFromJobConfig().getConfigs(),
+        job.getFromJobConfig(),
         fromConfig);
     ConfigUtils.applyValidation(
-        job.getToJobConfig().getConfigs(),
+        job.getToJobConfig(),
         toConfig);
     ConfigUtils.applyValidation(
-      job.getDriverConfig().getConfigs(),
+      job.getDriverConfig(),
       driver
     );
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/common/src/main/java/org/apache/sqoop/model/ConfigUtils.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/ConfigUtils.java b/common/src/main/java/org/apache/sqoop/model/ConfigUtils.java
index e5d4f80..493de8d 100644
--- a/common/src/main/java/org/apache/sqoop/model/ConfigUtils.java
+++ b/common/src/main/java/org/apache/sqoop/model/ConfigUtils.java
@@ -343,12 +343,13 @@ public class  ConfigUtils {
    * @param configs
    * @param result
    */
-  public static void applyValidation(List<MConfig> configs, ConfigValidationResult
result) {
-    for(MConfig config : configs) {
-      applyValidation(config, result);
+  public static void applyValidation(MConfigList configList, ConfigValidationResult result)
{
+    applyValidation(configList, "", result);
+    for(MConfig config : configList.getConfigs()) {
+      applyValidation(configList, config.getName(), result);
 
       for(MInput input : config.getInputs()) {
-        applyValidation(input, result);
+        applyValidation(input, input.getName(), result);
       }
     }
   }
@@ -361,8 +362,8 @@ public class  ConfigUtils {
    * @param element
    * @param result
    */
-  public static void applyValidation(MValidatedElement element, ConfigValidationResult result)
{
-    List<Message> messages = result.getMessages().get(element.getName());
+  public static void applyValidation(MValidatedElement element, String name, ConfigValidationResult
result) {
+    List<Message> messages = result.getMessages().get(name);
 
     if(messages != null) {
       element.setValidationMessages(messages);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java b/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
index 8fc744a..1b350f7 100644
--- a/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
+++ b/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
@@ -28,7 +28,7 @@ import java.util.Date;
  */
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
-abstract public class MAccountableEntity extends MValidatedElement {
+abstract public class MAccountableEntity extends MNamedElement {
 
   private static final boolean DEFAULT_ENABLED = true;
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/common/src/main/java/org/apache/sqoop/model/MConfig.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MConfig.java b/common/src/main/java/org/apache/sqoop/model/MConfig.java
index b618946..ad04263 100644
--- a/common/src/main/java/org/apache/sqoop/model/MConfig.java
+++ b/common/src/main/java/org/apache/sqoop/model/MConfig.java
@@ -33,7 +33,7 @@ import java.util.Set;
  */
 @InterfaceAudience.Public
 @InterfaceStability.Unstable
-public final class MConfig extends MValidatedElement implements MClonable {
+public final class MConfig extends MNamedElement implements MClonable {
 
   private final List<MInput<?>> inputs;
   private Set<String> inputNames = new HashSet<String>();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/common/src/main/java/org/apache/sqoop/model/MConfigList.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MConfigList.java b/common/src/main/java/org/apache/sqoop/model/MConfigList.java
index 35cb17a..1d889ea 100644
--- a/common/src/main/java/org/apache/sqoop/model/MConfigList.java
+++ b/common/src/main/java/org/apache/sqoop/model/MConfigList.java
@@ -29,7 +29,7 @@ import java.util.List;
  */
 @InterfaceAudience.Public
 @InterfaceStability.Unstable
-public class MConfigList implements MClonable {
+public class MConfigList extends MValidatedElement implements MClonable {
 
   private final List<MConfig> configObjects;
   private final MConfigType type;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/common/src/main/java/org/apache/sqoop/model/MInput.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MInput.java b/common/src/main/java/org/apache/sqoop/model/MInput.java
index d5ce074..649f2fd 100644
--- a/common/src/main/java/org/apache/sqoop/model/MInput.java
+++ b/common/src/main/java/org/apache/sqoop/model/MInput.java
@@ -28,7 +28,7 @@ import org.apache.sqoop.classification.InterfaceStability;
  */
 @InterfaceAudience.Public
 @InterfaceStability.Unstable
-public abstract class MInput<T> extends MValidatedElement implements MClonable {
+public abstract class MInput<T> extends MNamedElement implements MClonable {
   private final boolean sensitive;
 
   private final String overrides;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/common/src/main/java/org/apache/sqoop/model/MNamedElement.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MNamedElement.java b/common/src/main/java/org/apache/sqoop/model/MNamedElement.java
index b18eaf1..7972467 100644
--- a/common/src/main/java/org/apache/sqoop/model/MNamedElement.java
+++ b/common/src/main/java/org/apache/sqoop/model/MNamedElement.java
@@ -25,7 +25,7 @@ import org.apache.sqoop.classification.InterfaceStability;
  */
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
-public abstract class MNamedElement extends MPersistableEntity {
+public abstract class MNamedElement extends MValidatedElement {
   private static final String LABEL_KEY_SUFFIX = ".label";
   private static final String HELP_KEY_SUFFIX = ".help";
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java b/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
index dd19088..c8042f6 100644
--- a/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
+++ b/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
@@ -30,7 +30,7 @@ import java.util.List;
  */
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
-public abstract class MValidatedElement extends MNamedElement {
+public abstract class MValidatedElement extends MPersistableEntity {
 
   /**
    * Validation messages.
@@ -42,8 +42,7 @@ public abstract class MValidatedElement extends MNamedElement {
    */
   private Status validationStatus;
 
-  public MValidatedElement(String name) {
-    super(name);
+  public MValidatedElement() {
     resetValidationMessages();
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java b/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java
index 6fee4b5..4bd218e 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java
@@ -35,7 +35,6 @@ public class TestMValidatedElement {
   @Test
   public void testInitialization() {
     MValidatedElement input = new MIntegerInput("input", false,InputEditable.ANY, StringUtils.EMPTY
);
-    assertEquals("input", input.getName());
     assertEquals(Status.OK, input.getValidationStatus());
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/3d004fac/shell/src/main/java/org/apache/sqoop/shell/utils/ConfigFiller.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/ConfigFiller.java b/shell/src/main/java/org/apache/sqoop/shell/utils/ConfigFiller.java
index 39bc914..2dbde97 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/utils/ConfigFiller.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/utils/ConfigFiller.java
@@ -1121,7 +1121,7 @@ public final class ConfigFiller {
    *
    * @param element Validated element
    */
-  static void printValidationMessage(MValidatedElement element, boolean includeInputPrefix)
{
+  static void printValidationMessage(MNamedElement element, boolean includeInputPrefix) {
     if(element.getValidationStatus() == Status.getDefault()) {
       return;
     }


Mime
View raw message