sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject sqoop git commit: SQOOP-1974: Sqoop2: parseCSVString in SQOOPIDFUtils add more tests
Date Tue, 06 Jan 2015 21:12:11 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 ae26b9668 -> dc50e4074


SQOOP-1974: Sqoop2: parseCSVString in SQOOPIDFUtils add more tests

(Veena Basavaraj via Abraham Elmahrek)


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

Branch: refs/heads/sqoop2
Commit: dc50e4074ff34f0a3dcf808cdf9f91cebd116105
Parents: ae26b96
Author: Abraham Elmahrek <abe@apache.org>
Authored: Tue Jan 6 13:11:13 2015 -0800
Committer: Abraham Elmahrek <abe@apache.org>
Committed: Tue Jan 6 13:11:13 2015 -0800

----------------------------------------------------------------------
 .../sqoop/connector/common/TestSqoopIDFUtils.java      | 13 +++++++++++++
 .../connector/idf/TestCSVIntermediateDataFormat.java   | 13 +++++++++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/dc50e407/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
index e9108b0..68890cc 100644
--- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
+++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
@@ -175,5 +175,18 @@ public class TestSqoopIDFUtils {
     String encodedText = encodeToCSVMap(map, mapCol);
     assertEquals(encodedText, "'{\"A\":[\"A\",\"B\"]}'");
   }
+  
+  @Test
+  public void testParseCSVString() {
+
+    String csv= "'hello, world','34',45";
+    String[] arr = parseCSVString(csv);
+    assertEquals(arr.length, 3);
+    assertEquals(arr[0], "'hello, world'");
+    assertEquals(arr[1], "'34'");
+    assertEquals(arr[2], "45");
+    
+  }
+
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/dc50e407/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
index 2602c61..64b18fd 100644
--- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
+++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
@@ -197,6 +197,19 @@ public class TestCSVIntermediateDataFormat {
     assertEquals(testData, dataFormat.getData());
   }
 
+  @Test
+  public void testInputAsCSVTextInObjectOutWithSingleColumn() {
+
+    String testData = "'\"hello, world\"'";
+    Schema schema = new Schema("test");
+    schema.addColumn(new Text("text"));
+
+    dataFormat.setSchema(schema);
+    dataFormat.setCSVTextData(testData);
+
+    Object[] out = dataFormat.getObjectData();
+    assertEquals("\"hello, world\"",out[0]);
+  }
 
   @Test
   public void testInputAsCSVTextInObjectOut() {


Mime
View raw message