From 198280d1766331b8ee790a336ee65630dd6cfcc2 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Mon, 30 Oct 2023 12:04:54 +0100 Subject: [PATCH 01/13] add v8 to ci --- .github/workflows/ci-build.yml | 9 +++++-- doc/changes/changelog.md | 1 + doc/changes/changes_2.4.4.md | 25 +++++++++++++++++++ doc/user_guide/oracle_user_guide.md | 2 +- pk_generated_parent.pom | 2 +- pom.xml | 4 +-- .../oracle/IntegrationTestConstants.java | 2 +- 7 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 doc/changes/changes_2.4.4.md diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 4d3ebab..a0c3f1b 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -10,8 +10,12 @@ jobs: build: runs-on: ubuntu-20.04 # UDFs fail with "VM error: Internal error: VM crashed" on ubuntu-latest concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.docker_db_version }} cancel-in-progress: true + strategy: + fail-fast: false + matrix: + docker_db_version: ["7.1.24", "8.23.0"] steps: - name: Free Disk Space run: | @@ -41,7 +45,8 @@ jobs: run: | JAVA_HOME=$JAVA_HOME_11_X64 mvn --batch-mode clean verify \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ - -DtrimStackTrace=false + -DtrimStackTrace=false \ + -Dcom.exasol.dockerdb.image=${{ matrix.docker_db_version }} - name: Publish Test Report uses: scacap/action-surefire-report@v1 if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index 927ce84..00fa71d 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,5 +1,6 @@ # Changes +* [2.4.4](changes_2.4.4.md) * [2.4.3](changes_2.4.3.md) * [2.4.2](changes_2.4.2.md) * [2.4.1](changes_2.4.1.md) diff --git a/doc/changes/changes_2.4.4.md b/doc/changes/changes_2.4.4.md new file mode 100644 index 0000000..5472283 --- /dev/null +++ b/doc/changes/changes_2.4.4.md @@ -0,0 +1,25 @@ +# Virtual Schema for Oracle 2.4.4, released 2023-??-?? + +Code name: + +## Summary + +## Features + +* ISSUE_NUMBER: description + +## Dependency Updates + +### Test Dependency Updates + +* Updated `org.jacoco:org.jacoco.agent:0.8.10` to `0.8.11` +* Updated `org.mockito:mockito-junit-jupiter:5.5.0` to `5.6.0` + +### Plugin Dependency Updates + +* Updated `com.exasol:error-code-crawler-maven-plugin:1.3.0` to `1.3.1` +* Updated `com.exasol:project-keeper-maven-plugin:2.9.12` to `2.9.14` +* Updated `org.apache.maven.plugins:maven-enforcer-plugin:3.4.0` to `3.4.1` +* Updated `org.codehaus.mojo:versions-maven-plugin:2.16.0` to `2.16.1` +* Updated `org.jacoco:jacoco-maven-plugin:0.8.10` to `0.8.11` +* Updated `org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184` to `3.10.0.2594` diff --git a/doc/user_guide/oracle_user_guide.md b/doc/user_guide/oracle_user_guide.md index 4ee90a5..91b77c3 100644 --- a/doc/user_guide/oracle_user_guide.md +++ b/doc/user_guide/oracle_user_guide.md @@ -48,7 +48,7 @@ The SQL statement below creates the adapter script, defines the Java class that ```sql CREATE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS %scriptclass com.exasol.adapter.RequestDispatcher; - %jar /buckets///virtual-schema-dist-11.0.2-oracle-2.4.3.jar; + %jar /buckets///virtual-schema-dist-11.0.2-oracle-2.4.4.jar; %jar /buckets///ojdbc.jar; / ; diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom index 8cb7fdb..a91d514 100644 --- a/pk_generated_parent.pom +++ b/pk_generated_parent.pom @@ -3,7 +3,7 @@ 4.0.0 com.exasol oracle-virtual-schema-generated-parent - 2.4.3 + 2.4.4 pom UTF-8 diff --git a/pom.xml b/pom.xml index 9adf70e..5aa2a59 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.exasol oracle-virtual-schema - 2.4.3 + 2.4.4 Virtual Schema for Oracle Virtual Schema for Oracle https://github.com/exasol/oracle-virtual-schema/ @@ -185,7 +185,7 @@ oracle-virtual-schema-generated-parent com.exasol - 2.4.3 + 2.4.4 pk_generated_parent.pom diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java index 32d7d4e..c48472f 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java @@ -1,7 +1,7 @@ package com.exasol.adapter.dialects.oracle; public final class IntegrationTestConstants { - public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-11.0.2-oracle-2.4.3.jar"; + public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-11.0.2-oracle-2.4.4.jar"; public static final String ORACLE_CONTAINER_NAME = "gvenzl/oracle-xe:21.3.0"; public static final String SCHEMA_EXASOL = "SCHEMA_EXASOL"; public static final String TABLE_JOIN_1 = "TABLE_JOIN_1"; From c7b3c6cb3e9ce4210a87b02ed6eb722acc85cbf4 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Wed, 8 Nov 2023 07:59:55 +0100 Subject: [PATCH 02/13] Fix version increment --- dependencies.md | 2 +- doc/changes/changelog.md | 1 - doc/changes/changes_2.4.3.md | 15 ++++++++++----- doc/changes/changes_2.4.4.md | 25 ------------------------- pk_generated_parent.pom | 2 +- pom.xml | 14 +++++++------- 6 files changed, 19 insertions(+), 40 deletions(-) delete mode 100644 doc/changes/changes_2.4.4.md diff --git a/dependencies.md b/dependencies.md index caea3fe..ba47bb1 100644 --- a/dependencies.md +++ b/dependencies.md @@ -70,7 +70,7 @@ [10]: https://junit.org/junit5/ [11]: https://www.eclipse.org/legal/epl-v20.html [12]: https://github.com/mockito/mockito -[13]: https://github.com/mockito/mockito/blob/main/LICENSE +[13]: https://opensource.org/licenses/MIT [14]: https://www.jqno.nl/equalsverifier [15]: https://www.apache.org/licenses/LICENSE-2.0.txt [16]: http://www.slf4j.org diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index 00fa71d..927ce84 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,6 +1,5 @@ # Changes -* [2.4.4](changes_2.4.4.md) * [2.4.3](changes_2.4.3.md) * [2.4.2](changes_2.4.2.md) * [2.4.1](changes_2.4.1.md) diff --git a/doc/changes/changes_2.4.3.md b/doc/changes/changes_2.4.3.md index b201d79..4332e62 100644 --- a/doc/changes/changes_2.4.3.md +++ b/doc/changes/changes_2.4.3.md @@ -1,24 +1,29 @@ # Virtual Schema for Oracle 2.4.3, released 2023-??-?? -Code name: +Code name: Test with Exasol 8 ## Summary -## Refactoring +This release adds integration tests using Exasol 8. -* #15: Fix reuse of oracle-db in integration test +## Feature + +* #33: Added tests with Exasol 8 ## Dependency Updates ### Test Dependency Updates +* Updated `com.exasol:hamcrest-resultset-matcher:1.6.1` to `1.6.2` +* Updated `nl.jqno.equalsverifier:equalsverifier:3.15.2` to `3.15.3` * Updated `org.jacoco:org.jacoco.agent:0.8.10` to `0.8.11` -* Updated `org.mockito:mockito-junit-jupiter:5.5.0` to `5.6.0` +* Updated `org.junit.jupiter:junit-jupiter:5.10.0` to `5.10.1` +* Updated `org.mockito:mockito-junit-jupiter:5.5.0` to `5.7.0` ### Plugin Dependency Updates * Updated `com.exasol:error-code-crawler-maven-plugin:1.3.0` to `1.3.1` -* Updated `com.exasol:project-keeper-maven-plugin:2.9.12` to `2.9.14` +* Updated `com.exasol:project-keeper-maven-plugin:2.9.12` to `2.9.15` * Updated `org.apache.maven.plugins:maven-enforcer-plugin:3.4.0` to `3.4.1` * Updated `org.codehaus.mojo:versions-maven-plugin:2.16.0` to `2.16.1` * Updated `org.jacoco:jacoco-maven-plugin:0.8.10` to `0.8.11` diff --git a/doc/changes/changes_2.4.4.md b/doc/changes/changes_2.4.4.md deleted file mode 100644 index 5472283..0000000 --- a/doc/changes/changes_2.4.4.md +++ /dev/null @@ -1,25 +0,0 @@ -# Virtual Schema for Oracle 2.4.4, released 2023-??-?? - -Code name: - -## Summary - -## Features - -* ISSUE_NUMBER: description - -## Dependency Updates - -### Test Dependency Updates - -* Updated `org.jacoco:org.jacoco.agent:0.8.10` to `0.8.11` -* Updated `org.mockito:mockito-junit-jupiter:5.5.0` to `5.6.0` - -### Plugin Dependency Updates - -* Updated `com.exasol:error-code-crawler-maven-plugin:1.3.0` to `1.3.1` -* Updated `com.exasol:project-keeper-maven-plugin:2.9.12` to `2.9.14` -* Updated `org.apache.maven.plugins:maven-enforcer-plugin:3.4.0` to `3.4.1` -* Updated `org.codehaus.mojo:versions-maven-plugin:2.16.0` to `2.16.1` -* Updated `org.jacoco:jacoco-maven-plugin:0.8.10` to `0.8.11` -* Updated `org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184` to `3.10.0.2594` diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom index a91d514..8cb7fdb 100644 --- a/pk_generated_parent.pom +++ b/pk_generated_parent.pom @@ -3,7 +3,7 @@ 4.0.0 com.exasol oracle-virtual-schema-generated-parent - 2.4.4 + 2.4.3 pom UTF-8 diff --git a/pom.xml b/pom.xml index 5aa2a59..25df44a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.exasol oracle-virtual-schema - 2.4.4 + 2.4.3 Virtual Schema for Oracle Virtual Schema for Oracle https://github.com/exasol/oracle-virtual-schema/ @@ -44,19 +44,19 @@ org.junit.jupiter junit-jupiter - 5.10.0 + 5.10.1 test org.mockito mockito-junit-jupiter - 5.6.0 + 5.7.0 test nl.jqno.equalsverifier equalsverifier - 3.15.2 + 3.15.3 test @@ -107,7 +107,7 @@ com.exasol hamcrest-resultset-matcher - 1.6.1 + 1.6.2 test @@ -137,7 +137,7 @@ com.exasol project-keeper-maven-plugin - 2.9.14 + 2.9.15 @@ -185,7 +185,7 @@ oracle-virtual-schema-generated-parent com.exasol - 2.4.4 + 2.4.3 pk_generated_parent.pom From 086dc8fbba0735694996c1af6d55095b7673e9c6 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Wed, 8 Nov 2023 08:03:37 +0100 Subject: [PATCH 03/13] Upgrade Exasol version --- .github/workflows/ci-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index a0c3f1b..357453f 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -10,12 +10,12 @@ jobs: build: runs-on: ubuntu-20.04 # UDFs fail with "VM error: Internal error: VM crashed" on ubuntu-latest concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.docker_db_version }} + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }} cancel-in-progress: true strategy: fail-fast: false matrix: - docker_db_version: ["7.1.24", "8.23.0"] + exasol_db_version: ["7.1.24", "8.23.1"] steps: - name: Free Disk Space run: | @@ -46,7 +46,7 @@ jobs: JAVA_HOME=$JAVA_HOME_11_X64 mvn --batch-mode clean verify \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ -DtrimStackTrace=false \ - -Dcom.exasol.dockerdb.image=${{ matrix.docker_db_version }} + -Dcom.exasol.dockerdb.image=${{ matrix.exasol_db_version }} - name: Publish Test Report uses: scacap/action-surefire-report@v1 if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} From c26853d4e724ac3fa3da6cf70a1909114ac412a6 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Wed, 8 Nov 2023 08:04:25 +0100 Subject: [PATCH 04/13] Run PK fix --- .github/workflows/dependencies_check.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependencies_check.yml b/.github/workflows/dependencies_check.yml index 3059964..4b6eadf 100644 --- a/.github/workflows/dependencies_check.yml +++ b/.github/workflows/dependencies_check.yml @@ -1,12 +1,15 @@ -name: Dependencies Check +name: Report Security Issues for Repository on: + workflow_dispatch: schedule: - cron: "0 2 * * *" jobs: - build: + report_security_issues: runs-on: ubuntu-latest + permissions: + issues: write steps: - uses: actions/checkout@v4 @@ -16,5 +19,17 @@ jobs: distribution: "temurin" java-version: 11 cache: "maven" - - name: Checking dependencies for vulnerabilities - run: mvn --batch-mode org.sonatype.ossindex.maven:ossindex-maven-plugin:audit -f pom.xml + + - name: Generate ossindex report + run: | + mvn org.sonatype.ossindex.maven:ossindex-maven-plugin:audit \ + org.sonatype.ossindex.maven:ossindex-maven-plugin:audit-aggregate \ + -Dossindex.reportFile=$(pwd)/ossindex-report.json \ + -Dossindex.fail=false + + - name: Report Security Issues + uses: exasol/python-toolbox/.github/actions/security-issues@main + with: + format: "maven" + command: "cat ossindex-report.json" + github-token: ${{ secrets.GITHUB_TOKEN }} From aba16c7d2b982986b7a1ec549f6aa9ea0ee7c66b Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Wed, 8 Nov 2023 08:07:37 +0100 Subject: [PATCH 05/13] Configure runner OS with project keeper --- .gitattributes | 1 + .github/workflows/release_droid_prepare_original_checksum.yml | 2 +- .project-keeper.yml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index f1e6c1c..42375ef 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,6 +6,7 @@ doc/changes/changelog.md linguist-genera .github/workflows/dependencies_check.yml linguist-generated=true .github/workflows/release_droid_print_quick_checksum.yml linguist-generated=true .github/workflows/release_droid_upload_github_release_assets.yml linguist-generated=true +.github/workflows/release_droid_prepare_original_checksum.yml linguist-generated=true .settings/org.eclipse.jdt.core.prefs linguist-generated=true .settings/org.eclipse.jdt.ui.prefs linguist-generated=true diff --git a/.github/workflows/release_droid_prepare_original_checksum.yml b/.github/workflows/release_droid_prepare_original_checksum.yml index 843604c..99c6a0b 100644 --- a/.github/workflows/release_droid_prepare_original_checksum.yml +++ b/.github/workflows/release_droid_prepare_original_checksum.yml @@ -5,7 +5,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 # UDFs fail with "VM error: Internal error: VM crashed" on ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Free Disk Space run: | diff --git a/.project-keeper.yml b/.project-keeper.yml index d1ed13d..ffaba3b 100644 --- a/.project-keeper.yml +++ b/.project-keeper.yml @@ -7,4 +7,4 @@ sources: - jar_artifact excludes: - "E-PK-CORE-18: Outdated content: '.github/workflows/ci-build.yml'" - - "E-PK-CORE-18: Outdated content: '.github/workflows/release_droid_prepare_original_checksum.yml'" +ciBuildRunnerOS: ubuntu-20.04 From 905dc5fa01c536b5047ba4855784d2dafd0a88c1 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Wed, 8 Nov 2023 08:08:56 +0100 Subject: [PATCH 06/13] Update references --- doc/user_guide/oracle_user_guide.md | 2 +- .../adapter/dialects/oracle/IntegrationTestConstants.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user_guide/oracle_user_guide.md b/doc/user_guide/oracle_user_guide.md index 91b77c3..4ee90a5 100644 --- a/doc/user_guide/oracle_user_guide.md +++ b/doc/user_guide/oracle_user_guide.md @@ -48,7 +48,7 @@ The SQL statement below creates the adapter script, defines the Java class that ```sql CREATE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS %scriptclass com.exasol.adapter.RequestDispatcher; - %jar /buckets///virtual-schema-dist-11.0.2-oracle-2.4.4.jar; + %jar /buckets///virtual-schema-dist-11.0.2-oracle-2.4.3.jar; %jar /buckets///ojdbc.jar; / ; diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java index c48472f..32d7d4e 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java @@ -1,7 +1,7 @@ package com.exasol.adapter.dialects.oracle; public final class IntegrationTestConstants { - public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-11.0.2-oracle-2.4.4.jar"; + public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-11.0.2-oracle-2.4.3.jar"; public static final String ORACLE_CONTAINER_NAME = "gvenzl/oracle-xe:21.3.0"; public static final String SCHEMA_EXASOL = "SCHEMA_EXASOL"; public static final String TABLE_JOIN_1 = "TABLE_JOIN_1"; From 8b278e88151ace817deffd50dabc00e838aafed7 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Wed, 8 Nov 2023 08:59:06 +0100 Subject: [PATCH 07/13] Use fast startup oracle container --- .../adapter/dialects/oracle/IntegrationTestConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java index 32d7d4e..116bc84 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java @@ -2,7 +2,7 @@ public final class IntegrationTestConstants { public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-11.0.2-oracle-2.4.3.jar"; - public static final String ORACLE_CONTAINER_NAME = "gvenzl/oracle-xe:21.3.0"; + public static final String ORACLE_CONTAINER_NAME = "gvenzl/oracle-xe:21.3.0-slim-faststart"; public static final String SCHEMA_EXASOL = "SCHEMA_EXASOL"; public static final String TABLE_JOIN_1 = "TABLE_JOIN_1"; public static final String TABLE_JOIN_2 = "TABLE_JOIN_2"; From d67cb4aabe4c38b9396d4d2444dccde5e8c66755 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Wed, 8 Nov 2023 16:31:49 +0100 Subject: [PATCH 08/13] Don't include Oracle JDBC driver in packaged JAR --- doc/changes/changes_2.4.3.md | 2 ++ pom.xml | 5 ++--- .../oracle/OracleVirtualSchemaIntegrationTestSetup.java | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/changes/changes_2.4.3.md b/doc/changes/changes_2.4.3.md index 4332e62..a5db5ab 100644 --- a/doc/changes/changes_2.4.3.md +++ b/doc/changes/changes_2.4.3.md @@ -6,6 +6,8 @@ Code name: Test with Exasol 8 This release adds integration tests using Exasol 8. +**Note:** This release removes the Oracle JDBC driver from the adapter JAR file that was accidentally included in version 2.1.0. This means that you will need to define the `ADAPTER SCRIPT` specifying both the adapter JAR and the JDBC driver JAR as described in the [user guide](../user_guide/oracle_user_guide.md#installing-the-adapter-script). + ## Feature * #33: Added tests with Exasol 8 diff --git a/pom.xml b/pom.xml index 25df44a..2f3442e 100644 --- a/pom.xml +++ b/pom.xml @@ -88,9 +88,8 @@ com.oracle.database.jdbc ojdbc8 23.3.0.23.09 - - compile + + test com.exasol diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/OracleVirtualSchemaIntegrationTestSetup.java b/src/test/java/com/exasol/adapter/dialects/oracle/OracleVirtualSchemaIntegrationTestSetup.java index 2d64447..d08f192 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/OracleVirtualSchemaIntegrationTestSetup.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/OracleVirtualSchemaIntegrationTestSetup.java @@ -87,7 +87,8 @@ public static void uploadOracleJDBCDriverAndVSToBucket(final Bucket bucket) public static AdapterScript createAdapterScript(final ExasolSchema schema) { final String content = "%scriptclass com.exasol.adapter.RequestDispatcher;\n" // - + "%jar /buckets/bfsdefault/default/" + VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION + ";\n"; + + "%jar /buckets/bfsdefault/default/" + VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION + ";\n" // + + "%jar /buckets/bfsdefault/default/drivers/jdbc/ojdbc8.jar;\n"; return schema.createAdapterScript(ADAPTER_SCRIPT_EXASOL, JAVA, content); } From fafdd123f8ff7857ad01a97fdc1f76bff1360321 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Wed, 8 Nov 2023 16:46:33 +0100 Subject: [PATCH 09/13] Simplify JDBC driver installation --- dependencies.md | 94 +++++++++---------- doc/changes/changes_2.4.3.md | 5 + .../oracle/IntegrationTestConstants.java | 1 - .../IntegrationTestsHelperfunctions.java | 25 ----- .../dialects/oracle/OracleSqlDialectIT.java | 11 +-- ...acleVirtualSchemaIntegrationTestSetup.java | 27 +++--- .../driver/oracle/oracle.properties | 4 - .../integration/driver/oracle/settings.cfg | 7 -- 8 files changed, 70 insertions(+), 104 deletions(-) delete mode 100644 src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestsHelperfunctions.java delete mode 100644 src/test/resources/integration/driver/oracle/oracle.properties delete mode 100644 src/test/resources/integration/driver/oracle/settings.cfg diff --git a/dependencies.md b/dependencies.md index ba47bb1..c82d523 100644 --- a/dependencies.md +++ b/dependencies.md @@ -3,31 +3,31 @@ ## Compile Dependencies -| Dependency | License | -| ------------------------------------------ | ------------------------------------------------ | -| [Virtual Schema Common JDBC][0] | [MIT License][1] | -| [Exasol Database fundamentals for Java][2] | [MIT License][3] | -| [error-reporting-java][4] | [MIT License][5] | -| [ojdbc8][6] | [Oracle Free Use Terms and Conditions (FUTC)][7] | +| Dependency | License | +| ------------------------------------------ | ---------------- | +| [Virtual Schema Common JDBC][0] | [MIT License][1] | +| [Exasol Database fundamentals for Java][2] | [MIT License][3] | +| [error-reporting-java][4] | [MIT License][5] | ## Test Dependencies -| Dependency | License | -| ----------------------------------------------- | --------------------------------- | -| [Virtual Schema Common JDBC][0] | [MIT License][1] | -| [Hamcrest][8] | [BSD License 3][9] | -| [JUnit Jupiter (Aggregator)][10] | [Eclipse Public License v2.0][11] | -| [mockito-junit-jupiter][12] | [MIT][13] | -| [EqualsVerifier \| release normal jar][14] | [Apache License, Version 2.0][15] | -| [SLF4J JDK14 Provider][16] | [MIT License][17] | -| [Test containers for Exasol on Docker][18] | [MIT License][19] | -| [Testcontainers :: JUnit Jupiter Extension][20] | [MIT][21] | -| [Testcontainers :: JDBC :: Oracle XE][20] | [MIT][21] | -| [Test Database Builder for Java][22] | [MIT License][23] | -| [udf-debugging-java][24] | [MIT License][25] | -| [Matcher for SQL Result Sets][26] | [MIT License][27] | -| [virtual-schema-shared-integration-tests][28] | [MIT License][29] | -| [JaCoCo :: Agent][30] | [Eclipse Public License 2.0][31] | +| Dependency | License | +| ----------------------------------------------- | ------------------------------------------------- | +| [Virtual Schema Common JDBC][0] | [MIT License][1] | +| [Hamcrest][6] | [BSD License 3][7] | +| [JUnit Jupiter (Aggregator)][8] | [Eclipse Public License v2.0][9] | +| [mockito-junit-jupiter][10] | [MIT][11] | +| [EqualsVerifier \| release normal jar][12] | [Apache License, Version 2.0][13] | +| [SLF4J JDK14 Provider][14] | [MIT License][15] | +| [Test containers for Exasol on Docker][16] | [MIT License][17] | +| [Testcontainers :: JUnit Jupiter Extension][18] | [MIT][19] | +| [Testcontainers :: JDBC :: Oracle XE][18] | [MIT][19] | +| [ojdbc8][20] | [Oracle Free Use Terms and Conditions (FUTC)][21] | +| [Test Database Builder for Java][22] | [MIT License][23] | +| [udf-debugging-java][24] | [MIT License][25] | +| [Matcher for SQL Result Sets][26] | [MIT License][27] | +| [virtual-schema-shared-integration-tests][28] | [MIT License][29] | +| [JaCoCo :: Agent][30] | [Eclipse Public License 2.0][31] | ## Runtime Dependencies @@ -40,19 +40,19 @@ | Dependency | License | | ------------------------------------------------------- | --------------------------------- | | [SonarQube Scanner for Maven][35] | [GNU LGPL 3][36] | -| [Apache Maven Compiler Plugin][37] | [Apache-2.0][15] | -| [Apache Maven Enforcer Plugin][38] | [Apache-2.0][15] | -| [Maven Flatten Plugin][39] | [Apache Software Licenese][15] | +| [Apache Maven Compiler Plugin][37] | [Apache-2.0][13] | +| [Apache Maven Enforcer Plugin][38] | [Apache-2.0][13] | +| [Maven Flatten Plugin][39] | [Apache Software Licenese][13] | | [org.sonatype.ossindex.maven:ossindex-maven-plugin][40] | [ASL2][41] | -| [Maven Surefire Plugin][42] | [Apache-2.0][15] | -| [Versions Maven Plugin][43] | [Apache License, Version 2.0][15] | +| [Maven Surefire Plugin][42] | [Apache-2.0][13] | +| [Versions Maven Plugin][43] | [Apache License, Version 2.0][13] | | [duplicate-finder-maven-plugin Maven Mojo][44] | [Apache License 2.0][45] | | [Project keeper maven plugin][46] | [The MIT License][47] | -| [Apache Maven Assembly Plugin][48] | [Apache-2.0][15] | -| [Apache Maven JAR Plugin][49] | [Apache License, Version 2.0][15] | +| [Apache Maven Assembly Plugin][48] | [Apache-2.0][13] | +| [Apache Maven JAR Plugin][49] | [Apache License, Version 2.0][13] | | [Artifact reference checker and unifier][50] | [MIT License][51] | -| [Apache Maven Dependency Plugin][52] | [Apache-2.0][15] | -| [Maven Failsafe Plugin][53] | [Apache-2.0][15] | +| [Apache Maven Dependency Plugin][52] | [Apache-2.0][13] | +| [Maven Failsafe Plugin][53] | [Apache-2.0][13] | | [JaCoCo :: Maven Plugin][54] | [Eclipse Public License 2.0][31] | | [error-code-crawler-maven-plugin][55] | [MIT License][56] | | [Reproducible Build Maven Plugin][57] | [Apache 2.0][41] | @@ -63,22 +63,22 @@ [3]: https://github.com/exasol/db-fundamentals-java/blob/main/LICENSE [4]: https://github.com/exasol/error-reporting-java/ [5]: https://github.com/exasol/error-reporting-java/blob/main/LICENSE -[6]: https://www.oracle.com/database/technologies/maven-central-guide.html -[7]: https://www.oracle.com/downloads/licenses/oracle-free-license.html -[8]: http://hamcrest.org/JavaHamcrest/ -[9]: http://opensource.org/licenses/BSD-3-Clause -[10]: https://junit.org/junit5/ -[11]: https://www.eclipse.org/legal/epl-v20.html -[12]: https://github.com/mockito/mockito -[13]: https://opensource.org/licenses/MIT -[14]: https://www.jqno.nl/equalsverifier -[15]: https://www.apache.org/licenses/LICENSE-2.0.txt -[16]: http://www.slf4j.org -[17]: http://www.opensource.org/licenses/mit-license.php -[18]: https://github.com/exasol/exasol-testcontainers/ -[19]: https://github.com/exasol/exasol-testcontainers/blob/main/LICENSE -[20]: https://java.testcontainers.org -[21]: http://opensource.org/licenses/MIT +[6]: http://hamcrest.org/JavaHamcrest/ +[7]: http://opensource.org/licenses/BSD-3-Clause +[8]: https://junit.org/junit5/ +[9]: https://www.eclipse.org/legal/epl-v20.html +[10]: https://github.com/mockito/mockito +[11]: https://opensource.org/licenses/MIT +[12]: https://www.jqno.nl/equalsverifier +[13]: https://www.apache.org/licenses/LICENSE-2.0.txt +[14]: http://www.slf4j.org +[15]: http://www.opensource.org/licenses/mit-license.php +[16]: https://github.com/exasol/exasol-testcontainers/ +[17]: https://github.com/exasol/exasol-testcontainers/blob/main/LICENSE +[18]: https://java.testcontainers.org +[19]: http://opensource.org/licenses/MIT +[20]: https://www.oracle.com/database/technologies/maven-central-guide.html +[21]: https://www.oracle.com/downloads/licenses/oracle-free-license.html [22]: https://github.com/exasol/test-db-builder-java/ [23]: https://github.com/exasol/test-db-builder-java/blob/main/LICENSE [24]: https://github.com/exasol/udf-debugging-java/ diff --git a/doc/changes/changes_2.4.3.md b/doc/changes/changes_2.4.3.md index a5db5ab..11a7076 100644 --- a/doc/changes/changes_2.4.3.md +++ b/doc/changes/changes_2.4.3.md @@ -14,9 +14,14 @@ This release adds integration tests using Exasol 8. ## Dependency Updates +### Compile Dependency Updates + +* Removed `com.oracle.database.jdbc:ojdbc8:23.3.0.23.09` + ### Test Dependency Updates * Updated `com.exasol:hamcrest-resultset-matcher:1.6.1` to `1.6.2` +* Added `com.oracle.database.jdbc:ojdbc8:23.3.0.23.09` * Updated `nl.jqno.equalsverifier:equalsverifier:3.15.2` to `3.15.3` * Updated `org.jacoco:org.jacoco.agent:0.8.10` to `0.8.11` * Updated `org.junit.jupiter:junit-jupiter:5.10.0` to `5.10.1` diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java index 116bc84..292b63b 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestConstants.java @@ -6,7 +6,6 @@ public final class IntegrationTestConstants { public static final String SCHEMA_EXASOL = "SCHEMA_EXASOL"; public static final String TABLE_JOIN_1 = "TABLE_JOIN_1"; public static final String TABLE_JOIN_2 = "TABLE_JOIN_2"; - public static final String JDBC_DRIVER_CONFIGURATION_FILE_NAME = "settings.cfg"; public static final int ORACLE_PORT = 1521; public static final String RESOURCES_FOLDER_DIALECT_NAME = "oracle"; diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestsHelperfunctions.java b/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestsHelperfunctions.java deleted file mode 100644 index 3e4895e..0000000 --- a/src/test/java/com/exasol/adapter/dialects/oracle/IntegrationTestsHelperfunctions.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.exasol.adapter.dialects.oracle; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -public class IntegrationTestsHelperfunctions { - public static String getPropertyFromFile(final String resourcesDialectName, final String propertyName) { - final String pathToPropertyFile = getPathToPropertyFile(resourcesDialectName); - try (final InputStream inputStream = new FileInputStream(pathToPropertyFile)) { - final Properties properties = new Properties(); - properties.load(inputStream); - return properties.getProperty(propertyName); - } catch (final IOException exception) { - throw new IllegalArgumentException( - "Cannot access the properties file or read from it. Check if the path spelling is correct" - + " and if the file exists.",exception); - } - } - public static String getPathToPropertyFile(final String resourcesDialectName) { - return "src/test/resources/integration/driver/" + resourcesDialectName + "/" + resourcesDialectName - + ".properties"; - } -} diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java index 68d3cb9..77a2a0a 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java @@ -1,9 +1,7 @@ package com.exasol.adapter.dialects.oracle; import static com.exasol.adapter.dialects.oracle.IntegrationTestConstants.*; -import static com.exasol.adapter.dialects.oracle.IntegrationTestsHelperfunctions.getPropertyFromFile; -import static com.exasol.adapter.dialects.oracle.OracleVirtualSchemaIntegrationTestSetup.createAdapterScript; -import static com.exasol.adapter.dialects.oracle.OracleVirtualSchemaIntegrationTestSetup.uploadOracleJDBCDriverAndVSToBucket; +import static com.exasol.adapter.dialects.oracle.OracleVirtualSchemaIntegrationTestSetup.*; import static com.exasol.matcher.ResultSetMatcher.matchesResultSet; import static com.exasol.matcher.ResultSetStructureMatcher.table; import static org.hamcrest.CoreMatchers.*; @@ -75,8 +73,8 @@ static void beforeAll() private static void uploadInstantClientToBucket() throws BucketAccessException, TimeoutException, FileNotFoundException { final Bucket bucket = exasolContainer.getDefaultBucket(); - final String instantClientName = getPropertyFromFile(RESOURCES_FOLDER_DIALECT_NAME, "instant.client.name"); - final String instantClientPath = getPropertyFromFile(RESOURCES_FOLDER_DIALECT_NAME, "instant.client.path"); + final String instantClientName = "instantclient-basic-linux.x64-12.1.0.2.0.zip"; + final String instantClientPath = "src/test/resources/integration/driver/oracle"; bucket.uploadFile(Path.of(instantClientPath, instantClientName), "drivers/oracle/" + instantClientName); } @@ -91,7 +89,8 @@ private static String getTestHostIpFromInsideExasol(final ExasolContainer exa private static void setupExasolContainer() throws BucketAccessException, TimeoutException, FileNotFoundException, SQLException, InterruptedException { - uploadOracleJDBCDriverAndVSToBucket(exasolContainer.getDefaultBucket()); + uploadOracleJDBCDriverToBucket(exasolContainer); + uploadAdapterToBucket(exasolContainer.getDefaultBucket()); uploadInstantClientToBucket(); final Connection exasolConnection = exasolContainer.createConnectionForUser(exasolContainer.getUsername(), exasolContainer.getPassword()); diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/OracleVirtualSchemaIntegrationTestSetup.java b/src/test/java/com/exasol/adapter/dialects/oracle/OracleVirtualSchemaIntegrationTestSetup.java index d08f192..89dfc4e 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/OracleVirtualSchemaIntegrationTestSetup.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/OracleVirtualSchemaIntegrationTestSetup.java @@ -1,7 +1,6 @@ package com.exasol.adapter.dialects.oracle; -import static com.exasol.adapter.dialects.oracle.IntegrationTestConstants.*; -import static com.exasol.adapter.dialects.oracle.IntegrationTestsHelperfunctions.getPropertyFromFile; +import static com.exasol.adapter.dialects.oracle.IntegrationTestConstants.VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION; import static com.exasol.dbbuilder.dialects.exasol.AdapterScript.Language.JAVA; import java.io.*; @@ -17,6 +16,7 @@ import com.exasol.containers.ExasolService; import com.exasol.dbbuilder.dialects.exasol.*; import com.exasol.dbbuilder.dialects.oracle.OracleObjectFactory; +import com.exasol.drivers.JdbcDriver; import com.exasol.udfdebugging.UdfTestSetup; import com.github.dockerjava.api.model.ContainerNetwork; @@ -28,6 +28,7 @@ public class OracleVirtualSchemaIntegrationTestSetup implements Closeable { private static final String SCHEMA_EXASOL = "SCHEMA_EXASOL"; private static final String ADAPTER_SCRIPT_EXASOL = "ADAPTER_SCRIPT_EXASOL"; private static final String ORACLE_CONTAINER_NAME = IntegrationTestConstants.ORACLE_CONTAINER_NAME; + private static final String ORACLE_JDBC_DRIVER_NAME = "ojdbc8.jar"; private final Statement oracleStatement; private final OracleContainerDBA oracleContainer = new OracleContainerDBA(ORACLE_CONTAINER_NAME); @@ -46,7 +47,8 @@ public class OracleVirtualSchemaIntegrationTestSetup implements Closeable { try { this.exasolContainer.start(); this.oracleContainer.start(); - uploadOracleJDBCDriverAndVSToBucket(this.exasolContainer.getDefaultBucket()); + uploadOracleJDBCDriverToBucket(this.exasolContainer); + uploadAdapterToBucket(this.exasolContainer.getDefaultBucket()); this.exasolConnection = this.exasolContainer.createConnection(""); this.exasolStatement = this.exasolConnection.createStatement(); this.oracleConnection = this.oracleContainer.createConnectionDBA(""); @@ -69,19 +71,16 @@ public class OracleVirtualSchemaIntegrationTestSetup implements Closeable { } } - public static void uploadOracleJDBCDriverAndVSToBucket(final Bucket bucket) + public static void uploadOracleJDBCDriverToBucket(final ExasolContainer> container) throws BucketAccessException, TimeoutException, FileNotFoundException { - final String driverName = getPropertyFromFile(RESOURCES_FOLDER_DIALECT_NAME, "driver.name"); - - final Path pathToSettingsFile = Path.of("src", "test", "resources", "integration", "driver", - RESOURCES_FOLDER_DIALECT_NAME, JDBC_DRIVER_CONFIGURATION_FILE_NAME); + container.getDriverManager() + .install(JdbcDriver.builder("ORACLE").enableSecurityManager(false).mainClass("oracle.jdbc.OracleDriver") + .prefix("jdbc:oracle:thin:") + .sourceFile(Path.of("target/oracle-driver", ORACLE_JDBC_DRIVER_NAME)).build()); + } - // Upload the settings.cfg file for the driver that registers the driver. - bucket.uploadFile(pathToSettingsFile, "drivers/jdbc/" + JDBC_DRIVER_CONFIGURATION_FILE_NAME); - final String driverPath = getPropertyFromFile(RESOURCES_FOLDER_DIALECT_NAME, "driver.path"); - // Upload the driver itself - bucket.uploadFile(Path.of(driverPath, driverName), "drivers/jdbc/" + driverName); - // Upload the virtual schema jar to be able to use oracle virtual schemas + public static void uploadAdapterToBucket(final Bucket bucket) + throws BucketAccessException, TimeoutException, FileNotFoundException { bucket.uploadFile(PATH_TO_VIRTUAL_SCHEMAS_JAR, VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION); } diff --git a/src/test/resources/integration/driver/oracle/oracle.properties b/src/test/resources/integration/driver/oracle/oracle.properties deleted file mode 100644 index 33d273f..0000000 --- a/src/test/resources/integration/driver/oracle/oracle.properties +++ /dev/null @@ -1,4 +0,0 @@ -driver.name=ojdbc8.jar -driver.path=target/oracle-driver -instant.client.name=instantclient-basic-linux.x64-12.1.0.2.0.zip -instant.client.path=src/test/resources/integration/driver/oracle \ No newline at end of file diff --git a/src/test/resources/integration/driver/oracle/settings.cfg b/src/test/resources/integration/driver/oracle/settings.cfg deleted file mode 100644 index dd8870c..0000000 --- a/src/test/resources/integration/driver/oracle/settings.cfg +++ /dev/null @@ -1,7 +0,0 @@ -DRIVERNAME=ORACLE -JAR=ojdbc8.jar -DRIVERMAIN=oracle.jdbc.OracleDriver -PREFIX=jdbc:oracle:thin: -FETCHSIZE=100000 -INSERTSIZE=-1 -NOSECURITY=YES From 77ed49a74474f5612ab309982394eecc618f407a Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Fri, 10 Nov 2023 07:13:02 +0100 Subject: [PATCH 10/13] Improve Javadoc --- .../closeafterall/CloseAfterAllExtension.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/exasol/closeafterall/CloseAfterAllExtension.java b/src/test/java/com/exasol/closeafterall/CloseAfterAllExtension.java index 77cded6..c9702c1 100644 --- a/src/test/java/com/exasol/closeafterall/CloseAfterAllExtension.java +++ b/src/test/java/com/exasol/closeafterall/CloseAfterAllExtension.java @@ -1,16 +1,17 @@ package com.exasol.closeafterall; -import com.exasol.errorreporting.ExaError; -import org.junit.jupiter.api.extension.AfterAllCallback; -import org.junit.jupiter.api.extension.ExtensionContext; - import java.io.Closeable; import java.io.IOException; import java.lang.reflect.Field; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.ExtensionContext; + +import com.exasol.errorreporting.ExaError; + /** * This JUnit extension closes resources in static fields that are annotated with {@code @CloseAfterAll}. You can use it - * by annotating your class with {@code @ExtendWith({ CloseAfterAllExtension.class })}. + * by annotating your class with {@code @ExtendWith({ CloseAfterAllExtension.class })}. */ public class CloseAfterAllExtension implements AfterAllCallback { @@ -40,7 +41,7 @@ private void closeObject(final Field field, final Object annotatedObject) throws ((Closeable) annotatedObject).close(); } else { throw new IllegalStateException(ExaError.messageBuilder("E-VSORA-9").message( - "Could not close the field {{field}} annotated with @CloseAfterAll since it does not implement Closable.") + "Could not close the field {{field}} annotated with @CloseAfterAll since it does not implement java.io.Closeable.") .parameter("field", field.getName()).toString()); } } From ff43070e9dfa82629d61ecfffdb5048ee3dd22a7 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Fri, 10 Nov 2023 07:18:03 +0100 Subject: [PATCH 11/13] Upgrade exasol-testcontainers --- doc/changes/changes_2.4.3.md | 1 + pom.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/changes/changes_2.4.3.md b/doc/changes/changes_2.4.3.md index 11a7076..f71649a 100644 --- a/doc/changes/changes_2.4.3.md +++ b/doc/changes/changes_2.4.3.md @@ -20,6 +20,7 @@ This release adds integration tests using Exasol 8. ### Test Dependency Updates +* Updated `com.exasol:exasol-testcontainers:6.6.2` to `6.6.3` * Updated `com.exasol:hamcrest-resultset-matcher:1.6.1` to `1.6.2` * Added `com.oracle.database.jdbc:ojdbc8:23.3.0.23.09` * Updated `nl.jqno.equalsverifier:equalsverifier:3.15.2` to `3.15.3` diff --git a/pom.xml b/pom.xml index 2f3442e..381b0b4 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ com.exasol exasol-testcontainers - 6.6.2 + 6.6.3 test From 3f60c9c7f8ae019560742f35fac788f2fb86a6ab Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Fri, 10 Nov 2023 07:20:06 +0100 Subject: [PATCH 12/13] Skip integration tests with Exasol 8 --- .../dialects/oracle/ExasolVersionCheck.java | 32 +++++++++++++++++++ .../oracle/OracleScalarFunctionsIT.java | 13 +++++--- .../dialects/oracle/OracleSqlDialectIT.java | 5 +-- 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 src/test/java/com/exasol/adapter/dialects/oracle/ExasolVersionCheck.java diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/ExasolVersionCheck.java b/src/test/java/com/exasol/adapter/dialects/oracle/ExasolVersionCheck.java new file mode 100644 index 0000000..53e49ad --- /dev/null +++ b/src/test/java/com/exasol/adapter/dialects/oracle/ExasolVersionCheck.java @@ -0,0 +1,32 @@ +package com.exasol.adapter.dialects.oracle; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +import java.sql.*; + +class ExasolVersionCheck { + + private ExasolVersionCheck() { + // Not instantiable + } + + /** + * This is a temporary workaround until integration tests work with Exasol 8. + */ + static void assumeExasolVersion7(final Connection connection) { + final String version = getExasolMajorVersion(connection); + assumeTrue("7".equals(version), "Expected Exasol version 7 but got '" + version + "'"); + } + + static String getExasolMajorVersion(final Connection connection) { + try (Statement stmt = connection.createStatement()) { + final ResultSet result = stmt + .executeQuery("SELECT PARAM_VALUE FROM SYS.EXA_METADATA WHERE PARAM_NAME='databaseMajorVersion'"); + assertTrue(result.next(), "no result"); + return result.getString(1); + } catch (final SQLException exception) { + throw new IllegalStateException("Failed to query Exasol version: " + exception.getMessage(), exception); + } + } +} diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/OracleScalarFunctionsIT.java b/src/test/java/com/exasol/adapter/dialects/oracle/OracleScalarFunctionsIT.java index f1bb6a7..9d92895 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/OracleScalarFunctionsIT.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/OracleScalarFunctionsIT.java @@ -34,6 +34,11 @@ protected static String getUniqueIdentifier() { return "ID" + idCounter; } + @BeforeAll + static void assumeExasol71() throws SQLException { + ExasolVersionCheck.assumeExasolVersion7(SETUP.getExasolContainer().createConnection()); + } + @Override protected TestSetup getTestSetup() { final OracleObjectFactory oracleFactory = SETUP.getOracleFactory(); @@ -42,11 +47,11 @@ protected TestSetup getTestSetup() { private static class OracleSingleTableVirtualSchemaTestSetup implements VirtualSchemaTestSetup { private final VirtualSchema virtualSchema; - private final Schema OracleSchema; + private final Schema oracleSchema; - private OracleSingleTableVirtualSchemaTestSetup(final VirtualSchema virtualSchema, final Schema OracleSchema) { + private OracleSingleTableVirtualSchemaTestSetup(final VirtualSchema virtualSchema, final Schema oracleSchema) { this.virtualSchema = virtualSchema; - this.OracleSchema = OracleSchema; + this.oracleSchema = oracleSchema; } @Override @@ -57,7 +62,7 @@ public String getFullyQualifiedName() { @Override public void close() { this.virtualSchema.drop(); - this.OracleSchema.drop(); + this.oracleSchema.drop(); } } diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java index 77a2a0a..7dbc889 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java @@ -66,8 +66,8 @@ class OracleSqlDialectIT { @BeforeAll static void beforeAll() throws BucketAccessException, TimeoutException, SQLException, FileNotFoundException, InterruptedException { - setupOracleDbContainer(); setupExasolContainer(); + setupOracleDbContainer(); } private static void uploadInstantClientToBucket() @@ -82,7 +82,7 @@ private static String getTestHostIpFromInsideExasol(final ExasolContainer exa final Map networks = exasolContainer.getContainerInfo().getNetworkSettings() .getNetworks(); if (networks.size() == 0) { - return null; + throw new IllegalStateException("Failed to get host IP from container network settings"); } return networks.values().iterator().next().getGateway(); } @@ -94,6 +94,7 @@ private static void setupExasolContainer() uploadInstantClientToBucket(); final Connection exasolConnection = exasolContainer.createConnectionForUser(exasolContainer.getUsername(), exasolContainer.getPassword()); + ExasolVersionCheck.assumeExasolVersion7(exasolConnection); statementExasol = exasolConnection.createStatement(); final UdfTestSetup udfTestSetup = new UdfTestSetup(getTestHostIpFromInsideExasol(exasolContainer), From 202f9887bddd52323471bce676917a11f2d10e47 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Fri, 10 Nov 2023 07:37:27 +0100 Subject: [PATCH 13/13] Fix setup order --- .../com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java index 7dbc889..3f20982 100644 --- a/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/oracle/OracleSqlDialectIT.java @@ -66,8 +66,8 @@ class OracleSqlDialectIT { @BeforeAll static void beforeAll() throws BucketAccessException, TimeoutException, SQLException, FileNotFoundException, InterruptedException { - setupExasolContainer(); setupOracleDbContainer(); + setupExasolContainer(); } private static void uploadInstantClientToBucket()