diff --git a/pom.xml b/pom.xml index 637894a2e..32a923a17 100644 --- a/pom.xml +++ b/pom.xml @@ -402,7 +402,7 @@ net.snowflake snowflake-jdbc - 3.13.3 + 3.13.11 diff --git a/pom_confluent.xml b/pom_confluent.xml index 85d9aad7f..db2032bce 100644 --- a/pom_confluent.xml +++ b/pom_confluent.xml @@ -450,7 +450,7 @@ net.snowflake snowflake-jdbc - 3.13.3 + 3.13.11 diff --git a/src/test/java/com/snowflake/kafka/connector/ConnectorIT.java b/src/test/java/com/snowflake/kafka/connector/ConnectorIT.java index 574260f7e..3c479e31c 100644 --- a/src/test/java/com/snowflake/kafka/connector/ConnectorIT.java +++ b/src/test/java/com/snowflake/kafka/connector/ConnectorIT.java @@ -5,14 +5,12 @@ import static com.snowflake.kafka.connector.internal.TestUtils.TEST_CONNECTOR_NAME; import static com.snowflake.kafka.connector.internal.TestUtils.getConf; -import com.snowflake.kafka.connector.internal.TestUtils; +import com.snowflake.kafka.connector.internal.SnowflakeKafkaConnectorException; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import net.snowflake.client.jdbc.SnowflakeSQLException; import org.apache.kafka.common.config.Config; import org.apache.kafka.common.config.ConfigValue; -import org.junit.After; import org.junit.Assert; import org.junit.Test; @@ -100,15 +98,6 @@ static Map getCorrectConfig() { return config; } - @After - public void cleanup() throws SnowflakeSQLException { - try { - TestUtils.resetProxyParametersInJDBC(); - } catch (SnowflakeSQLException ex) { - Assert.fail("Cannot reset proxy parameters in:" + this.getClass().getName()); - } - } - @Test public void testValidateErrorConfig() { Map validateMap = toValidateMap(getErrorConfig()); @@ -280,8 +269,7 @@ public void testProxyHostPortConfig() { Map config = getCorrectConfig(); config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_HOST, "localhost"); config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_PORT, "8080"); - Map validateMap = toValidateMap(config); - assertPropHasError(validateMap, new String[] {}); + Utils.validateProxySetting(config); } @Test @@ -290,13 +278,13 @@ public void testErrorProxyUsernameConfig() { config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_HOST, "localhost"); config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_PORT, "8080"); config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_USERNAME, "user"); - Map validateMap = toValidateMap(config); - assertPropHasError( - validateMap, - new String[] { - SnowflakeSinkConnectorConfig.JVM_PROXY_USERNAME, - SnowflakeSinkConnectorConfig.JVM_PROXY_PASSWORD - }); + try { + Utils.validateProxySetting(config); + } catch (SnowflakeKafkaConnectorException e) { + Assert.assertEquals("0023", e.getCode()); + return; + } + Assert.fail(); } @Test @@ -305,13 +293,13 @@ public void testErrorProxyPasswordConfig() { config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_HOST, "localhost"); config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_PORT, "8080"); config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_PASSWORD, "pass"); - Map validateMap = toValidateMap(config); - assertPropHasError( - validateMap, - new String[] { - SnowflakeSinkConnectorConfig.JVM_PROXY_USERNAME, - SnowflakeSinkConnectorConfig.JVM_PROXY_PASSWORD - }); + try { + Utils.validateProxySetting(config); + } catch (SnowflakeKafkaConnectorException e) { + Assert.assertEquals("0023", e.getCode()); + return; + } + Assert.fail(); } @Test @@ -321,8 +309,7 @@ public void testProxyUsernamePasswordConfig() { config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_PORT, "3128"); config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_USERNAME, "admin"); config.put(SnowflakeSinkConnectorConfig.JVM_PROXY_PASSWORD, "test"); - Map validateMap = toValidateMap(config); - assertPropHasError(validateMap, new String[] {}); + Utils.validateProxySetting(config); } @Test diff --git a/src/test/java/com/snowflake/kafka/connector/SinkTaskProxyIT.java b/src/test/java/com/snowflake/kafka/connector/SinkTaskProxyIT.java index 622df92fb..6aca3f875 100644 --- a/src/test/java/com/snowflake/kafka/connector/SinkTaskProxyIT.java +++ b/src/test/java/com/snowflake/kafka/connector/SinkTaskProxyIT.java @@ -5,7 +5,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import net.snowflake.client.jdbc.SnowflakeSQLException; import org.junit.After; import org.junit.Assert; import org.junit.Ignore; @@ -15,12 +14,7 @@ public class SinkTaskProxyIT { @After public void testCleanup() { - try { - TestUtils.resetProxyParametersInJDBC(); - TestUtils.resetProxyParametersInJVM(); - } catch (SnowflakeSQLException ex) { - Assert.fail("Cannot reset proxy parameters in:" + this.getClass().getName()); - } + TestUtils.resetProxyParametersInJVM(); } @Test(expected = SnowflakeKafkaConnectorException.class) diff --git a/src/test/java/com/snowflake/kafka/connector/internal/InternalStageIT.java b/src/test/java/com/snowflake/kafka/connector/internal/InternalStageIT.java index b1f8150c9..474f49723 100644 --- a/src/test/java/com/snowflake/kafka/connector/internal/InternalStageIT.java +++ b/src/test/java/com/snowflake/kafka/connector/internal/InternalStageIT.java @@ -165,9 +165,6 @@ public void testInternalStageWithProxy() throws SnowflakeSQLException { assert files1.size() == 2; System.out.println(Logging.logMessage("Time: {} ms", (System.currentTimeMillis() - startTime))); proxyConnectionService.dropStage(proxyStage); - - // Reset proxy configuration - TestUtils.resetProxyParametersInJDBC(); } @Test diff --git a/src/test/java/com/snowflake/kafka/connector/internal/ResetProxyConfigExec.java b/src/test/java/com/snowflake/kafka/connector/internal/ResetProxyConfigExec.java index 9a97311a1..e7bac50e7 100644 --- a/src/test/java/com/snowflake/kafka/connector/internal/ResetProxyConfigExec.java +++ b/src/test/java/com/snowflake/kafka/connector/internal/ResetProxyConfigExec.java @@ -5,7 +5,6 @@ public class ResetProxyConfigExec extends Logging { public static void main(String[] args) throws SnowflakeSQLException { System.out.println("ResetProxyConfigExec::Start wiping Proxy config"); - TestUtils.resetProxyParametersInJDBC(); TestUtils.resetProxyParametersInJVM(); System.out.println("ResetProxyConfigExec::Proxy Parameters reset in JVM in JDBC"); } diff --git a/src/test/java/com/snowflake/kafka/connector/internal/TestUtils.java b/src/test/java/com/snowflake/kafka/connector/internal/TestUtils.java index 82f6dc70a..5f0883de2 100644 --- a/src/test/java/com/snowflake/kafka/connector/internal/TestUtils.java +++ b/src/test/java/com/snowflake/kafka/connector/internal/TestUtils.java @@ -30,9 +30,6 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.snowflake.client.core.HttpUtil; -import net.snowflake.client.core.SFSessionProperty; -import net.snowflake.client.jdbc.SnowflakeSQLException; import net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.JsonNode; import net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.ObjectMapper; @@ -274,17 +271,6 @@ public static SnowflakeConnectionService getConnectionService(Map resetProxy = new EnumMap(SFSessionProperty.class); - resetProxy.put(SFSessionProperty.USE_PROXY, false); - HttpUtil.configureCustomProxyProperties(resetProxy); - } - /** * Reset proxy parameters in JVM which is enabled during starting a sink Task. Call this if your * test/code executes the Utils.enableJVMProxy function