Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/gradle/org.projectlombok-lombok…
Browse files Browse the repository at this point in the history
…-1.18.34
  • Loading branch information
stepansergeevitch authored Oct 30, 2024
2 parents d6d098d + 57b4257 commit 76ad32a
Show file tree
Hide file tree
Showing 84 changed files with 1,130 additions and 402 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ jobs:
run: |
echo "PROJECT_VERSION=$(./gradlew printVersion |grep 'PROJECT_VERSION=' | cut -d= -f2)" >> $GITHUB_OUTPUT
- name: Upload uber-jar
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: firebolt-jdbc-${{ steps.project-version.outputs.PROJECT_VERSION }}.jar
path: build/libs/firebolt-jdbc-${{ steps.project-version.outputs.PROJECT_VERSION }}.jar
- name: Upload sources-jar
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: firebolt-jdbc-${{ steps.project-version.outputs.PROJECT_VERSION }}-sources.jar
path: build/libs/firebolt-jdbc-${{ steps.project-version.outputs.PROJECT_VERSION }}-sources.jar
13 changes: 11 additions & 2 deletions .github/workflows/integration-test-v1.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
name: Run integration tests v1

on:
workflow_dispatch:
inputs:
database:
description: 'Database override'
required: false
default: ''
engine:
description: 'Engine override'
required: false
workflow_call:
inputs:
database:
description: 'Database - a new one will be created if not provided'
description: 'Database override'
required: false
default: ''
type: string
engine:
description: 'Engine - a new one will be created if not provided'
description: 'Engine override'
required: false
type: string
secrets:
Expand Down
36 changes: 30 additions & 6 deletions .github/workflows/integration-test-v2.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
name: Run integration tests v2

on:
workflow_dispatch:
inputs:
database:
description: 'Database override'
required: false
default: ''
engine:
description: 'Engine override'
required: false
account:
description: 'Account override'
required: false
type: string
workflow_call:
inputs:
database:
description: 'Database - a new one will be created if not provided'
description: 'Database override'
required: false
default: ''
type: string
engine:
description: 'Engine - a new one will be created if not provided'
description: 'Engine override'
required: false
type: string
account:
description: 'Account'
required: true
description: 'Account override'
required: false
type: string
secrets:
FIREBOLT_CLIENT_ID_STG_NEW_IDN:
Expand All @@ -34,6 +47,17 @@ jobs:
script: |
core.setFailed("Database and Engine parameters should be provided simultaneously")
- name: Resolve account
id: set-account
run: |
if ! [[ -z "${{ inputs.account }}" ]]; then
echo "account=${{ inputs.account }}" >> $GITHUB_OUTPUT
echo "account=${{ inputs.account }}"
else
echo "account=${{ vars.FIREBOLT_ACCOUNT }}" >> $GITHUB_OUTPUT
echo "account=${{ vars.FIREBOLT_ACCOUNT }}"
fi
- name: Check out code
uses: actions/checkout@v3

Expand All @@ -50,7 +74,7 @@ jobs:
with:
firebolt-client-id: ${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}
firebolt-client-secret: ${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}
account: ${{ inputs.account }}
account: ${{ steps.set-account.outputs.account }}
api-endpoint: "api.staging.firebolt.io"

- name: Determine database name
Expand All @@ -72,4 +96,4 @@ jobs:
fi
- name: Run integration tests
run: ./gradlew integrationTest -Ddb=${{ steps.find-database-name.outputs.database_name }} -Denv=staging -Dclient_secret="${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}" -Dclient_id="${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}" -Daccount="${{ inputs.account }}" -Dengine="${{ steps.find-engine-name.outputs.engine_name }}" -DexcludeTags=v1
run: ./gradlew integrationTest -Ddb=${{ steps.find-database-name.outputs.database_name }} -Denv=staging -Dclient_secret="${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}" -Dclient_id="${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}" -Daccount="${{ steps.set-account.outputs.account }}" -Dengine="${{ steps.find-engine-name.outputs.engine_name }}" -DexcludeTags=v1
41 changes: 1 addition & 40 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,17 @@ name: Run integration tests

