From fc8dbe63fa3341ae7e11c34202b229a6ae1601b6 Mon Sep 17 00:00:00 2001 From: Peter Zaoral Date: Wed, 29 May 2024 15:45:13 +0200 Subject: [PATCH] Remove Oracle JDBC driver out of the box MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: #29491 Co-authored-by: Václav Muzikář Co-authored-by: Martin Bartoš Signed-off-by: Peter Zaoral --- .../it/cli/dist/BuildCommandDistTest.java | 2 +- .../keycloak/it/storage/database/OracleTest.java | 16 ++++++++++++++++ .../it/utils/RawKeycloakDistribution.java | 2 -- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/BuildCommandDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/BuildCommandDistTest.java index feb0be91f242..ac9b9b685815 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/BuildCommandDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/BuildCommandDistTest.java @@ -103,7 +103,7 @@ void testDoNotRecordRuntimeOptionsDuringBuild(KeycloakDistribution distribution) void missingOracleJdbcDriver(LaunchResult result) { CLIResult cliResult = (CLIResult) result; - String dbDriver = Database.getDriver("oracle", true).orElse(""); + String dbDriver = Database.getDriver("oracle", false).orElse(""); cliResult.assertError(String.format("ERROR: Unable to find the JDBC driver (%s). You need to install it.", dbDriver)); cliResult.assertNoBuild(); } diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/OracleTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/OracleTest.java index 032e0df8a21c..0c109f526658 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/OracleTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/OracleTest.java @@ -17,12 +17,18 @@ package org.keycloak.it.storage.database; +import org.keycloak.it.junit5.extension.BeforeStartDistribution; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.CLITest; import org.keycloak.it.junit5.extension.WithDatabase; +import org.keycloak.it.utils.KeycloakDistribution; +import org.keycloak.it.utils.RawKeycloakDistribution; + +import java.util.function.Consumer; @CLITest @WithDatabase(alias = "oracle") +@BeforeStartDistribution(OracleTest.CopyOracleJdbcDriver.class) public class OracleTest extends BasicDatabaseTest { @Override @@ -34,4 +40,14 @@ protected void assertWrongUsername(CLIResult cliResult) { protected void assertWrongPassword(CLIResult cliResult) { cliResult.assertMessage("ORA-01017: invalid username/password; logon denied"); } + + public static class CopyOracleJdbcDriver implements Consumer { + + @Override + public void accept(KeycloakDistribution distribution) { + RawKeycloakDistribution rawDist = distribution.unwrap(RawKeycloakDistribution.class); + rawDist.copyProvider("com.oracle.database.jdbc", "ojdbc11"); + rawDist.copyProvider("com.oracle.database.nls", "orai18n"); + } + } } diff --git a/quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java b/quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java index 8a988fa1b34f..6f984c35d55a 100644 --- a/quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java +++ b/quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java @@ -460,8 +460,6 @@ private Path prepareDistribution() { if (System.getProperty("product") != null) { // JDBC drivers might be excluded if running as a product build copyProvider(dPath, "com.microsoft.sqlserver", "mssql-jdbc"); - copyProvider(dPath, "com.oracle.database.jdbc", "ojdbc11"); - copyProvider(dPath, "com.oracle.database.nls", "orai18n"); } }