sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [45/52] [abbrv] SQOOP-1498: Sqoop2: Repository Object refactoring (objects prefixed with M)
Date Fri, 10 Oct 2014 02:52:14 GMT
http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/ConfigTestUtil.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/ConfigTestUtil.java b/common/src/test/java/org/apache/sqoop/json/ConfigTestUtil.java
new file mode 100644
index 0000000..4372171
--- /dev/null
+++ b/common/src/test/java/org/apache/sqoop/json/ConfigTestUtil.java
@@ -0,0 +1,217 @@
+/**
+ * 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.json;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.apache.sqoop.model.MConfig;
+import org.apache.sqoop.model.MConnector;
+import org.apache.sqoop.model.MDriver;
+import org.apache.sqoop.model.MDriverConfig;
+import org.apache.sqoop.model.MFromConfig;
+import org.apache.sqoop.model.MInput;
+import org.apache.sqoop.model.MIntegerInput;
+import org.apache.sqoop.model.MJob;
+import org.apache.sqoop.model.MLink;
+import org.apache.sqoop.model.MLinkConfig;
+import org.apache.sqoop.model.MStringInput;
+import org.apache.sqoop.model.MToConfig;
+import org.apache.sqoop.utils.MapResourceBundle;
+
+/**
+ *
+ */
+public class ConfigTestUtil {
+  public static MConnector getConnector(String name) {
+    return getConnector(name, true, true);
+  }
+
+  public static MConnector getConnector(String name, boolean from, boolean to) {
+    MFromConfig fromConfig = null;
+    MToConfig toConfig = null;
+    if (from) {
+      fromConfig = getFromConfig();
+    }
+    if (to) {
+      toConfig = getToConfig();
+    }
+    return new MConnector(name, name + ".class", "1.0-test",
+      getLinkConfig(), fromConfig, toConfig);
+  }
+
+
+  public static MLink getLink(String name) {
+    return new MLink(1, getConnector(name).getLinkConfig());
+  }
+
+  public static MJob getJob(String name) {
+    return new MJob(1, 2, 1, 2, getConnector(name).getFromConfig(), getConnector(name)
+        .getToConfig(), getDriverConfig());
+  }
+
+  public static MDriverConfig getDriverConfig() {
+    List<MInput<?>> inputs;
+    MIntegerInput input;
+    MConfig config;
+    List<MConfig> driverConfigs = new ArrayList<MConfig>();
+    inputs = new ArrayList<MInput<?>>();
+
+    input = new MIntegerInput("numExtractors", false);
+    input.setPersistenceId(1);
+    inputs.add(input);
+
+    input = new MIntegerInput("numLoaders", false);
+    input.setPersistenceId(2);
+    inputs.add(input);
+
+    config = new MConfig("driver", inputs);
+    config.setPersistenceId(10);
+    driverConfigs.add(config);
+    return new MDriverConfig(driverConfigs);
+  }
+
+  public static MLinkConfig getLinkConfig() {
+    List<MInput<?>> inputs;
+    MStringInput input;
+    MConfig config;
+    List<MConfig> linkConfig = new ArrayList<MConfig>();
+    inputs = new ArrayList<MInput<?>>();
+
+    input = new MStringInput("url", false, (short) 10);
+    input.setPersistenceId(1);
+    inputs.add(input);
+
+    input = new MStringInput("username", false, (short) 10);
+    input.setPersistenceId(2);
+    input.setValue("test");
+    inputs.add(input);
+
+    input = new MStringInput("password", true, (short) 10);
+    input.setPersistenceId(3);
+    input.setValue("test");
+    inputs.add(input);
+
+    config = new MConfig("connection", inputs);
+    config.setPersistenceId(10);
+    linkConfig.add(config);
+
+    return new MLinkConfig(linkConfig);
+  }
+
+  static MFromConfig getFromConfig() {
+    List<MInput<?>> inputs;
+    MStringInput input;
+    MConfig config;
+    List<MConfig> jobConfigs = new ArrayList<MConfig>();
+
+    inputs = new ArrayList<MInput<?>>();
+
+    input = new MStringInput("A", false, (short) 10);
+    input.setPersistenceId(4);
+    inputs.add(input);
+
+    input = new MStringInput("B", false, (short) 10);
+    input.setPersistenceId(5);
+    inputs.add(input);
+
+    input = new MStringInput("C", false, (short) 10);
+    input.setPersistenceId(6);
+    inputs.add(input);
+
+    config = new MConfig("Z", inputs);
+    config.setPersistenceId(11);
+    jobConfigs.add(config);
+
+    inputs = new ArrayList<MInput<?>>();
+
+    input = new MStringInput("D", false, (short) 10);
+    input.setPersistenceId(7);
+    inputs.add(input);
+
+    input = new MStringInput("E", false, (short) 10);
+    input.setPersistenceId(8);
+    inputs.add(input);
+
+    input = new MStringInput("F", false, (short) 10);
+    input.setPersistenceId(9);
+    inputs.add(input);
+
+    config = new MConfig("from-table", inputs);
+    config.setPersistenceId(12);
+    jobConfigs.add(config);
+
+    return new MFromConfig(jobConfigs);
+  }
+
+  static MToConfig getToConfig() {
+    List<MInput<?>> inputs;
+    MStringInput input;
+    MConfig config;
+    List<MConfig> jobConfigs = new ArrayList<MConfig>();
+
+    inputs = new ArrayList<MInput<?>>();
+
+    input = new MStringInput("A", false, (short) 10);
+    input.setPersistenceId(4);
+    inputs.add(input);
+
+    input = new MStringInput("B", false, (short) 10);
+    input.setPersistenceId(5);
+    inputs.add(input);
+
+    input = new MStringInput("C", false, (short) 10);
+    input.setPersistenceId(6);
+    inputs.add(input);
+
+    config = new MConfig("Z", inputs);
+    config.setPersistenceId(11);
+    jobConfigs.add(config);
+
+    inputs = new ArrayList<MInput<?>>();
+
+    input = new MStringInput("D", false, (short) 10);
+    input.setPersistenceId(7);
+    inputs.add(input);
+
+    input = new MStringInput("E", false, (short) 10);
+    input.setPersistenceId(8);
+    inputs.add(input);
+
+    input = new MStringInput("F", false, (short) 10);
+    input.setPersistenceId(9);
+    inputs.add(input);
+
+    config = new MConfig("to-table", inputs);
+    config.setPersistenceId(12);
+    jobConfigs.add(config);
+
+    return new MToConfig(jobConfigs);
+  }
+
+  public static ResourceBundle getResourceBundle() {
+    Map<String, Object> map = new HashMap<String, Object>();
+    map.put("a", "a");
+    map.put("b", "b");
+
+    return new MapResourceBundle(map);
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java b/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
index fe75ee0..9fd2fe3 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
@@ -17,10 +17,9 @@
  */
 package org.apache.sqoop.json;
 
-import org.apache.sqoop.model.MConnector;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-import org.junit.Test;
+import static org.apache.sqoop.json.ConfigTestUtil.getConnector;
+import static org.apache.sqoop.json.ConfigTestUtil.getResourceBundle;
+import static org.junit.Assert.*;
 
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -28,8 +27,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.ResourceBundle;
 
-import static org.apache.sqoop.json.TestUtil.*;
-import static org.junit.Assert.*;
+import org.apache.sqoop.model.MConnector;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.junit.Test;
 
 /**
  *
@@ -48,26 +49,26 @@ public class TestConnectorBean {
     connectors.add(getConnector("mysql"));
 
     // Create testing bundles
-    Map<Long, ResourceBundle> bundles = new HashMap<Long, ResourceBundle>();
-    bundles.put(1L, getResourceBundle());
-    bundles.put(2L, getResourceBundle());
+    Map<Long, ResourceBundle> configBundles = new HashMap<Long, ResourceBundle>();
+    configBundles.put(1L, getResourceBundle());
+    configBundles.put(2L, getResourceBundle());
 
     // Serialize it to JSON object
-    ConnectorBean bean = new ConnectorBean(connectors, bundles);
-    JSONObject json = bean.extract(false);
+    ConnectorBean connectorBean = new ConnectorBean(connectors, configBundles);
+    JSONObject connectorJSON = connectorBean.extract(false);
 
     // "Move" it across network in text form
-    String string = json.toJSONString();
+    String connectorJSONString = connectorJSON.toJSONString();
 
     // Retrieved transferred object
-    JSONObject retrievedJson = (JSONObject) JSONValue.parse(string);
-    ConnectorBean retrievedBean = new ConnectorBean();
-    retrievedBean.restore(retrievedJson);
+    JSONObject parsedConnector = (JSONObject) JSONValue.parse(connectorJSONString);
+    ConnectorBean parsedConnectorBean = new ConnectorBean();
+    parsedConnectorBean.restore(parsedConnector);
 
-    assertEquals(connectors.size(), retrievedBean.getConnectors().size());
-    assertEquals(connectors.get(0), retrievedBean.getConnectors().get(0));
+    assertEquals(connectors.size(), parsedConnectorBean.getConnectors().size());
+    assertEquals(connectors.get(0), parsedConnectorBean.getConnectors().get(0));
 
-    ResourceBundle retrievedBundle = retrievedBean.getResourceBundles().get(1L);
+    ResourceBundle retrievedBundle = parsedConnectorBean.getResourceBundles().get(1L);
     assertNotNull(retrievedBundle);
     assertEquals("a", retrievedBundle.getString("a"));
     assertEquals("b", retrievedBundle.getString("b"));

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/TestDriverBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestDriverBean.java b/common/src/test/java/org/apache/sqoop/json/TestDriverBean.java
new file mode 100644
index 0000000..8c92aef
--- /dev/null
+++ b/common/src/test/java/org/apache/sqoop/json/TestDriverBean.java
@@ -0,0 +1,62 @@
+/**
+ * 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.json;
+
+import static org.apache.sqoop.json.ConfigTestUtil.getResourceBundle;
+import static org.junit.Assert.assertEquals;
+
+import java.util.ResourceBundle;
+
+import org.apache.sqoop.model.MDriver;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class TestDriverBean {
+
+  /**
+   * Test that by JSON serialization followed by deserialization we will get
+   * equal drive config object.
+   */
+  @Test
+  public void testSerialization() {
+    MDriver driver = new MDriver(ConfigTestUtil.getDriverConfig(), DriverBean.CURRENT_DRIVER_VERSION);
+
+    // Serialize it to JSON object
+    DriverBean bean = new DriverBean(driver, getResourceBundle());
+    JSONObject json = bean.extract(false);
+
+    // "Move" it across network in text form
+    String string = json.toJSONString();
+
+    // Retrieved transferred object
+    JSONObject retrievedJson = (JSONObject) JSONValue.parse(string);
+    DriverBean retrievedBean = new DriverBean();
+    retrievedBean.restore(retrievedJson);
+
+    assertEquals(driver, retrievedBean.getDriver());
+
+    ResourceBundle retrievedBundle = retrievedBean.getDriverConfigResourceBundle();
+    assertEquals("a", retrievedBundle.getString("a"));
+    assertEquals("b", retrievedBundle.getString("b"));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java b/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java
deleted file mode 100644
index fcce7b5..0000000
--- a/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.json;
-
-import org.apache.sqoop.model.MDriverConfig;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-import org.junit.Test;
-
-import java.util.ResourceBundle;
-
-import static org.apache.sqoop.json.TestUtil.*;
-import static org.junit.Assert.*;
-
-/**
- *
- */
-public class TestDriverConfigBean {
-
-  /**
-   * Test that by JSON serialization followed by deserialization we will get
-   * equal framework object.
-   */
-  @Test
-  public void testSerialization() {
-    MDriverConfig driverConfig = getDriverConfig();
-
-    // Serialize it to JSON object
-    DriverConfigBean bean = new DriverConfigBean(driverConfig, getResourceBundle());
-    JSONObject json = bean.extract(false);
-
-    // "Move" it across network in text form
-    String string = json.toJSONString();
-
-    // Retrieved transferred object
-    JSONObject retrievedJson = (JSONObject) JSONValue.parse(string);
-    DriverConfigBean retrievedBean = new DriverConfigBean();
-    retrievedBean.restore(retrievedJson);
-
-    assertEquals(driverConfig, retrievedBean.getDriverConfig());
-
-    ResourceBundle retrievedBundle = retrievedBean.getResourceBundle();
-    assertEquals("a", retrievedBundle.getString("a"));
-    assertEquals("b", retrievedBundle.getString("b"));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/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 78a3420..1fc8dbd 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
@@ -17,6 +17,11 @@
  */
 package org.apache.sqoop.json;
 
+import static org.apache.sqoop.json.ConfigTestUtil.getJob;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Date;
+
 import org.apache.sqoop.common.Direction;
 import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.model.MStringInput;
@@ -25,11 +30,6 @@ import org.json.simple.JSONValue;
 import org.json.simple.parser.ParseException;
 import org.junit.Test;
 
-import java.util.Date;
-
-import static org.apache.sqoop.json.TestUtil.getJob;
-import static org.junit.Assert.assertEquals;
-
 /**
  *
  */
@@ -46,25 +46,25 @@ public class TestJobBean {
     job.setEnabled(false);
 
     // Fill some data at the beginning
-    MStringInput input = (MStringInput) job.getConnectorPart(Direction.FROM)
-        .getForms().get(0).getInputs().get(0);
+    MStringInput input = (MStringInput) job.getJobConfig(Direction.FROM)
+        .getConfigs().get(0).getInputs().get(0);
     input.setValue("Hi there!");
-    input = (MStringInput) job.getConnectorPart(Direction.TO)
-        .getForms().get(0).getInputs().get(0);
+    input = (MStringInput) job.getJobConfig(Direction.TO)
+        .getConfigs().get(0).getInputs().get(0);
     input.setValue("Hi there again!");
 
     // Serialize it to JSON object
-    JobBean bean = new JobBean(job);
-    JSONObject json = bean.extract(false);
+    JobBean jobBean = new JobBean(job);
+    JSONObject jobJson = jobBean.extract(false);
 
     // "Move" it across network in text form
-    String string = json.toJSONString();
+    String jobJsonString = jobJson.toJSONString();
 
     // Retrieved transferred object
-    JSONObject retrievedJson = (JSONObject)JSONValue.parseWithException(string);
-    JobBean retrievedBean = new JobBean();
-    retrievedBean.restore(retrievedJson);
-    MJob target = retrievedBean.getJobs().get(0);
+    JSONObject parsedJobJson = (JSONObject)JSONValue.parseWithException(jobJsonString);
+    JobBean parsedJobBean = new JobBean();
+    parsedJobBean.restore(parsedJobJson);
+    MJob target = parsedJobBean.getJobs().get(0);
 
     // Check id and name
     assertEquals(666, target.getPersistenceId());
@@ -78,11 +78,11 @@ public class TestJobBean {
     assertEquals(false, target.getEnabled());
 
     // Test that value was correctly moved
-    MStringInput targetInput = (MStringInput) target.getConnectorPart(Direction.FROM)
-      .getForms().get(0).getInputs().get(0);
+    MStringInput targetInput = (MStringInput) target.getJobConfig(Direction.FROM)
+      .getConfigs().get(0).getInputs().get(0);
     assertEquals("Hi there!", targetInput.getValue());
-    targetInput = (MStringInput) target.getConnectorPart(Direction.TO)
-        .getForms().get(0).getInputs().get(0);
+    targetInput = (MStringInput) target.getJobConfig(Direction.TO)
+        .getConfigs().get(0).getInputs().get(0);
     assertEquals("Hi there again!", targetInput.getValue());
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java b/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
index 9ca6b64..ac07137 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
@@ -17,19 +17,21 @@
  */
 package org.apache.sqoop.json;
 
+import static org.apache.sqoop.json.ConfigTestUtil.getLink;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+
+import org.apache.sqoop.json.util.ConfigSerialization;
 import org.apache.sqoop.model.MLink;
 import org.apache.sqoop.model.MStringInput;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
-import org.json.simple.JSONArray;
 import org.json.simple.JSONValue;
 import org.junit.Test;
 
-import java.util.Date;
-
-import static org.junit.Assert.*;
-import static org.apache.sqoop.json.TestUtil.*;
-
 /**
  *
  */
@@ -48,31 +50,31 @@ public class TestLinkBean {
     link.setEnabled(false);
 
     // Fill some data at the beginning
-    MStringInput input = (MStringInput) link.getConnectorPart().getForms()
+    MStringInput input = (MStringInput) link.getConnectorLinkConfig().getConfigs()
       .get(0).getInputs().get(0);
     input.setValue("Hi there!");
 
     // Serialize it to JSON object
-    LinkBean bean = new LinkBean(link);
-    JSONObject json = bean.extract(false);
+    LinkBean linkBean = new LinkBean(link);
+    JSONObject json = linkBean.extract(false);
 
     // Check for sensitivity
-    JSONArray all = (JSONArray)json.get("all");
+    JSONArray all = (JSONArray)json.get(ConfigSerialization.ALL);
     JSONObject allItem = (JSONObject)all.get(0);
-    JSONArray connectors = (JSONArray)allItem.get("connector");
+    JSONArray connectors = (JSONArray)allItem.get(LinkBean.LINK_CONFIG);
     JSONObject connector = (JSONObject)connectors.get(0);
-    JSONArray inputs = (JSONArray)connector.get("inputs");
+    JSONArray inputs = (JSONArray)connector.get(ConfigSerialization.CONFIG_INPUTS);
     for (Object input1 : inputs) {
-      assertTrue(((JSONObject)input1).containsKey("sensitive"));
+      assertTrue(((JSONObject)input1).containsKey(ConfigSerialization.CONFIG_INPUT_SENSITIVE));
     }
 
     // "Move" it across network in text form
-    String string = json.toJSONString();
+    String linkJsonString = json.toJSONString();
 
     // Retrieved transferred object
-    JSONObject retrievedJson = (JSONObject) JSONValue.parse(string);
+    JSONObject parsedLinkJson = (JSONObject) JSONValue.parse(linkJsonString);
     LinkBean retrievedBean = new LinkBean();
-    retrievedBean.restore(retrievedJson);
+    retrievedBean.restore(parsedLinkJson);
     MLink target = retrievedBean.getLinks().get(0);
 
     // Check id and name
@@ -85,8 +87,8 @@ public class TestLinkBean {
     assertEquals(false, target.getEnabled());
 
     // Test that value was correctly moved
-    MStringInput targetInput = (MStringInput) target.getConnectorPart()
-      .getForms().get(0).getInputs().get(0);
+    MStringInput targetInput = (MStringInput) target.getConnectorLinkConfig()
+      .getConfigs().get(0).getInputs().get(0);
     assertEquals("Hi there!", targetInput.getValue());
   }
 
@@ -104,7 +106,7 @@ public class TestLinkBean {
     link.setEnabled(true);
 
     // Fill some data at the beginning
-    MStringInput input = (MStringInput) link.getConnectorPart().getForms()
+    MStringInput input = (MStringInput) link.getConnectorLinkConfig().getConfigs()
       .get(0).getInputs().get(0);
     input.setValue("Hi there!");
 
@@ -114,25 +116,25 @@ public class TestLinkBean {
     JSONObject jsonFiltered = bean.extract(true);
 
     // Sensitive values should exist
-    JSONArray all = (JSONArray)json.get("all");
+    JSONArray all = (JSONArray)json.get(ConfigSerialization.ALL);
     JSONObject allItem = (JSONObject)all.get(0);
-    JSONArray connectors = (JSONArray)allItem.get("connector");
+    JSONArray connectors = (JSONArray)allItem.get(LinkBean.LINK_CONFIG);
     JSONObject connector = (JSONObject)connectors.get(0);
-    JSONArray inputs = (JSONArray)connector.get("inputs");
+    JSONArray inputs = (JSONArray)connector.get(ConfigSerialization.CONFIG_INPUTS);
     assertEquals(3, inputs.size());
     // Inputs are ordered when creating link
     JSONObject password = (JSONObject)inputs.get(2);
-    assertTrue(password.containsKey("value"));
+    assertTrue(password.containsKey(ConfigSerialization.CONFIG_INPUT_VALUE));
 
     // Sensitive values should not exist
-    all = (JSONArray)jsonFiltered.get("all");
+    all = (JSONArray)jsonFiltered.get(ConfigSerialization.ALL);
     allItem = (JSONObject)all.get(0);
-    connectors = (JSONArray)allItem.get("connector");
+    connectors = (JSONArray)allItem.get(LinkBean.LINK_CONFIG);
     connector = (JSONObject)connectors.get(0);
-    inputs = (JSONArray)connector.get("inputs");
+    inputs = (JSONArray)connector.get(ConfigSerialization.CONFIG_INPUTS);
     assertEquals(3, inputs.size());
     // Inputs are ordered when creating link
     password = (JSONObject)inputs.get(2);
-    assertFalse(password.containsKey("value"));
+    assertFalse(password.containsKey(ConfigSerialization.CONFIG_INPUT_VALUE));
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/TestUtil.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestUtil.java b/common/src/test/java/org/apache/sqoop/json/TestUtil.java
deleted file mode 100644
index 9875219..0000000
--- a/common/src/test/java/org/apache/sqoop/json/TestUtil.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * 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.json;
-
-import org.apache.sqoop.common.Direction;
-import org.apache.sqoop.model.MLink;
-import org.apache.sqoop.model.MConnectionForms;
-import org.apache.sqoop.model.MConnector;
-import org.apache.sqoop.model.MForm;
-import org.apache.sqoop.model.MDriverConfig;
-import org.apache.sqoop.model.MInput;
-import org.apache.sqoop.model.MJob;
-import org.apache.sqoop.model.MJobForms;
-import org.apache.sqoop.model.MStringInput;
-import org.apache.sqoop.utils.MapResourceBundle;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-/**
- *
- */
-public class TestUtil {
-  public static MConnector getConnector(String name) {
-    return getConnector(name, true, true);
-  }
-
-  public static MConnector getConnector(String name, boolean from, boolean to) {
-    MJobForms fromJobForms = null;
-    MJobForms toJobForms = null;
-    if (from) {
-      fromJobForms = getJobForms();
-    }
-    if (to) {
-      toJobForms = getJobForms();
-    }
-    return new MConnector(name, name + ".class", "1.0-test",
-      getConnectionForms(), fromJobForms, toJobForms);
-  }
-
-  public static MDriverConfig getDriverConfig() {
-    return new MDriverConfig(getConnectionForms(), getJobForms(), "1");
-  }
-
-  public static MLink getLink(String name) {
-    return new MLink(1, getConnector(name).getConnectionForms(), getDriverConfig()
-        .getConnectionForms());
-  }
-
-  public static MJob getJob(String name) {
-    return new MJob(1, 2, 1, 2, getConnector(name).getJobForms(Direction.FROM), getConnector(name)
-        .getJobForms(Direction.TO), getDriverConfig().getJobForms());
-  }
-
-  public static MConnectionForms getConnectionForms() {
-    List<MInput<?>> inputs;
-    MStringInput input;
-    MForm form;
-    List<MForm> connectionForms = new ArrayList<MForm>();
-    inputs = new ArrayList<MInput<?>>();
-
-    input = new MStringInput("url", false, (short) 10);
-    input.setPersistenceId(1);
-    inputs.add(input);
-
-    input = new MStringInput("username", false, (short) 10);
-    input.setPersistenceId(2);
-    input.setValue("test");
-    inputs.add(input);
-
-    input = new MStringInput("password", true, (short) 10);
-    input.setPersistenceId(3);
-    input.setValue("test");
-    inputs.add(input);
-
-    form = new MForm("connection", inputs);
-    form.setPersistenceId(10);
-    connectionForms.add(form);
-
-    return new MConnectionForms(connectionForms);
-  }
-
-  public static MJobForms getJobForms() {
-    List<MInput<?>> inputs;
-    MStringInput input;
-    MForm form;
-    List<MForm> jobForms = new ArrayList<MForm>();
-
-    inputs = new ArrayList<MInput<?>>();
-
-    input = new MStringInput("A", false, (short) 10);
-    input.setPersistenceId(4);
-    inputs.add(input);
-
-    input = new MStringInput("B", false, (short) 10);
-    input.setPersistenceId(5);
-    inputs.add(input);
-
-    input = new MStringInput("C", false, (short) 10);
-    input.setPersistenceId(6);
-    inputs.add(input);
-
-    form = new MForm("Z", inputs);
-    form.setPersistenceId(11);
-    jobForms.add(form);
-
-    inputs = new ArrayList<MInput<?>>();
-
-    input = new MStringInput("D", false, (short) 10);
-    input.setPersistenceId(7);
-    inputs.add(input);
-
-    input = new MStringInput("E", false, (short) 10);
-    input.setPersistenceId(8);
-    inputs.add(input);
-
-    input = new MStringInput("F", false, (short) 10);
-    input.setPersistenceId(9);
-    inputs.add(input);
-
-    form = new MForm("connection", inputs);
-    form.setPersistenceId(12);
-    jobForms.add(form);
-
-    return new MJobForms(jobForms);
-  }
-
-  public static ResourceBundle getResourceBundle() {
-    Map<String, Object> map = new HashMap<String, Object>();
-    map.put("a", "a");
-    map.put("b", "b");
-
-    return new MapResourceBundle(map);
-  }
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java b/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java
index f5f3389..fc5b21d 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java
@@ -17,18 +17,20 @@
  */
 package org.apache.sqoop.json;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.validation.ConfigValidator;
 import org.apache.sqoop.validation.Status;
-import org.apache.sqoop.validation.Validation;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
 import org.junit.Test;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
 /**
  *
  */
@@ -44,7 +46,7 @@ public class TestValidationBean {
     );
     JSONObject json = bean.extract(false);
 
-    // "Move" it across network in text form
+    // "Move" it across network in text config
     String string = json.toJSONString();
 
     // Retrieved transferred object
@@ -54,43 +56,43 @@ public class TestValidationBean {
 
     assertNull(retrievedBean.getId());
 
-    Validation.FormInput fa = new Validation.FormInput("f", "i");
-    Validation.FormInput fb = new Validation.FormInput("f2", "i2");
+    ConfigValidator.ConfigInput fa = new ConfigValidator.ConfigInput("c", "i");
+    ConfigValidator.ConfigInput fb = new ConfigValidator.ConfigInput("c2", "i2");
 
-    Validation fromConnector = retrievedBean.getConnectorValidation(Direction.FROM);
+    ConfigValidator fromConnector = retrievedBean.getConnectorValidation(Direction.FROM);
     assertEquals(Status.FINE, fromConnector.getStatus());
     assertEquals(2, fromConnector.getMessages().size());
     assertTrue(fromConnector.getMessages().containsKey(fa));
-    assertEquals(new Validation.Message(Status.FINE, "d"),
+    assertEquals(new ConfigValidator.Message(Status.FINE, "d"),
         fromConnector.getMessages().get(fa));
 
-    Validation toConnector = retrievedBean.getConnectorValidation(Direction.TO);
+    ConfigValidator toConnector = retrievedBean.getConnectorValidation(Direction.TO);
     assertEquals(Status.FINE, toConnector.getStatus());
     assertEquals(2, toConnector.getMessages().size());
     assertTrue(toConnector.getMessages().containsKey(fa));
-    assertEquals(new Validation.Message(Status.FINE, "d"),
+    assertEquals(new ConfigValidator.Message(Status.FINE, "d"),
         toConnector.getMessages().get(fa));
 
-    Validation framework = retrievedBean.getFrameworkValidation();
+    ConfigValidator framework = retrievedBean.getFrameworkValidation();
     assertEquals(Status.UNACCEPTABLE, framework.getStatus());
     assertEquals(2, framework.getMessages().size());
     assertTrue(framework.getMessages().containsKey(fb));
-    assertEquals(new Validation.Message(Status.UNACCEPTABLE, "c"),
+    assertEquals(new ConfigValidator.Message(Status.UNACCEPTABLE, "c"),
       framework.getMessages().get(fb));
   }
 
   @Test
   public void testJobValidationBeanId() {
     // Serialize it to JSON object
-    JobValidationBean bean = new JobValidationBean(
+    JobValidationBean jobValidatioBean = new JobValidationBean(
         getValidation(Status.FINE),
         getValidation(Status.FINE),
         getValidation(Status.FINE)
     );
-    bean.setId((long) 10);
-    JSONObject json = bean.extract(false);
+    jobValidatioBean.setId((long) 10);
+    JSONObject json = jobValidatioBean.extract(false);
 
-    // "Move" it across network in text form
+    // "Move" it across network in text config
     String string = json.toJSONString();
 
     // Retrieved transferred object
@@ -105,12 +107,10 @@ public class TestValidationBean {
   public void testLinkValidationBeanSerialization() {
     // Serialize it to JSON object
     LinkValidationBean bean = new LinkValidationBean(
-        getValidation(Status.FINE),
-        getValidation(Status.UNACCEPTABLE)
-    );
+        getValidation(Status.FINE));
     JSONObject json = bean.extract(false);
 
-    // "Move" it across network in text form
+    // "Move" it across network in text config
     String string = json.toJSONString();
 
     // Retrieved transferred object
@@ -120,35 +120,25 @@ public class TestValidationBean {
 
     assertNull(retrievedBean.getId());
 
-    Validation.FormInput fa = new Validation.FormInput("f", "i");
-    Validation.FormInput fb = new Validation.FormInput("f2", "i2");
-
-    Validation connector = retrievedBean.getConnectorValidation();
+    ConfigValidator.ConfigInput ca = new ConfigValidator.ConfigInput("c", "i");
+    ConfigValidator connector = retrievedBean.getLinkConfigValidator();
     assertEquals(Status.FINE, connector.getStatus());
     assertEquals(2, connector.getMessages().size());
-    assertTrue(connector.getMessages().containsKey(fa));
-    assertEquals(new Validation.Message(Status.FINE, "d"),
-        connector.getMessages().get(fa));
-
-    Validation framework = retrievedBean.getFrameworkValidation();
-    assertEquals(Status.UNACCEPTABLE, framework.getStatus());
-    assertEquals(2, framework.getMessages().size());
-    assertTrue(framework.getMessages().containsKey(fb));
-    assertEquals(new Validation.Message(Status.UNACCEPTABLE, "c"),
-        framework.getMessages().get(fb));
+    assertTrue(connector.getMessages().containsKey(ca));
+    assertEquals(new ConfigValidator.Message(Status.FINE, "d"),
+        connector.getMessages().get(ca));
   }
 
   @Test
   public void testLinkValidationBeanId() {
     // Serialize it to JSON object
     LinkValidationBean bean = new LinkValidationBean(
-        getValidation(Status.FINE),
         getValidation(Status.FINE)
     );
     bean.setId((long) 10);
     JSONObject json = bean.extract(false);
 
-    // "Move" it across network in text form
+    // "Move" it across network in text config
     String string = json.toJSONString();
 
     // Retrieved transferred object
@@ -159,17 +149,12 @@ public class TestValidationBean {
     assertEquals((Long)(long) 10, retrievedBean.getId());
   }
 
-  public Validation getValidation(Status status) {
-    Map<Validation.FormInput, Validation.Message> messages =
-      new HashMap<Validation.FormInput, Validation.Message>();
+  public ConfigValidator getValidation(Status status) {
+    Map<ConfigValidator.ConfigInput, ConfigValidator.Message> messages = new HashMap<ConfigValidator.ConfigInput, ConfigValidator.Message>();
 
-    messages.put(
-      new Validation.FormInput("f", "i"),
-      new Validation.Message(status, "d"));
-    messages.put(
-      new Validation.FormInput("f2", "i2"),
-      new Validation.Message(status, "c"));
+    messages.put(new ConfigValidator.ConfigInput("c", "i"), new ConfigValidator.Message(status, "d"));
+    messages.put(new ConfigValidator.ConfigInput("c2", "i2"), new ConfigValidator.Message(status, "c"));
 
-    return new Validation(status, messages);
+    return new ConfigValidator(status, messages);
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/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 5c094fb..bdbad72 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
@@ -19,7 +19,7 @@ package org.apache.sqoop.json;
 
 import org.apache.sqoop.validation.Message;
 import org.apache.sqoop.validation.Status;
-import org.apache.sqoop.validation.ValidationResult;
+import org.apache.sqoop.validation.ConfigValidationResult;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
 import org.junit.Test;
@@ -39,31 +39,31 @@ public class TestValidationResultBean {
 
   @Test
   public void testEmptyTransfer() {
-    ValidationResult []empty = new ValidationResult[0];
+    ConfigValidationResult []empty = new ConfigValidationResult[0];
 
-    ValidationResult []retrieved = transfer(empty);
+    ConfigValidationResult []retrieved = transfer(empty);
     assertEquals(0, retrieved.length);
   }
 
   @Test
   public void testOneMessage() {
-    ValidationResult []empty = new ValidationResult[] {
+    ConfigValidationResult []empty = new ConfigValidationResult[] {
       getResultA()
     };
 
-    ValidationResult []retrieved = transfer(empty);
+    ConfigValidationResult []retrieved = transfer(empty);
     assertEquals(1, retrieved.length);
     verifyResultA(retrieved[0]);
   }
 
   @Test
   public void testTwoMessages() {
-     ValidationResult []empty = new ValidationResult[] {
+     ConfigValidationResult []empty = new ConfigValidationResult[] {
       getResultA(),
       getResultA()
     };
 
-    ValidationResult []retrieved = transfer(empty);
+    ConfigValidationResult []retrieved = transfer(empty);
     assertEquals(2, retrieved.length);
 
     verifyResultA(retrieved[0]);
@@ -79,7 +79,7 @@ public class TestValidationResultBean {
     assertNull(idNull);
   }
 
-  public void verifyResultA(ValidationResult result) {
+  public void verifyResultA(ConfigValidationResult result) {
     assertNotNull(result);
     assertEquals(Status.UNACCEPTABLE, result.getStatus());
 
@@ -98,8 +98,8 @@ public class TestValidationResultBean {
     assertEquals("B", messagesA.get(1).getMessage());
   }
 
-  public ValidationResult getResultA() {
-    ValidationResult result = new ValidationResult();
+  public ConfigValidationResult getResultA() {
+    ConfigValidationResult result = new ConfigValidationResult();
     List<Message> messages = new LinkedList<Message>();
     messages.add(new Message(Status.ACCEPTABLE, "A"));
     messages.add(new Message(Status.UNACCEPTABLE, "B"));
@@ -109,7 +109,7 @@ public class TestValidationResultBean {
 
 
   private Long transfer(Long id) {
-    ValidationResultBean bean = new ValidationResultBean(new ValidationResult[0]);
+    ValidationResultBean bean = new ValidationResultBean(new ConfigValidationResult[0]);
     bean.setId(id);
     JSONObject json = bean.extract(false);
 
@@ -122,7 +122,7 @@ public class TestValidationResultBean {
     return retrievedBean.getId();
   }
 
-  private ValidationResult[] transfer(ValidationResult [] results) {
+  private ConfigValidationResult[] transfer(ConfigValidationResult [] results) {
     ValidationResultBean bean = new ValidationResultBean(results);
     JSONObject json = bean.extract(false);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/util/TestConfigSerialization.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/util/TestConfigSerialization.java b/common/src/test/java/org/apache/sqoop/json/util/TestConfigSerialization.java
new file mode 100644
index 0000000..4f0c84d
--- /dev/null
+++ b/common/src/test/java/org/apache/sqoop/json/util/TestConfigSerialization.java
@@ -0,0 +1,157 @@
+/**
+ * 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.json.util;
+
+import org.apache.sqoop.common.SqoopException;
+import org.apache.sqoop.model.MBooleanInput;
+import org.apache.sqoop.model.MEnumInput;
+import org.apache.sqoop.model.MConfig;
+import org.apache.sqoop.model.MInput;
+import org.apache.sqoop.model.MIntegerInput;
+import org.apache.sqoop.model.MMapInput;
+import org.apache.sqoop.model.MStringInput;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ *
+ */
+public class TestConfigSerialization {
+
+  @Test
+  public void testAllDataTypes() {
+    // Inserted values
+    Map<String, String> map = new HashMap<String, String>();
+    map.put("A", "B");
+
+    // Fill config with all values
+    MConfig config = getConfig();
+    config.getStringInput("String").setValue("A");
+    config.getMapInput("Map").setValue(map);
+    config.getIntegerInput("Integer").setValue(1);
+    config.getBooleanInput("Boolean").setValue(true);
+    config.getEnumInput("Enum").setValue("YES");
+
+    // Serialize that into JSON
+    JSONObject jsonObject = ConfigSerialization.extractConfig(config, false);
+    assertNotNull(jsonObject);
+
+    // Exchange the data on string level
+    String serializedJson = jsonObject.toJSONString();
+    JSONObject retrievedJson = (JSONObject) JSONValue.parse(serializedJson);
+
+    // And retrieve back from JSON representation
+    MConfig retrieved = ConfigSerialization.restoreConfig(retrievedJson);
+
+    // Verify all expected values
+    assertEquals("A", retrieved.getStringInput("String").getValue());
+    assertEquals(map, retrieved.getMapInput("Map").getValue());
+    assertEquals(1, (int)retrieved.getIntegerInput("Integer").getValue());
+    assertEquals(true, retrieved.getBooleanInput("Boolean").getValue());
+    assertEquals("YES", retrieved.getEnumInput("Enum").getValue());
+  }
+
+  @Test
+  public void testMapDataType() {
+    MConfig config = getMapConfig();
+
+    // Inserted values
+    Map<String, String> map = new HashMap<String, String>();
+    map.put("A", "B");
+    config.getMapInput("Map").setValue(map);
+
+    // Serialize
+    JSONObject jsonObject = ConfigSerialization.extractConfig(config, false);
+    String serializedJson = jsonObject.toJSONString();
+
+    // Deserialize
+    JSONObject retrievedJson = (JSONObject) JSONValue.parse(serializedJson);
+    MConfig retrieved = ConfigSerialization.restoreConfig(retrievedJson);
+    assertEquals(map, retrieved.getMapInput("Map").getValue());
+  }
+
+  @Test(expected=SqoopException.class)
+  public void testMapDataTypeException() {
+    MConfig config = getMapConfig();
+
+    // Inserted values
+    Map<String, String> map = new HashMap<String, String>();
+    map.put("A", "B");
+    config.getMapInput("Map").setValue(map);
+
+    // Serialize
+    JSONObject jsonObject = ConfigSerialization.extractConfig(config, false);
+    String serializedJson = jsonObject.toJSONString();
+
+    // Replace map value with a fake string to force exception
+    String badSerializedJson = serializedJson.replace("{\"A\":\"B\"}", "\"nonsensical string\"");
+    System.out.println(badSerializedJson);
+    JSONObject retrievedJson = (JSONObject) JSONValue.parse(badSerializedJson);
+    ConfigSerialization.restoreConfig(retrievedJson);
+  }
+
+  protected MConfig getMapConfig() {
+    List<MInput<?>> inputs;
+    MInput input;
+
+    inputs = new LinkedList<MInput<?>>();
+
+    input = new MMapInput("Map", false);
+    inputs.add(input);
+
+    return new MConfig("c", inputs);
+  }
+
+  /**
+   * Return config with all data types.
+   *
+   * @return
+   */
+  protected MConfig getConfig() {
+    List<MInput<?>> inputs;
+    MInput input;
+
+    inputs = new LinkedList<MInput<?>>();
+
+    input = new MStringInput("String", false, (short)30);
+    inputs.add(input);
+
+    input = new MMapInput("Map", false);
+    inputs.add(input);
+
+    input = new MIntegerInput("Integer", false);
+    inputs.add(input);
+
+    input = new MBooleanInput("Boolean", false);
+    inputs.add(input);
+
+    input = new MEnumInput("Enum", false, new String[] {"YES", "NO"});
+    inputs.add(input);
+
+    return new MConfig("c", inputs);
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/json/util/TestFormSerialization.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/util/TestFormSerialization.java b/common/src/test/java/org/apache/sqoop/json/util/TestFormSerialization.java
deleted file mode 100644
index c4223ec..0000000
--- a/common/src/test/java/org/apache/sqoop/json/util/TestFormSerialization.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * 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.json.util;
-
-import org.apache.sqoop.common.SqoopException;
-import org.apache.sqoop.model.MBooleanInput;
-import org.apache.sqoop.model.MEnumInput;
-import org.apache.sqoop.model.MForm;
-import org.apache.sqoop.model.MInput;
-import org.apache.sqoop.model.MIntegerInput;
-import org.apache.sqoop.model.MMapInput;
-import org.apache.sqoop.model.MStringInput;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- *
- */
-public class TestFormSerialization {
-
-  @Test
-  public void testAllDataTypes() {
-    // Inserted values
-    Map<String, String> map = new HashMap<String, String>();
-    map.put("A", "B");
-
-    // Fill form with all values
-    MForm form = getForm();
-    form.getStringInput("String").setValue("A");
-    form.getMapInput("Map").setValue(map);
-    form.getIntegerInput("Integer").setValue(1);
-    form.getBooleanInput("Boolean").setValue(true);
-    form.getEnumInput("Enum").setValue("YES");
-
-    // Serialize that into JSON
-    JSONObject jsonObject = FormSerialization.extractForm(form, false);
-    assertNotNull(jsonObject);
-
-    // Exchange the data on string level
-    String serializedJson = jsonObject.toJSONString();
-    JSONObject retrievedJson = (JSONObject) JSONValue.parse(serializedJson);
-
-    // And retrieve back from JSON representation
-    MForm retrieved = FormSerialization.restoreForm(retrievedJson);
-
-    // Verify all expected values
-    assertEquals("A", retrieved.getStringInput("String").getValue());
-    assertEquals(map, retrieved.getMapInput("Map").getValue());
-    assertEquals(1, (int)retrieved.getIntegerInput("Integer").getValue());
-    assertEquals(true, retrieved.getBooleanInput("Boolean").getValue());
-    assertEquals("YES", retrieved.getEnumInput("Enum").getValue());
-  }
-
-  @Test
-  public void testMapDataType() {
-    MForm form = getMapForm();
-
-    // Inserted values
-    Map<String, String> map = new HashMap<String, String>();
-    map.put("A", "B");
-    form.getMapInput("Map").setValue(map);
-
-    // Serialize
-    JSONObject jsonObject = FormSerialization.extractForm(form, false);
-    String serializedJson = jsonObject.toJSONString();
-
-    // Deserialize
-    JSONObject retrievedJson = (JSONObject) JSONValue.parse(serializedJson);
-    MForm retrieved = FormSerialization.restoreForm(retrievedJson);
-    assertEquals(map, retrieved.getMapInput("Map").getValue());
-  }
-
-  @Test(expected=SqoopException.class)
-  public void testMapDataTypeException() {
-    MForm form = getMapForm();
-
-    // Inserted values
-    Map<String, String> map = new HashMap<String, String>();
-    map.put("A", "B");
-    form.getMapInput("Map").setValue(map);
-
-    // Serialize
-    JSONObject jsonObject = FormSerialization.extractForm(form, false);
-    String serializedJson = jsonObject.toJSONString();
-
-    // Replace map value with a fake string to force exception
-    String badSerializedJson = serializedJson.replace("{\"A\":\"B\"}", "\"nonsensical string\"");
-    System.out.println(badSerializedJson);
-    JSONObject retrievedJson = (JSONObject) JSONValue.parse(badSerializedJson);
-    FormSerialization.restoreForm(retrievedJson);
-  }
-
-  protected MForm getMapForm() {
-    List<MInput<?>> inputs;
-    MInput input;
-
-    inputs = new LinkedList<MInput<?>>();
-
-    input = new MMapInput("Map", false);
-    inputs.add(input);
-
-    return new MForm("f", inputs);
-  }
-
-  /**
-   * Return form with all data types.
-   *
-   * @return
-   */
-  protected MForm getForm() {
-    List<MInput<?>> inputs;
-    MInput input;
-
-    inputs = new LinkedList<MInput<?>>();
-
-    input = new MStringInput("String", false, (short)30);
-    inputs.add(input);
-
-    input = new MMapInput("Map", false);
-    inputs.add(input);
-
-    input = new MIntegerInput("Integer", false);
-    inputs.add(input);
-
-    input = new MBooleanInput("Boolean", false);
-    inputs.add(input);
-
-    input = new MEnumInput("Enum", false, new String[] {"YES", "NO"});
-    inputs.add(input);
-
-    return new MForm("f", inputs);
-  }
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/model/TestConfigUtils.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestConfigUtils.java b/common/src/test/java/org/apache/sqoop/model/TestConfigUtils.java
new file mode 100644
index 0000000..d5377f8
--- /dev/null
+++ b/common/src/test/java/org/apache/sqoop/model/TestConfigUtils.java
@@ -0,0 +1,290 @@
+/**
+ * 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.model;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.sqoop.common.SqoopException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Test config utils
+ */
+public class TestConfigUtils extends TestCase {
+
+  public void testConfigs() {
+    TestConfiguration config = new TestConfiguration();
+    config.aConfig.a1 = "value";
+
+    List<MConfig> configsByInstance = ConfigUtils.toConfigs(config);
+    assertEquals(getConfigs(), configsByInstance);
+    assertEquals("value", configsByInstance.get(0).getInputs().get(0).getValue());
+
+    List<MConfig> configsByClass = ConfigUtils.toConfigs(TestConfiguration.class);
+    assertEquals(getConfigs(), configsByClass);
+
+    List<MConfig> configsByBoth = ConfigUtils.toConfigs(TestConfiguration.class, config);
+    assertEquals(getConfigs(), configsByBoth);
+    assertEquals("value", configsByBoth.get(0).getInputs().get(0).getValue());
+  }
+
+  public void testConfigsMissingAnnotation() {
+    try {
+      ConfigUtils.toConfigs(ConfigWithout.class);
+    } catch(SqoopException ex) {
+      assertEquals(ModelError.MODEL_003, ex.getErrorCode());
+      return;
+    }
+
+    fail("Correct exception wasn't thrown");
+  }
+
+  public void testNonUniqueFormNameAttributes() {
+    try {
+      ConfigUtils.toConfigs(ConfigurationWithNonUniqueFormNameAttribute.class);
+    } catch (SqoopException ex) {
+      assertEquals(ModelError.MODEL_012, ex.getErrorCode());
+      return;
+    }
+
+    fail("Correct exception wasn't thrown");
+  }
+
+  public void testInvalidFormNameAttribute() {
+    try {
+      ConfigUtils.toConfigs(ConfigurationWithInvalidFormNameAttribute.class);
+    } catch (SqoopException ex) {
+      assertEquals(ModelError.MODEL_013, ex.getErrorCode());
+      return;
+    }
+
+    fail("Correct exception wasn't thrown");
+  }
+
+  public void testInvalidFormNameAttributeLength() {
+    try {
+      ConfigUtils.toConfigs(ConfigurationWithInvalidFormNameAttributeLength.class);
+    } catch (SqoopException ex) {
+      assertEquals(ModelError.MODEL_014, ex.getErrorCode());
+      return;
+    }
+    fail("Correct exception wasn't thrown");
+  }
+
+  public void testFailureOnPrimitiveType() {
+    PrimitiveConfig config = new PrimitiveConfig();
+
+    try {
+      ConfigUtils.toConfigs(config);
+      fail("We were expecting exception for unsupported type.");
+    } catch(SqoopException ex) {
+      assertEquals(ModelError.MODEL_007, ex.getErrorCode());
+    }
+  }
+
+  public void testFillValues() {
+    List<MConfig> configs = getConfigs();
+
+    ((MStringInput)configs.get(0).getInputs().get(0)).setValue("value");
+
+    TestConfiguration config = new TestConfiguration();
+
+    ConfigUtils.fromConfigs(configs, config);
+    assertEquals("value", config.aConfig.a1);
+  }
+
+  public void testFillValuesObjectReuse() {
+    List<MConfig> configs = getConfigs();
+
+    ((MStringInput)configs.get(0).getInputs().get(0)).setValue("value");
+
+    TestConfiguration config = new TestConfiguration();
+    config.aConfig.a2 = "x";
+    config.bConfig.b1 = "y";
+
+    ConfigUtils.fromConfigs(configs, config);
+    assertEquals("value", config.aConfig.a1);
+    assertNull(config.aConfig.a2);
+    assertNull(config.bConfig.b2);
+    assertNull(config.bConfig.b2);
+  }
+
+  public void testJson() {
+    TestConfiguration config = new TestConfiguration();
+    config.aConfig.a1 = "A";
+    config.bConfig.b2 = "B";
+    config.cConfig.intValue = 4;
+    config.cConfig.map.put("C", "D");
+    config.cConfig.enumeration = Enumeration.X;
+
+    String json = ConfigUtils.toJson(config);
+
+    TestConfiguration targetConfig = new TestConfiguration();
+
+    // Old values from should be always removed
+    targetConfig.aConfig.a2 = "X";
+    targetConfig.bConfig.b1 = "Y";
+    // Nulls in configs shouldn't be an issue either
+    targetConfig.cConfig = null;
+
+    ConfigUtils.fillValues(json, targetConfig);
+
+    assertEquals("A", targetConfig.aConfig.a1);
+    assertNull(targetConfig.aConfig.a2);
+
+    assertNull(targetConfig.bConfig.b1);
+    assertEquals("B", targetConfig.bConfig.b2);
+
+    assertEquals((Integer)4, targetConfig.cConfig.intValue);
+    assertEquals(1, targetConfig.cConfig.map.size());
+    assertTrue(targetConfig.cConfig.map.containsKey("C"));
+    assertEquals("D", targetConfig.cConfig.map.get("C"));
+    assertEquals(Enumeration.X, targetConfig.cConfig.enumeration);
+  }
+
+  /**
+   * Config structure that corresponds to Config class declared below
+   * @return Config structure
+   */
+  protected List<MConfig> getConfigs() {
+    List<MConfig> ret = new LinkedList<MConfig>();
+
+    List<MInput<?>> inputs;
+
+    // Config A
+    inputs = new LinkedList<MInput<?>>();
+    inputs.add(new MStringInput("aConfig.a1", false, (short)30));
+    inputs.add(new MStringInput("aConfig.a2", true, (short)-1));
+    ret.add(new MConfig("aConfig", inputs));
+
+    // Config B
+    inputs = new LinkedList<MInput<?>>();
+    inputs.add(new MStringInput("bConfig.b1", false, (short)2));
+    inputs.add(new MStringInput("bConfig.b2", false, (short)3));
+    ret.add(new MConfig("bConfig", inputs));
+
+    // Config C
+    inputs = new LinkedList<MInput<?>>();
+    inputs.add(new MIntegerInput("cConfig.intValue", false));
+    inputs.add(new MMapInput("cConfig.map", false));
+    inputs.add(new MEnumInput("cConfig.enumeration", false, new String[]{"X", "Y"}));
+    ret.add(new MConfig("cConfig", inputs));
+
+    return ret;
+  }
+
+  @ConfigurationClass
+  public static class ConfigurationWithNonUniqueFormNameAttribute {
+    public ConfigurationWithNonUniqueFormNameAttribute() {
+      aForm = new InvalidConfig();
+      bForm = new InvalidConfig();
+    }
+
+    @Config(name = "sameName")
+    InvalidConfig aForm;
+    @Config(name = "sameName")
+    InvalidConfig bForm;
+  }
+
+  @ConfigurationClass
+  public static class ConfigurationWithInvalidFormNameAttribute {
+    public ConfigurationWithInvalidFormNameAttribute() {
+      invalidForm = new InvalidConfig();
+    }
+
+    @Config(name = "#_form")
+    InvalidConfig invalidForm;
+  }
+
+  @ConfigurationClass
+  public static class ConfigurationWithInvalidFormNameAttributeLength {
+    public ConfigurationWithInvalidFormNameAttributeLength() {
+      invalidLengthForm = new InvalidConfig();
+    }
+
+    @Config(name = "longest_form_more_than_30_characers")
+    InvalidConfig invalidLengthForm;
+  }
+
+  @ConfigurationClass
+  public static class TestConfiguration {
+
+    public TestConfiguration() {
+      aConfig = new AConfig();
+      bConfig = new BConfig();
+      cConfig = new CConfig();
+    }
+
+    @Config AConfig aConfig;
+    @Config BConfig bConfig;
+    @Config CConfig cConfig;
+  }
+
+  @ConfigurationClass
+  public static class PrimitiveConfig {
+    @Config DConfig dConfig;
+  }
+
+  @ConfigClass
+  public static class AConfig {
+    @Input(size = 30)  String a1;
+    @Input(sensitive = true)  String a2;
+  }
+
+  @ConfigClass
+  public static class BConfig {
+    @Input(size = 2) String b1;
+    @Input(size = 3) String b2;
+  }
+
+  @ConfigClass
+  public static class CConfig {
+    @Input Integer intValue;
+    @Input Map<String, String> map;
+    @Input Enumeration enumeration;
+
+    public CConfig() {
+      map = new HashMap<String, String>();
+    }
+  }
+
+  @ConfigClass
+  public static class InvalidConfig {
+
+  }
+
+  @ConfigClass
+  public static class DConfig {
+    @Input int value;
+  }
+
+  public static class ConfigWithout {
+  }
+
+  enum Enumeration {
+    X,
+    Y,
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java b/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java
deleted file mode 100644
index d2a3476..0000000
--- a/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/**
- * 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.model;
-
-import org.apache.sqoop.common.SqoopException;
-import org.apache.sqoop.validation.Status;
-import org.apache.sqoop.validation.Validation;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Test form utils
- */
-public class TestFormUtils {
-
-  @Test
-  public void testToForms() {
-    Config config = new Config();
-    config.aForm.a1 = "value";
-
-    List<MForm> formsByInstance = FormUtils.toForms(config);
-    assertEquals(getForms(), formsByInstance);
-    assertEquals("value", formsByInstance.get(0).getInputs().get(0).getValue());
-
-    List<MForm> formsByClass = FormUtils.toForms(Config.class);
-    assertEquals(getForms(), formsByClass);
-
-    List<MForm> formsByBoth = FormUtils.toForms(Config.class, config);
-    assertEquals(getForms(), formsByBoth);
-    assertEquals("value", formsByBoth.get(0).getInputs().get(0).getValue());
-  }
-
-  @Test
-  public void testToFormsMissingAnnotation() {
-    try {
-      FormUtils.toForms(ConfigWithout.class);
-    } catch(SqoopException ex) {
-      assertEquals(ModelError.MODEL_003, ex.getErrorCode());
-      return;
-    }
-
-    fail("Correct exception wasn't thrown");
-  }
-
-  public void testNonUniqueFormNameAttributes() {
-    try {
-      FormUtils.toForms(ConfigurationWithNonUniqueFormNameAttribute.class);
-    } catch (SqoopException ex) {
-      assertEquals(ModelError.MODEL_012, ex.getErrorCode());
-      return;
-    }
-
-    fail("Correct exception wasn't thrown");
-  }
-
-  public void testInvalidFormNameAttribute() {
-    try {
-      FormUtils.toForms(ConfigurationWithInvalidFormNameAttribute.class);
-    } catch (SqoopException ex) {
-      assertEquals(ModelError.MODEL_013, ex.getErrorCode());
-      return;
-    }
-
-    fail("Correct exception wasn't thrown");
-  }
-
-  public void testInvalidFormNameAttributeLength() {
-    try {
-      FormUtils.toForms(ConfigurationWithInvalidFormNameAttributeLength.class);
-    } catch (SqoopException ex) {
-      assertEquals(ModelError.MODEL_014, ex.getErrorCode());
-      return;
-    }
-    fail("Correct exception wasn't thrown");
-  }
-
-  @Test
-  public void testFailureOnPrimitiveType() {
-    PrimitiveConfig config = new PrimitiveConfig();
-
-    try {
-      FormUtils.toForms(config);
-      fail("We were expecting exception for unsupported type.");
-    } catch(SqoopException ex) {
-      assertEquals(ModelError.MODEL_007, ex.getErrorCode());
-    }
-  }
-
-  @Test
-  public void testFillValues() {
-    List<MForm> forms = getForms();
-
-    ((MStringInput)forms.get(0).getInputs().get(0)).setValue("value");
-
-    Config config = new Config();
-
-    FormUtils.fromForms(forms, config);
-    assertEquals("value", config.aForm.a1);
-  }
-
-  @Test
-  public void testFillValuesObjectReuse() {
-    List<MForm> forms = getForms();
-
-    ((MStringInput)forms.get(0).getInputs().get(0)).setValue("value");
-
-    Config config = new Config();
-    config.aForm.a2 = "x";
-    config.bForm.b1 = "y";
-
-    FormUtils.fromForms(forms, config);
-    assertEquals("value", config.aForm.a1);
-    assertNull(config.aForm.a2);
-    assertNull(config.bForm.b2);
-    assertNull(config.bForm.b2);
-  }
-
-  @Test
-  public void testJson() {
-    Config config = new Config();
-    config.aForm.a1 = "A";
-    config.bForm.b2 = "B";
-    config.cForm.intValue = 4;
-    config.cForm.map.put("C", "D");
-    config.cForm.enumeration = Enumeration.X;
-
-    String json = FormUtils.toJson(config);
-
-    Config targetConfig = new Config();
-
-    // Old values from should be always removed
-    targetConfig.aForm.a2 = "X";
-    targetConfig.bForm.b1 = "Y";
-    // Nulls in forms shouldn't be an issue either
-    targetConfig.cForm = null;
-
-    FormUtils.fillValues(json, targetConfig);
-
-    assertEquals("A", targetConfig.aForm.a1);
-    assertNull(targetConfig.aForm.a2);
-
-    assertNull(targetConfig.bForm.b1);
-    assertEquals("B", targetConfig.bForm.b2);
-
-    assertEquals((Integer)4, targetConfig.cForm.intValue);
-    assertEquals(1, targetConfig.cForm.map.size());
-    assertTrue(targetConfig.cForm.map.containsKey("C"));
-    assertEquals("D", targetConfig.cForm.map.get("C"));
-    assertEquals(Enumeration.X, targetConfig.cForm.enumeration);
-  }
-
-  /**
-   * Form structure that corresponds to Config class declared below
-   * @return Form structure
-   */
-  protected List<MForm> getForms() {
-    List<MForm> ret = new LinkedList<MForm>();
-
-    List<MInput<?>> inputs;
-
-    // Form A
-    inputs = new LinkedList<MInput<?>>();
-    inputs.add(new MStringInput("aForm.a1", false, (short)30));
-    inputs.add(new MStringInput("aForm.a2", true, (short)-1));
-    ret.add(new MForm("aForm", inputs));
-
-    // Form B
-    inputs = new LinkedList<MInput<?>>();
-    inputs.add(new MStringInput("bForm.b1", false, (short)2));
-    inputs.add(new MStringInput("bForm.b2", false, (short)3));
-    ret.add(new MForm("bForm", inputs));
-
-    // Form C
-    inputs = new LinkedList<MInput<?>>();
-    inputs.add(new MIntegerInput("cForm.intValue", false));
-    inputs.add(new MMapInput("cForm.map", false));
-    inputs.add(new MEnumInput("cForm.enumeration", false, new String[]{"X", "Y"}));
-    ret.add(new MForm("cForm", inputs));
-
-    return ret;
-  }
-
-  @ConfigurationClass
-  public static class ConfigurationWithNonUniqueFormNameAttribute {
-    public ConfigurationWithNonUniqueFormNameAttribute() {
-      aForm = new InvalidForm();
-      bForm = new InvalidForm();
-    }
-
-    @Form(name = "sameName")
-    InvalidForm aForm;
-    @Form(name = "sameName")
-    InvalidForm bForm;
-  }
-
-  @ConfigurationClass
-  public static class ConfigurationWithInvalidFormNameAttribute {
-    public ConfigurationWithInvalidFormNameAttribute() {
-      invalidForm = new InvalidForm();
-    }
-
-    @Form(name = "#_form")
-    InvalidForm invalidForm;
-  }
-
-  @ConfigurationClass
-  public static class ConfigurationWithInvalidFormNameAttributeLength {
-    public ConfigurationWithInvalidFormNameAttributeLength() {
-      invalidLengthForm = new InvalidForm();
-    }
-
-    @Form(name = "longest_form_more_than_30_characers")
-    InvalidForm invalidLengthForm;
-  }
-
-  @ConfigurationClass
-  public static class Config {
-
-    public Config() {
-      aForm = new AForm();
-      bForm = new BForm();
-      cForm = new CForm();
-    }
-
-    @Form AForm aForm;
-    @Form BForm bForm;
-    @Form CForm cForm;
-  }
-
-  @ConfigurationClass
-  public static class PrimitiveConfig {
-    @Form DForm dForm;
-  }
-
-  @FormClass
-  public static class AForm {
-    @Input(size = 30)  String a1;
-    @Input(sensitive = true)  String a2;
-  }
-
-  @FormClass
-  public static class BForm {
-    @Input(size = 2) String b1;
-    @Input(size = 3) String b2;
-  }
-
-  @FormClass
-  public static class CForm {
-    @Input Integer intValue;
-    @Input Map<String, String> map;
-    @Input Enumeration enumeration;
-
-    public CForm() {
-      map = new HashMap<String, String>();
-    }
-  }
-
-  @FormClass
-  public static class InvalidForm {
-
-  }
-  @FormClass
-  public static class DForm {
-    @Input int value;
-  }
-
-  public static class ConfigWithout {
-  }
-
-  enum Enumeration {
-    X,
-    Y,
-  }
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java b/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
index af0f450..ba53739 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
@@ -35,14 +35,13 @@ public class TestMAccountableEntity {
    */
   @Test
   public void testInitialization() {
-    List<MForm> forms = new ArrayList<MForm>();
+    List<MConfig> configs = new ArrayList<MConfig>();
     MIntegerInput input = new MIntegerInput("INTEGER-INPUT", false);
     List<MInput<?>> list = new ArrayList<MInput<?>>();
     list.add(input);
-    MForm form = new MForm("FORMNAME", list);
-    forms.add(form);
-    MAccountableEntity link = new MLink(123l, new MConnectionForms(
-        forms), new MConnectionForms(forms));
+    MConfig config = new MConfig("CONFIGNAME", list);
+    configs.add(config);
+    MAccountableEntity link = new MLink(123l, new MLinkConfig(configs));
     // Initially creation date and last update date is same
     assertEquals(link.getCreationDate(), link.getLastUpdateDate());
     Date testCreationDate = new Date();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/model/TestMConfig.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMConfig.java b/common/src/test/java/org/apache/sqoop/model/TestMConfig.java
new file mode 100644
index 0000000..c5a07a0
--- /dev/null
+++ b/common/src/test/java/org/apache/sqoop/model/TestMConfig.java
@@ -0,0 +1,86 @@
+/**
+ * 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.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class TestMConfig {
+
+  /**
+   * Test for initialization
+   */
+  @Test
+  public void testInitialization() {
+    MInput<String> input1 = new MStringInput("sqoopsqoop1", true, (short) 5);
+    MInput<String> input2 = new MStringInput("sqoopsqoop2", true, (short) 5);
+
+    List<MInput<?>> list = new ArrayList<MInput<?>>();
+    list.add(input1);
+    list.add(input2);
+    MConfig mConfig = new MConfig("config", list);
+
+    assertEquals("config", mConfig.getName());
+    assertEquals(2, mConfig.getInputs().size());
+  }
+
+  /**
+   * Test for equals method
+   */
+  @Test
+  public void testEquals() {
+    MInput<Integer> input1 = new MIntegerInput("sqoopsqoop1", false);
+    MInput<Integer> input2 = new MIntegerInput("sqoopsqoop2", false);
+    List<MInput<?>> list1 = new ArrayList<MInput<?>>();
+    list1.add(input1);
+    list1.add(input2);
+    MConfig mform1 = new MConfig("config", list1);
+
+    MInput<Integer> input3 = new MIntegerInput("sqoopsqoop1", false);
+    MInput<Integer> input4 = new MIntegerInput("sqoopsqoop2", false);
+    List<MInput<?>> list2 = new ArrayList<MInput<?>>();
+    list2.add(input3);
+    list2.add(input4);
+    MConfig mform2 = new MConfig("config", list2);
+    assertEquals(mform2, mform1);
+  }
+
+  @Test
+  public void testGetInputs() {
+    MIntegerInput intInput = new MIntegerInput("Config.A", false);
+    MMapInput mapInput = new MMapInput("Config.B", false);
+    MStringInput stringInput = new MStringInput("Config.C", false, (short)3);
+    MEnumInput enumInput = new MEnumInput("Config.D", false, new String[] {"I", "V"});
+
+    List<MInput<?>> inputs = new ArrayList<MInput<?>>();
+    inputs.add(intInput);
+    inputs.add(mapInput);
+    inputs.add(stringInput);
+    inputs.add(enumInput);
+
+    MConfig config = new MConfig("Config", inputs);
+    assertEquals(intInput, config.getIntegerInput("Config.A"));
+    assertEquals(mapInput, config.getMapInput("Config.B"));
+    assertEquals(stringInput, config.getStringInput("Config.C"));
+    assertEquals(enumInput, config.getEnumInput("Config.D"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/model/TestMConfigList.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMConfigList.java b/common/src/test/java/org/apache/sqoop/model/TestMConfigList.java
new file mode 100644
index 0000000..9b60055
--- /dev/null
+++ b/common/src/test/java/org/apache/sqoop/model/TestMConfigList.java
@@ -0,0 +1,55 @@
+/**
+ * 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.model;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestMConfigList {
+  @Test
+  public void testGetInputs() {
+    List<MConfig> configs = new LinkedList<MConfig>();
+
+    MIntegerInput intInput = new MIntegerInput("Config1.A", false);
+    MMapInput mapInput = new MMapInput("Config1.B", false);
+
+    List<MInput<?>> inputs = new ArrayList<MInput<?>>();
+    inputs.add(intInput);
+    inputs.add(mapInput);
+    configs.add(new MConfig("Config1", inputs));
+
+    MStringInput stringInput = new MStringInput("Config2.C", false, (short)3);
+    MEnumInput enumInput = new MEnumInput("Config2.D", false, new String[] {"I", "V"});
+
+    inputs = new ArrayList<MInput<?>>();
+    inputs.add(stringInput);
+    inputs.add(enumInput);
+    configs.add(new MConfig("Config2", inputs));
+
+    MConfigList config = new MConfigList(configs);
+    assertEquals(intInput, config.getIntegerInput("Config1.A"));
+    assertEquals(mapInput, config.getMapInput("Config1.B"));
+    assertEquals(stringInput, config.getStringInput("Config2.C"));
+    assertEquals(enumInput, config.getEnumInput("Config2.D"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/8362c73c/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java b/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java
deleted file mode 100644
index 243fff9..0000000
--- a/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Test class for org.apache.sqoop.model.MConnectionForms
- */
-public class TestMConnectionForms {
-
-  /**
-   * Test for class initialization and values
-   */
-  @Test
-  public void testInitialization() {
-    List<MForm> forms = new ArrayList<MForm>();
-    MConnectionForms connectionForms1 = new MConnectionForms(forms);
-    List<MForm> testForms = new ArrayList<MForm>();
-    assertEquals(testForms, connectionForms1.getForms());
-    MConnectionForms connectionForms2 = new MConnectionForms(testForms);
-    assertEquals(connectionForms2, connectionForms1);
-    // Add a form to list for checking not equals
-    MForm m = new MForm("test", null);
-    testForms.add(m);
-    assertFalse(connectionForms1.equals(connectionForms2));
-  }
-}


Mime
View raw message