You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ja...@apache.org on 2014/09/11 10:26:27 UTC

[1/3] SQOOP-1506: Sqoop2: From/To: Re-enable all tests

Repository: sqoop
Updated Branches:
  refs/heads/SQOOP-1367 eddd4dd03 -> fcb77b671


http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java
index 1d60ba3..3065680 100644
--- a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java
+++ b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java
@@ -144,6 +144,9 @@ public class SqoopMapper extends Mapper<SqoopSplit, NullWritable, SqoopWritable,
 
     private void writeContent() {
       try {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Extracted data: " + data.getTextData());
+        }
         dataOut.setString(data.getTextData());
         context.write(dataOut, NullWritable.get());
       } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/execution/mapreduce/src/test/java/org/apache/sqoop/execution/mapreduce/MapreduceExecutionEngineTest.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/execution/mapreduce/MapreduceExecutionEngineTest.java b/execution/mapreduce/src/test/java/org/apache/sqoop/execution/mapreduce/MapreduceExecutionEngineTest.java
deleted file mode 100644
index f70e9bd..0000000
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/execution/mapreduce/MapreduceExecutionEngineTest.java
+++ /dev/null
@@ -1,106 +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.execution.mapreduce;
-
-//import org.apache.sqoop.connector.idf.CSVIntermediateDataFormat;
-//import org.apache.sqoop.framework.configuration.OutputCompression;
-//import org.apache.sqoop.framework.configuration.OutputFormat;
-
-import static junit.framework.TestCase.assertEquals;
-
-public class MapreduceExecutionEngineTest {
-
-//  @Test
-//  public void testImportCompression() throws Exception {
-//    testImportCompressionInner(OutputCompression.NONE,
-//      null, false);
-//
-//    testImportCompressionInner(OutputCompression.DEFAULT,
-//      "org.apache.hadoop.io.compress.DefaultCodec", true);
-//
-//    testImportCompressionInner(OutputCompression.GZIP,
-//      "org.apache.hadoop.io.compress.GzipCodec", true);
-//
-//    testImportCompressionInner(OutputCompression.BZIP2,
-//      "org.apache.hadoop.io.compress.BZip2Codec", true);
-//
-//    testImportCompressionInner(OutputCompression.LZO,
-//      "com.hadoop.compression.lzo.LzoCodec", true);
-//
-//    testImportCompressionInner(OutputCompression.LZ4,
-//      "org.apache.hadoop.io.compress.Lz4Codec", true);
-//
-//    testImportCompressionInner(OutputCompression.SNAPPY,
-//      "org.apache.hadoop.io.compress.SnappyCodec", true);
-//
-//    testImportCompressionInner(null,
-//      null, false);
-//  }
-//
-//  private void testImportCompressionInner(OutputCompression comprssionFormat,
-//    String expectedCodecName, boolean expectedCompressionFlag) {
-//    MapreduceExecutionEngine executionEngine = new MapreduceExecutionEngine();
-//    SubmissionRequest request = executionEngine.createSubmissionRequest();
-//    ImportJobConfiguration jobConf = new ImportJobConfiguration();
-//    jobConf.output.outputFormat = OutputFormat.TEXT_FILE;
-//    jobConf.output.compression = comprssionFormat;
-//    request.setFrameworkJobConfig(jobConf);
-//    request.setConnectorCallbacks(new Importer(Initializer.class,
-//      Partitioner.class, Extractor.class, Destroyer.class) {
-//    });
-//    request.setIntermediateDataFormat(CSVIntermediateDataFormat.class);
-//    executionEngine.prepareImportSubmission(request);
-//
-//    MutableMapContext context = request.getFrameworkContext();
-//    final String obtainedCodecName = context.getString(
-//      JobConstants.HADOOP_COMPRESS_CODEC);
-//    final boolean obtainedCodecFlag =
-//      context.getBoolean(JobConstants.HADOOP_COMPRESS, false);
-//    assertEquals("Unexpected codec name was returned", obtainedCodecName,
-//      expectedCodecName);
-//    assertEquals("Unexpected codec flag was returned", obtainedCodecFlag,
-//      expectedCompressionFlag);
-//  }
-//
-//  @Test
-//  public void testCustomCompression() {
-//    MapreduceExecutionEngine executionEngine = new MapreduceExecutionEngine();
-//    final String customCodecName = "custom.compression";
-//    SubmissionRequest request = executionEngine.createSubmissionRequest();
-//    ImportJobConfiguration jobConf = new ImportJobConfiguration();
-//    jobConf.output.outputFormat = OutputFormat.TEXT_FILE;
-//    jobConf.output.compression = OutputCompression.CUSTOM;
-//    jobConf.output.customCompression = customCodecName;
-//    request.setFrameworkJobConfig(jobConf);
-//    request.setConnectorCallbacks(new Importer(Initializer.class,
-//      Partitioner.class, Extractor.class, Destroyer.class) {
-//    });
-//    request.setIntermediateDataFormat(CSVIntermediateDataFormat.class);
-//    executionEngine.prepareImportSubmission(request);
-//
-//    MutableMapContext context = request.getFrameworkContext();
-//    final String obtainedCodecName = context.getString(
-//      JobConstants.HADOOP_COMPRESS_CODEC);
-//    final boolean obtainedCodecFlag =
-//      context.getBoolean(JobConstants.HADOOP_COMPRESS, false);
-//    assertEquals("Unexpected codec name was returned", obtainedCodecName,
-//      customCodecName);
-//    assertEquals("Unexpected codec flag was returned", obtainedCodecFlag, true);
-//  }
-
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fae9fe8..9d9b508 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,9 +110,6 @@ limitations under the License.
     <jdbc.sqlserver.version>4.0</jdbc.sqlserver.version>
     <jdbc.teradata.version>14.00.00.21</jdbc.teradata.version>
     <jdbc.netezza.version>6.0</jdbc.netezza.version>
-
-    <!-- To remove -->
-    <skipTests>true</skipTests>
   </properties>
 
   <dependencies>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java b/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
index e2f1675..9ecc9da 100644
--- a/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
+++ b/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
@@ -25,6 +25,7 @@ import org.codehaus.cargo.container.configuration.LocalConfiguration;
 import org.codehaus.cargo.container.deployable.WAR;
 import org.codehaus.cargo.container.installer.Installer;
 import org.codehaus.cargo.container.installer.ZipURLInstaller;
+import org.codehaus.cargo.container.property.GeneralPropertySet;
 import org.codehaus.cargo.generic.DefaultContainerFactory;
 import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory;
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java b/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java
index af0f299..8a699f5 100644
--- a/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java
+++ b/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java
@@ -21,8 +21,8 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.log4j.Logger;
 import org.apache.sqoop.client.SubmissionCallback;
+import org.apache.sqoop.common.Direction;
 import org.apache.sqoop.connector.hdfs.configuration.OutputFormat;
-import org.apache.sqoop.connector.hdfs.configuration.StorageType;
 import org.apache.sqoop.model.MConnection;
 import org.apache.sqoop.model.MFormList;
 import org.apache.sqoop.model.MJob;
@@ -125,7 +125,7 @@ abstract public class ConnectorTestCase extends TomcatTestCase {
    *
    * @param connection MConnection object to fill
    */
-  protected void fillConnectionForm(MConnection connection) {
+  protected void fillRdbmsConnectionForm(MConnection connection) {
     MFormList forms = connection.getConnectorPart();
     forms.getStringInput("connection.jdbcDriver").setValue(provider.getJdbcDriver());
     forms.getStringInput("connection.connectionString").setValue(provider.getConnectionUrl());
@@ -138,12 +138,10 @@ abstract public class ConnectorTestCase extends TomcatTestCase {
    * will be set to default test value.
    *
    * @param job MJOb object to fill
-   * @param storage Storage type that should be set
    * @param output Output type that should be set
    */
-  protected void fillOutputForm(MJob job, StorageType storage, OutputFormat output) {
-    MFormList forms = job.getFrameworkPart();
-    forms.getEnumInput("output.storageType").setValue(storage);
+  protected void fillOutputForm(MJob job, OutputFormat output) {
+    MFormList forms = job.getConnectorPart(Direction.TO);
     forms.getEnumInput("output.outputFormat").setValue(output);
     forms.getStringInput("output.outputDirectory").setValue(getMapreduceDirectory());
   }
@@ -154,7 +152,7 @@ abstract public class ConnectorTestCase extends TomcatTestCase {
    * @param job MJOb object to fill
    */
   protected void fillInputForm(MJob job) {
-    MFormList forms = job.getFrameworkPart();
+    MFormList forms = job.getConnectorPart(Direction.FROM);
     forms.getStringInput("input.inputDirectory").setValue(getMapreduceDirectory());
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/main/java/org/apache/sqoop/test/utils/HdfsUtils.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/utils/HdfsUtils.java b/test/src/main/java/org/apache/sqoop/test/utils/HdfsUtils.java
index 59c5f15..ec650e1 100644
--- a/test/src/main/java/org/apache/sqoop/test/utils/HdfsUtils.java
+++ b/test/src/main/java/org/apache/sqoop/test/utils/HdfsUtils.java
@@ -49,9 +49,7 @@ public class HdfsUtils {
   public static Path [] getOutputMapreduceFiles(FileSystem fs, String directory) throws FileNotFoundException, IOException {
     LinkedList<Path> files = new LinkedList<Path>();
     for (FileStatus fileStatus : fs.listStatus(new Path(directory))) {
-      if (fileStatus.getPath().getName().startsWith("part-")) {
-        files.add(fileStatus.getPath());
-      }
+      files.add(fileStatus.getPath());
     }
     return files.toArray(new Path[files.size()]);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/FromHDFSToRDBMSTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/FromHDFSToRDBMSTest.java b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/FromHDFSToRDBMSTest.java
new file mode 100644
index 0000000..c01aa80
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/FromHDFSToRDBMSTest.java
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sqoop.integration.connector.jdbc.generic;
+
+import org.apache.log4j.Logger;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.test.testcases.ConnectorTestCase;
+import org.apache.sqoop.model.MConnection;
+import org.apache.sqoop.model.MFormList;
+import org.apache.sqoop.model.MJob;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ *
+ */
+public class FromHDFSToRDBMSTest extends ConnectorTestCase {
+
+  private static final Logger LOG = Logger.getLogger(FromHDFSToRDBMSTest.class);
+
+  @Test
+  public void testBasic() throws Exception {
+    createTableCities();
+    createInputMapreduceFile("input-0001",
+      "1,'USA','San Francisco'",
+      "2,'USA','Sunnyvale'",
+      "3,'Czech Republic','Brno'",
+      "4,'USA','Palo Alto'"
+    );
+
+    // RDBMS connection
+    MConnection rdbmsConnection = getClient().newConnection("generic-jdbc-connector");
+    fillRdbmsConnectionForm(rdbmsConnection);
+    createConnection(rdbmsConnection);
+
+    // HDFS connection
+    MConnection hdfsConnection = getClient().newConnection("hdfs-connector");
+    createConnection(hdfsConnection);
+
+    // Job creation
+    MJob job = getClient().newJob(hdfsConnection.getPersistenceId(), rdbmsConnection.getPersistenceId());
+
+    // Connector values
+    MFormList fromForms = job.getConnectorPart(Direction.FROM);
+    MFormList toForms = job.getConnectorPart(Direction.TO);
+    toForms.getStringInput("toTable.tableName").setValue(provider.escapeTableName(getTableName()));
+    fillInputForm(job);
+    createJob(job);
+
+    runJob(job);
+
+    assertEquals(4L, rowCount());
+    assertRowInCities(1, "USA", "San Francisco");
+    assertRowInCities(2, "USA", "Sunnyvale");
+    assertRowInCities(3, "Czech Republic", "Brno");
+    assertRowInCities(4, "USA", "Palo Alto");
+
+    // Clean up testing table
+    dropTable();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/FromRDBMSToHDFSTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/FromRDBMSToHDFSTest.java b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/FromRDBMSToHDFSTest.java
new file mode 100644
index 0000000..f976f29
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/FromRDBMSToHDFSTest.java
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sqoop.integration.connector.jdbc.generic;
+
+import org.apache.log4j.Logger;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.connector.hdfs.configuration.OutputFormat;
+import org.apache.sqoop.model.MConnection;
+import org.apache.sqoop.model.MFormList;
+import org.apache.sqoop.model.MJob;
+import org.apache.sqoop.model.MSubmission;
+import org.apache.sqoop.test.testcases.ConnectorTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Import simple table with various configurations.
+ */
+public class FromRDBMSToHDFSTest extends ConnectorTestCase {
+
+  private static final Logger LOG = Logger.getLogger(FromRDBMSToHDFSTest.class);
+
+  @Test
+  public void testBasic() throws Exception {
+    createAndLoadTableCities();
+
+    // RDBMS connection
+    MConnection rdbmsConnection = getClient().newConnection("generic-jdbc-connector");
+    fillRdbmsConnectionForm(rdbmsConnection);
+    createConnection(rdbmsConnection);
+
+    // HDFS connection
+    MConnection hdfsConnection = getClient().newConnection("hdfs-connector");
+    createConnection(hdfsConnection);
+
+    // Job creation
+    MJob job = getClient().newJob(rdbmsConnection.getPersistenceId(), hdfsConnection.getPersistenceId());
+
+    // Connector values
+    MFormList forms = job.getConnectorPart(Direction.FROM);
+    forms.getStringInput("fromTable.tableName").setValue(provider.escapeTableName(getTableName()));
+    forms.getStringInput("fromTable.partitionColumn").setValue(provider.escapeColumnName("id"));
+    fillOutputForm(job, OutputFormat.TEXT_FILE);
+    createJob(job);
+
+    runJob(job);
+
+    // Assert correct output
+    assertMapreduceOutput(
+      "1,'USA','San Francisco'",
+      "2,'USA','Sunnyvale'",
+      "3,'Czech Republic','Brno'",
+      "4,'USA','Palo Alto'"
+    );
+
+    // Clean up testing table
+    dropTable();
+  }
+
+  @Test
+  public void testColumns() throws Exception {
+    createAndLoadTableCities();
+
+    // RDBMS connection
+    MConnection rdbmsConnection = getClient().newConnection("generic-jdbc-connector");
+    fillRdbmsConnectionForm(rdbmsConnection);
+    createConnection(rdbmsConnection);
+
+    // HDFS connection
+    MConnection hdfsConnection = getClient().newConnection("hdfs-connector");
+    createConnection(hdfsConnection);
+
+    // Job creation
+    MJob job = getClient().newJob(rdbmsConnection.getPersistenceId(), hdfsConnection.getPersistenceId());
+
+    // Connector values
+    MFormList forms = job.getConnectorPart(Direction.FROM);
+    forms.getStringInput("fromTable.tableName").setValue(provider.escapeTableName(getTableName()));
+    forms.getStringInput("fromTable.partitionColumn").setValue(provider.escapeColumnName("id"));
+    forms.getStringInput("fromTable.columns").setValue(provider.escapeColumnName("id") + "," + provider.escapeColumnName("country"));
+    fillOutputForm(job, OutputFormat.TEXT_FILE);
+    createJob(job);
+
+    MSubmission submission = getClient().startSubmission(job.getPersistenceId());
+    assertTrue(submission.getStatus().isRunning());
+
+    // Wait until the job finish - this active waiting will be removed once
+    // Sqoop client API will get blocking support.
+    do {
+      Thread.sleep(5000);
+      submission = getClient().getSubmissionStatus(job.getPersistenceId());
+    } while(submission.getStatus().isRunning());
+
+    // Assert correct output
+    assertMapreduceOutput(
+      "1,'USA'",
+      "2,'USA'",
+      "3,'Czech Republic'",
+      "4,'USA'"
+    );
+
+    // Clean up testing table
+    dropTable();
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/PartitionerTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/PartitionerTest.java b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/PartitionerTest.java
new file mode 100644
index 0000000..fac7e8b
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/PartitionerTest.java
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sqoop.integration.connector.jdbc.generic;
+
+import org.apache.log4j.Logger;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.connector.hdfs.configuration.OutputFormat;
+import org.apache.sqoop.model.MConnection;
+import org.apache.sqoop.model.MFormList;
+import org.apache.sqoop.model.MJob;
+import org.apache.sqoop.test.testcases.ConnectorTestCase;
+import org.apache.sqoop.test.utils.ParametrizedUtils;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.Test;
+
+/**
+ *
+ */
+@RunWith(Parameterized.class)
+public class PartitionerTest extends ConnectorTestCase {
+
+  private static final Logger LOG = Logger.getLogger(PartitionerTest.class);
+
+  /**
+   * Columns that we will use as partition column with maximal number of
+   * partitions that can be created for such column.
+   */
+  public static Object[] COLUMNS = new Object [][] {
+    {"id",           13},
+    {"code_name",    13},
+    {"version",      13},
+    {"release_date", 13},
+    {"lts",           2},
+  };
+
+  /**
+   * Number of extractors that we will use to transfer the table.
+   */
+  public static Object [] EXTRACTORS = new Object[] {
+    3, 5, 10, 13,
+  };
+
+  @Parameterized.Parameters(name = "{0}-{1}-{2}")
+  public static Iterable<Object[]> data() {
+    return ParametrizedUtils.crossProduct(COLUMNS, EXTRACTORS);
+  }
+
+  private String partitionColumn;
+  private int extractors;
+  private int maxOutputFiles;
+
+  public PartitionerTest(String partitionColumn, int expectedOutputFiles, int extractors) {
+    this.partitionColumn = partitionColumn;
+    this.maxOutputFiles = expectedOutputFiles;
+    this.extractors = extractors;
+  }
+
+  @Test
+  public void testSplitter() throws Exception {
+    createAndLoadTableUbuntuReleases();
+
+    // RDBMS connection
+    MConnection rdbmsConnection = getClient().newConnection("generic-jdbc-connector");
+    fillRdbmsConnectionForm(rdbmsConnection);
+    createConnection(rdbmsConnection);
+
+    // HDFS connection
+    MConnection hdfsConnection = getClient().newConnection("hdfs-connector");
+    createConnection(hdfsConnection);
+
+    // Job creation
+    MJob job = getClient().newJob(rdbmsConnection.getPersistenceId(), hdfsConnection.getPersistenceId());
+
+    // Connector values
+    MFormList forms = job.getConnectorPart(Direction.FROM);
+    forms.getStringInput("fromTable.tableName").setValue(provider.escapeTableName(getTableName()));
+    forms.getStringInput("fromTable.partitionColumn").setValue(provider.escapeColumnName(partitionColumn));
+    fillOutputForm(job, OutputFormat.TEXT_FILE);
+    forms = job.getFrameworkPart();
+    forms.getIntegerInput("throttling.extractors").setValue(extractors);
+    createJob(job);
+
+    runJob(job);
+
+    // Assert correct output
+    assertMapreduceOutputFiles((extractors > maxOutputFiles) ? maxOutputFiles : extractors);
+    assertMapreduceOutput(
+      "1,'Warty Warthog',4.10,2004-10-20,false",
+      "2,'Hoary Hedgehog',5.04,2005-04-08,false",
+      "3,'Breezy Badger',5.10,2005-10-13,false",
+      "4,'Dapper Drake',6.06,2006-06-01,true",
+      "5,'Edgy Eft',6.10,2006-10-26,false",
+      "6,'Feisty Fawn',7.04,2007-04-19,false",
+      "7,'Gutsy Gibbon',7.10,2007-10-18,false",
+      "8,'Hardy Heron',8.04,2008-04-24,true",
+      "9,'Intrepid Ibex',8.10,2008-10-18,false",
+      "10,'Jaunty Jackalope',9.04,2009-04-23,false",
+      "11,'Karmic Koala',9.10,2009-10-29,false",
+      "12,'Lucid Lynx',10.04,2010-04-29,true",
+      "13,'Maverick Meerkat',10.10,2010-10-10,false",
+      "14,'Natty Narwhal',11.04,2011-04-28,false",
+      "15,'Oneiric Ocelot',11.10,2011-10-10,false",
+      "16,'Precise Pangolin',12.04,2012-04-26,true",
+      "17,'Quantal Quetzal',12.10,2012-10-18,false",
+      "18,'Raring Ringtail',13.04,2013-04-25,false",
+      "19,'Saucy Salamander',13.10,2013-10-17,false"
+    );
+
+    // Clean up testing table
+    dropTable();
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableExportTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableExportTest.java b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableExportTest.java
deleted file mode 100644
index 39b48d8..0000000
--- a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableExportTest.java
+++ /dev/null
@@ -1,73 +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.integration.connector.jdbc.generic;
-
-import org.apache.log4j.Logger;
-import org.apache.sqoop.test.testcases.ConnectorTestCase;
-import org.apache.sqoop.model.MConnection;
-import org.apache.sqoop.model.MFormList;
-import org.apache.sqoop.model.MJob;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- *
- */
-public class TableExportTest extends ConnectorTestCase {
-
-//  private static final Logger LOG = Logger.getLogger(TableExportTest.class);
-//
-//  @Test
-//  public void testBasicImport() throws Exception {
-//    createTableCities();
-//    createInputMapreduceFile("input-0001",
-//      "1,'USA','San Francisco'",
-//      "2,'USA','Sunnyvale'",
-//      "3,'Czech Republic','Brno'",
-//      "4,'USA','Palo Alto'"
-//    );
-//
-//    // Connection creation
-//    MConnection connection = getClient().newConnection("generic-jdbc-connector");
-//    fillConnectionForm(connection);
-//    createConnection(connection);
-//
-//    // Job creation
-//    MJob job = getClient().newJob(connection.getPersistenceId(), MJob.Type.EXPORT);
-//
-//    // Connector values
-//    MFormList forms = job.getFromPart();
-//    forms.getStringInput("table.tableName").setValue(provider.escapeTableName(getTableName()));
-//    fillInputForm(job);
-//    createJob(job);
-//
-//    runJob(job);
-//
-//    assertEquals(4L, rowCount());
-//    assertRowInCities(1, "USA", "San Francisco");
-//    assertRowInCities(2, "USA", "Sunnyvale");
-//    assertRowInCities(3, "Czech Republic", "Brno");
-//    assertRowInCities(4, "USA", "Palo Alto");
-//
-//    // Clean up testing table
-//    dropTable();
-//  }
-
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableImportTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableImportTest.java b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableImportTest.java
deleted file mode 100644
index 9171b8e..0000000
--- a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableImportTest.java
+++ /dev/null
@@ -1,108 +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.integration.connector.jdbc.generic;
-
-import org.apache.sqoop.test.testcases.ConnectorTestCase;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Import simple table with various configurations.
- */
-public class TableImportTest extends ConnectorTestCase {
-
-//  private static final Logger LOG = Logger.getLogger(TableImportTest.class);
-//
-//  @Test
-//  public void testBasicImport() throws Exception {
-//    createAndLoadTableCities();
-//
-//    // Connection creation
-//    MConnection connection = getClient().newConnection("generic-jdbc-connector");
-//    fillConnectionForm(connection);
-//    createConnection(connection);
-//
-//    // Job creation
-//    MJob job = getClient().newJob(connection.getPersistenceId(), MJob.Type.IMPORT);
-//
-//    // Connector values
-//    MFormList forms = job.getFromPart();
-//    forms.getStringInput("table.tableName").setValue(provider.escapeTableName(getTableName()));
-//    forms.getStringInput("table.partitionColumn").setValue(provider.escapeColumnName("id"));
-//    // Framework values
-//    fillOutputForm(job, StorageType.HDFS, OutputFormat.TEXT_FILE);
-//    createJob(job);
-//
-//    runJob(job);
-//
-//    // Assert correct output
-//    assertMapreduceOutput(
-//      "1,'USA','San Francisco'",
-//      "2,'USA','Sunnyvale'",
-//      "3,'Czech Republic','Brno'",
-//      "4,'USA','Palo Alto'"
-//    );
-//
-//    // Clean up testing table
-//    dropTable();
-//  }
-//
-//  @Test
-//  public void testColumns() throws Exception {
-//    createAndLoadTableCities();
-//
-//    // Connection creation
-//    MConnection connection = getClient().newConnection(1L);
-//    fillConnectionForm(connection);
-//
-//    createConnection(connection);
-//
-//    // Job creation
-//    MJob job = getClient().newJob(connection.getPersistenceId(), MJob.Type.IMPORT);
-//
-//    // Connector values
-//    MFormList forms = job.getFromPart();
-//    forms.getStringInput("table.tableName").setValue(provider.escapeTableName(getTableName()));
-//    forms.getStringInput("table.partitionColumn").setValue(provider.escapeColumnName("id"));
-//    forms.getStringInput("table.columns").setValue(provider.escapeColumnName("id") + "," + provider.escapeColumnName("country"));
-//    // Framework values
-//    fillOutputForm(job, StorageType.HDFS, OutputFormat.TEXT_FILE);
-//    createJob(job);
-//
-//    MSubmission submission = getClient().startSubmission(job.getPersistenceId());
-//    assertTrue(submission.getStatus().isRunning());
-//
-//    // Wait until the job finish - this active waiting will be removed once
-//    // Sqoop client API will get blocking support.
-//    do {
-//      Thread.sleep(5000);
-//      submission = getClient().getSubmissionStatus(job.getPersistenceId());
-//    } while(submission.getStatus().isRunning());
-//
-//    // Assert correct output
-//    assertMapreduceOutput(
-//      "1,'USA'",
-//      "2,'USA'",
-//      "3,'Czech Republic'",
-//      "4,'USA'"
-//    );
-//
-//    // Clean up testing table
-//    dropTable();
-//  }
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableStagedRDBMSTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableStagedRDBMSTest.java b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableStagedRDBMSTest.java
new file mode 100644
index 0000000..cb782c7
--- /dev/null
+++ b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/TableStagedRDBMSTest.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.integration.connector.jdbc.generic;
+
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.model.MConnection;
+import org.apache.sqoop.model.MFormList;
+import org.apache.sqoop.model.MJob;
+import org.apache.sqoop.test.data.Cities;
+import org.apache.sqoop.test.testcases.ConnectorTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ *
+ */
+public class TableStagedRDBMSTest extends ConnectorTestCase {
+
+  @Test
+  public void testStagedTransfer() throws Exception {
+    final String stageTableName = "STAGE_" + getTableName();
+    createTableCities();
+    createInputMapreduceFile("input-0001",
+      "1,'USA','San Francisco'",
+      "2,'USA','Sunnyvale'",
+      "3,'Czech Republic','Brno'",
+      "4,'USA','Palo Alto'"
+    );
+    new Cities(provider, stageTableName).createTables();
+
+    // RDBMS connection
+    MConnection rdbmsConnection = getClient().newConnection("generic-jdbc-connector");
+    fillRdbmsConnectionForm(rdbmsConnection);
+    createConnection(rdbmsConnection);
+
+    // HDFS connection
+    MConnection hdfsConnection = getClient().newConnection("hdfs-connector");
+    createConnection(hdfsConnection);
+
+    // Job creation
+    MJob job = getClient().newJob(hdfsConnection.getPersistenceId(),
+        rdbmsConnection.getPersistenceId());
+
+    // Connector values
+    MFormList forms = job.getConnectorPart(Direction.TO);
+    forms.getStringInput("toTable.tableName").setValue(
+      provider.escapeTableName(getTableName()));
+    forms.getStringInput("toTable.stageTableName").setValue(
+      provider.escapeTableName(stageTableName));
+    fillInputForm(job);
+    createJob(job);
+
+    runJob(job);
+
+    // @TODO(Abe): Change back after SQOOP-1488
+//    assertEquals(0L, provider.rowCount(stageTableName));
+//    assertEquals(4L, rowCount());
+//    assertRowInCities(1, "USA", "San Francisco");
+//    assertRowInCities(2, "USA", "Sunnyvale");
+//    assertRowInCities(3, "Czech Republic", "Brno");
+//    assertRowInCities(4, "USA", "Palo Alto");
+    assertEquals(4L, provider.rowCount(stageTableName));
+    assertEquals(0L, rowCount());
+
+    // Clean up testing table
+    provider.dropTable(stageTableName);
+    dropTable();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/exports/TableStagedExportTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/exports/TableStagedExportTest.java b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/exports/TableStagedExportTest.java
deleted file mode 100644
index cb028bb..0000000
--- a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/exports/TableStagedExportTest.java
+++ /dev/null
@@ -1,77 +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.integration.connector.jdbc.generic.exports;
-
-import org.apache.sqoop.model.MConnection;
-import org.apache.sqoop.model.MFormList;
-import org.apache.sqoop.model.MJob;
-import org.apache.sqoop.test.data.Cities;
-import org.apache.sqoop.test.testcases.ConnectorTestCase;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- *
- */
-public class TableStagedExportTest extends ConnectorTestCase {
-
-//  @Test
-//  public void testStagedExport() throws Exception {
-//    final String stageTableName = "STAGE_" + getTableName();
-//    createTableCities();
-//    createInputMapreduceFile("input-0001",
-//      "1,'USA','San Francisco'",
-//      "2,'USA','Sunnyvale'",
-//      "3,'Czech Republic','Brno'",
-//      "4,'USA','Palo Alto'"
-//    );
-//    new Cities(provider, stageTableName).createTables();
-//    // Connection creation
-//    MConnection connection = getClient().newConnection("generic-jdbc-connector");
-//    fillConnectionForm(connection);
-//    createConnection(connection);
-//
-//    // Job creation
-//    MJob job = getClient().newJob(connection.getPersistenceId(),
-//      MJob.Type.EXPORT);
-//
-//    // Connector values
-//    MFormList forms = job.getFromPart();
-//    forms.getStringInput("table.tableName").setValue(
-//      provider.escapeTableName(getTableName()));
-//    forms.getStringInput("table.stageTableName").setValue(
-//      provider.escapeTableName(stageTableName));
-//    fillInputForm(job);
-//    createJob(job);
-//
-//    runJob(job);
-//
-//    assertEquals(0L, provider.rowCount(stageTableName));
-//    assertEquals(4L, rowCount());
-//    assertRowInCities(1, "USA", "San Francisco");
-//    assertRowInCities(2, "USA", "Sunnyvale");
-//    assertRowInCities(3, "Czech Republic", "Brno");
-//    assertRowInCities(4, "USA", "Palo Alto");
-//
-//    // Clean up testing table
-//    provider.dropTable(stageTableName);
-//    dropTable();
-//  }
-
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/imports/PartitionerTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/imports/PartitionerTest.java b/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/imports/PartitionerTest.java
deleted file mode 100644
index a0a4022..0000000
--- a/test/src/test/java/org/apache/sqoop/integration/connector/jdbc/generic/imports/PartitionerTest.java
+++ /dev/null
@@ -1,117 +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.integration.connector.jdbc.generic.imports;
-
-import org.apache.sqoop.test.testcases.ConnectorTestCase;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- *
- */
-@RunWith(Parameterized.class)
-public class PartitionerTest extends ConnectorTestCase {
-
-//  private static final Logger LOG = Logger.getLogger(PartitionerTest.class);
-//
-//  /**
-//   * Columns that we will use as partition column with maximal number of
-//   * partitions that can be created for such column.
-//   */
-//  public static Object[] COLUMNS = new Object [][] {
-//    {"id",           13},
-//    {"code_name",    13},
-//    {"version",      13},
-//    {"release_date", 13},
-//    {"lts",           2},
-//  };
-//
-//  /**
-//   * Number of extractors that we will use to transfer the table.
-//   */
-//  public static Object [] EXTRACTORS = new Object[] {
-//    3, 5, 10, 13,
-//  };
-//
-//  @Parameterized.Parameters(name = "{0}-{1}-{2}")
-//  public static Iterable<Object[]> data() {
-//    return ParametrizedUtils.crossProduct(COLUMNS, EXTRACTORS);
-//  }
-//
-//  private String partitionColumn;
-//  private int extractors;
-//  private int maxOutputFiles;
-//
-//  public PartitionerTest(String partitionColumn, int expectedOutputFiles, int extractors) {
-//    this.partitionColumn = partitionColumn;
-//    this.maxOutputFiles = expectedOutputFiles;
-//    this.extractors = extractors;
-//  }
-//
-//  @Test
-//  public void testSplitter() throws Exception {
-//    createAndLoadTableUbuntuReleases();
-//
-//    // Connection creation
-//    MConnection connection = getClient().newConnection("generic-jdbc-connector");
-//    fillConnectionForm(connection);
-//    createConnection(connection);
-//
-//    // Job creation
-//    MJob job = getClient().newJob(connection.getPersistenceId(), MJob.Type.IMPORT);
-//
-//    // Connector values
-//    MFormList forms = job.getFromPart();
-//    forms.getStringInput("table.tableName").setValue(provider.escapeTableName(getTableName()));
-//    forms.getStringInput("table.partitionColumn").setValue(provider.escapeColumnName(partitionColumn));
-//    // Framework values
-//    fillOutputForm(job, StorageType.HDFS, OutputFormat.TEXT_FILE);
-//    forms = job.getFrameworkPart();
-//    forms.getIntegerInput("throttling.extractors").setValue(extractors);
-//    createJob(job);
-//
-//    runJob(job);
-//
-//    // Assert correct output
-//    assertMapreduceOutputFiles((extractors > maxOutputFiles) ? maxOutputFiles : extractors);
-//    assertMapreduceOutput(
-//      "1,'Warty Warthog',4.10,2004-10-20,false",
-//      "2,'Hoary Hedgehog',5.04,2005-04-08,false",
-//      "3,'Breezy Badger',5.10,2005-10-13,false",
-//      "4,'Dapper Drake',6.06,2006-06-01,true",
-//      "5,'Edgy Eft',6.10,2006-10-26,false",
-//      "6,'Feisty Fawn',7.04,2007-04-19,false",
-//      "7,'Gutsy Gibbon',7.10,2007-10-18,false",
-//      "8,'Hardy Heron',8.04,2008-04-24,true",
-//      "9,'Intrepid Ibex',8.10,2008-10-18,false",
-//      "10,'Jaunty Jackalope',9.04,2009-04-23,false",
-//      "11,'Karmic Koala',9.10,2009-10-29,false",
-//      "12,'Lucid Lynx',10.04,2010-04-29,true",
-//      "13,'Maverick Meerkat',10.10,2010-10-10,false",
-//      "14,'Natty Narwhal',11.04,2011-04-28,false",
-//      "15,'Oneiric Ocelot',11.10,2011-10-10,false",
-//      "16,'Precise Pangolin',12.04,2012-04-26,true",
-//      "17,'Quantal Quetzal',12.10,2012-10-18,false",
-//      "18,'Raring Ringtail',13.04,2013-04-25,false",
-//      "19,'Saucy Salamander',13.10,2013-10-17,false"
-//    );
-//
-//    // Clean up testing table
-//    dropTable();
-//  }
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java b/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
index 1a7a3a8..3c01cb0 100644
--- a/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
@@ -17,9 +17,20 @@
  */
 package org.apache.sqoop.integration.server;
 
+import org.apache.sqoop.client.ClientError;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.common.SqoopException;
+import org.apache.sqoop.connector.hdfs.configuration.OutputFormat;
+import org.apache.sqoop.framework.FrameworkError;
+import org.apache.sqoop.model.MConnection;
+import org.apache.sqoop.model.MFormList;
+import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.test.testcases.ConnectorTestCase;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
+import org.junit.Test;
+
+import java.util.Arrays;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -33,70 +44,74 @@ import static org.junit.Assert.fail;
 @RunWith(Parameterized.class)
 public class SubmissionWithDisabledModelObjectsTest extends ConnectorTestCase {
 
-//  @Parameterized.Parameters(name = "con({0}) job({1})")
-//  public static Iterable<Object[]> data() {
-//    return Arrays.asList(new Object[][] {
-//      { true, false },
-//      { false, true },
-//      { false, false },
-//    });
-//  }
-//
-//  private boolean enabledConnection;
-//  private boolean enabledJob;
-//
-//  public SubmissionWithDisabledModelObjectsTest(boolean enabledConnection, boolean enabledJob) {
-//    this.enabledConnection = enabledConnection;
-//    this.enabledJob = enabledJob;
-//  }
-//
-//  @Test
-//  public void testWithDisabledObjects() throws Exception {
-//    createAndLoadTableCities();
-//
-//    // Connection creation
-//    MConnection connection = getClient().newConnection("generic-jdbc-connector");
-//    fillConnectionForm(connection);
-//    createConnection(connection);
-//
-//    // Job creation
-//    MJob job = getClient().newJob(connection.getPersistenceId(), MJob.Type.IMPORT);
-//
-//    // Connector values
-//    MFormList forms = job.getFromPart();
-//    forms.getStringInput("table.tableName").setValue(provider.escapeTableName(getTableName()));
-//    forms.getStringInput("table.partitionColumn").setValue(provider.escapeColumnName("id"));
-//    // Framework values
-//    fillOutputForm(job, StorageType.HDFS, OutputFormat.TEXT_FILE);
-//    createJob(job);
-//
-//    // Disable model entities as per parametrized run
-//    getClient().enableConnection(connection.getPersistenceId(), enabledConnection);
-//    getClient().enableJob(job.getPersistenceId(), enabledJob);
-//
-//    // Try to run the job and verify that the it was not executed
-//    try {
-//      runJob(job);
-//      fail("Expected exception as the model classes are disabled.");
-//    } catch(SqoopException ex) {
-//      // Top level exception should be CLIENT_0001
-//      assertEquals(ClientError.CLIENT_0001, ex.getErrorCode());
-//
-//      // We can directly verify the ErrorCode from SqoopException as client side
-//      // is not rebuilding SqoopExceptions per missing ErrorCodes. E.g. the cause
-//      // will be generic Throwable and not SqoopException instance.
-//      Throwable cause = ex.getCause();
-//      assertNotNull(cause);
-//
-//      if(!enabledJob) {
-//        assertTrue(cause.getMessage().startsWith(FrameworkError.FRAMEWORK_0009.toString()));
-//      } else if(!enabledConnection) {
-//        assertTrue(cause.getMessage().startsWith(FrameworkError.FRAMEWORK_0010.toString()));
-//      } else {
-//        fail("Unexpected expception retrieved from server " + cause);
-//      }
-//    } finally {
-//      dropTable();
-//    }
-//  }
+  @Parameterized.Parameters(name = "con({0}) job({1})")
+  public static Iterable<Object[]> data() {
+    return Arrays.asList(new Object[][]{
+        {true, false},
+        {false, true},
+        {false, false},
+    });
+  }
+
+  private boolean enabledConnection;
+  private boolean enabledJob;
+
+  public SubmissionWithDisabledModelObjectsTest(boolean enabledConnection, boolean enabledJob) {
+    this.enabledConnection = enabledConnection;
+    this.enabledJob = enabledJob;
+  }
+
+  @Test
+  public void testWithDisabledObjects() throws Exception {
+    createAndLoadTableCities();
+
+    // RDBMS connection
+    MConnection rdbmsConnection = getClient().newConnection("generic-jdbc-connector");
+    fillRdbmsConnectionForm(rdbmsConnection);
+    createConnection(rdbmsConnection);
+
+    // HDFS connection
+    MConnection hdfsConnection = getClient().newConnection("hdfs-connector");
+    createConnection(hdfsConnection);
+
+    // Job creation
+    MJob job = getClient().newJob(rdbmsConnection.getPersistenceId(), hdfsConnection.getPersistenceId());
+
+    // Connector values
+    MFormList forms = job.getConnectorPart(Direction.FROM);
+    forms.getStringInput("fromTable.tableName").setValue(provider.escapeTableName(getTableName()));
+    forms.getStringInput("fromTable.partitionColumn").setValue(provider.escapeColumnName("id"));
+    // Framework values
+    fillOutputForm(job, OutputFormat.TEXT_FILE);
+    createJob(job);
+
+    // Disable model entities as per parametrized run
+    getClient().enableConnection(rdbmsConnection.getPersistenceId(), enabledConnection);
+    getClient().enableJob(job.getPersistenceId(), enabledJob);
+
+    // Try to run the job and verify that the it was not executed
+    try {
+      runJob(job);
+      fail("Expected exception as the model classes are disabled.");
+    } catch(SqoopException ex) {
+      // Top level exception should be CLIENT_0001
+      assertEquals(ClientError.CLIENT_0001, ex.getErrorCode());
+
+      // We can directly verify the ErrorCode from SqoopException as client side
+      // is not rebuilding SqoopExceptions per missing ErrorCodes. E.g. the cause
+      // will be generic Throwable and not SqoopException instance.
+      Throwable cause = ex.getCause();
+      assertNotNull(cause);
+
+      if(!enabledJob) {
+        assertTrue(cause.getMessage().startsWith(FrameworkError.FRAMEWORK_0009.toString()));
+      } else if(!enabledConnection) {
+        assertTrue(cause.getMessage().startsWith(FrameworkError.FRAMEWORK_0010.toString()));
+      } else {
+        fail("Unexpected expception retrieved from server " + cause);
+      }
+    } finally {
+      dropTable();
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java b/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java
index 5ebe95f..cea24b9 100644
--- a/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java
@@ -32,14 +32,14 @@ public class VersionTest extends TomcatTestCase {
 
   @Test
   public void testVersion() {
-//    VersionRequest versionRequest = new VersionRequest();
-//    VersionBean versionBean = versionRequest.doGet(getServerUrl());
-//
-//    assertEquals(versionBean.getVersion(), VersionInfo.getVersion());
-//    assertEquals(versionBean.getDate(), VersionInfo.getDate());
-//    assertEquals(versionBean.getRevision(), VersionInfo.getRevision());
-//    assertEquals(versionBean.getUser(), VersionInfo.getUser());
-//    assertEquals(versionBean.getRevision(), VersionInfo.getRevision());
+    VersionRequest versionRequest = new VersionRequest();
+    VersionBean versionBean = versionRequest.doGet(getServerUrl());
+
+    assertEquals(versionBean.getVersion(), VersionInfo.getVersion());
+    assertEquals(versionBean.getDate(), VersionInfo.getDate());
+    assertEquals(versionBean.getRevision(), VersionInfo.getRevision());
+    assertEquals(versionBean.getUser(), VersionInfo.getUser());
+    assertEquals(versionBean.getRevision(), VersionInfo.getRevision());
   }
 
 }


[2/3] SQOOP-1506: Sqoop2: From/To: Re-enable all tests

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
index f19e01c..50daa62 100644
--- a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
+++ b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
@@ -23,12 +23,13 @@ import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.sqoop.common.Direction;
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.connector.ConnectorManager;
 import org.apache.sqoop.connector.spi.MetadataUpgrader;
 import org.apache.sqoop.connector.spi.SqoopConnector;
 import org.apache.sqoop.framework.FrameworkManager;
-//import org.apache.sqoop.framework.configuration.ImportJobConfiguration;
+import org.apache.sqoop.framework.configuration.JobConfiguration;
 import org.apache.sqoop.model.ConfigurationClass;
 import org.apache.sqoop.model.FormUtils;
 import org.apache.sqoop.model.MConnection;
@@ -38,11 +39,10 @@ import org.apache.sqoop.model.MForm;
 import org.apache.sqoop.model.MFramework;
 import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.model.MJobForms;
-//import org.apache.sqoop.model.MJob.Type;
 import org.apache.sqoop.validation.Status;
 import org.apache.sqoop.validation.Validation;
-import org.apache.sqoop.validation.Validator;
 
+import org.apache.sqoop.validation.Validator;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.InOrder;
@@ -52,221 +52,225 @@ import static org.mockito.Mockito.*;
 
 public class TestJdbcRepository {
 
-//  private JdbcRepository repo;
-//  private JdbcRepositoryTransaction tx;
-//  private ConnectorManager connectorMgr;
-//  private FrameworkManager frameworkMgr;
-//  private JdbcRepositoryHandler repoHandler;
-//  private Validator validator;
-//  private MetadataUpgrader upgrader;
-//
-//  private Validation valid;
-//  private Validation invalid;
-//
-//  @Before
-//  public void setUp() throws Exception {
-//    tx = mock(JdbcRepositoryTransaction.class);
-//    connectorMgr = mock(ConnectorManager.class);
-//    frameworkMgr = mock(FrameworkManager.class);
-//    repoHandler = mock(JdbcRepositoryHandler.class);
-//    validator = mock(Validator.class);
-//    upgrader = mock(MetadataUpgrader.class);
-//    repo = spy(new JdbcRepository(repoHandler, null));
-//
-//    // setup transaction and connector manager
-//    doReturn(tx).when(repo).getTransaction();
-//    ConnectorManager.setInstance(connectorMgr);
-//    FrameworkManager.setInstance(frameworkMgr);
-//
-//    valid = mock(Validation.class);
-//    when(valid.getStatus()).thenReturn(Status.ACCEPTABLE);
-//    invalid = mock(Validation.class);
-//    when(invalid.getStatus()).thenReturn(Status.UNACCEPTABLE);
-//
-//    doNothing().when(upgrader).upgrade(any(MConnectionForms.class), any(MConnectionForms.class));
-//    doNothing().when(upgrader).upgrade(any(MJobForms.class), any(MJobForms.class));
-//  }
-//
-//  /**
-//   * Test the procedure when the connector auto upgrade option is enabled
-//   */
-//  @Test
-//  public void testConnectorEnableAutoUpgrade() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1, "1.0");
-//
-//    when(repoHandler.findConnector(anyString(), any(Connection.class))).thenReturn(oldConnector);
-//
-//    // make the upgradeConnector to throw an exception to prove that it has been called
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "upgradeConnector() has been called.");
-//    doThrow(exception).when(connectorMgr).getConnector(anyString());
-//
-//    try {
-//      repo.registerConnector(newConnector, true);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnector(anyString(), any(Connection.class));
-//      verify(connectorMgr, times(1)).getConnector(anyString());
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the procedure when  the connector auto upgrade option is disabled
-//   */
-//  @Test
-//  public void testConnectorDisableAutoUpgrade() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    when(repoHandler.findConnector(anyString(), any(Connection.class))).thenReturn(oldConnector);
-//
-//    try {
-//      repo.registerConnector(newConnector, false);
-//    } catch (SqoopException ex) {
-//      verify(repoHandler, times(1)).findConnector(anyString(), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      assertEquals(ex.getErrorCode(), RepositoryError.JDBCREPO_0026);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with code: " + RepositoryError.JDBCREPO_0026);
-//  }
-//
-//  /**
-//   * Test the procedure when the framework auto upgrade option is enabled
-//   */
-//  @Test
-//  public void testFrameworkEnableAutoUpgrade() {
-//    MFramework newFramework = framework();
-//    MFramework oldFramework = anotherFramework();
-//
-//    when(repoHandler.findFramework(any(Connection.class))).thenReturn(oldFramework);
-//
-//    // make the upgradeFramework to throw an exception to prove that it has been called
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "upgradeFramework() has been called.");
-//    doThrow(exception).when(repoHandler).findConnections(any(Connection.class));
-//
-//    try {
-//      repo.registerFramework(newFramework, true);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findFramework(any(Connection.class));
-//      verify(repoHandler, times(1)).findConnections(any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the procedure when the framework auto upgrade option is disabled
-//   */
-//  @Test
-//  public void testFrameworkDisableAutoUpgrade() {
-//    MFramework newFramework = framework();
-//    MFramework oldFramework = anotherFramework();
-//
-//    when(repoHandler.findFramework(any(Connection.class))).thenReturn(oldFramework);
-//
-//    try {
-//      repo.registerFramework(newFramework, false);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getErrorCode(), RepositoryError.JDBCREPO_0026);
-//      verify(repoHandler, times(1)).findFramework(any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with code: " + RepositoryError.JDBCREPO_0026);
-//  }
-//
-//  /**
-//   * Test the connector upgrade procedure, when all the connections and
-//   * jobs using the old connector are still valid for the new connector
-//   */
-//  @Test
-//  public void testConnectorUpgradeWithValidConnectionsAndJobs() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    // prepare the sqoop connector
-//    SqoopConnector sqconnector = mock(SqoopConnector.class);
-//    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
-//    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
-//    when(sqconnector.getValidator()).thenReturn(validator);
-//    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(sqconnector.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
-//    when(sqconnector.getJobConfigurationClass(any(MJob.Type.class))).thenReturn(ImportJobConfiguration.class);
-//    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
-//
-//    // prepare the connections and jobs
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//
-//    // mock necessary methods for upgradeConnector() procedure
-//    doReturn(connectionList).when(repo).findConnectionsForConnector(anyLong());
-//    doReturn(jobList).when(repo).findJobsForConnector(anyLong());
-//    doNothing().when(repo).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
-//    doNothing().when(repo).updateJob(any(MJob.class), any(RepositoryTransaction.class));
-//    doNothing().when(repo).updateConnector(any(MConnector.class), any(RepositoryTransaction.class));
-//
-//    repo.upgradeConnector(oldConnector, newConnector);
-//
-//    InOrder repoOrder = inOrder(repo);
-//    InOrder txOrder = inOrder(tx);
-//    InOrder upgraderOrder = inOrder(upgrader);
-//    InOrder validatorOrder = inOrder(validator);
-//
-//    repoOrder.verify(repo, times(1)).findConnectionsForConnector(anyLong());
-//    repoOrder.verify(repo, times(1)).findJobsForConnector(anyLong());
-//    repoOrder.verify(repo, times(1)).getTransaction();
-//    repoOrder.verify(repo, times(1)).deleteJobInputs(1, tx);
-//    repoOrder.verify(repo, times(1)).deleteJobInputs(2, tx);
-//    repoOrder.verify(repo, times(1)).deleteConnectionInputs(1, tx);
-//    repoOrder.verify(repo, times(1)).deleteConnectionInputs(2, tx);
-//    repoOrder.verify(repo, times(1)).updateConnector(any(MConnector.class), any(RepositoryTransaction.class));
-//    repoOrder.verify(repo, times(2)).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
-//    repoOrder.verify(repo, times(2)).updateJob(any(MJob.class), any(RepositoryTransaction.class));
-//    repoOrder.verifyNoMoreInteractions();
-//    txOrder.verify(tx, times(1)).begin();
-//    txOrder.verify(tx, times(1)).commit();
-//    txOrder.verify(tx, times(1)).close();
-//    txOrder.verifyNoMoreInteractions();
-//    upgraderOrder.verify(upgrader, times(2)).upgrade(any(MConnectionForms.class), any(MConnectionForms.class));
-//    upgraderOrder.verify(upgrader, times(2)).upgrade(any(MJobForms.class), any(MJobForms.class));
-//    upgraderOrder.verifyNoMoreInteractions();
-//    validatorOrder.verify(validator, times(2)).validateConnection(anyObject());
-//    validatorOrder.verify(validator, times(2)).validateJob(any(MJob.Type.class), anyObject());
-//    validatorOrder.verifyNoMoreInteractions();
-//  }
-//
-//  /**
-//   * Test the connector upgrade procedure, when all the connections and
-//   * jobs using the old connector are invalid for the new connector
-//   */
+  private JdbcRepository repo;
+  private JdbcRepositoryTransaction tx;
+  private ConnectorManager connectorMgr;
+  private FrameworkManager frameworkMgr;
+  private JdbcRepositoryHandler repoHandler;
+  private Validator validator;
+  private MetadataUpgrader upgrader;
+
+  private Validation valid;
+  private Validation invalid;
+
+  @Before
+  public void setUp() throws Exception {
+    tx = mock(JdbcRepositoryTransaction.class);
+    connectorMgr = mock(ConnectorManager.class);
+    frameworkMgr = mock(FrameworkManager.class);
+    repoHandler = mock(JdbcRepositoryHandler.class);
+    validator = mock(Validator.class);
+    upgrader = mock(MetadataUpgrader.class);
+    repo = spy(new JdbcRepository(repoHandler, null));
+
+    // setup transaction and connector manager
+    doReturn(tx).when(repo).getTransaction();
+    ConnectorManager.setInstance(connectorMgr);
+    FrameworkManager.setInstance(frameworkMgr);
+
+    valid = mock(Validation.class);
+    when(valid.getStatus()).thenReturn(Status.ACCEPTABLE);
+    invalid = mock(Validation.class);
+    when(invalid.getStatus()).thenReturn(Status.UNACCEPTABLE);
+
+    doNothing().when(upgrader).upgrade(any(MConnectionForms.class), any(MConnectionForms.class));
+    doNothing().when(upgrader).upgrade(any(MJobForms.class), any(MJobForms.class));
+  }
+
+  /**
+   * Test the procedure when the connector auto upgrade option is enabled
+   */
+  @Test
+  public void testConnectorEnableAutoUpgrade() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1, "1.0");
+
+    when(repoHandler.findConnector(anyString(), any(Connection.class))).thenReturn(oldConnector);
+
+    // make the upgradeConnector to throw an exception to prove that it has been called
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "upgradeConnector() has been called.");
+    doThrow(exception).when(connectorMgr).getConnector(anyString());
+
+    try {
+      repo.registerConnector(newConnector, true);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnector(anyString(), any(Connection.class));
+      verify(connectorMgr, times(1)).getConnector(anyString());
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the procedure when  the connector auto upgrade option is disabled
+   */
+  @Test
+  public void testConnectorDisableAutoUpgrade() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    when(repoHandler.findConnector(anyString(), any(Connection.class))).thenReturn(oldConnector);
+
+    try {
+      repo.registerConnector(newConnector, false);
+    } catch (SqoopException ex) {
+      verify(repoHandler, times(1)).findConnector(anyString(), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      assertEquals(ex.getErrorCode(), RepositoryError.JDBCREPO_0026);
+      return ;
+    }
+
+    fail("Should throw out an exception with code: " + RepositoryError.JDBCREPO_0026);
+  }
+
+  /**
+   * Test the procedure when the framework auto upgrade option is enabled
+   */
+  @Test
+  public void testFrameworkEnableAutoUpgrade() {
+    MFramework newFramework = framework();
+    MFramework oldFramework = anotherFramework();
+
+    when(repoHandler.findFramework(any(Connection.class))).thenReturn(oldFramework);
+
+    // make the upgradeFramework to throw an exception to prove that it has been called
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "upgradeFramework() has been called.");
+    doThrow(exception).when(repoHandler).findConnections(any(Connection.class));
+
+    try {
+      repo.registerFramework(newFramework, true);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findFramework(any(Connection.class));
+      verify(repoHandler, times(1)).findConnections(any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the procedure when the framework auto upgrade option is disabled
+   */
+  @Test
+  public void testFrameworkDisableAutoUpgrade() {
+    MFramework newFramework = framework();
+    MFramework oldFramework = anotherFramework();
+
+    when(repoHandler.findFramework(any(Connection.class))).thenReturn(oldFramework);
+
+    try {
+      repo.registerFramework(newFramework, false);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getErrorCode(), RepositoryError.JDBCREPO_0026);
+      verify(repoHandler, times(1)).findFramework(any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with code: " + RepositoryError.JDBCREPO_0026);
+  }
+
+  /**
+   * Test the connector upgrade procedure, when all the connections and
+   * jobs using the old connector are still valid for the new connector
+   */
+  @Test
+  public void testConnectorUpgradeWithValidConnectionsAndJobs() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    // prepare the sqoop connector
+    SqoopConnector sqconnector = mock(SqoopConnector.class);
+    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
+    when(validator.validateJob(any(MJob.class))).thenReturn(valid);
+    when(sqconnector.getValidator()).thenReturn(validator);
+    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
+    when(sqconnector.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
+    when(sqconnector.getJobConfigurationClass(any(Direction.class))).thenReturn(JobConfiguration.class);
+    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
+
+    // prepare the connections and jobs
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+
+    // mock necessary methods for upgradeConnector() procedure
+    doReturn(connectionList).when(repo).findConnectionsForConnector(anyLong());
+    doReturn(jobList).when(repo).findJobsForConnector(anyLong());
+    doNothing().when(repo).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
+    doNothing().when(repo).updateJob(any(MJob.class), any(RepositoryTransaction.class));
+    doNothing().when(repo).updateConnector(any(MConnector.class), any(RepositoryTransaction.class));
+
+    repo.upgradeConnector(oldConnector, newConnector);
+
+    InOrder repoOrder = inOrder(repo);
+    InOrder txOrder = inOrder(tx);
+    InOrder upgraderOrder = inOrder(upgrader);
+    InOrder validatorOrder = inOrder(validator);
+
+    repoOrder.verify(repo, times(1)).findConnectionsForConnector(anyLong());
+    repoOrder.verify(repo, times(1)).findJobsForConnector(anyLong());
+    repoOrder.verify(repo, times(1)).getTransaction();
+    repoOrder.verify(repo, times(1)).deleteJobInputs(1, tx);
+    repoOrder.verify(repo, times(1)).deleteJobInputs(2, tx);
+    repoOrder.verify(repo, times(1)).deleteConnectionInputs(1, tx);
+    repoOrder.verify(repo, times(1)).deleteConnectionInputs(2, tx);
+    repoOrder.verify(repo, times(1)).updateConnector(any(MConnector.class), any(RepositoryTransaction.class));
+    repoOrder.verify(repo, times(2)).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
+    repoOrder.verify(repo, times(4)).updateJob(any(MJob.class), any(RepositoryTransaction.class));
+    repoOrder.verifyNoMoreInteractions();
+    txOrder.verify(tx, times(1)).begin();
+    txOrder.verify(tx, times(1)).commit();
+    txOrder.verify(tx, times(1)).close();
+    txOrder.verifyNoMoreInteractions();
+    upgraderOrder.verify(upgrader, times(2)).upgrade(any(MConnectionForms.class), any(MConnectionForms.class));
+    upgraderOrder.verify(upgrader, times(4)).upgrade(any(MJobForms.class), any(MJobForms.class));
+    upgraderOrder.verifyNoMoreInteractions();
+    validatorOrder.verify(validator, times(2)).validateConnection(anyObject());
+    // @TODO(Abe): Re-enable job validation?
+    validatorOrder.verify(validator, times(0)).validateJob(anyObject());
+    validatorOrder.verifyNoMoreInteractions();
+  }
+
+  /**
+   * @TODO(Abe): To re-enable with Validation in Repository upgrade.
+   * Test the connector upgrade procedure, when all the connections and
+   * jobs using the old connector are invalid for the new connector
+   */
 //  @Test
 //  public void testConnectorUpgradeWithInvalidConnectionsAndJobs() {
 //    MConnector newConnector = connector(1, "1.1");
 //    MConnector oldConnector = connector(1);
 //
+//    // prepare the sqoop connector
 //    SqoopConnector sqconnector = mock(SqoopConnector.class);
 //    when(validator.validateConnection(any(MConnection.class))).thenReturn(invalid);
-//    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(invalid);
+//    when(validator.validateJob(any(MJob.class))).thenReturn(invalid);
 //    when(sqconnector.getValidator()).thenReturn(validator);
 //    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
 //    when(sqconnector.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
-//    when(sqconnector.getJobConfigurationClass(any(MJob.Type.class))).thenReturn(ImportJobConfiguration.class);
+//    when(sqconnector.getJobConfigurationClass(any(Direction.class))).thenReturn(JobConfiguration.class);
 //    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
 //
+//    // prepare the connections and jobs
 //    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
+//    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
 //
 //    doReturn(connectionList).when(repo).findConnectionsForConnector(anyLong());
 //    doReturn(jobList).when(repo).findJobsForConnector(anyLong());
@@ -301,730 +305,730 @@ public class TestJdbcRepository {
 //      upgraderOrder.verify(upgrader, times(2)).upgrade(any(MJobForms.class), any(MJobForms.class));
 //      upgraderOrder.verifyNoMoreInteractions();
 //      validatorOrder.verify(validator, times(2)).validateConnection(anyObject());
-//      validatorOrder.verify(validator, times(2)).validateJob(any(MJob.Type.class), anyObject());
-//      validatorOrder.verifyNoMoreInteractions();
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with code: " + RepositoryError.JDBCREPO_0027);
-//  }
-//
-//  /**
-//   * Test the framework upgrade procedure, when all the connections and
-//   * jobs using the old connector are still valid for the new connector
-//   */
-//  @Test
-//  public void testFrameworkUpgradeWithValidConnectionsAndJobs() {
-//    MFramework newFramework = framework();
-//
-//    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
-//    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(frameworkMgr.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
-//    when(frameworkMgr.getJobConfigurationClass(any(MJob.Type.class))).thenReturn(ImportJobConfiguration.class);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//
-//    doReturn(connectionList).when(repo).findConnections();
-//    doReturn(jobList).when(repo).findJobs();
-//    doNothing().when(repo).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
-//    doNothing().when(repo).updateJob(any(MJob.class), any(RepositoryTransaction.class));
-//    doNothing().when(repo).updateFramework(any(MFramework.class), any(RepositoryTransaction.class));
-//
-//    repo.upgradeFramework(newFramework);
-//
-//    InOrder repoOrder = inOrder(repo);
-//    InOrder txOrder = inOrder(tx);
-//    InOrder upgraderOrder = inOrder(upgrader);
-//    InOrder validatorOrder = inOrder(validator);
-//
-//    repoOrder.verify(repo, times(1)).findConnections();
-//    repoOrder.verify(repo, times(1)).findJobs();
-//    repoOrder.verify(repo, times(1)).getTransaction();
-//    repoOrder.verify(repo, times(1)).deleteJobInputs(1, tx);
-//    repoOrder.verify(repo, times(1)).deleteJobInputs(2, tx);
-//    repoOrder.verify(repo, times(1)).deleteConnectionInputs(1, tx);
-//    repoOrder.verify(repo, times(1)).deleteConnectionInputs(2, tx);
-//    repoOrder.verify(repo, times(1)).updateFramework(any(MFramework.class), any(RepositoryTransaction.class));
-//    repoOrder.verify(repo, times(2)).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
-//    repoOrder.verify(repo, times(2)).updateJob(any(MJob.class), any(RepositoryTransaction.class));
-//    repoOrder.verifyNoMoreInteractions();
-//    txOrder.verify(tx, times(1)).begin();
-//    txOrder.verify(tx, times(1)).commit();
-//    txOrder.verify(tx, times(1)).close();
-//    txOrder.verifyNoMoreInteractions();
-//    upgraderOrder.verify(upgrader, times(2)).upgrade(any(MConnectionForms.class), any(MConnectionForms.class));
-//    upgraderOrder.verify(upgrader, times(2)).upgrade(any(MJobForms.class), any(MJobForms.class));
-//    upgraderOrder.verifyNoMoreInteractions();
-//    validatorOrder.verify(validator, times(2)).validateConnection(anyObject());
-//    validatorOrder.verify(validator, times(2)).validateJob(any(MJob.Type.class), anyObject());
-//    validatorOrder.verifyNoMoreInteractions();
-//  }
-//
-//  /**
-//   * Test the framework upgrade procedure, when all the connections and
-//   * jobs using the old connector are invalid for the new connector
-//   */
-//  @Test
-//  public void testFrameworkUpgradeWithInvalidConnectionsAndJobs() {
-//    MFramework newFramework = framework();
-//
-//    when(validator.validateConnection(any(MConnection.class))).thenReturn(invalid);
-//    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(invalid);
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(frameworkMgr.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
-//    when(frameworkMgr.getJobConfigurationClass(any(MJob.Type.class))).thenReturn(ImportJobConfiguration.class);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//
-//    doReturn(connectionList).when(repo).findConnections();
-//    doReturn(jobList).when(repo).findJobs();
-//    doNothing().when(repo).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
-//    doNothing().when(repo).updateJob(any(MJob.class), any(RepositoryTransaction.class));
-//    doNothing().when(repo).updateFramework(any(MFramework.class), any(RepositoryTransaction.class));
-//
-//    try {
-//      repo.upgradeFramework(newFramework);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getErrorCode(), RepositoryError.JDBCREPO_0027);
-//
-//      InOrder repoOrder = inOrder(repo);
-//      InOrder txOrder = inOrder(tx);
-//      InOrder upgraderOrder = inOrder(upgrader);
-//      InOrder validatorOrder = inOrder(validator);
-//
-//      repoOrder.verify(repo, times(1)).findConnections();
-//      repoOrder.verify(repo, times(1)).findJobs();
-//      repoOrder.verify(repo, times(1)).getTransaction();
-//      repoOrder.verify(repo, times(1)).deleteJobInputs(1, tx);
-//      repoOrder.verify(repo, times(1)).deleteJobInputs(2, tx);
-//      repoOrder.verify(repo, times(1)).deleteConnectionInputs(1, tx);
-//      repoOrder.verify(repo, times(1)).deleteConnectionInputs(2, tx);
-//      repoOrder.verify(repo, times(1)).updateFramework(any(MFramework.class), any(RepositoryTransaction.class));
-//      repoOrder.verifyNoMoreInteractions();
-//      txOrder.verify(tx, times(1)).begin();
-//      txOrder.verify(tx, times(1)).rollback();
-//      txOrder.verify(tx, times(1)).close();
-//      txOrder.verifyNoMoreInteractions();
-//      upgraderOrder.verify(upgrader, times(2)).upgrade(any(MConnectionForms.class), any(MConnectionForms.class));
-//      upgraderOrder.verify(upgrader, times(2)).upgrade(any(MJobForms.class), any(MJobForms.class));
-//      upgraderOrder.verifyNoMoreInteractions();
-//      validatorOrder.verify(validator, times(2)).validateConnection(anyObject());
-//      validatorOrder.verify(validator, times(2)).validateJob(any(MJob.Type.class), anyObject());
+//      validatorOrder.verify(validator, times(2)).validateJob(anyObject());
 //      validatorOrder.verifyNoMoreInteractions();
 //      return ;
 //    }
 //
 //    fail("Should throw out an exception with code: " + RepositoryError.JDBCREPO_0027);
 //  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * find connections for a given connector
-//   */
-//  @Test
-//  public void testConnectorUpgradeHandlerFindConnectionsForConnectorError() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    SqoopConnector sqconnector = mock(SqoopConnector.class);
-//    when(sqconnector.getValidator()).thenReturn(validator);
-//    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "find connections for connector error.");
-//    doThrow(exception).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
-//
-//    try {
-//      repo.upgradeConnector(oldConnector, newConnector);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * find jobs for a given connector
-//   */
-//  @Test
-//  public void testConnectorUpgradeHandlerFindJobsForConnectorError() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    SqoopConnector sqconnector = mock(SqoopConnector.class);
-//    when(sqconnector.getValidator()).thenReturn(validator);
-//    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "find jobs for connector error.");
-//    doThrow(exception).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
-//
-//    try {
-//      repo.upgradeConnector(oldConnector, newConnector);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * delete job inputs for a given connector
-//   */
-//  @Test
-//  public void testConnectorUpgradeHandlerDeleteJobInputsError() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    SqoopConnector sqconnector = mock(SqoopConnector.class);
-//    when(sqconnector.getValidator()).thenReturn(validator);
-//    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "delete job inputs for connector error.");
-//    doThrow(exception).when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//
-//    try {
-//      repo.upgradeConnector(oldConnector, newConnector);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * delete connection inputs for a given connector
-//   */
-//  @Test
-//  public void testConnectorUpgradeHandlerDeleteConnectionInputsError() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    SqoopConnector sqconnector = mock(SqoopConnector.class);
-//    when(sqconnector.getValidator()).thenReturn(validator);
-//    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "delete connection inputs for connector error.");
-//    doThrow(exception).when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
-//
-//    try {
-//      repo.upgradeConnector(oldConnector, newConnector);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).deleteConnectionInputs(anyLong(), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * update the connector metadata
-//   */
-//  @Test
-//  public void testConnectorUpgradeHandlerUpdateConnectorError() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    SqoopConnector sqconnector = mock(SqoopConnector.class);
-//    when(sqconnector.getValidator()).thenReturn(validator);
-//    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "update connector error.");
-//    doThrow(exception).when(repoHandler).updateConnector(any(MConnector.class), any(Connection.class));
-//
-//    try {
-//      repo.upgradeConnector(oldConnector, newConnector);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateConnector(any(MConnector.class), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * update the connection metadata
-//   */
-//  @Test
-//  public void testConnectorUpgradeHandlerUpdateConnectionError() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    SqoopConnector sqconnector = mock(SqoopConnector.class);
-//    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
-//    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
-//    when(sqconnector.getValidator()).thenReturn(validator);
-//    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(sqconnector.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
-//    when(sqconnector.getJobConfigurationClass(any(MJob.Type.class))).thenReturn(ImportJobConfiguration.class);
-//    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).updateConnector(any(MConnector.class), any(Connection.class));
-//    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "update connection error.");
-//    doThrow(exception).when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));
-//
-//    try {
-//      repo.upgradeConnector(oldConnector, newConnector);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateConnector(any(MConnector.class), any(Connection.class));
-//      verify(repoHandler, times(1)).existsConnection(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateConnection(any(MConnection.class), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * update the job metadata
-//   */
-//  @Test
-//  public void testConnectorUpgradeHandlerUpdateJobError() {
-//    MConnector newConnector = connector(1, "1.1");
-//    MConnector oldConnector = connector(1);
-//
-//    SqoopConnector sqconnector = mock(SqoopConnector.class);
-//    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
-//    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
-//    when(sqconnector.getValidator()).thenReturn(validator);
-//    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(sqconnector.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
-//    when(sqconnector.getJobConfigurationClass(any(MJob.Type.class))).thenReturn(ImportJobConfiguration.class);
-//    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).updateConnector(any(MConnector.class), any(Connection.class));
-//    doNothing().when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));
-//    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
-//    doReturn(true).when(repoHandler).existsJob(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "update job error.");
-//    doThrow(exception).when(repoHandler).updateJob(any(MJob.class), any(Connection.class));
-//
-//    try {
-//      repo.upgradeConnector(oldConnector, newConnector);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateConnector(any(MConnector.class), any(Connection.class));
-//      verify(repoHandler, times(2)).existsConnection(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).updateConnection(any(MConnection.class), any(Connection.class));
-//      verify(repoHandler, times(1)).existsJob(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateJob(any(MJob.class), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * find connections for framework
-//   */
-//  @Test
-//  public void testFrameworkUpgradeHandlerFindConnectionsError() {
-//    MFramework newFramework = framework();
-//
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "find connections error.");
-//    doThrow(exception).when(repoHandler).findConnections(any(Connection.class));
-//
-//    try {
-//      repo.upgradeFramework(newFramework);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnections(any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * find jobs for framework
-//   */
-//  @Test
-//  public void testFrameworkUpgradeHandlerFindJobsError() {
-//    MFramework newFramework = framework();
-//
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "find jobs error.");
-//    doThrow(exception).when(repoHandler).findJobs(any(Connection.class));
-//
-//    try {
-//      repo.upgradeFramework(newFramework);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnections(any(Connection.class));
-//      verify(repoHandler, times(1)).findJobs(any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * delete job inputs for framework upgrade
-//   */
-//  @Test
-//  public void testFrameworkUpgradeHandlerDeleteJobInputsError() {
-//    MFramework newFramework = framework();
-//
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "delete job inputs error.");
-//    doThrow(exception).when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//
-//    try {
-//      repo.upgradeFramework(newFramework);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnections(any(Connection.class));
-//      verify(repoHandler, times(1)).findJobs(any(Connection.class));
-//      verify(repoHandler, times(1)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * delete connection inputs for framework upgrade
-//   */
-//  @Test
-//  public void testFrameworkUpgradeHandlerDeleteConnectionInputsError() {
-//    MFramework newFramework = framework();
-//
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
-//    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "delete connection inputs error.");
-//    doThrow(exception).when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
-//
-//    try {
-//      repo.upgradeFramework(newFramework);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnections(any(Connection.class));
-//      verify(repoHandler, times(1)).findJobs(any(Connection.class));
-//      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).deleteConnectionInputs(anyLong(), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * update the framework metadata
-//   */
-//  @Test
-//  public void testFrameworkUpgradeHandlerUpdateFrameworkError() {
-//    MFramework newFramework = framework();
-//
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
-//    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "update framework metadata error.");
-//    doThrow(exception).when(repoHandler).updateFramework(any(MFramework.class), any(Connection.class));
-//
-//    try {
-//      repo.upgradeFramework(newFramework);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnections(any(Connection.class));
-//      verify(repoHandler, times(1)).findJobs(any(Connection.class));
-//      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateFramework(any(MFramework.class), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * update the connection metadata
-//   */
-//  @Test
-//  public void testFrameworkUpgradeHandlerUpdateConnectionError() {
-//    MFramework newFramework = framework();
-//
-//    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
-//    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(frameworkMgr.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
-//    when(frameworkMgr.getJobConfigurationClass(any(MJob.Type.class))).thenReturn(ImportJobConfiguration.class);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
-//    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).updateFramework(any(MFramework.class), any(Connection.class));
-//    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "update connection error.");
-//    doThrow(exception).when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));
-//
-//    try {
-//      repo.upgradeFramework(newFramework);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnections(any(Connection.class));
-//      verify(repoHandler, times(1)).findJobs(any(Connection.class));
-//      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateFramework(any(MFramework.class), any(Connection.class));
-//      verify(repoHandler, times(1)).existsConnection(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateConnection(any(MConnection.class), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  /**
-//   * Test the exception handling procedure when the database handler fails to
-//   * update the job metadata
-//   */
-//  @Test
-//  public void testFrameworkUpgradeHandlerUpdateJobError() {
-//    MFramework newFramework = framework();
-//
-//    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
-//    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
-//    when(frameworkMgr.getValidator()).thenReturn(validator);
-//    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
-//    when(frameworkMgr.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
-//    when(frameworkMgr.getJobConfigurationClass(any(MJob.Type.class))).thenReturn(ImportJobConfiguration.class);
-//
-//    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
-//    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
-//    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
-//    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
-//    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).updateFramework(any(MFramework.class), any(Connection.class));
-//    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
-//    doReturn(true).when(repoHandler).existsJob(anyLong(), any(Connection.class));
-//    doNothing().when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));
-//
-//    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
-//        "update job error.");
-//    doThrow(exception).when(repoHandler).updateJob(any(MJob.class), any(Connection.class));
-//
-//    try {
-//      repo.upgradeFramework(newFramework);
-//    } catch (SqoopException ex) {
-//      assertEquals(ex.getMessage(), exception.getMessage());
-//      verify(repoHandler, times(1)).findConnections(any(Connection.class));
-//      verify(repoHandler, times(1)).findJobs(any(Connection.class));
-//      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateFramework(any(MFramework.class), any(Connection.class));
-//      verify(repoHandler, times(2)).existsConnection(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(2)).updateConnection(any(MConnection.class), any(Connection.class));
-//      verify(repoHandler, times(1)).existsJob(anyLong(), any(Connection.class));
-//      verify(repoHandler, times(1)).updateJob(any(MJob.class), any(Connection.class));
-//      verifyNoMoreInteractions(repoHandler);
-//      return ;
-//    }
-//
-//    fail("Should throw out an exception with message: " + exception.getMessage());
-//  }
-//
-//  private MConnector connector(long id, String version) {
-//    List<MJobForms> jobForms = new LinkedList<MJobForms>();
-//    jobForms.add(new MJobForms(MJob.Type.IMPORT, FormUtils.toForms(ImportJobConfiguration.class)));
-//
-//    MConnector connector = new MConnector("A" + id, "A" + id, version + id,
-//        new MConnectionForms(new LinkedList<MForm>()), jobForms);
-//    connector.setPersistenceId(id);
-//    return connector;
-//  }
-//
-//  private MConnector connector(long id) {
-//    return connector(id, "1.0");
-//  }
-//
-//  private MFramework framework() {
-//    List<MJobForms> jobForms = new LinkedList<MJobForms>();
-//    jobForms.add(new MJobForms(MJob.Type.IMPORT, FormUtils.toForms(ImportJobConfiguration.class)));
-//
-//    MFramework framework = new MFramework(new MConnectionForms(new LinkedList<MForm>()),
-//      jobForms, FrameworkManager.CURRENT_FRAMEWORK_VERSION);
-//    framework.setPersistenceId(1);
-//    return framework;
-//  }
-//
-//  private MFramework anotherFramework() {
-//    MFramework framework = new MFramework(null, new LinkedList<MJobForms>(),
-//      FrameworkManager.CURRENT_FRAMEWORK_VERSION);
-//    framework.setPersistenceId(1);
-//    return framework;
-//  }
-//
-//  private MConnection connection(long id, long cid) {
-//    MConnection connection = new MConnection(cid, new MConnectionForms(new LinkedList<MForm>()),
-//        new MConnectionForms(new LinkedList<MForm>()));
-//    connection.setPersistenceId(id);
-//    return connection;
-//  }
-//
-//  private MJob job(long id, long cid, long xid) {
-//    MJob job = new MJob(cid, xid, Type.IMPORT, new MJobForms(Type.IMPORT, new LinkedList<MForm>()),
-//        new MJobForms(Type.IMPORT, new LinkedList<MForm>()));
-//    job.setPersistenceId(id);
-//    return job;
-//  }
-//
-//  private List<MConnection> connections(MConnection ... cs) {
-//    List<MConnection> connections = new ArrayList<MConnection>();
-//    Collections.addAll(connections, cs);
-//    return connections;
-//  }
-//
-//  private List<MJob> jobs(MJob ... js) {
-//    List<MJob> jobs = new ArrayList<MJob>();
-//    Collections.addAll(jobs, js);
-//    return jobs;
-//  }
-//
-//  @ConfigurationClass
-//  public static class EmptyConfigurationClass {
-//  }
+
+  /**
+   * Test the framework upgrade procedure, when all the connections and
+   * jobs using the old connector are still valid for the new connector
+   */
+  @Test
+  public void testFrameworkUpgradeWithValidConnectionsAndJobs() {
+    MFramework newFramework = framework();
+
+    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
+    when(validator.validateJob(any(MJob.class))).thenReturn(valid);
+    when(frameworkMgr.getValidator()).thenReturn(validator);
+    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
+    when(frameworkMgr.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
+    when(frameworkMgr.getJobConfigurationClass()).thenReturn(JobConfiguration.class);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+
+    doReturn(connectionList).when(repo).findConnections();
+    doReturn(jobList).when(repo).findJobs();
+    doNothing().when(repo).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
+    doNothing().when(repo).updateJob(any(MJob.class), any(RepositoryTransaction.class));
+    doNothing().when(repo).updateFramework(any(MFramework.class), any(RepositoryTransaction.class));
+
+    repo.upgradeFramework(newFramework);
+
+    InOrder repoOrder = inOrder(repo);
+    InOrder txOrder = inOrder(tx);
+    InOrder upgraderOrder = inOrder(upgrader);
+    InOrder validatorOrder = inOrder(validator);
+
+    repoOrder.verify(repo, times(1)).findConnections();
+    repoOrder.verify(repo, times(1)).findJobs();
+    repoOrder.verify(repo, times(1)).getTransaction();
+    repoOrder.verify(repo, times(1)).deleteJobInputs(1, tx);
+    repoOrder.verify(repo, times(1)).deleteJobInputs(2, tx);
+    repoOrder.verify(repo, times(1)).deleteConnectionInputs(1, tx);
+    repoOrder.verify(repo, times(1)).deleteConnectionInputs(2, tx);
+    repoOrder.verify(repo, times(1)).updateFramework(any(MFramework.class), any(RepositoryTransaction.class));
+    repoOrder.verify(repo, times(2)).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
+    repoOrder.verify(repo, times(2)).updateJob(any(MJob.class), any(RepositoryTransaction.class));
+    repoOrder.verifyNoMoreInteractions();
+    txOrder.verify(tx, times(1)).begin();
+    txOrder.verify(tx, times(1)).commit();
+    txOrder.verify(tx, times(1)).close();
+    txOrder.verifyNoMoreInteractions();
+    upgraderOrder.verify(upgrader, times(2)).upgrade(any(MConnectionForms.class), any(MConnectionForms.class));
+    upgraderOrder.verify(upgrader, times(2)).upgrade(any(MJobForms.class), any(MJobForms.class));
+    upgraderOrder.verifyNoMoreInteractions();
+    validatorOrder.verify(validator, times(2)).validateConnection(anyObject());
+    validatorOrder.verify(validator, times(2)).validateJob(anyObject());
+    validatorOrder.verifyNoMoreInteractions();
+  }
+
+  /**
+   * Test the framework upgrade procedure, when all the connections and
+   * jobs using the old connector are invalid for the new connector
+   */
+  @Test
+  public void testFrameworkUpgradeWithInvalidConnectionsAndJobs() {
+    MFramework newFramework = framework();
+
+    when(validator.validateConnection(any(MConnection.class))).thenReturn(invalid);
+    when(validator.validateJob(any(MJob.class))).thenReturn(invalid);
+    when(frameworkMgr.getValidator()).thenReturn(validator);
+    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
+    when(frameworkMgr.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
+    when(frameworkMgr.getJobConfigurationClass()).thenReturn(JobConfiguration.class);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+
+    doReturn(connectionList).when(repo).findConnections();
+    doReturn(jobList).when(repo).findJobs();
+    doNothing().when(repo).updateConnection(any(MConnection.class), any(RepositoryTransaction.class));
+    doNothing().when(repo).updateJob(any(MJob.class), any(RepositoryTransaction.class));
+    doNothing().when(repo).updateFramework(any(MFramework.class), any(RepositoryTransaction.class));
+
+    try {
+      repo.upgradeFramework(newFramework);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getErrorCode(), RepositoryError.JDBCREPO_0027);
+
+      InOrder repoOrder = inOrder(repo);
+      InOrder txOrder = inOrder(tx);
+      InOrder upgraderOrder = inOrder(upgrader);
+      InOrder validatorOrder = inOrder(validator);
+
+      repoOrder.verify(repo, times(1)).findConnections();
+      repoOrder.verify(repo, times(1)).findJobs();
+      repoOrder.verify(repo, times(1)).getTransaction();
+      repoOrder.verify(repo, times(1)).deleteJobInputs(1, tx);
+      repoOrder.verify(repo, times(1)).deleteJobInputs(2, tx);
+      repoOrder.verify(repo, times(1)).deleteConnectionInputs(1, tx);
+      repoOrder.verify(repo, times(1)).deleteConnectionInputs(2, tx);
+      repoOrder.verify(repo, times(1)).updateFramework(any(MFramework.class), any(RepositoryTransaction.class));
+      repoOrder.verifyNoMoreInteractions();
+      txOrder.verify(tx, times(1)).begin();
+      txOrder.verify(tx, times(1)).rollback();
+      txOrder.verify(tx, times(1)).close();
+      txOrder.verifyNoMoreInteractions();
+      upgraderOrder.verify(upgrader, times(2)).upgrade(any(MConnectionForms.class), any(MConnectionForms.class));
+      upgraderOrder.verify(upgrader, times(2)).upgrade(any(MJobForms.class), any(MJobForms.class));
+      upgraderOrder.verifyNoMoreInteractions();
+      validatorOrder.verify(validator, times(2)).validateConnection(anyObject());
+      validatorOrder.verify(validator, times(2)).validateJob(anyObject());
+      validatorOrder.verifyNoMoreInteractions();
+      return ;
+    }
+
+    fail("Should throw out an exception with code: " + RepositoryError.JDBCREPO_0027);
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * find connections for a given connector
+   */
+  @Test
+  public void testConnectorUpgradeHandlerFindConnectionsForConnectorError() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    SqoopConnector sqconnector = mock(SqoopConnector.class);
+    when(sqconnector.getValidator()).thenReturn(validator);
+    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
+    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "find connections for connector error.");
+    doThrow(exception).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
+
+    try {
+      repo.upgradeConnector(oldConnector, newConnector);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * find jobs for a given connector
+   */
+  @Test
+  public void testConnectorUpgradeHandlerFindJobsForConnectorError() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    SqoopConnector sqconnector = mock(SqoopConnector.class);
+    when(sqconnector.getValidator()).thenReturn(validator);
+    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
+    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "find jobs for connector error.");
+    doThrow(exception).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
+
+    try {
+      repo.upgradeConnector(oldConnector, newConnector);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * delete job inputs for a given connector
+   */
+  @Test
+  public void testConnectorUpgradeHandlerDeleteJobInputsError() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    SqoopConnector sqconnector = mock(SqoopConnector.class);
+    when(sqconnector.getValidator()).thenReturn(validator);
+    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
+    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "delete job inputs for connector error.");
+    doThrow(exception).when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+
+    try {
+      repo.upgradeConnector(oldConnector, newConnector);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).deleteJobInputs(anyLong(), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * delete connection inputs for a given connector
+   */
+  @Test
+  public void testConnectorUpgradeHandlerDeleteConnectionInputsError() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    SqoopConnector sqconnector = mock(SqoopConnector.class);
+    when(sqconnector.getValidator()).thenReturn(validator);
+    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
+    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "delete connection inputs for connector error.");
+    doThrow(exception).when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
+
+    try {
+      repo.upgradeConnector(oldConnector, newConnector);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).deleteConnectionInputs(anyLong(), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * update the connector metadata
+   */
+  @Test
+  public void testConnectorUpgradeHandlerUpdateConnectorError() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    SqoopConnector sqconnector = mock(SqoopConnector.class);
+    when(sqconnector.getValidator()).thenReturn(validator);
+    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
+    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "update connector error.");
+    doThrow(exception).when(repoHandler).updateConnector(any(MConnector.class), any(Connection.class));
+
+    try {
+      repo.upgradeConnector(oldConnector, newConnector);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).updateConnector(any(MConnector.class), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * update the connection metadata
+   */
+  @Test
+  public void testConnectorUpgradeHandlerUpdateConnectionError() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    SqoopConnector sqconnector = mock(SqoopConnector.class);
+    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
+    when(validator.validateJob(any(MJob.class))).thenReturn(valid);
+    when(sqconnector.getValidator()).thenReturn(validator);
+    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
+    when(sqconnector.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
+    when(sqconnector.getJobConfigurationClass(any(Direction.class))).thenReturn(JobConfiguration.class);
+    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).updateConnector(any(MConnector.class), any(Connection.class));
+    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "update connection error.");
+    doThrow(exception).when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));
+
+    try {
+      repo.upgradeConnector(oldConnector, newConnector);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).updateConnector(any(MConnector.class), any(Connection.class));
+      verify(repoHandler, times(1)).existsConnection(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).updateConnection(any(MConnection.class), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * update the job metadata
+   */
+  @Test
+  public void testConnectorUpgradeHandlerUpdateJobError() {
+    MConnector newConnector = connector(1, "1.1");
+    MConnector oldConnector = connector(1);
+
+    SqoopConnector sqconnector = mock(SqoopConnector.class);
+    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
+    when(validator.validateJob(any(MJob.class))).thenReturn(valid);
+    when(sqconnector.getValidator()).thenReturn(validator);
+    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
+    when(sqconnector.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
+    when(sqconnector.getJobConfigurationClass(any(Direction.class))).thenReturn(JobConfiguration.class);
+    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnectionsForConnector(anyLong(), any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobsForConnector(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).updateConnector(any(MConnector.class), any(Connection.class));
+    doNothing().when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));
+    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
+    doReturn(true).when(repoHandler).existsJob(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "update job error.");
+    doThrow(exception).when(repoHandler).updateJob(any(MJob.class), any(Connection.class));
+
+    try {
+      repo.upgradeConnector(oldConnector, newConnector);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).updateConnector(any(MConnector.class), any(Connection.class));
+      verify(repoHandler, times(2)).existsConnection(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).updateConnection(any(MConnection.class), any(Connection.class));
+      verify(repoHandler, times(1)).existsJob(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).updateJob(any(MJob.class), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * find connections for framework
+   */
+  @Test
+  public void testFrameworkUpgradeHandlerFindConnectionsError() {
+    MFramework newFramework = framework();
+
+    when(frameworkMgr.getValidator()).thenReturn(validator);
+    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "find connections error.");
+    doThrow(exception).when(repoHandler).findConnections(any(Connection.class));
+
+    try {
+      repo.upgradeFramework(newFramework);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnections(any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * find jobs for framework
+   */
+  @Test
+  public void testFrameworkUpgradeHandlerFindJobsError() {
+    MFramework newFramework = framework();
+
+    when(frameworkMgr.getValidator()).thenReturn(validator);
+    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "find jobs error.");
+    doThrow(exception).when(repoHandler).findJobs(any(Connection.class));
+
+    try {
+      repo.upgradeFramework(newFramework);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnections(any(Connection.class));
+      verify(repoHandler, times(1)).findJobs(any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * delete job inputs for framework upgrade
+   */
+  @Test
+  public void testFrameworkUpgradeHandlerDeleteJobInputsError() {
+    MFramework newFramework = framework();
+
+    when(frameworkMgr.getValidator()).thenReturn(validator);
+    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "delete job inputs error.");
+    doThrow(exception).when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+
+    try {
+      repo.upgradeFramework(newFramework);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnections(any(Connection.class));
+      verify(repoHandler, times(1)).findJobs(any(Connection.class));
+      verify(repoHandler, times(1)).deleteJobInputs(anyLong(), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * delete connection inputs for framework upgrade
+   */
+  @Test
+  public void testFrameworkUpgradeHandlerDeleteConnectionInputsError() {
+    MFramework newFramework = framework();
+
+    when(frameworkMgr.getValidator()).thenReturn(validator);
+    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
+    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "delete connection inputs error.");
+    doThrow(exception).when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
+
+    try {
+      repo.upgradeFramework(newFramework);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnections(any(Connection.class));
+      verify(repoHandler, times(1)).findJobs(any(Connection.class));
+      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).deleteConnectionInputs(anyLong(), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * update the framework metadata
+   */
+  @Test
+  public void testFrameworkUpgradeHandlerUpdateFrameworkError() {
+    MFramework newFramework = framework();
+
+    when(frameworkMgr.getValidator()).thenReturn(validator);
+    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
+    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "update framework metadata error.");
+    doThrow(exception).when(repoHandler).updateFramework(any(MFramework.class), any(Connection.class));
+
+    try {
+      repo.upgradeFramework(newFramework);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnections(any(Connection.class));
+      verify(repoHandler, times(1)).findJobs(any(Connection.class));
+      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).updateFramework(any(MFramework.class), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw out an exception with message: " + exception.getMessage());
+  }
+
+  /**
+   * Test the exception handling procedure when the database handler fails to
+   * update the connection metadata
+   */
+  @Test
+  public void testFrameworkUpgradeHandlerUpdateConnectionError() {
+    MFramework newFramework = framework();
+
+    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
+    when(validator.validateJob(any(MJob.class))).thenReturn(valid);
+    when(frameworkMgr.getValidator()).thenReturn(validator);
+    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
+    when(frameworkMgr.getConnectionConfigurationClass()).thenReturn(EmptyConfigurationClass.class);
+    when(frameworkMgr.getJobConfigurationClass()).thenReturn(JobConfiguration.class);
+
+    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
+    List<MJob> jobList = jobs(job(1,1,1,1,1), job(2,1,1,2,1));
+    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
+    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
+    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
+    doNothing().when(repoHandler).updateFramework(any(MFramework.class), any(Connection.class));
+    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
+
+    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
+        "update connection error.");
+    doThrow(exception).when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));
+
+    try {
+      repo.upgradeFramework(newFramework);
+    } catch (SqoopException ex) {
+      assertEquals(ex.getMessage(), exception.getMessage());
+      verify(repoHandler, times(1)).findConnections(any(Connection.class));
+      verify(repoHandler, times(1)).findJobs(any(Connection.class));
+      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).updateFramework(any(MFramework.class), any(Connection.class));
+      verify(repoHandler, times(1)).existsConnection(anyLong(), any(Connection.class));
+      verify(repoHandler, times(1)).updateConnection(any(MConnection.class), any(Connection.class));
+      verifyNoMoreInteractions(repoHandler);
+      return ;
+    }
+
+    fail("Should throw o

<TRUNCATED>

[3/3] git commit: SQOOP-1506: Sqoop2: From/To: Re-enable all tests

Posted by ja...@apache.org.
SQOOP-1506: Sqoop2: From/To: Re-enable all tests

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

Branch: refs/heads/SQOOP-1367
Commit: fcb77b671345fc3b1e6d7b4285acce420f52ec01
Parents: eddd4dd
Author: Jarek Jarcec Cecho <ja...@apache.org>
Authored: Thu Sep 11 10:25:37 2014 +0200
Committer: Jarek Jarcec Cecho <ja...@apache.org>
Committed: Thu Sep 11 10:25:37 2014 +0200

----------------------------------------------------------------------
 .../apache/sqoop/client/TestSqoopClient.java    |  363 ++--
 .../apache/sqoop/model/MValidatedElement.java   |    1 +
 .../validation/validators/NullOrContains.java   |   32 +
 .../validators/TestNullOrContains.java          |   97 +
 .../jdbc/configuration/FromTableForm.java       |    4 +-
 .../sqoop/connector/jdbc/TestToInitializer.java |   30 +-
 .../apache/sqoop/connector/hdfs/HdfsLoader.java |    3 +-
 .../hdfs/configuration/StorageType.java         |   28 -
 .../sqoop/connector/hdfs/TestExtractor.java     |   25 +-
 .../sqoop/connector/hdfs/TestHdfsBase.java      |   14 +-
 .../configuration/ConnectionConfiguration.java  |    2 +-
 .../sqoop/framework/TestFrameworkValidator.java |  178 +-
 .../sqoop/repository/TestJdbcRepository.java    | 1854 +++++++++---------
 .../org/apache/sqoop/job/mr/SqoopMapper.java    |    3 +
 .../mapreduce/MapreduceExecutionEngineTest.java |  106 -
 pom.xml                                         |    3 -
 .../minicluster/TomcatSqoopMiniCluster.java     |    1 +
 .../sqoop/test/testcases/ConnectorTestCase.java |   12 +-
 .../org/apache/sqoop/test/utils/HdfsUtils.java  |    4 +-
 .../jdbc/generic/FromHDFSToRDBMSTest.java       |   78 +
 .../jdbc/generic/FromRDBMSToHDFSTest.java       |  121 ++
 .../connector/jdbc/generic/PartitionerTest.java |  128 ++
 .../connector/jdbc/generic/TableExportTest.java |   73 -
 .../connector/jdbc/generic/TableImportTest.java |  108 -
 .../jdbc/generic/TableStagedRDBMSTest.java      |   86 +
 .../generic/exports/TableStagedExportTest.java  |   77 -
 .../jdbc/generic/imports/PartitionerTest.java   |  117 --
 .../SubmissionWithDisabledModelObjectsTest.java |  147 +-
 .../sqoop/integration/server/VersionTest.java   |   16 +-
 29 files changed, 1848 insertions(+), 1863 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/client/src/test/java/org/apache/sqoop/client/TestSqoopClient.java
----------------------------------------------------------------------
diff --git a/client/src/test/java/org/apache/sqoop/client/TestSqoopClient.java b/client/src/test/java/org/apache/sqoop/client/TestSqoopClient.java
index b5e7e61..731f6cc 100644
--- a/client/src/test/java/org/apache/sqoop/client/TestSqoopClient.java
+++ b/client/src/test/java/org/apache/sqoop/client/TestSqoopClient.java
@@ -43,185 +43,186 @@ import static org.mockito.Mockito.*;
 
 public class TestSqoopClient {
 
-//  SqoopRequests requests;
-//  SqoopClient client;
-//
-//  @Before
-//  public void setUp() {
-//    requests = mock(SqoopRequests.class);
-//    client = new SqoopClient("my-cool-server");
-//    client.setSqoopRequests(requests);
-//  }
-//
-//  /**
-//   * Retrieve connector information, request to bundle for same connector should
-//   * not require additional HTTP request.
-//   */
-//  @Test
-//  public void testGetConnector() {
-//    when(requests.readConnector(1L)).thenReturn(connectorBean(connector(1)));
-//    MConnector connector = client.getConnector(1);
-//    assertEquals(1, connector.getPersistenceId());
-//
-//    client.getResourceBundle(1L);
-//
-//    verify(requests, times(1)).readConnector(1L);
-//  }
-//
-//  @Test
-//  public void testGetConnectorByString() {
-//    when(requests.readConnector(null)).thenReturn(connectorBean(connector(1)));
-//    MConnector connector = client.getConnector("A1");
-//    assertEquals(1, connector.getPersistenceId());
-//    assertEquals("A1", connector.getUniqueName());
-//
-//    client.getResourceBundle(1L);
-//
-//    verify(requests, times(0)).readConnector(1L);
-//    verify(requests, times(1)).readConnector(null);
-//  }
-//
-//  /**
-//   * Retrieve connector bundle, request for metadata for same connector should
-//   * not require additional HTTP request.
-//   */
-//  @Test
-//  public void testGetConnectorBundle() {
-//    when(requests.readConnector(1L)).thenReturn(connectorBean(connector(1)));
-//    client.getResourceBundle(1L);
-//
-//    MConnector connector = client.getConnector(1);
-//    assertEquals(1, connector.getPersistenceId());
-//
-//    verify(requests, times(1)).readConnector(1L);
-//  }
-//
-//  /**
-//   * Retrieve framework information, request to framework bundle should not
-//   * require additional HTTP request.
-//   */
-//  @Test
-//  public void testGetFramework() {
-//    when(requests.readFramework()).thenReturn(frameworkBean(framework()));
-//
-//    client.getFramework();
-//    client.getFrameworkResourceBundle();
-//
-//    verify(requests, times(1)).readFramework();
-//  }
-//
-//  /**
-//   * Retrieve framework bundle, request to framework metadata should not
-//   * require additional HTTP request.
-//   */
-//  @Test
-//  public void testGetFrameworkBundle() {
-//    when(requests.readFramework()).thenReturn(frameworkBean(framework()));
-//
-//    client.getFrameworkResourceBundle();
-//    client.getFramework();
-//
-//    verify(requests, times(1)).readFramework();
-//  }
-//
-//  /**
-//   * Getting all connectors at once should avoid any other HTTP request to
-//   * specific connectors.
-//   */
-//  @Test
-//  public void testGetConnectors() {
-//    MConnector connector;
-//
-//    when(requests.readConnector(null)).thenReturn(connectorBean(connector(1), connector(2)));
-//    Collection<MConnector> connectors = client.getConnectors();
-//    assertEquals(2, connectors.size());
-//
-//    client.getResourceBundle(1);
-//    connector = client.getConnector(1);
-//    assertEquals(1, connector.getPersistenceId());
-//
-//    connector = client.getConnector(2);
-//    client.getResourceBundle(2);
-//    assertEquals(2, connector.getPersistenceId());
-//
-//    connectors = client.getConnectors();
-//    assertEquals(2, connectors.size());
-//
-//    connector = client.getConnector("A1");
-//    assertEquals(1, connector.getPersistenceId());
-//    assertEquals("A1", connector.getUniqueName());
-//
-//    connector = client.getConnector("A2");
-//    assertEquals(2, connector.getPersistenceId());
-//    assertEquals("A2", connector.getUniqueName());
-//
-//    connector = client.getConnector("A3");
-//    assertNull(connector);
-//
-//    verify(requests, times(1)).readConnector(null);
-//    verifyNoMoreInteractions(requests);
-//  }
-//
-//
-//  /**
-//   * Getting connectors one by one should not be equivalent to getting all connectors
-//   * at once as Client do not know how many connectors server have.
-//   */
-//  @Test
-//  public void testGetConnectorOneByOne() {
-//    ConnectorBean bean = connectorBean(connector(1), connector(2));
-//    when(requests.readConnector(null)).thenReturn(bean);
-//    when(requests.readConnector(1L)).thenReturn(bean);
-//    when(requests.readConnector(2L)).thenReturn(bean);
-//
-//    client.getResourceBundle(1);
-//    client.getConnector(1);
-//
-//    client.getConnector(2);
-//    client.getResourceBundle(2);
-//
-//    Collection<MConnector> connectors = client.getConnectors();
-//    assertEquals(2, connectors.size());
-//
-//    verify(requests, times(1)).readConnector(null);
-//    verify(requests, times(1)).readConnector(1L);
-//    verify(requests, times(1)).readConnector(2L);
-//    verifyNoMoreInteractions(requests);
-//  }
-//
-//  /**
-//   * Connection for non-existing connector can't be created.
-//   */
-//  @Test(expected = SqoopException.class)
-//  public void testNewConnection() {
-//    when(requests.readConnector(null)).thenReturn(connectorBean(connector(1)));
-//    client.newConnection("non existing connector");
-//  }
-//
-//  private ConnectorBean connectorBean(MConnector...connectors) {
-//    List<MConnector> connectorList = new ArrayList<MConnector>();
-//    Map<Long, ResourceBundle> bundles = new HashMap<Long, ResourceBundle>();
-//
-//    for(MConnector connector : connectors) {
-//      connectorList.add(connector);
-//      bundles.put(connector.getPersistenceId(), null);
-//    }
-//    return new ConnectorBean(connectorList, bundles);
-//  }
-//  private FrameworkBean frameworkBean(MFramework framework) {
-//    return new FrameworkBean(framework, new MapResourceBundle(null));
-//  }
-//
-//  private MConnector connector(long id) {
-//    MConnector connector = new MConnector("A" + id, "A" + id, "1.0" + id, new MConnectionForms(null), new LinkedList<MJobForms>());
-//    connector.setPersistenceId(id);
-//    return connector;
-//  }
-//
-//  private MFramework framework() {
-//    MFramework framework = new MFramework(new MConnectionForms(null),
-//      new LinkedList<MJobForms>(), "1");
-//    framework.setPersistenceId(1);
-//    return framework;
-//  }
+  SqoopRequests requests;
+  SqoopClient client;
+
+  @Before
+  public void setUp() {
+    requests = mock(SqoopRequests.class);
+    client = new SqoopClient("my-cool-server");
+    client.setSqoopRequests(requests);
+  }
+
+  /**
+   * Retrieve connector information, request to bundle for same connector should
+   * not require additional HTTP request.
+   */
+  @Test
+  public void testGetConnector() {
+    when(requests.readConnector(1L)).thenReturn(connectorBean(connector(1)));
+    MConnector connector = client.getConnector(1);
+    assertEquals(1, connector.getPersistenceId());
+
+    client.getResourceBundle(1L);
+
+    verify(requests, times(1)).readConnector(1L);
+  }
+
+  @Test
+  public void testGetConnectorByString() {
+    when(requests.readConnector(null)).thenReturn(connectorBean(connector(1)));
+    MConnector connector = client.getConnector("A1");
+    assertEquals(1, connector.getPersistenceId());
+    assertEquals("A1", connector.getUniqueName());
+
+    client.getResourceBundle(1L);
+
+    verify(requests, times(0)).readConnector(1L);
+    verify(requests, times(1)).readConnector(null);
+  }
+
+  /**
+   * Retrieve connector bundle, request for metadata for same connector should
+   * not require additional HTTP request.
+   */
+  @Test
+  public void testGetConnectorBundle() {
+    when(requests.readConnector(1L)).thenReturn(connectorBean(connector(1)));
+    client.getResourceBundle(1L);
+
+    MConnector connector = client.getConnector(1);
+    assertEquals(1, connector.getPersistenceId());
+
+    verify(requests, times(1)).readConnector(1L);
+  }
+
+  /**
+   * Retrieve framework information, request to framework bundle should not
+   * require additional HTTP request.
+   */
+  @Test
+  public void testGetFramework() {
+    when(requests.readFramework()).thenReturn(frameworkBean(framework()));
+
+    client.getFramework();
+    client.getFrameworkResourceBundle();
+
+    verify(requests, times(1)).readFramework();
+  }
+
+  /**
+   * Retrieve framework bundle, request to framework metadata should not
+   * require additional HTTP request.
+   */
+  @Test
+  public void testGetFrameworkBundle() {
+    when(requests.readFramework()).thenReturn(frameworkBean(framework()));
+
+    client.getFrameworkResourceBundle();
+    client.getFramework();
+
+    verify(requests, times(1)).readFramework();
+  }
+
+  /**
+   * Getting all connectors at once should avoid any other HTTP request to
+   * specific connectors.
+   */
+  @Test
+  public void testGetConnectors() {
+    MConnector connector;
+
+    when(requests.readConnector(null)).thenReturn(connectorBean(connector(1), connector(2)));
+    Collection<MConnector> connectors = client.getConnectors();
+    assertEquals(2, connectors.size());
+
+    client.getResourceBundle(1);
+    connector = client.getConnector(1);
+    assertEquals(1, connector.getPersistenceId());
+
+    connector = client.getConnector(2);
+    client.getResourceBundle(2);
+    assertEquals(2, connector.getPersistenceId());
+
+    connectors = client.getConnectors();
+    assertEquals(2, connectors.size());
+
+    connector = client.getConnector("A1");
+    assertEquals(1, connector.getPersistenceId());
+    assertEquals("A1", connector.getUniqueName());
+
+    connector = client.getConnector("A2");
+    assertEquals(2, connector.getPersistenceId());
+    assertEquals("A2", connector.getUniqueName());
+
+    connector = client.getConnector("A3");
+    assertNull(connector);
+
+    verify(requests, times(1)).readConnector(null);
+    verifyNoMoreInteractions(requests);
+  }
+
+
+  /**
+   * Getting connectors one by one should not be equivalent to getting all connectors
+   * at once as Client do not know how many connectors server have.
+   */
+  @Test
+  public void testGetConnectorOneByOne() {
+    ConnectorBean bean = connectorBean(connector(1), connector(2));
+    when(requests.readConnector(null)).thenReturn(bean);
+    when(requests.readConnector(1L)).thenReturn(bean);
+    when(requests.readConnector(2L)).thenReturn(bean);
+
+    client.getResourceBundle(1);
+    client.getConnector(1);
+
+    client.getConnector(2);
+    client.getResourceBundle(2);
+
+    Collection<MConnector> connectors = client.getConnectors();
+    assertEquals(2, connectors.size());
+
+    verify(requests, times(1)).readConnector(null);
+    verify(requests, times(1)).readConnector(1L);
+    verify(requests, times(1)).readConnector(2L);
+    verifyNoMoreInteractions(requests);
+  }
+
+  /**
+   * Connection for non-existing connector can't be created.
+   */
+  @Test(expected = SqoopException.class)
+  public void testNewConnection() {
+    when(requests.readConnector(null)).thenReturn(connectorBean(connector(1)));
+    client.newConnection("non existing connector");
+  }
+
+  private ConnectorBean connectorBean(MConnector...connectors) {
+    List<MConnector> connectorList = new ArrayList<MConnector>();
+    Map<Long, ResourceBundle> bundles = new HashMap<Long, ResourceBundle>();
+
+    for(MConnector connector : connectors) {
+      connectorList.add(connector);
+      bundles.put(connector.getPersistenceId(), null);
+    }
+    return new ConnectorBean(connectorList, bundles);
+  }
+  private FrameworkBean frameworkBean(MFramework framework) {
+    return new FrameworkBean(framework, new MapResourceBundle(null));
+  }
+
+  private MConnector connector(long id) {
+    MConnector connector = new MConnector("A" + id, "A" + id, "1.0" + id,
+        new MConnectionForms(null), new MJobForms(null), new MJobForms(null));
+    connector.setPersistenceId(id);
+    return connector;
+  }
+
+  private MFramework framework() {
+    MFramework framework = new MFramework(new MConnectionForms(null),
+        new MJobForms(null), "1");
+    framework.setPersistenceId(1);
+    return framework;
+  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/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 a50c815..c0d678a 100644
--- a/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
+++ b/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
@@ -45,6 +45,7 @@ public abstract class MValidatedElement extends MNamedElement {
 
   public MValidatedElement(MValidatedElement other) {
     super(other);
+    resetValidationMessages();
     this.validationStatus = other.validationStatus;
     this.validationMessages.addAll(other.validationMessages);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/common/src/main/java/org/apache/sqoop/validation/validators/NullOrContains.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/validation/validators/NullOrContains.java b/common/src/main/java/org/apache/sqoop/validation/validators/NullOrContains.java
new file mode 100644
index 0000000..9d11a2e
--- /dev/null
+++ b/common/src/main/java/org/apache/sqoop/validation/validators/NullOrContains.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sqoop.validation.validators;
+
+import org.apache.sqoop.validation.Status;
+
+/**
+ * String validator to verify presence of a sub string (provided as a String argument)
+ */
+public class NullOrContains extends AbstractValidator<String> {
+  @Override
+  public void validate(String str) {
+    if(str != null && !str.contains(getStringArgument())) {
+      addMessage(Status.UNACCEPTABLE, "String must contain substring: " + getStringArgument());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java b/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java
new file mode 100644
index 0000000..4bd1559
--- /dev/null
+++ b/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java
@@ -0,0 +1,97 @@
+/**
+ * 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.validation.validators;
+
+import org.apache.sqoop.validation.Status;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+
+/**
+ */
+public class TestNullOrContains {
+
+  AbstractValidator validator = new NullOrContains();
+
+  @Test
+  public void test() {
+    assertEquals(0, validator.getMessages().size());
+
+    // Default, no string argument set
+    validator.validate("str");
+    assertEquals(Status.FINE, validator.getStatus());
+    assertEquals(0, validator.getMessages().size());
+
+    // Searched substring is entire string
+    validator.reset();
+    validator.setStringArgument("str");
+    validator.validate("str");
+    assertEquals(Status.FINE, validator.getStatus());
+    assertEquals(0, validator.getMessages().size());
+
+    // Just starts with
+    validator.reset();
+    validator.setStringArgument("str");
+    validator.validate("straaaaa");
+    assertEquals(Status.FINE, validator.getStatus());
+    assertEquals(0, validator.getMessages().size());
+
+    // Ends with
+    validator.reset();
+    validator.setStringArgument("str");
+    validator.validate("aaastr");
+    assertEquals(Status.FINE, validator.getStatus());
+    assertEquals(0, validator.getMessages().size());
+
+    // In the middle
+    validator.reset();
+    validator.setStringArgument("str");
+    validator.validate("aaastraaa");
+    assertEquals(Status.FINE, validator.getStatus());
+    assertEquals(0, validator.getMessages().size());
+
+    // Repitition
+    validator.reset();
+    validator.setStringArgument("str");
+    validator.validate("aaastraaastraaa");
+    assertEquals(Status.FINE, validator.getStatus());
+    assertEquals(0, validator.getMessages().size());
+
+    // Null string
+    validator.reset();
+    validator.setStringArgument("str");
+    validator.validate(null);
+    assertEquals(Status.FINE, validator.getStatus());
+    assertEquals(0, validator.getMessages().size());
+
+    // Empty string
+    validator.reset();
+    validator.setStringArgument("str");
+    validator.validate("");
+    assertEquals(Status.UNACCEPTABLE, validator.getStatus());
+    assertEquals(1, validator.getMessages().size());
+
+    // "Random" string
+    validator.reset();
+    validator.setStringArgument("str");
+    validator.validate("Ahoj tady je meduza");
+    assertEquals(Status.UNACCEPTABLE, validator.getStatus());
+    assertEquals(1, validator.getMessages().size());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromTableForm.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromTableForm.java b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromTableForm.java
index ac72546..72902a2 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromTableForm.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromTableForm.java
@@ -23,7 +23,7 @@ import org.apache.sqoop.model.Input;
 import org.apache.sqoop.model.Validator;
 import org.apache.sqoop.validation.Status;
 import org.apache.sqoop.validation.validators.AbstractValidator;
-import org.apache.sqoop.validation.validators.Contains;
+import org.apache.sqoop.validation.validators.NullOrContains;
 
 /**
  *
@@ -36,7 +36,7 @@ public class FromTableForm {
   @Input(size = 50)
   public String tableName;
 
-  @Input(size = 2000, validators = {@Validator(value = Contains.class, strArg = GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN)})
+  @Input(size = 2000, validators = {@Validator(value = NullOrContains.class, strArg = GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN)})
   public String sql;
 
   @Input(size = 50)

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
index 4831cf8..eb6fcf1 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
@@ -27,6 +27,8 @@ import org.apache.sqoop.job.etl.Initializer;
 import org.apache.sqoop.job.etl.InitializerContext;
 import org.apache.sqoop.validation.Status;
 import org.apache.sqoop.validation.Validation;
+import org.apache.sqoop.validation.ValidationResult;
+import org.apache.sqoop.validation.ValidationRunner;
 
 public class TestToInitializer extends TestCase {
   private final String schemaName;
@@ -274,23 +276,23 @@ public class TestToInitializer extends TestCase {
     // the stage table
     jobConf.toTable.tableName = schemalessTableName;
     jobConf.toTable.clearStageTable = false;
-    GenericJdbcValidator validator = new GenericJdbcValidator();
-    Validation validation = validator.validateJob(jobConf);
+    ValidationRunner validationRunner = new ValidationRunner();
+    ValidationResult result = validationRunner.validate(jobConf);
     assertEquals("User should not specify clear stage table flag without " +
       "specifying name of the stage table",
       Status.UNACCEPTABLE,
-      validation.getStatus());
-    assertTrue(validation.getMessages().containsKey(
-      new Validation.FormInput("toTable")));
+        result.getStatus());
+    assertTrue(result.getMessages().containsKey(
+      "toTable"));
 
     jobConf.toTable.clearStageTable = true;
-    validation = validator.validateJob(jobConf);
+    result = validationRunner.validate(jobConf);
     assertEquals("User should not specify clear stage table flag without " +
       "specifying name of the stage table",
       Status.UNACCEPTABLE,
-      validation.getStatus());
-    assertTrue(validation.getMessages().containsKey(
-      new Validation.FormInput("toTable")));
+        result.getStatus());
+    assertTrue(result.getMessages().containsKey(
+      "toTable"));
   }
 
   @SuppressWarnings("unchecked")
@@ -304,12 +306,12 @@ public class TestToInitializer extends TestCase {
     jobConf.toTable.stageTableName = stageTableName;
     jobConf.toTable.sql = "";
 
-    GenericJdbcValidator validator = new GenericJdbcValidator();
-    Validation validation = validator.validateJob(jobConf);
+    ValidationRunner validationRunner = new ValidationRunner();
+    ValidationResult result = validationRunner.validate(jobConf);
     assertEquals("Stage table name cannot be specified without specifying " +
-      "table name", Status.UNACCEPTABLE, validation.getStatus());
-    assertTrue(validation.getMessages().containsKey(
-      new Validation.FormInput("toTable")));
+      "table name", Status.UNACCEPTABLE, result.getStatus());
+    assertTrue(result.getMessages().containsKey(
+      "toTable"));
   }
 
   @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsLoader.java
----------------------------------------------------------------------
diff --git a/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsLoader.java b/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsLoader.java
index 5a924f9..61676fe 100644
--- a/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsLoader.java
+++ b/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsLoader.java
@@ -21,6 +21,7 @@ import org.apache.hadoop.conf.Configurable;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.compress.CompressionCodec;
+import org.apache.sqoop.common.PrefixContext;
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.connector.hdfs.configuration.ConnectionConfiguration;
 import org.apache.sqoop.connector.hdfs.configuration.OutputFormat;
@@ -50,7 +51,7 @@ public class HdfsLoader extends Loader<ConnectionConfiguration, ToJobConfigurati
 
     DataReader reader = context.getDataReader();
 
-    Configuration conf = new Configuration();
+    Configuration conf = ((PrefixContext)context.getContext()).getConfiguration();
 
     String directoryName = job.output.outputDirectory;
     String codecname = getCompressionCodecName(job);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/configuration/StorageType.java
----------------------------------------------------------------------
diff --git a/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/configuration/StorageType.java b/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/configuration/StorageType.java
deleted file mode 100644
index d4aaa0a..0000000
--- a/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/configuration/StorageType.java
+++ /dev/null
@@ -1,28 +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.connector.hdfs.configuration;
-
-/**
- * Various storage types that Sqoop is supporting
- */
-public enum StorageType {
-  /**
-   * Direct HDFS import
-   */
-  HDFS,
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestExtractor.java
----------------------------------------------------------------------
diff --git a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestExtractor.java b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestExtractor.java
index 6ed4087..5e21543 100644
--- a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestExtractor.java
+++ b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestExtractor.java
@@ -97,9 +97,8 @@ public class TestExtractor extends TestHdfsBase {
   public void testExtractor() throws Exception {
     Configuration conf = new Configuration();
     PrefixContext prefixContext = new PrefixContext(conf, "org.apache.sqoop.job.connector.from.context.");
+    final boolean[] visited = new boolean[NUMBER_OF_FILES * NUMBER_OF_ROWS_PER_FILE];
     ExtractorContext context = new ExtractorContext(prefixContext, new DataWriter() {
-      private long index = 1L;
-
       @Override
       public void writeArrayRecord(Object[] array) {
         throw new AssertionError("Should not be writing array.");
@@ -107,7 +106,23 @@ public class TestExtractor extends TestHdfsBase {
 
       @Override
       public void writeStringRecord(String text) {
-        Assert.assertEquals(index + "," + index + ".0,'" + index++ + "'", text);
+        int index;
+        String[] components = text.split(",");
+        Assert.assertEquals(3, components.length);
+
+        // Value should take on the form <integer>,<float>,'<integer>'
+        // for a single index. IE: 1,1.0,'1'.
+        try {
+          index = Integer.parseInt(components[0]);
+        } catch (NumberFormatException e) {
+          throw new AssertionError("Could not parse int for " + components[0]);
+        }
+
+        Assert.assertFalse(visited[index - 1]);
+        Assert.assertEquals(String.valueOf((double)index), components[1]);
+        Assert.assertEquals("'" + index + "'", components[2]);
+
+        visited[index - 1] = true;
       }
 
       @Override
@@ -121,5 +136,9 @@ public class TestExtractor extends TestHdfsBase {
     HdfsPartition partition = createPartition(FileUtils.listDir(inputDirectory));
 
     extractor.extract(context, connConf, jobConf, partition);
+
+    for (int index = 0; index < NUMBER_OF_FILES * NUMBER_OF_ROWS_PER_FILE; ++index) {
+      Assert.assertTrue("Index " + (index + 1) + " was not visited", visited[index]);
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestHdfsBase.java
----------------------------------------------------------------------
diff --git a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestHdfsBase.java b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestHdfsBase.java
index 0cc2b8b..6eae7fd 100644
--- a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestHdfsBase.java
+++ b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestHdfsBase.java
@@ -30,6 +30,7 @@ import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
+import java.util.UUID;
 
 public class TestHdfsBase {
 
@@ -66,7 +67,7 @@ public class TestHdfsBase {
 
     int index = 1;
     for (int fi = 0; fi < numberOfFiles; fi++) {
-      String fileName = indir + "/" + "part-r-" + padZeros(fi, 5) + extension;
+      String fileName = indir + "/" + UUID.randomUUID() + extension;
       OutputStream filestream = FileUtils.create(fileName);
       BufferedWriter filewriter;
       if (codec != null) {
@@ -105,8 +106,7 @@ public class TestHdfsBase {
 
     int index = 1;
     for (int fi = 0; fi < numberOfFiles; fi++) {
-      Path filepath = new Path(indir,
-          "part-r-" + padZeros(fi, 5) + ".seq");
+      Path filepath = new Path(indir,UUID.randomUUID() + ".seq");
       SequenceFile.Writer filewriter;
       if (codec != null) {
         filewriter = SequenceFile.createWriter(filepath.getFileSystem(conf),
@@ -128,12 +128,4 @@ public class TestHdfsBase {
       filewriter.close();
     }
   }
-
-  private String padZeros(int number, int digits) {
-    String string = String.valueOf(number);
-    for (int i = (digits - string.length()); i > 0; i--) {
-      string = "0" + string;
-    }
-    return string;
-  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/core/src/main/java/org/apache/sqoop/framework/configuration/ConnectionConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/framework/configuration/ConnectionConfiguration.java b/core/src/main/java/org/apache/sqoop/framework/configuration/ConnectionConfiguration.java
index 830606a..897d3c7 100644
--- a/core/src/main/java/org/apache/sqoop/framework/configuration/ConnectionConfiguration.java
+++ b/core/src/main/java/org/apache/sqoop/framework/configuration/ConnectionConfiguration.java
@@ -26,5 +26,5 @@ import org.apache.sqoop.model.Form;
 @ConfigurationClass
 public class ConnectionConfiguration {
 
-  @Form SecurityForm security;
+  @Form SecurityForm security = new SecurityForm();
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/fcb77b67/core/src/test/java/org/apache/sqoop/framework/TestFrameworkValidator.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/framework/TestFrameworkValidator.java b/core/src/test/java/org/apache/sqoop/framework/TestFrameworkValidator.java
index 90395ac..69c1b56 100644
--- a/core/src/test/java/org/apache/sqoop/framework/TestFrameworkValidator.java
+++ b/core/src/test/java/org/apache/sqoop/framework/TestFrameworkValidator.java
@@ -17,7 +17,13 @@
  */
 package org.apache.sqoop.framework;
 
-//import org.apache.sqoop.framework.configuration.OutputCompression;
+import org.apache.sqoop.framework.configuration.ConnectionConfiguration;
+import org.apache.sqoop.framework.configuration.JobConfiguration;
+import org.apache.sqoop.validation.Status;
+import org.apache.sqoop.validation.ValidationResult;
+import org.apache.sqoop.validation.ValidationRunner;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -27,134 +33,48 @@ import static org.junit.Assert.assertTrue;
  */
 public class TestFrameworkValidator {
 
-//  FrameworkValidator validator;
-//
-//  @Before
-//  public void setUp() {
-//    validator = new FrameworkValidator();
-//  }
-//
-//  @Test
-//  public void testConnectionValidation() {
-//    ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration();
-//
-//    Validation validation = validator.validateConnection(connectionConfiguration);
-//    assertEquals(Status.FINE, validation.getStatus());
-//    assertEquals(0, validation.getMessages().size());
-//  }
-//
-//  @Test
-//  public void testExportJobValidation() {
-//    ExportJobConfiguration configuration;
-//    Validation validation;
-//
-//    // Empty form is not allowed
-//    configuration = new ExportJobConfiguration();
-//    validation = validator.validateJob(MJob.Type.EXPORT, configuration);
-//    assertEquals(Status.UNACCEPTABLE, validation.getStatus());
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("input.inputDirectory")));
-//
-//    // Explicitly setting extractors and loaders
-//    configuration = new ExportJobConfiguration();
-//    configuration.input.inputDirectory = "/czech/republic";
-//    configuration.throttling.extractors = 3;
-//    configuration.throttling.loaders = 3;
-//
-//    validation = validator.validateJob(MJob.Type.EXPORT, configuration);
-//    assertEquals(Status.FINE, validation.getStatus());
-//    assertEquals(0, validation.getMessages().size());
-//
-//    // Negative and zero values for extractors and loaders
-//    configuration = new ExportJobConfiguration();
-//    configuration.input.inputDirectory = "/czech/republic";
-//    configuration.throttling.extractors = 0;
-//    configuration.throttling.loaders = -1;
-//
-//    validation = validator.validateJob(MJob.Type.EXPORT, configuration);
-//    assertEquals(Status.UNACCEPTABLE, validation.getStatus());
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("throttling.extractors")));
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("throttling.loaders")));
-//  }
-//
-//
-//  @Test
-//  public void testImportJobValidation() {
-//    ImportJobConfiguration configuration;
-//    Validation validation;
-//
-//    // Empty form is not allowed
-//    configuration = new ImportJobConfiguration();
-//    validation = validator.validateJob(MJob.Type.IMPORT, configuration);
-//    assertEquals(Status.UNACCEPTABLE, validation.getStatus());
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("output.outputDirectory")));
-//
-//    // Explicitly setting extractors and loaders
-//    configuration = new ImportJobConfiguration();
-//    configuration.output.outputDirectory = "/czech/republic";
-//    configuration.throttling.extractors = 3;
-//    configuration.throttling.loaders = 3;
-//
-//    validation = validator.validateJob(MJob.Type.IMPORT, configuration);
-//    assertEquals(Status.FINE, validation.getStatus());
-//    assertEquals(0, validation.getMessages().size());
-//
-//    // Negative and zero values for extractors and loaders
-//    configuration = new ImportJobConfiguration();
-//    configuration.output.outputDirectory = "/czech/republic";
+  FrameworkValidator validator;
+
+  @Before
+  public void setUp() {
+    validator = new FrameworkValidator();
+  }
+
+  @Test
+  public void testConnectionValidation() {
+    ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration();
+    ValidationRunner runner = new ValidationRunner();
+    ValidationResult result = runner.validate(connectionConfiguration);
+    assertEquals(Status.FINE, result.getStatus());
+    assertEquals(0, result.getMessages().size());
+  }
+
+  @Test
+  public void testJobValidation() {
+    ValidationRunner runner = new ValidationRunner();
+    ValidationResult result;
+    JobConfiguration configuration;
+
+    // Empty form is allowed
+    configuration = new JobConfiguration();
+    result = runner.validate(configuration);
+    assertEquals(Status.FINE, result.getStatus());
+
+    // Explicitly setting extractors and loaders
+    configuration = new JobConfiguration();
+    configuration.throttling.extractors = 3;
+    configuration.throttling.loaders = 3;
+    result = runner.validate(configuration);
+    assertEquals(Status.FINE, result.getStatus());
+    assertEquals(0, result.getMessages().size());
+
+    // Negative and zero values for extractors and loaders
+//    configuration = new JobConfiguration();
 //    configuration.throttling.extractors = 0;
 //    configuration.throttling.loaders = -1;
-//
-//    validation = validator.validateJob(MJob.Type.IMPORT, configuration);
-//    assertEquals(Status.UNACCEPTABLE, validation.getStatus());
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("throttling.extractors")));
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("throttling.loaders")));
-//
-//    // specifying both compression as well as customCompression is
-//    // unacceptable
-//    configuration = new ImportJobConfiguration();
-//    configuration.output.outputDirectory = "/czech/republic";
-//    configuration.throttling.extractors = 2;
-//    configuration.throttling.loaders = 2;
-//    configuration.output.compression = OutputCompression.BZIP2;
-//    configuration.output.customCompression = "some.compression.codec";
-//
-//    validation = validator.validateJob(MJob.Type.IMPORT, configuration);
-//    assertEquals(Status.UNACCEPTABLE, validation.getStatus());
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("output.compression")));
-//
-//    // specifying a customCompression is fine
-//    configuration = new ImportJobConfiguration();
-//    configuration.output.outputDirectory = "/czech/republic";
-//    configuration.throttling.extractors = 2;
-//    configuration.throttling.loaders = 2;
-//    configuration.output.compression = OutputCompression.CUSTOM;
-//    configuration.output.customCompression = "some.compression.codec";
-//
-//    validation = validator.validateJob(MJob.Type.IMPORT, configuration);
-//    assertEquals(Status.FINE, validation.getStatus());
-//
-//    // specifying a customCompression without codec name is unacceptable
-//    configuration = new ImportJobConfiguration();
-//    configuration.output.outputDirectory = "/czech/republic";
-//    configuration.throttling.extractors = 2;
-//    configuration.throttling.loaders = 2;
-//    configuration.output.compression = OutputCompression.CUSTOM;
-//    configuration.output.customCompression = "";
-//
-//    validation = validator.validateJob(MJob.Type.IMPORT, configuration);
-//    assertEquals(Status.UNACCEPTABLE, validation.getStatus());
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("output.compression")));
-//
-//    configuration = new ImportJobConfiguration();
-//    configuration.output.outputDirectory = "/czech/republic";
-//    configuration.throttling.extractors = 2;
-//    configuration.throttling.loaders = 2;
-//    configuration.output.compression = OutputCompression.CUSTOM;
-//    configuration.output.customCompression = null;
-//
-//    validation = validator.validateJob(MJob.Type.IMPORT, configuration);
-//    assertEquals(Status.UNACCEPTABLE, validation.getStatus());
-//    assertTrue(validation.getMessages().containsKey(new Validation.FormInput("output.compression")));
-//
-//  }
+//    result = runner.validate(configuration);
+//    assertEquals(Status.FINE, result.getStatus());
+//    assertTrue(result.getMessages().containsKey("throttling.extractors"));
+//    assertTrue(result.getMessages().containsKey("throttling.loaders"));
+  }
 }