5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-02 00:53:48 +08:00

SQOOP-3350: Fix tests which use warehouse-dir as target-dir

(Szabolcs Vasas via Boglarka Egyed)
This commit is contained in:
Boglarka Egyed 2018-07-27 11:27:18 +02:00
parent a06f2f3a83
commit 1213b7725a
6 changed files with 14 additions and 20 deletions

View File

@ -90,7 +90,7 @@ public void tearDown() {
args.add("--connect");
args.add(getConnectString());
args.add("--target-dir");
args.add(getWarehouseDir());
args.add(getTablePath().toString());
args.add("--split-by");
args.add(splitByCol);
args.add("--num-mappers");
@ -134,8 +134,7 @@ public void testSimpleJoin() throws IOException {
runImport(getArgv(tableName1 + "." + getColName(0), query));
Path warehousePath = new Path(this.getWarehouseDir());
Path filePath = new Path(warehousePath, "part-m-00000");
Path filePath = new Path(getTablePath(), "part-m-00000");
String expectedVal = "1,foo";
BufferedReader reader = null;

View File

@ -87,7 +87,7 @@ public void tearDown() {
args.add(mySQLTestUtils.getUserName());
mySQLTestUtils.addPasswordIfIsSet(args);
args.add("--target-dir");
args.add(getWarehouseDir());
args.add(getTablePath().toString());
args.add("--num-mappers");
args.add("1");
args.add("--table");
@ -105,8 +105,7 @@ public void testEscapeColumnWithDoubleQuote() throws IOException {
String[] args = getArgv();
runImport(args);
Path warehousePath = new Path(this.getWarehouseDir());
Path filePath = new Path(warehousePath, "part-m-00000");
Path filePath = new Path(getTablePath(), "part-m-00000");
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
assertEquals("hello, world", output.trim());

View File

@ -87,7 +87,7 @@ public void tearDown() {
args.add("--password");
args.add(OracleUtils.ORACLE_USER_PASS);
args.add("--target-dir");
args.add(getWarehouseDir());
args.add(getTablePath().toString());
args.add("--num-mappers");
args.add("1");
args.add("--query");
@ -104,8 +104,7 @@ public void testRegexpReplaceEscapeWithSpecialCharacters() throws IOException {
String[] args = getArgv();
runImport(args);
Path warehousePath = new Path(this.getWarehouseDir());
Path filePath = new Path(warehousePath, "part-m-00000");
Path filePath = new Path(getTablePath(), "part-m-00000");
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
assertEquals("hello, world!", output.trim());

View File

@ -109,7 +109,7 @@ public void tearDown() {
args.add("--connect");
args.add(getConnectString());
args.add("--target-dir");
args.add(getWarehouseDir());
args.add(getTablePath().toString());
args.add("--num-mappers");
args.add("1");
args.add("--split-by");
@ -153,8 +153,7 @@ public void testIncrementalImportWithLastModified() throws IOException {
String[] args = getArgv(tableName, connPropsFileName, getColName(2));
runImport(args);
Path warehousePath = new Path(this.getWarehouseDir());
Path filePath = new Path(warehousePath, "part-m-00000");
Path filePath = new Path(getTablePath().toString(), "part-m-00000");
String output = readLineFromPath(filePath);
String expectedVal = "2,new_data,2000-11-11";
assertEquals("Incremental import result expected a different string",
@ -181,8 +180,7 @@ public void testIncrementalImportWithLastModifiedTimestamp() throws IOException
String[] args = getArgv(tableName, connPropsFileName, getColName(2));
runImport(args);
Path warehousePath = new Path(this.getWarehouseDir());
Path filePath = new Path(warehousePath, "part-m-00000");
Path filePath = new Path(getTablePath(), "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",

View File

@ -98,7 +98,7 @@ public void tearDown() {
args.add("--password");
args.add(OracleUtils.ORACLE_USER_PASS);
args.add("--target-dir");
args.add(getWarehouseDir());
args.add(getTablePath().toString());
args.add("--num-mappers");
args.add("1");
args.add("--table");
@ -120,8 +120,7 @@ public void testImportWithTableNameContainingSpecialCharacters() throws IOExcept
String[] args = getArgv();
runImport(args);
Path warehousePath = new Path(this.getWarehouseDir());
Path filePath = new Path(warehousePath, "part-m-00000");
Path filePath = new Path(getTablePath(), "part-m-00000");
String output = Files.toString(new File(filePath.toString()), Charsets.UTF_8);
assertEquals("hello, world!", output.trim());

View File

@ -91,7 +91,7 @@ public void tearDown() {
args.add("--connect");
args.add(getConnectString());
args.add("--target-dir");
args.add(getWarehouseDir());
args.add(getTablePath().toString());
args.add("--num-mappers");
args.add("2");
args.add("--split-by");
@ -127,13 +127,13 @@ public void testTimestampSplitter() throws IOException {
List<String> lines;
// 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");
assertEquals(1, lines.size());
assertEquals("1,old_data,1999-01-01 11:11:11.0", lines.get(0));
// 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");
assertEquals(1, lines.size());
assertEquals("2,new_data,2000-11-11 23:23:23.0", lines.get(0));