on:
workflow_dispatch:
inputs:
database1:
description: 'Database (v1) - a new one will be created if not provided'
required: false
default: ''
database-with-engine-v2:
description: 'Database (v2) for Firebolt v2 - a new one will be created if not provided'
required: false
default: ''
engine1:
description: 'Engine (v1) - a new one will be created if not provided'
required: false
engine_v2_fb_2_0:
description: 'Engine (v2) for Firebolt v2 - a new one will be created if not provided'
required: false
run-v1:
description: 'Run tests against Firebolt DB v1'
required: true
default: true
type: choice
options:
- 'true'
- 'false'
run-database-with-engine-v2:
description: 'Run tests against Firebolt DB v2 and Engine V2'
required: true
default: true
type: choice
options:
- 'true'
- 'false'
workflow_call:

jobs:
run-integration-tests1:
if: ${{ inputs.run-v1 == 'true' }}
uses: ./.github/workflows/integration-test-v1.yml
with:
database: ${{ inputs.database1 }}
engine: ${{ inputs.engine1 }}
secrets:
FIREBOLT_STG_USERNAME: ${{ secrets.FIREBOLT_STG_USERNAME }}
FIREBOLT_STG_PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }}

run-integration-tests-engine2:
if: ${{ inputs.run-database-with-engine-v2 == 'true' }}
uses: ./.github/workflows/integration-test-v2.yml
with:
database: ${{ inputs.database-with-engine-v2 }}
engine: ${{ inputs.engine_v2_fb_2_0 }}
account: ${{ vars.FIREBOLT_ACCOUNT_V2 }}
secrets:
FIREBOLT_CLIENT_ID_STG_NEW_IDN: ${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}
FIREBOLT_CLIENT_SECRET_STG_NEW_IDN: ${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/performance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
mkdir dependencies
- name: Download uber-jar
id: download-jar
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
with:
name: ${{ needs.build.outputs.uber-jar }}
path: dependencies
Expand Down Expand Up @@ -63,12 +63,12 @@ jobs:
outputReportsFolder: reports/
args: -Jdatabase=${{ steps.find-database-name.outputs.database_name }} -Jpassword=${{ secrets.SERVICE_ACCOUNT_SECRET_STAGING }} -Jusername=${{ secrets.SERVICE_ACCOUNT_ID_STAGING }} -Jdriver=${{ needs.build.outputs.uber-jar }} -Jenvironment=staging -Jthreads=${{ inputs.threads }} -Jloops=${{ inputs.loops }}
- name: Upload JMeter report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: performance_test_report
path: reports
- name: Upload JMeter logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: jmeter_log.log
path: jmeter_log.log
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: Release new version
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name to publish'
required: true

jobs:
build:
Expand All @@ -15,13 +20,13 @@ jobs:
- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
ref: ${{ github.event.release.tag_name || github.event.inputs.tag_name}}
- name: Download uber-jar
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
with:
name: ${{ needs.build.outputs.uber-jar }}
- name: Download sources-jar
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
with:
name: ${{ needs.build.outputs.sources-jar }}
- uses: xresloader/upload-to-github-release@v1
Expand All @@ -31,8 +36,10 @@ jobs:
file: ${{ needs.build.outputs.uber-jar }}
tags: true
draft: false
- name: Deploy to Repsy repository
- name: Deploy to Maven Central repository
run: ./gradlew publish
env:
MAVEN_REPO_USERNAME: ${{ secrets.MAVEN_REPO_USERNAME }}
MAVEN_REPO_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }}
GRADLE_SIGNING_KEY: ${{ secrets.GRADLE_SIGNING_KEY }}
GRADLE_SIGNING_PASSWORD: ${{ secrets.GRADLE_SIGNING_PASSWORD }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
The official JDBC driver for Firebolt.

## Documentation
To download the JDBC driver and learn how to use it, please see the official [Firebolt documentation](https://docs.firebolt.io/developing-with-firebolt/connecting-with-jdbc.html).
To download the JDBC driver and learn how to use it, please see the official [Firebolt documentation](https://docs.firebolt.io/Guides/developing-with-firebolt/connecting-with-jdbc.html).

## Development
The code of this repository is formatted using the Eclipse formatter, which was chosen because it is supported by multiple modern IDEs (such as Intellij).
Expand Down
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
id "org.sonarqube" version "5.0.0.4638"
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.0.0'
id 'org.quiltmc.gradle.licenser' version '2.0.2'
id 'signing'
}

Expand Down Expand Up @@ -66,7 +65,6 @@ dependencies {
implementation 'net.jodah:expiringmap:0.5.11'
implementation 'org.apache.commons:commons-text:1.12.0'
implementation 'org.lz4:lz4-java:1.8.0'
implementation 'org.slf4j:jul-to-slf4j:2.0.13'

implementation fileTree(dir: 'libs', includes: ['*.jar'])

Expand Down Expand Up @@ -336,8 +334,11 @@ task generateJavadoc(type: Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}


signing {
def signingKey = System.getenv("GRADLE_SIGNING_KEY")
def signingPassword = System.getenv("GRADLE_SIGNING_PASSWORD")
useInMemoryPgpKeys(signingKey, signingPassword)

sign publishing.publications
}

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=3.0.4-SNAPSHOT
jdbcVersion=4.3
version=3.2.1
jdbcVersion=4.3
1 change: 1 addition & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
lombok.anyConstructor.addConstructorProperties = true
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
lombok.log.custom.declaration = com.firebolt.jdbc.log.FireboltLogger com.firebolt.jdbc.util.LoggerUtil.getLogger(NAME)
2 changes: 2 additions & 0 deletions src/integrationTest/java/integration/IntegrationTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration;

import com.firebolt.jdbc.client.HttpClientConfig;
import lombok.CustomLog;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.TestInstance;
Expand All @@ -16,6 +17,7 @@
import static com.firebolt.jdbc.connection.FireboltConnectionUserPassword.SYSTEM_ENGINE_NAME;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@CustomLog
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Tag("common")
public abstract class IntegrationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void connectToNotExistingDb(EngineType engineType) {
String url = format("jdbc:firebolt:%s?env=%s&account=%s%s", database, params.getEnv(), params.getAccount(), engineSuffix);
FireboltException e = assertThrows(FireboltException.class, () -> DriverManager.getConnection(url, params.getPrincipal(), params.getSecret()));
if (infraVersion >= 2) {
assertEquals(ExceptionType.ERROR, e.getType());
assertEquals(ExceptionType.INVALID_REQUEST, e.getType());
String expectedMessage = format("Database '%s' does not exist or not authorized", database);
assertTrue(e.getMessage().contains(expectedMessage), format("Error message '%s' does not match '%s'", e.getMessage(), expectedMessage));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void shouldReturnTable() throws SQLException {
",,,VIEW,views;tables,integration_test",

// table name pattern
",,%account%,,service_account_users;service_accounts,tables;columns;views",
",,%account%,,accounts;service_accounts,tables;columns;views",
",,%test,,integration_test,tables;columns;views",

// schema name pattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.firebolt.jdbc.type.FireboltDataType;
import com.firebolt.jdbc.type.array.FireboltArray;
import integration.IntegrationTest;
import lombok.CustomLog;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -26,6 +27,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;

@CustomLog
class PreparedStatementArrayTest extends IntegrationTest {
enum PreparedStatementValueSetter {
ARRAY {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import integration.ConnectionInfo;
import integration.IntegrationTest;
import lombok.Builder;
import lombok.CustomLog;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -32,6 +33,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -49,6 +51,7 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@CustomLog
class PreparedStatementTest extends IntegrationTest {

@BeforeEach
Expand Down Expand Up @@ -432,6 +435,26 @@ void shouldInsertAndRetrieveUrl() throws SQLException, MalformedURLException {
}
}

@Test
void shouldFetchSpecialCharacters() throws SQLException, MalformedURLException {
try (Connection connection = createConnection()) {
try (PreparedStatement statement = connection
.prepareStatement("SELECT ? as a, ? as b, ? as c, ? as d")) {
statement.setString(1, "ї");
statement.setString(2, "\n");
statement.setString(3, "\\");
statement.setString(4, "don't");
statement.execute();
ResultSet rs = statement.getResultSet();
assertTrue(rs.next());
assertEquals("ї", rs.getString(1));
assertEquals("\n", rs.getString(2));
assertEquals("\\", rs.getString(3));
assertEquals("don't", rs.getString(4));
}
}
}

@Builder
@Value
@EqualsAndHashCode
Expand Down
Loading

0 comments on commit 76ad32a

Please sign in to comment.