sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From annaszo...@apache.org
Subject sqoop git commit: SQOOP-3198: Fix DirectMySQLExportTest and OracleExportTest
Date Tue, 20 Jun 2017 09:50:30 GMT
Repository: sqoop
Updated Branches:
  refs/heads/trunk 89684ad84 -> 66ce74a91


SQOOP-3198: Fix DirectMySQLExportTest and OracleExportTest

(Szabolcs Vasas via Anna Szonyi)


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

Branch: refs/heads/trunk
Commit: 66ce74a9100699741dad7396f4c7a4b8afb53c25
Parents: 89684ad
Author: Anna Szonyi <annaszonyi@apache.org>
Authored: Tue Jun 20 10:28:01 2017 +0200
Committer: Anna Szonyi <annaszonyi@apache.org>
Committed: Tue Jun 20 11:18:28 2017 +0200

----------------------------------------------------------------------
 src/test/com/cloudera/sqoop/TestExport.java     | 37 ++++++++++----------
 .../sqoop/manager/DirectMySQLExportTest.java    | 17 +++++++--
 .../apache/sqoop/TestExportUsingProcedure.java  |  4 +--
 3 files changed, 35 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/66ce74a9/src/test/com/cloudera/sqoop/TestExport.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/TestExport.java b/src/test/com/cloudera/sqoop/TestExport.java
index 8b468c8..7948dae 100644
--- a/src/test/com/cloudera/sqoop/TestExport.java
+++ b/src/test/com/cloudera/sqoop/TestExport.java
@@ -124,6 +124,20 @@ public class TestExport extends ExportJobTestCase {
     String getType();
   }
 
+  protected static class IntColumnGenerator implements ColumnGenerator {
+    public String getExportText(int rowNum) {
+      int day = rowNum + 1;
+      return String.valueOf(day);
+    }
+    public String getVerifyText(int rowNum) {
+      int day = rowNum + 1;
+      return String.valueOf(day);
+    }
+    public String getType() {
+      return "INT";
+    }
+  }
+
   /**
    * Create a data file that gets exported to the db.
    * @param fileNum the number of the file (for multi-file export)
@@ -906,14 +920,14 @@ public class TestExport extends ExportJobTestCase {
   public void testLessColumnsInFileThanInTable() throws IOException, SQLException {
     final int TOTAL_RECORDS = 10;
 
-    ColumnGenerator genDate = getDateColumnGenerator();
+    ColumnGenerator genInteger = new IntColumnGenerator();
     ColumnGenerator genTime = getTimeColumnGenerator();
 
-    createTextFile(0, TOTAL_RECORDS, false, genDate);
-    createTable(genDate, genTime);
+    createTextFile(0, TOTAL_RECORDS, false, genInteger);
+    createTable(genInteger, genTime);
     runExport(getArgv(true, 10, 10));
     verifyExport(TOTAL_RECORDS);
-    assertColMinAndMax(forIdx(0), genDate);
+    assertColMinAndMax(forIdx(0), genInteger);
 
     // test that the Time column is with NULL values
     class NullColumnGenerator implements ColumnGenerator {
@@ -1045,21 +1059,6 @@ public class TestExport extends ExportJobTestCase {
       }
     }
 
-    // a normal string column
-    class  IntColumnGenerator implements ColumnGenerator {
-      public String getExportText(int rowNum) {
-        int day = rowNum + 1;
-        return String.valueOf(day);
-      }
-      public String getVerifyText(int rowNum) {
-        int day = rowNum + 1;
-        return String.valueOf(day);
-      }
-      public String getType() {
-        return "INT";
-      }
-    }
-
     // test that the second column is with NULL values after import
     class NullColumnGenerator implements ColumnGenerator {
       public String getExportText(int rowNum) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/66ce74a9/src/test/com/cloudera/sqoop/manager/DirectMySQLExportTest.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/manager/DirectMySQLExportTest.java b/src/test/com/cloudera/sqoop/manager/DirectMySQLExportTest.java
index ec7b84a..9fa8816 100644
--- a/src/test/com/cloudera/sqoop/manager/DirectMySQLExportTest.java
+++ b/src/test/com/cloudera/sqoop/manager/DirectMySQLExportTest.java
@@ -38,6 +38,7 @@ import org.junit.Before;
 import com.cloudera.sqoop.SqoopOptions;
 import com.cloudera.sqoop.TestExport;
 import com.cloudera.sqoop.mapreduce.MySQLExportMapper;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -302,18 +303,30 @@ public class DirectMySQLExportTest extends TestExport {
     }
   }
 
+  @Ignore("Ignoring this test as staging is not supported in direct mode.")
   @Override
   @Test
   public void testMultiMapTextExportWithStaging()
     throws IOException, SQLException {
-    // disable this test as staging is not supported in direct mode
   }
 
+  @Ignore("Ignoring this test as staging is not supported in direct mode.")
   @Override
   @Test
   public void testMultiTransactionWithStaging()
     throws IOException, SQLException {
-    // disable this test as staging is not supported in direct mode
+  }
+
+  @Ignore("Ignoring this test as --input-null-non-string is not supported in direct mode.")
+  @Override
+  @Test
+  public void testLessColumnsInFileThanInTableInputNullIntPassed() throws IOException, SQLException
{
+  }
+
+  @Ignore("Ignoring this test as --input-null-string is not supported in direct mode.")
+  @Override
+  @Test
+  public void testLessColumnsInFileThanInTableInputNullStringPassed() throws IOException,
SQLException {
   }
 
   private void verifyTableColumnContents(Connection connection,

http://git-wip-us.apache.org/repos/asf/sqoop/blob/66ce74a9/src/test/org/apache/sqoop/TestExportUsingProcedure.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/TestExportUsingProcedure.java b/src/test/org/apache/sqoop/TestExportUsingProcedure.java
index 68e79f1..1783676 100644
--- a/src/test/org/apache/sqoop/TestExportUsingProcedure.java
+++ b/src/test/org/apache/sqoop/TestExportUsingProcedure.java
@@ -343,11 +343,11 @@ public class TestExportUsingProcedure extends TestExport {
    * columns in the table.
    */
   public static void insertFunctiontestLessColumnsInFileThanInTable(int id, String msg,
-      final Date date1, final Timestamp t2) throws SQLException {
+      final int number, final Timestamp t2) throws SQLException {
     insertFunction(id, msg, new SetExtraArgs() {
       @Override
       public void set(PreparedStatement on) throws SQLException {
-        on.setDate(3, date1);
+        on.setInt(3, number);
         on.setNull(4, Types.TIMESTAMP);
       }
     });


Mime
View raw message