Skip to content

Commit

Permalink
fixed db name for non system engine
Browse files Browse the repository at this point in the history
  • Loading branch information
alexradzin committed Nov 14, 2023
1 parent 2cd29b4 commit 1567b93
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ protected void authenticate() throws SQLException {
String accessToken = getAccessToken(loginProperties).orElse(StringUtils.EMPTY);
FireboltProperties propertiesWithAccessToken = loginProperties.toBuilder().accessToken(accessToken).build();
Engine engine = fireboltEngineService.getEngine(propertiesWithAccessToken);
this.sessionProperties = loginProperties.toBuilder().host(engine.getEndpoint()).engine(engine.getName()).build();
String database = loginProperties.isSystemEngine() ? loginProperties.getDatabase() : engine.getDatabase();
this.sessionProperties = loginProperties.toBuilder().host(engine.getEndpoint()).engine(engine.getName()).database(database).build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
class FireboltConnectionServiceSecretAuthenticationTest extends FireboltConnectionTest {
private static final String SYSTEM_ENGINE_URL = "jdbc:firebolt:db?env=dev&account=dev";

public FireboltConnectionServiceSecretAuthenticationTest() {
super("jdbc:firebolt:db?env=dev&engine=eng&account=dev");
}

@Test
void shouldNotValidateConnectionWhenCallingIsValidWhenUsingSystemEngine() throws SQLException {
Properties propertiesWithSystemEngine = new Properties(connectionProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@

@ExtendWith(MockitoExtension.class)
abstract class FireboltConnectionTest {

private static final String URL = "jdbc:firebolt:db?env=dev&engine=eng&account=dev";

private static final String LOCAL_URL = "jdbc:firebolt:local_dev_db?account=dev&ssl=false&max_query_size=10000000&use_standard_sql=1&mask_internal_errors=0&firebolt_enable_beta_functions=1&firebolt_case_insensitive_identifiers=1&rest_api_pull_timeout_sec=3600&rest_api_pull_interval_millisec=5000&rest_api_retry_times=10&host=localhost";
private final FireboltConnectionTokens fireboltConnectionTokens = FireboltConnectionTokens.builder().build();
@Captor
Expand All @@ -100,6 +97,12 @@ abstract class FireboltConnectionTest {
protected Properties connectionProperties = new Properties();
private static Connection connection;

private final String URL;

protected FireboltConnectionTest(String url) {
this.URL = url;
}

private static Stream<Arguments> unsupported() {
return Stream.of(
Arguments.of("createClob", (Executable) () -> connection.createClob()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

class FireboltConnectionUserPasswordAuthenticationTest extends FireboltConnectionTest {
private static final String SYSTEM_ENGINE_URL = "jdbc:firebolt:db?env=dev&account=dev&engine=system";

public FireboltConnectionUserPasswordAuthenticationTest() {
super("jdbc:firebolt://api.dev.firebolt.io/db");
}

@Test
void shouldNotValidateConnectionWhenCallingIsValidWhenUsingSystemEngine() throws SQLException {
Properties propertiesWithSystemEngine = new Properties(connectionProperties);
Expand Down

0 comments on commit 1567b93

Please sign in to comment.