sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkatran...@apache.org
Subject [2/3] sqoop git commit: SQOOP-2746: Add test case for Oracle incremental import using Timestamp (Jarek Jarcec Cecho via Venkat Ranganathan)
Date Thu, 17 Dec 2015 04:50:14 GMT
SQOOP-2746: Add test case for Oracle incremental import using Timestamp
  (Jarek Jarcec Cecho via Venkat Ranganathan)


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

Branch: refs/heads/trunk
Commit: e4f12a99bfd01d25666e32c9a753b4ff42aef583
Parents: 9c7638d
Author: Venkat Ranganathan <venkat@hortonworks.com>
Authored: Wed Dec 16 20:48:46 2015 -0800
Committer: Venkat Ranganathan <venkat@hortonworks.com>
Committed: Wed Dec 16 20:48:46 2015 -0800

----------------------------------------------------------------------
 .../oracle/OracleIncrementalImportTest.java     | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/e4f12a99/src/test/org/apache/sqoop/manager/oracle/OracleIncrementalImportTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/oracle/OracleIncrementalImportTest.java b/src/test/org/apache/sqoop/manager/oracle/OracleIncrementalImportTest.java
index 3bbb1b1..e596646 100644
--- a/src/test/org/apache/sqoop/manager/oracle/OracleIncrementalImportTest.java
+++ b/src/test/org/apache/sqoop/manager/oracle/OracleIncrementalImportTest.java
@@ -108,6 +108,8 @@ public class OracleIncrementalImportTest extends ImportJobTestCase {
     args.add(getWarehouseDir());
     args.add("--num-mappers");
     args.add("1");
+    args.add("--split-by");
+    args.add(checkColumnName);
     args.add("--table");
     args.add(tableName);
     args.add("--incremental");
@@ -154,6 +156,33 @@ public class OracleIncrementalImportTest extends ImportJobTestCase {
                  expectedVal, output);
   }
 
+  public void testIncrementalImportWithLastModifiedTimestamp() throws IOException {
+    tableNames = new ArrayList<String>();
+    String [] types = { "INT", "VARCHAR(10)", "TIMESTAMP", };
+    String [] vals = {
+        "1", "'old_data'",
+        "TO_TIMESTAMP('1999-01-01 11:11:11', 'YYYY-MM-DD HH24:MI:SS')",
+        "2", "'new_data'",
+        "TO_TIMESTAMP('2000-11-11 23:23:23', 'YYYY-MM-DD HH24:MI:SS')", };
+    String tableName = getTableName();
+    tableNames.add(tableName);
+    createTableWithColTypes(types, vals);
+    // Some version of Oracle's jdbc drivers automatically convert date to
+    // timestamp. Since we don't want this to happen for this test,
+    // we must explicitly use a property file to control this behavior.
+    String connPropsFileName = "connection.properties";
+    createFileWithContent(connPropsFileName, "oracle.jdbc.mapDateToTimestamp=false");
+    String[] args = getArgv(tableName, connPropsFileName, getColName(2));
+    runImport(args);
+
+    Path warehousePath = new Path(this.getWarehouseDir());
+    Path filePath = new Path(warehousePath, "part-m-00000");
+    String output = readLineFromPath(filePath);
+    String expectedVal = "2,new_data,2000-11-11 23:23:23.0";
+    assertEquals("Incremental import result expected a different string",
+                 expectedVal, output);
+  }
+
   private void createFileWithContent(String connPropsFileName,
       String fileContent) throws IOException {
     File file = new File(connPropsFileName);


Mime
View raw message