Skip to content

Commit

Permalink
Fixed the IT failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-vb committed Aug 2, 2024
1 parent d05fff7 commit 510486f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package net.snowflake.client.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Properties;
import net.snowflake.client.category.TestCategoryConnection;
import org.junit.Test;
Expand Down Expand Up @@ -35,8 +34,6 @@ public void testClosedConnection() throws Throwable {
expectConnectionAlreadyClosedException(() -> connection.setSchema("fakedb"));
expectConnectionAlreadyClosedException(
() -> connection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED));
expectConnectionAlreadyClosedException(
() -> connection.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT));
expectSQLClientInfoException(() -> connection.setClientInfo(new Properties()));
expectSQLClientInfoException(() -> connection.setClientInfo("name", "value"));
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/net/snowflake/client/jdbc/ConnectionIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,9 @@ public void testGetTypeMap() throws Throwable {
public void testHolderbility() throws Throwable {
try (Connection connection = getConnection()) {
try {
connection.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
connection.setHoldability(0);
} catch (SQLFeatureNotSupportedException ex) {
fail("should not fail");
// nop
}
// return an empty type map. setTypeMap is not supported.
assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, connection.getHoldability());
Expand Down
17 changes: 17 additions & 0 deletions src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Statement;
import java.time.Duration;
import java.util.ArrayList;
Expand Down Expand Up @@ -1559,4 +1560,20 @@ public void shouldGetDifferentTimestampLtzConsistentBetweenFormats() throws Exce
}
}
}
// Test setHolderbility() API.
@Test
public void testHolderbility() throws Throwable {
try (Connection connection = getConnection()) {
try {
connection.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
} catch (SQLFeatureNotSupportedException ex) {
fail("should not fail");
}
// return an empty type map. setTypeMap is not supported.
assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, connection.getHoldability());
connection.close();
expectConnectionAlreadyClosedException(
() -> connection.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT));
}
}
}

0 comments on commit 510486f

Please sign in to comment.