mirror of
https://github.com/apache/sqoop.git
synced 2025-05-02 07:21:58 +08:00
SQOOP-3350: Fix tests which use warehouse-dir as target-dir
(Szabolcs Vasas via Boglarka Egyed)
This commit is contained in:
parent
a06f2f3a83
commit
1213b7725a
@ -90,7 +90,7 @@ public void tearDown() {
|
|||||||
args.add("--connect");
|
args.add("--connect");
|
||||||
args.add(getConnectString());
|
args.add(getConnectString());
|
||||||
args.add("--target-dir");
|
args.add("--target-dir");
|
||||||
args.add(getWarehouseDir());
|
args.add(getTablePath().toString());
|
||||||
args.add("--split-by");
|
args.add("--split-by");
|
||||||
args.add(splitByCol);
|
args.add(splitByCol);
|
||||||
args.add("--num-mappers");
|
args.add("--num-mappers");
|
||||||
@ -134,8 +134,7 @@ public void testSimpleJoin() throws IOException {
|
|||||||
|
|
||||||
runImport(getArgv(tableName1 + "." + getColName(0), query));
|
runImport(getArgv(tableName1 + "." + getColName(0), query));
|
||||||
|
|
||||||
Path warehousePath = new Path(this.getWarehouseDir());
|
Path filePath = new Path(getTablePath(), "part-m-00000");
|
||||||
Path filePath = new Path(warehousePath, "part-m-00000");
|
|
||||||
String expectedVal = "1,foo";
|
String expectedVal = "1,foo";
|
||||||
|
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
|
@ -87,7 +87,7 @@ public void tearDown() {
|
|||||||
args.add(mySQLTestUtils.getUserName());
|
args.add(mySQLTestUtils.getUserName());
|
||||||
mySQLTestUtils.addPasswordIfIsSet(args);
|
mySQLTestUtils.addPasswordIfIsSet(args);
|
||||||
args.add("--target-dir");
|
args.add("--target-dir");
|
||||||
args.add(getWarehouseDir());
|
args.add(getTablePath().toString());
|
||||||
args.add("--num-mappers");
|
args.add("--num-mappers");
|
||||||
args.add("1");
|
args.add("1");
|
||||||
args.add("--table");
|
args.add("--table");
|
||||||
@ -105,8 +105,7 @@ public void testEscapeColumnWithDoubleQuote() throws IOException {
|
|||||||
String[] args = getArgv();
|
String[] args = getArgv();
|
||||||
runImport(args);
|
runImport(args);
|
||||||
|
|
||||||
Path warehousePath = new Path(this.getWarehouseDir());
|
Path filePath = new Path(getTablePath(), "part-m-00000");
|
||||||
Path filePath = new Path(warehousePath, "part-m-00000");
|
|
||||||
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
|
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
|
||||||
|
|
||||||
assertEquals("hello, world", output.trim());
|
assertEquals("hello, world", output.trim());
|
||||||
|
@ -87,7 +87,7 @@ public void tearDown() {
|
|||||||
args.add("--password");
|
args.add("--password");
|
||||||
args.add(OracleUtils.ORACLE_USER_PASS);
|
args.add(OracleUtils.ORACLE_USER_PASS);
|
||||||
args.add("--target-dir");
|
args.add("--target-dir");
|
||||||
args.add(getWarehouseDir());
|
args.add(getTablePath().toString());
|
||||||
args.add("--num-mappers");
|
args.add("--num-mappers");
|
||||||
args.add("1");
|
args.add("1");
|
||||||
args.add("--query");
|
args.add("--query");
|
||||||
@ -104,8 +104,7 @@ public void testRegexpReplaceEscapeWithSpecialCharacters() throws IOException {
|
|||||||
String[] args = getArgv();
|
String[] args = getArgv();
|
||||||
runImport(args);
|
runImport(args);
|
||||||
|
|
||||||
Path warehousePath = new Path(this.getWarehouseDir());
|
Path filePath = new Path(getTablePath(), "part-m-00000");
|
||||||
Path filePath = new Path(warehousePath, "part-m-00000");
|
|
||||||
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
|
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
|
||||||
|
|
||||||
assertEquals("hello, world!", output.trim());
|
assertEquals("hello, world!", output.trim());
|
||||||
|
@ -109,7 +109,7 @@ public void tearDown() {
|
|||||||
args.add("--connect");
|
args.add("--connect");
|
||||||
args.add(getConnectString());
|
args.add(getConnectString());
|
||||||
args.add("--target-dir");
|
args.add("--target-dir");
|
||||||
args.add(getWarehouseDir());
|
args.add(getTablePath().toString());
|
||||||
args.add("--num-mappers");
|
args.add("--num-mappers");
|
||||||
args.add("1");
|
args.add("1");
|
||||||
args.add("--split-by");
|
args.add("--split-by");
|
||||||
@ -153,8 +153,7 @@ public void testIncrementalImportWithLastModified() throws IOException {
|
|||||||
String[] args = getArgv(tableName, connPropsFileName, getColName(2));
|
String[] args = getArgv(tableName, connPropsFileName, getColName(2));
|
||||||
runImport(args);
|
runImport(args);
|
||||||
|
|
||||||
Path warehousePath = new Path(this.getWarehouseDir());
|
Path filePath = new Path(getTablePath().toString(), "part-m-00000");
|
||||||
Path filePath = new Path(warehousePath, "part-m-00000");
|
|
||||||
String output = readLineFromPath(filePath);
|
String output = readLineFromPath(filePath);
|
||||||
String expectedVal = "2,new_data,2000-11-11";
|
String expectedVal = "2,new_data,2000-11-11";
|
||||||
assertEquals("Incremental import result expected a different string",
|
assertEquals("Incremental import result expected a different string",
|
||||||
@ -181,8 +180,7 @@ public void testIncrementalImportWithLastModifiedTimestamp() throws IOException
|
|||||||
String[] args = getArgv(tableName, connPropsFileName, getColName(2));
|
String[] args = getArgv(tableName, connPropsFileName, getColName(2));
|
||||||
runImport(args);
|
runImport(args);
|
||||||
|
|
||||||
Path warehousePath = new Path(this.getWarehouseDir());
|
Path filePath = new Path(getTablePath(), "part-m-00000");
|
||||||
Path filePath = new Path(warehousePath, "part-m-00000");
|
|
||||||
String output = readLineFromPath(filePath);
|
String output = readLineFromPath(filePath);
|
||||||
String expectedVal = "2,new_data,2000-11-11 23:23:23.0";
|
String expectedVal = "2,new_data,2000-11-11 23:23:23.0";
|
||||||
assertEquals("Incremental import result expected a different string",
|
assertEquals("Incremental import result expected a different string",
|
||||||
|
@ -98,7 +98,7 @@ public void tearDown() {
|
|||||||
args.add("--password");
|
args.add("--password");
|
||||||
args.add(OracleUtils.ORACLE_USER_PASS);
|
args.add(OracleUtils.ORACLE_USER_PASS);
|
||||||
args.add("--target-dir");
|
args.add("--target-dir");
|
||||||
args.add(getWarehouseDir());
|
args.add(getTablePath().toString());
|
||||||
args.add("--num-mappers");
|
args.add("--num-mappers");
|
||||||
args.add("1");
|
args.add("1");
|
||||||
args.add("--table");
|
args.add("--table");
|
||||||
@ -120,8 +120,7 @@ public void testImportWithTableNameContainingSpecialCharacters() throws IOExcept
|
|||||||
String[] args = getArgv();
|
String[] args = getArgv();
|
||||||
runImport(args);
|
runImport(args);
|
||||||
|
|
||||||
Path warehousePath = new Path(this.getWarehouseDir());
|
Path filePath = new Path(getTablePath(), "part-m-00000");
|
||||||
Path filePath = new Path(warehousePath, "part-m-00000");
|
|
||||||
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
|
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
|
||||||
|
|
||||||
assertEquals("hello, world!", output.trim());
|
assertEquals("hello, world!", output.trim());
|
||||||
|
@ -91,7 +91,7 @@ public void tearDown() {
|
|||||||
args.add("--connect");
|
args.add("--connect");
|
||||||
args.add(getConnectString());
|
args.add(getConnectString());
|
||||||
args.add("--target-dir");
|
args.add("--target-dir");
|
||||||
args.add(getWarehouseDir());
|
args.add(getTablePath().toString());
|
||||||
args.add("--num-mappers");
|
args.add("--num-mappers");
|
||||||
args.add("2");
|
args.add("2");
|
||||||
args.add("--split-by");
|
args.add("--split-by");
|
||||||
@ -127,13 +127,13 @@ public void testTimestampSplitter() throws IOException {
|
|||||||
List<String> lines;
|
List<String> lines;
|
||||||
|
|
||||||
// First row should be in the first file
|
// First row should be in the first file
|
||||||
file = new File(this.getWarehouseDir(), "part-m-00000");
|
file = new File(getTablePath().toString(), "part-m-00000");
|
||||||
lines = FileUtils.readLines(file, "UTF-8");
|
lines = FileUtils.readLines(file, "UTF-8");
|
||||||
assertEquals(1, lines.size());
|
assertEquals(1, lines.size());
|
||||||
assertEquals("1,old_data,1999-01-01 11:11:11.0", lines.get(0));
|
assertEquals("1,old_data,1999-01-01 11:11:11.0", lines.get(0));
|
||||||
|
|
||||||
// With second line in the second file
|
// With second line in the second file
|
||||||
file = new File(this.getWarehouseDir(), "part-m-00001");
|
file = new File(getTablePath().toString(), "part-m-00001");
|
||||||
lines = FileUtils.readLines(file, "UTF-8");
|
lines = FileUtils.readLines(file, "UTF-8");
|
||||||
assertEquals(1, lines.size());
|
assertEquals(1, lines.size());
|
||||||
assertEquals("2,new_data,2000-11-11 23:23:23.0", lines.get(0));
|
assertEquals("2,new_data,2000-11-11 23:23:23.0", lines.get(0));
|
||||||
|
Loading…
Reference in New Issue
Block a user