diff --git a/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java b/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java index 9f86db711..d1eaa390d 100644 --- a/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java +++ b/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java @@ -273,4 +273,27 @@ public void testSizeOfHttpClientMapWithGzipAndUserAgentSuffix() { // Assert there are 3 entries because userAgentSuffix has changed assertEquals(3, HttpUtil.httpClient.size()); } + + @Test + public void testNullAndEmptyProxySettingsForS3() { + HttpClientSettingsKey testKey = + new HttpClientSettingsKey( + OCSPMode.FAIL_OPEN, + null, + 443, + null, + null, + null, + "", + "", + false); + ClientConfiguration clientConfig = new ClientConfiguration(); + HttpUtil.setProxyForS3(testKey, clientConfig); + assertEquals(Protocol.HTTP, clientConfig.getProxyProtocol()); + assertEquals("", clientConfig.getProxyHost()); + assertEquals(443, clientConfig.getProxyPort()); + assertEquals("", clientConfig.getNonProxyHosts()); + assertNull(clientConfig.getProxyUsername()); + assertNull(clientConfig.getProxyPassword()); + } } diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java index 2cea0e5fb..da29b287e 100644 --- a/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java @@ -416,6 +416,17 @@ public void testGetPropertyInfo() throws SQLException { "server URL in form of ://:/", info[0].description); + // Test with null URL and no properties. ServerURL is needed. + url = null; + props = new Properties(); + driver = DriverManager.getDriver("jdbc:snowflake://snowflake.reg.local:8082"); + info = driver.getPropertyInfo(url, props); + assertEquals(1, info.length); + assertEquals("serverURL", info[0].name); + assertEquals( + "server URL in form of ://:/", + info[0].description); + // Test with URL that requires username and password. url = "jdbc:snowflake://snowflake.reg.local:8082"; info = driver.getPropertyInfo(url, props);