Skip to content

Commit

Permalink
fixed custom database name
Browse files Browse the repository at this point in the history
  • Loading branch information
alexradzin committed Nov 16, 2023
1 parent 8872eaf commit a329fab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ protected void authenticate() throws SQLException {
String accessToken = getAccessToken(loginProperties).orElse(StringUtils.EMPTY);
FireboltProperties propertiesWithAccessToken = loginProperties.toBuilder().accessToken(accessToken).build();
Engine engine = fireboltEngineService.getEngine(propertiesWithAccessToken);
String database = loginProperties.isSystemEngine() ? loginProperties.getDatabase() : engine.getDatabase();
String database = loginProperties.getDatabase();
if (engine.getDatabase() != null) {
database = engine.getDatabase();
}
this.sessionProperties = loginProperties.toBuilder().host(engine.getEndpoint()).engine(engine.getName()).database(database).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
Expand Down Expand Up @@ -66,7 +65,7 @@ void shouldPostSqlQueryWithExpectedUrl() throws FireboltException, IOException {
void shouldPostSqlQueryForSystemEngine() throws FireboltException, IOException {
String url = shouldPostSqlQueryForSystemEngine(true).getValue();
assertEquals(
"http://firebolt1:555/?account_id=12345&output_format=TabSeparatedWithNamesAndTypes",
"http://firebolt1:555/?database=db1&account_id=12345&output_format=TabSeparatedWithNamesAndTypes",
url);
}

Expand Down

0 comments on commit a329fab

Please sign in to comment.