public void testClear() throws Exception { _tool.createTestSchema(); createTestTable(); _tool.executeSql( _tool.getTestCatalog(), _tool.getTestSchema(), "INSERT INTO " + TEST_TABLE + " (test_column) VALUES ('test')"); _tool.clearTestTables(); Connection connection = getConnection(); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery("SELECT COUNT(*) FROM " + TEST_TABLE); if (rs.next()) { int count = rs.getInt(1); assertEquals(0, count); } else { fail(); } rs.close(); statement.close(); connection.close(); _tool.dropTestSchema(); }
public void testDrop() throws Exception { _tool.createTestSchema(); createTestTable(); _tool.dropTestSchema(); // The table should no longer be there try { _tool.executeSql( _tool.getTestCatalog(), _tool.getTestSchema(), "SELECT * FROM " + TEST_TABLE); fail(); } catch (OpenGammaRuntimeException e) { // Ok - no table should be there! } }