From 510486f5ba1885c44548b7cddd7cd5fa3a80502b Mon Sep 17 00:00:00 2001 From: sfc-gh-ext-simba-vb Date: Thu, 1 Aug 2024 17:33:51 -0700 Subject: [PATCH] Fixed the IT failures. --- .../client/jdbc/ConnectionAlreadyClosedIT.java | 3 --- .../net/snowflake/client/jdbc/ConnectionIT.java | 4 ++-- .../client/jdbc/ConnectionLatestIT.java | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/test/java/net/snowflake/client/jdbc/ConnectionAlreadyClosedIT.java b/src/test/java/net/snowflake/client/jdbc/ConnectionAlreadyClosedIT.java index 53132677c..fd0b69488 100644 --- a/src/test/java/net/snowflake/client/jdbc/ConnectionAlreadyClosedIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ConnectionAlreadyClosedIT.java @@ -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; @@ -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")); } diff --git a/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java b/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java index 83d3847c3..2e0a9f13e 100644 --- a/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java @@ -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()); diff --git a/src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java index 0e7083e7e..3a2bf397e 100644 --- a/src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java @@ -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; @@ -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)); + } + } }