Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jf committed Aug 14, 2024
1 parent c665821 commit 663949d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,17 @@ public void setGetDateUseNullTimezone(Boolean getDateUseNullTimezone) {

public void setEnableClientRequestMfaToken(boolean enableClientRequestMfaToken) {
this.setAuthenticator(AUTHENTICATOR_USERNAME_PASSWORD_MFA);
this.properties.put("clientRequestMfaToken", enableClientRequestMfaToken);
this.properties.put(
SFSessionProperty.ENABLE_CLIENT_REQUEST_MFA_TOKEN.getPropertyKey(),
enableClientRequestMfaToken);
}

public void setEnableClientStoreTemporaryCredential(
boolean enableClientStoreTemporaryCredential) {
this.setAuthenticator(AUTHENTICATOR_EXTERNAL_BROWSER);
this.properties.put("clientStoreTemporaryCredential", enableClientStoreTemporaryCredential);
this.properties.put(
SFSessionProperty.ENABLE_CLIENT_STORE_TEMPORARY_CREDENTIAL.getPropertyKey(),
enableClientStoreTemporaryCredential);
}

public void setBrowserResponseTimeout(int seconds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Map;
import net.snowflake.client.AbstractDriverIT;
import net.snowflake.client.jdbc.SnowflakeBasicDataSource;
Expand Down Expand Up @@ -259,12 +258,10 @@ public void testEnableClientStoreTemporaryCredential() throws Exception {
ds.setUser(params.get("user"));
ds.setEnableClientStoreTemporaryCredential(false);

try (Connection con = ds.getConnection()) {
Statement stmt = con.createStatement();
for (int i = 0; i < 3; i++) {
try (ResultSet rs = stmt.executeQuery("SELECT CURRENT_USER()")) {
assertTrue(rs.next());
}
for (int i = 0; i < 3; i++) {
try (Connection con = ds.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT 1")) {
assertTrue(rs.next());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
import java.util.Properties;
import net.snowflake.client.AbstractDriverIT;
Expand Down Expand Up @@ -348,12 +347,10 @@ public void testEnableClientRequestMfaToken() throws SQLException {
ds.setPassword(params.get("password"));
ds.setEnableClientRequestMfaToken(false);

try (Connection con = ds.getConnection()) {
for (int i = 0; i < 3; i++) {
try (Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT CURRENT_USER()")) {
assertTrue(rs.next());
}
for (int i = 0; i < 3; i++) {
try (Connection con = ds.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT 1")) {
assertTrue(rs.next());
}
}
}
Expand Down

0 comments on commit 663949d

Please sign in to comment.