Skip to content

Commit

Permalink
Remove Oracle JDBC driver out of the box
Browse files Browse the repository at this point in the history
Closes: keycloak#29491

Co-authored-by: Václav Muzikář <[email protected]>
Co-authored-by: Martin Bartoš <[email protected]>
Signed-off-by: Peter Zaoral <[email protected]>
  • Loading branch information
3 people committed May 31, 2024
1 parent 470412b commit fc8dbe6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<KeycloakDistribution> {

@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");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down

0 comments on commit fc8dbe6

Please sign in to comment.