diff --git a/src/test/java/com/firebolt/FireboltDriverTest.java b/src/test/java/com/firebolt/FireboltDriverTest.java index b63594f12..e58924ed1 100644 --- a/src/test/java/com/firebolt/FireboltDriverTest.java +++ b/src/test/java/com/firebolt/FireboltDriverTest.java @@ -65,18 +65,18 @@ void jdbcCompliant() { @Test void version() { FireboltDriver fireboltDriver = new FireboltDriver(); - assertEquals(2, fireboltDriver.getMajorVersion()); - assertEquals(4, fireboltDriver.getMinorVersion()); + assertEquals(3, fireboltDriver.getMajorVersion()); + assertEquals(0, fireboltDriver.getMinorVersion()); } @ParameterizedTest @CsvSource(value = { "jdbc:firebolt,,", - "jdbc:firebolt://api.dev.firebolt.io/db_name,,host=api.dev.firebolt.io;path=/db_name", - "jdbc:firebolt://api.dev.firebolt.io/db_name?account=test,,host=api.dev.firebolt.io;path=/db_name;account=test", - "jdbc:firebolt://api.dev.firebolt.io/db_name?account=test,user=usr;password=pwd,host=api.dev.firebolt.io;path=/db_name;account=test;user=usr;password=pwd", // legit:ignore-secrets - "jdbc:firebolt://api.dev.firebolt.io/db_name,user=usr;password=pwd,host=api.dev.firebolt.io;path=/db_name;user=usr;password=pwd" // legit:ignore-secrets + "jdbc:firebolt:db_name,,environment=app;path=db_name", + "jdbc:firebolt:db_name?account=test,,environment=app;path=db_name;account=test", + "jdbc:firebolt:db_name?account=test,client_id=usr;client_secret=pwd,environment=app;path=db_name;account=test;client_id=usr;client_secret=pwd", + "jdbc:firebolt:db_name,client_id=usr;client_secret=pwd,environment=app;path=db_name;client_id=usr;client_secret=pwd" }, delimiter = ',') void getPropertyInfo(String url, String propStr, String expectedInfoStr) throws SQLException { diff --git a/src/test/java/com/firebolt/jdbc/connection/FireboltConnectionTest.java b/src/test/java/com/firebolt/jdbc/connection/FireboltConnectionTest.java index 83df66e2e..b19fc328e 100644 --- a/src/test/java/com/firebolt/jdbc/connection/FireboltConnectionTest.java +++ b/src/test/java/com/firebolt/jdbc/connection/FireboltConnectionTest.java @@ -12,6 +12,7 @@ import com.firebolt.jdbc.service.FireboltGatewayUrlService; import com.firebolt.jdbc.service.FireboltStatementService; import com.firebolt.jdbc.statement.StatementInfoWrapper; +import lombok.NonNull; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.junit.jupiter.api.BeforeEach; @@ -484,8 +485,9 @@ void shouldGetConnectionTokenFromProperties(String host, String configuredAccess if (configuredAccessToken != null) { propsWithToken.setProperty(ACCESS_TOKEN.getKey(), configuredAccessToken); } + try (FireboltConnection connection = new FireboltConnection(URL, propsWithToken, fireboltAuthenticationService, - fireboltEngineService, fireboltStatementService)) { + fireboltGatewayUrlService, fireboltStatementService, fireboltEngineService, fireboltAccountIdService)) { assertEquals(expectedAccessToken, connection.getAccessToken().orElse(null)); Mockito.verifyNoMoreInteractions(fireboltAuthenticationService); } @@ -498,7 +500,7 @@ void shouldThrowExceptionIfBothAccessTokenAndUserPasswordAreSupplied() { propsWithToken.setProperty(CLIENT_ID.getKey(), "my-client"); propsWithToken.setProperty(CLIENT_SECRET.getKey(), "my-secret"); assertThrows(SQLException.class, () -> new FireboltConnection(URL, propsWithToken, fireboltAuthenticationService, - fireboltEngineService, fireboltStatementService)); + fireboltGatewayUrlService, fireboltStatementService, fireboltEngineService, fireboltAccountIdService)); } @Test @@ -578,7 +580,7 @@ void shouldThrowExceptionWhenPreparingStatementWIthInvalidResultSetType() throws @Test void createArray() throws SQLException { try (Connection connection = new FireboltConnection(URL, connectionProperties, fireboltAuthenticationService, - fireboltEngineService, fireboltStatementService)) { + fireboltGatewayUrlService, fireboltStatementService, fireboltEngineService, fireboltAccountIdService)) { Object[] data = new Object[] {"red", "green", "blue"}; Array array = connection.createArrayOf("text", data); assertEquals(Types.VARCHAR, array.getBaseType()); @@ -588,9 +590,9 @@ void createArray() throws SQLException { @ParameterizedTest(name = "{0}") @MethodSource("unsupported") - void shouldThrowSQLFeatureNotSupportedException(String name, Executable function) throws FireboltException { + void shouldThrowSQLFeatureNotSupportedException(String name, Executable function) throws SQLException { connection = new FireboltConnection(URL, connectionProperties, fireboltAuthenticationService, - fireboltEngineService, fireboltStatementService); + fireboltGatewayUrlService, fireboltStatementService, fireboltEngineService, fireboltAccountIdService); assertThrows(SQLFeatureNotSupportedException.class, function); } @@ -598,7 +600,7 @@ void shouldThrowSQLFeatureNotSupportedException(String name, Executable function @MethodSource("empty") void shouldReturnEmptyResult(String name, Callable<?> function, Object expected) throws Exception { connection = new FireboltConnection(URL, connectionProperties, fireboltAuthenticationService, - fireboltEngineService, fireboltStatementService); + fireboltGatewayUrlService, fireboltStatementService, fireboltEngineService, fireboltAccountIdService); assertEquals(expected, function.call()); }