mirror of
https://github.com/apache/sqoop.git
synced 2025-05-06 17:20:31 +08:00
SQOOP-1974: Sqoop2: parseCSVString in SQOOPIDFUtils add more tests
(Veena Basavaraj via Abraham Elmahrek)
This commit is contained in:
parent
ae26b9668e
commit
dc50e4074f
@ -176,4 +176,17 @@ public void testEncodeMapToCSVString() {
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -197,6 +197,19 @@ public void testInputAsCSVTextInAndDataOut() {
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user