mirror of
https://github.com/apache/sqoop.git
synced 2025-05-19 02:10:54 +08:00
SQOOP-2915: Fixing Oracle related unit tests
(Attila Szabo via Jarek Jarcec Cecho)
This commit is contained in:
parent
660f3e8ad0
commit
db8c247000
@ -271,10 +271,10 @@ public void testUpsertTextExport() throws IOException, SQLException {
|
|||||||
createTable();
|
createTable();
|
||||||
// first time will be insert.
|
// first time will be insert.
|
||||||
runExport(getArgv(true, 10, 10, newStrArray(null,
|
runExport(getArgv(true, 10, 10, newStrArray(null,
|
||||||
"--update-key", "ID", "--update-mode", "allowinsert")));
|
"--update-key", "id", "--update-mode", "allowinsert")));
|
||||||
// second time will be update.
|
// second time will be update.
|
||||||
runExport(getArgv(true, 10, 10, newStrArray(null,
|
runExport(getArgv(true, 10, 10, newStrArray(null,
|
||||||
"--update-key", "ID", "--update-mode", "allowinsert")));
|
"--update-key", "id", "--update-mode", "allowinsert")));
|
||||||
verifyExport(TOTAL_RECORDS);
|
verifyExport(TOTAL_RECORDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public final class OracleUtils {
|
|||||||
public static final String ORACLE_SECONDARY_USER_PASS = "ABCDEF";
|
public static final String ORACLE_SECONDARY_USER_PASS = "ABCDEF";
|
||||||
|
|
||||||
public static final String ORACLE_INVALID_USER_NAME = "invalidusr";
|
public static final String ORACLE_INVALID_USER_NAME = "invalidusr";
|
||||||
public static final String SYSTEMTEST_TABLE_NAME = "oraoop_test";
|
public static final String SYSTEMTEST_TABLE_NAME = "ORAOOP_TEST";
|
||||||
public static final int SYSTEMTEST_NUM_ROWS = 100;
|
public static final int SYSTEMTEST_NUM_ROWS = 100;
|
||||||
public static final int INTEGRATIONTEST_NUM_ROWS = 10000;
|
public static final int INTEGRATIONTEST_NUM_ROWS = 10000;
|
||||||
// Number of mappers if wanting to override default setting
|
// Number of mappers if wanting to override default setting
|
||||||
|
@ -40,21 +40,21 @@ public static void setUpHdfsData() throws Exception {
|
|||||||
TEST_CASE.createTable("table_tst_product.xml");
|
TEST_CASE.createTable("table_tst_product.xml");
|
||||||
|
|
||||||
int retCode =
|
int retCode =
|
||||||
TEST_CASE.runImport("tst_product", TEST_CASE.getSqoopConf(), false);
|
TEST_CASE.runImport("TST_PRODUCT", TEST_CASE.getSqoopConf(), false);
|
||||||
Assert.assertEquals("Return code should be 0", 0, retCode);
|
Assert.assertEquals("Return code should be 0", 0, retCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProductExport() throws Exception {
|
public void testProductExport() throws Exception {
|
||||||
int retCode =
|
int retCode =
|
||||||
TEST_CASE.runExportFromTemplateTable("tst_product", "tst_product_exp");
|
TEST_CASE.runExportFromTemplateTable("TST_PRODUCT", "TST_PRODUCT_EXP");
|
||||||
Assert.assertEquals("Return code should be 0", 0, retCode);
|
Assert.assertEquals("Return code should be 0", 0, retCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProductExportMixedCaseTableName() throws Exception {
|
public void testProductExportMixedCaseTableName() throws Exception {
|
||||||
int retCode =
|
int retCode =
|
||||||
TEST_CASE.runExportFromTemplateTable("tst_product",
|
TEST_CASE.runExportFromTemplateTable("TST_PRODUCT",
|
||||||
"\"\"T5+_Pr#duct_Exp\"\"");
|
"\"\"T5+_Pr#duct_Exp\"\"");
|
||||||
Assert.assertEquals("Return code should be 0", 0, retCode);
|
Assert.assertEquals("Return code should be 0", 0, retCode);
|
||||||
}
|
}
|
||||||
|
@ -90,23 +90,23 @@ private String[] getArgv(String... extraArgs) {
|
|||||||
private void createObjects() {
|
private void createObjects() {
|
||||||
|
|
||||||
String createTableSql = "CREATE TABLE " + tableName + " ( "
|
String createTableSql = "CREATE TABLE " + tableName + " ( "
|
||||||
+ "id INT NOT NULL PRIMARY KEY, "
|
+ "\"id\" INT NOT NULL PRIMARY KEY, "
|
||||||
+ "msg VARCHAR(24) NOT NULL, "
|
+ "\"msg\" VARCHAR(24) NOT NULL, "
|
||||||
+ "d DATE, "
|
+ "\"d\" DATE, "
|
||||||
+ "f FLOAT, "
|
+ "\"f\" FLOAT, "
|
||||||
+ "vc VARCHAR(32))";
|
+ "\"vc\" VARCHAR(32))";
|
||||||
|
|
||||||
String createProcSql = "CREATE PROCEDURE " + procName + " ( "
|
String createProcSql = "CREATE PROCEDURE " + procName + " ( "
|
||||||
+ "id IN INT,"
|
+ "\"id\" IN INT,"
|
||||||
+ "msg IN VARCHAR,"
|
+ "\"msg\" IN VARCHAR,"
|
||||||
+ "d IN DATE,"
|
+ "\"d\" IN DATE,"
|
||||||
+ "f IN FLOAT) IS BEGIN "
|
+ "\"f\" IN FLOAT) IS BEGIN "
|
||||||
+ "INSERT INTO " + tableName + " "
|
+ "INSERT INTO " + tableName + " "
|
||||||
+ "VALUES(id,"
|
+ "VALUES(\"id\","
|
||||||
+ "msg,"
|
+ "\"msg\","
|
||||||
+ "d,"
|
+ "\"d\","
|
||||||
+ "f,"
|
+ "\"f\","
|
||||||
+ "msg || '_2'); END;";
|
+ "\"msg\" || '_2'); END;";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dropTableIfExists(tableName);
|
dropTableIfExists(tableName);
|
||||||
|
@ -39,7 +39,7 @@ public void testProductImportTimezone() throws Exception {
|
|||||||
sqoopConf.setBoolean(OraOopConstants.ORAOOP_MAP_TIMESTAMP_AS_STRING, false);
|
sqoopConf.setBoolean(OraOopConstants.ORAOOP_MAP_TIMESTAMP_AS_STRING, false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int retCode = runImport("tst_product", sqoopConf, false);
|
int retCode = runImport("TST_PRODUCT", sqoopConf, false);
|
||||||
Assert.assertEquals("Return code should be 0", 0, retCode);
|
Assert.assertEquals("Return code should be 0", 0, retCode);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user