mirror of
https://github.com/apache/sqoop.git
synced 2025-05-03 00:10:26 +08:00
SQOOP-3411: PostgresMetaConnectIncrementalImportTest fails if metastore tables are absent from the database
This closes #51 (Szabolcs Vasas via Boglarka Egyed)
This commit is contained in:
parent
08eb5bdc40
commit
696187bb16
@ -68,11 +68,24 @@ public MetaConnectIncrementalImportTestBase(String metaConnectString, String met
|
||||
@Before
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
try {
|
||||
initMetastoreConnection();
|
||||
resetTable();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
resetMetastoreSchema();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
super.tearDown();
|
||||
resetMetastoreSchema();
|
||||
try {
|
||||
cm.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String[] getIncrementalJob(String metaConnectString, String metaUser, String metaPass) {
|
||||
@ -123,12 +136,6 @@ protected String[] getExecJob(String metaConnectString, String metaUser, String
|
||||
|
||||
@Test
|
||||
public void testIncrementalJob() throws SQLException {
|
||||
resetTable();
|
||||
|
||||
initMetastoreConnection();
|
||||
|
||||
resetMetastoreSchema();
|
||||
|
||||
//creates Job
|
||||
createJob();
|
||||
|
||||
@ -148,8 +155,6 @@ public void testIncrementalJob() throws SQLException {
|
||||
|
||||
//Ensures the last incremental value is updated correctly.
|
||||
checkIncrementalState(2);
|
||||
|
||||
cm.close();
|
||||
}
|
||||
|
||||
private void checkIncrementalState(int expected) throws SQLException {
|
||||
@ -195,9 +200,13 @@ private void resetMetastoreSchema() {
|
||||
metastoreStatement.execute("DROP TABLE " + cm.escapeTableName("SQOOP_ROOT"));
|
||||
metastoreStatement.execute("DROP TABLE " + cm.escapeTableName("SQOOP_SESSIONS"));
|
||||
connMeta.commit();
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error( e.getLocalizedMessage() );
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getLocalizedMessage());
|
||||
try {
|
||||
connMeta.rollback();
|
||||
} catch (SQLException innerException) {
|
||||
LOG.error(innerException.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user