Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#817 - removing oracle database dependency preserving most of code. #3376

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,36 @@
*/
package org.kie.persistence.jdbc;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.kie.kogito.testcontainers.KogitoOracleSqlContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

import oracle.jdbc.pool.OracleDataSource;

@Testcontainers
@Disabled
public class OracleProcessInstancesIT extends AbstractProcessInstancesIT {

@Container
private final static KogitoOracleSqlContainer ORACLE_CONTAINER = new KogitoOracleSqlContainer();
private static final String ORACLE_TIMEZONE_PROPERTY = "oracle.jdbc.timezoneAsRegion";
private static OracleDataSource ORACLE_DATA_SOURCE;
// private static OracleDataSource ORACLE_DATA_SOURCE;

@BeforeAll
public static void start() {
try {
ORACLE_DATA_SOURCE = new OracleDataSource();
ORACLE_DATA_SOURCE.setURL(ORACLE_CONTAINER.getJdbcUrl());
ORACLE_DATA_SOURCE.setUser(ORACLE_CONTAINER.getUsername());
ORACLE_DATA_SOURCE.setPassword(ORACLE_CONTAINER.getPassword());
System.setProperty(ORACLE_TIMEZONE_PROPERTY, "false");
initMigration(ORACLE_CONTAINER, "oracle");
} catch (SQLException e) {
throw new RuntimeException("Failed to create oracle datasource");
}
// try {
// ORACLE_DATA_SOURCE = new OracleDataSource();
// ORACLE_DATA_SOURCE.setURL(ORACLE_CONTAINER.getJdbcUrl());
// ORACLE_DATA_SOURCE.setUser(ORACLE_CONTAINER.getUsername());
// ORACLE_DATA_SOURCE.setPassword(ORACLE_CONTAINER.getPassword());
System.setProperty(ORACLE_TIMEZONE_PROPERTY, "false");
initMigration(ORACLE_CONTAINER, "oracle");
// } catch (SQLException e) {
// throw new RuntimeException("Failed to create oracle datasource");
// }
}

@AfterAll
Expand All @@ -58,6 +56,7 @@ public static void stop() {
}

protected DataSource getDataSource() {
return ORACLE_DATA_SOURCE;
return null;
// return ORACLE_DATA_SOURCE;
}
}
1 change: 0 additions & 1 deletion kogito-build/kogito-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<!-- We don't use gson directly. This is just to align versions of transitive dependencies -->
<version.com.google.gson>2.10.1</version.com.google.gson>
<!-- currently required for integration test only -->
<version.com.oracle.database.jdbc>21.5.0.0</version.com.oracle.database.jdbc>
<version.com.sun.xml.bind.core>2.3.0.1</version.com.sun.xml.bind.core>
<version.com.sun.xml.bind.impl>2.3.5</version.com.sun.xml.bind.impl>
<version.com.sun.activation>2.0.1</version.com.sun.activation>
Expand Down
12 changes: 0 additions & 12 deletions kogito-test-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId>
<version>${version.org.testcontainers}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>${version.com.oracle.database.jdbc}</version>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>database-commons</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,64 +18,62 @@
*/
package org.kie.kogito.testcontainers;

import java.text.MessageFormat;
import java.util.function.Consumer;

import org.kie.kogito.test.resources.TestResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.OracleContainer;
import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.containers.output.OutputFrame;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.utility.DockerImageName;

/**
* OracleXE Container for Kogito examples.
* Placeholder for OracleXE Container (cleaned for Legal restrictions related to oracle license).
*/
public class KogitoOracleSqlContainer extends OracleContainer implements TestResource {

private static final Logger LOGGER = LoggerFactory.getLogger(KogitoOracleSqlContainer.class);

public static final String ORACLE_CONNECTION_URI = "kogito.persistence.oracle.connection.uri";
public class KogitoOracleSqlContainer extends JdbcDatabaseContainer<KogitoOracleSqlContainer> implements TestResource {

public KogitoOracleSqlContainer() {
withLogConsumer(getLogger());
withLogConsumer(new Slf4jLogConsumer(LOGGER));
withStartupTimeout(Constants.CONTAINER_START_TIMEOUT);
this(null);
}

public KogitoOracleSqlContainer(DockerImageName dockerImageName) {
super(dockerImageName);
}

private Consumer<OutputFrame> getLogger() {
return f -> System.out.print(f.getUtf8String());
}

@Override
public void start() {
super.start();
LOGGER.info("Oracle server: {}", this.getContainerIpAddress() + ":" + this.getOraclePort());
public String getResourceName() {
return null;
}

@Override
public int getMappedPort() {
return getOraclePort();
return 0;
}

@Override
public String getResourceName() {
return "oracle";
public String getDriverClassName() {
return null;
}

public String getReactiveUrl() {
final String connectionTemplate = "oracle://{0}:{1}@{2}:{3}/{4}?search_path={5}";
final String user = getUsername();
final String server = getHost();
final String secret = getPassword();
final String port = String.valueOf(getMappedPort());
final String database = getDatabaseName();
final String schema = "public";
return MessageFormat.format(connectionTemplate, user, secret, server, port, database, schema);
@Override
public String getJdbcUrl() {
return null;
}

@Override
public String getUsername() {
return null;
}

@Override
public String getPassword() {
return null;
}

@Override
public void stop() {
super.stop();
protected String getTestQueryString() {
return null;
}
}
Loading