/** Verify that on a given row, a column has a given value. * @param id the id column specifying the row to test. */ private void assertColValForRowId(int id, String colName, String expectedVal) throws SQLException { Connection conn = getConnection(); LOG.info("Verifying column " + colName + " has value " + expectedVal); PreparedStatement statement = conn.prepareStatement( "SELECT \"" + colName + "\" FROM " + getTableName() + " WHERE \"ID\" = " + id, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); String actualVal = null; try { ResultSet rs = statement.executeQuery(); try { rs.next(); actualVal = rs.getString(1); } finally { rs.close(); } } finally { statement.close(); } assertEquals("Got unexpected column value", expectedVal, actualVal); }
throws SQLException { String stageTableName = getStagingTableName(); Connection conn = getConnection(); PreparedStatement statement = conn.prepareStatement( getDropTableStatement(stageTableName),
Connection conn = getConnection(); PreparedStatement statement = conn.prepareStatement( getDropTableStatement(getTableName()),
/** Verify that for the max and min values of the 'id' column, the values for a given column meet the expected values. */ protected void assertColMinAndMax(String colName, ColumnGenerator generator) throws SQLException { Connection conn = getConnection(); int minId = getMinRowId(conn); int maxId = getMaxRowId(conn); LOG.info("Checking min/max for column " + colName + " with type " + generator.getType()); String expectedMin = generator.getVerifyText(minId); String expectedMax = generator.getVerifyText(maxId); assertColValForRowId(minId, colName, expectedMin); assertColValForRowId(maxId, colName, expectedMax); }