Skip to content

Commit

Permalink
fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
alexradzin committed Oct 5, 2023
1 parent 79fda14 commit 8dd589a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/test/java/com/firebolt/FireboltDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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
Expand Down Expand Up @@ -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());
Expand All @@ -588,17 +590,17 @@ 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);
}

@ParameterizedTest(name = "{0}")
@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());
}

Expand Down

0 comments on commit 8dd589a

Please sign in to comment.