Skip to content

Commit

Permalink
Simplify JDBC driver installation
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Nov 8, 2023
1 parent d67cb4a commit fafdd12
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 104 deletions.
94 changes: 47 additions & 47 deletions dependencies.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions doc/changes/changes_2.4.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down

This file was deleted.

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

Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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.*;
Expand All @@ -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;

Expand All @@ -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);
Expand All @@ -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("");
Expand All @@ -69,19 +71,16 @@ public class OracleVirtualSchemaIntegrationTestSetup implements Closeable {
}
}

public static void uploadOracleJDBCDriverAndVSToBucket(final Bucket bucket)
public static void uploadOracleJDBCDriverToBucket(final ExasolContainer<? extends 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);
}

Expand Down

This file was deleted.

7 changes: 0 additions & 7 deletions src/test/resources/integration/driver/oracle/settings.cfg

This file was deleted.

0 comments on commit fafdd12

Please sign in to comment.