From 2e15b49912b9c5dafb25d53ce116a5e77c97ec40 Mon Sep 17 00:00:00 2001
From: Francisco Javier Tirado Sarti
<65240126+fjtirado@users.noreply.github.com>
Date: Thu, 8 Feb 2024 11:32:39 +0100
Subject: [PATCH] Removing oracle driver and associated tests (#3381)
* Removing oracle driver and associated tests
* Removing Oracle container
* Removing oracle enum and script
---
.../kogito/persistence/jdbc/DatabaseType.java | 67 ---------------
...java => PostgreSQLCorrelationService.java} | 18 +----
.../V1.35.0__create_runtimes_Oracle.sql | 10 ---
.../jdbc/OracleProcessInstancesIT.java | 63 ---------------
.../correlation/JDBCCorrelationServiceIT.java | 6 +-
kogito-test-utils/pom.xml | 5 --
.../KogitoOracleSqlContainer.java | 81 -------------------
.../JDBCorrelationServiceProducer.java | 26 +++---
...dOnPersistenceJDBCConfigSourceFactory.java | 5 +-
.../quarkus/OracleSqlQuarkusTestResource.java | 55 -------------
.../OracleSqlSpringBootTestResource.java | 56 -------------
11 files changed, 17 insertions(+), 375 deletions(-)
delete mode 100644 addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/DatabaseType.java
rename addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/correlation/{JDBCCorrelationService.java => PostgreSQLCorrelationService.java} (74%)
delete mode 100644 addons/common/persistence/jdbc/src/main/resources/db/oracle/V1.35.0__create_runtimes_Oracle.sql
delete mode 100644 addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/OracleProcessInstancesIT.java
delete mode 100644 kogito-test-utils/src/main/java/org/kie/kogito/testcontainers/KogitoOracleSqlContainer.java
delete mode 100644 quarkus/test/src/main/java/org/kie/kogito/testcontainers/quarkus/OracleSqlQuarkusTestResource.java
delete mode 100644 springboot/test/src/main/java/org/kie/kogito/testcontainers/springboot/OracleSqlSpringBootTestResource.java
diff --git a/addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/DatabaseType.java b/addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/DatabaseType.java
deleted file mode 100644
index 8b33a481d36..00000000000
--- a/addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/DatabaseType.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.kie.kogito.persistence.jdbc;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public enum DatabaseType {
- ANSI("ansi", "process_instances"),
- ORACLE("Oracle", "PROCESS_INSTANCES"),
- POSTGRES("PostgreSQL", "process_instances");
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseType.class);
- private final String dbIdentifier;
- private final String tableNamePattern;
-
- DatabaseType(final String dbIdentifier, final String tableNamePattern) {
- this.dbIdentifier = dbIdentifier;
- this.tableNamePattern = tableNamePattern;
- }
-
- public String getDbIdentifier() {
- return this.dbIdentifier;
- }
-
- public String getTableNamePattern() {
- return tableNamePattern;
- }
-
- public static DatabaseType create(final String dbIdentifier) {
- if (ORACLE.getDbIdentifier().equals(dbIdentifier)) {
- return ORACLE;
- } else if (POSTGRES.getDbIdentifier().equals(dbIdentifier)) {
- return POSTGRES;
- } else {
- var msg = String.format("Unrecognized DB (%s), defaulting to ansi", dbIdentifier);
- LOGGER.warn(msg);
- return ANSI;
- }
- }
-
- public static DatabaseType getDataBaseType(Connection connection) throws SQLException {
- final DatabaseMetaData metaData = connection.getMetaData();
- final String dbProductName = metaData.getDatabaseProductName();
- return DatabaseType.create(dbProductName);
- }
-}
diff --git a/addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/correlation/JDBCCorrelationService.java b/addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/correlation/PostgreSQLCorrelationService.java
similarity index 74%
rename from addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/correlation/JDBCCorrelationService.java
rename to addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/correlation/PostgreSQLCorrelationService.java
index e43fc81c5db..d4eba667200 100644
--- a/addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/correlation/JDBCCorrelationService.java
+++ b/addons/common/persistence/jdbc/src/main/java/org/kie/kogito/persistence/jdbc/correlation/PostgreSQLCorrelationService.java
@@ -18,8 +18,6 @@
*/
package org.kie.kogito.persistence.jdbc.correlation;
-import java.sql.Connection;
-import java.sql.SQLException;
import java.util.Optional;
import javax.sql.DataSource;
@@ -29,25 +27,13 @@
import org.kie.kogito.correlation.CorrelationInstance;
import org.kie.kogito.correlation.CorrelationService;
import org.kie.kogito.event.correlation.MD5CorrelationEncoder;
-import org.kie.kogito.persistence.jdbc.DatabaseType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-public class JDBCCorrelationService implements CorrelationService {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(JDBCCorrelationService.class);
+public class PostgreSQLCorrelationService implements CorrelationService {
private PostgreSQLCorrelationRepository repository;
private CorrelationEncoder correlationEncoder;
- public JDBCCorrelationService(DataSource dataSource) {
- try (Connection connection = dataSource.getConnection()) {
- if (!DatabaseType.POSTGRES.equals(DatabaseType.getDataBaseType(connection))) {
- throw new IllegalArgumentException("Only PostgreSQL is supported for correlation");
- }
- } catch (SQLException e) {
- LOGGER.error("Error getting connection for {}", dataSource);
- }
+ public PostgreSQLCorrelationService(DataSource dataSource) {
this.repository = new PostgreSQLCorrelationRepository(dataSource);
this.correlationEncoder = new MD5CorrelationEncoder();
}
diff --git a/addons/common/persistence/jdbc/src/main/resources/db/oracle/V1.35.0__create_runtimes_Oracle.sql b/addons/common/persistence/jdbc/src/main/resources/db/oracle/V1.35.0__create_runtimes_Oracle.sql
deleted file mode 100644
index 25267ed6a6c..00000000000
--- a/addons/common/persistence/jdbc/src/main/resources/db/oracle/V1.35.0__create_runtimes_Oracle.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-CREATE TABLE process_instances
-(
- id char(36) NOT NULL,
- payload blob NOT NULL,
- process_id varchar2(3000) NOT NULL,
- version number(19),
- process_version varchar2(3000),
- CONSTRAINT process_instances_pkey PRIMARY KEY (id)
-);
-CREATE INDEX idx_process_instances_proc_id ON process_instances (process_id, id, process_version);
diff --git a/addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/OracleProcessInstancesIT.java b/addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/OracleProcessInstancesIT.java
deleted file mode 100644
index 69490b4a92f..00000000000
--- a/addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/OracleProcessInstancesIT.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-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.kie.kogito.testcontainers.KogitoOracleSqlContainer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-
-import oracle.jdbc.pool.OracleDataSource;
-
-@Testcontainers
-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;
-
- @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");
- }
- }
-
- @AfterAll
- public static void stop() {
- System.clearProperty(ORACLE_TIMEZONE_PROPERTY);
- }
-
- protected DataSource getDataSource() {
- return ORACLE_DATA_SOURCE;
- }
-}
diff --git a/addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/correlation/JDBCCorrelationServiceIT.java b/addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/correlation/JDBCCorrelationServiceIT.java
index 62212ac0eb0..f374bf8dad1 100644
--- a/addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/correlation/JDBCCorrelationServiceIT.java
+++ b/addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/correlation/JDBCCorrelationServiceIT.java
@@ -27,7 +27,7 @@
import org.kie.kogito.correlation.CompositeCorrelation;
import org.kie.kogito.correlation.CorrelationInstance;
import org.kie.kogito.correlation.SimpleCorrelation;
-import org.kie.kogito.persistence.jdbc.correlation.JDBCCorrelationService;
+import org.kie.kogito.persistence.jdbc.correlation.PostgreSQLCorrelationService;
import org.kie.kogito.testcontainers.KogitoPostgreSqlContainer;
import org.postgresql.ds.PGSimpleDataSource;
import org.testcontainers.containers.JdbcDatabaseContainer;
@@ -42,7 +42,7 @@ public class JDBCCorrelationServiceIT {
@Container
private static final KogitoPostgreSqlContainer PG_CONTAINER = new KogitoPostgreSqlContainer();
private static PGSimpleDataSource dataSource;
- private static JDBCCorrelationService correlationService;
+ private static PostgreSQLCorrelationService correlationService;
@BeforeAll
public static void setUp() {
@@ -50,7 +50,7 @@ public static void setUp() {
dataSource.setUrl(PG_CONTAINER.getJdbcUrl());
dataSource.setUser(PG_CONTAINER.getUsername());
dataSource.setPassword(PG_CONTAINER.getPassword());
- correlationService = new JDBCCorrelationService(dataSource);
+ correlationService = new PostgreSQLCorrelationService(dataSource);
//create table
// DDLRunner.init(new GenericRepository(dataSource), true);
initMigration(PG_CONTAINER, "postgresql");
diff --git a/kogito-test-utils/pom.xml b/kogito-test-utils/pom.xml
index 9e24f309ad8..a21e7b36a9d 100644
--- a/kogito-test-utils/pom.xml
+++ b/kogito-test-utils/pom.xml
@@ -96,11 +96,6 @@
${version.org.testcontainers}
compile
-
- com.oracle.database.jdbc
- ojdbc11
- ${version.com.oracle.database.jdbc}
-
org.testcontainers
diff --git a/kogito-test-utils/src/main/java/org/kie/kogito/testcontainers/KogitoOracleSqlContainer.java b/kogito-test-utils/src/main/java/org/kie/kogito/testcontainers/KogitoOracleSqlContainer.java
deleted file mode 100644
index b213234eedc..00000000000
--- a/kogito-test-utils/src/main/java/org/kie/kogito/testcontainers/KogitoOracleSqlContainer.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-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.output.OutputFrame;
-import org.testcontainers.containers.output.Slf4jLogConsumer;
-
-/**
- * OracleXE Container for Kogito examples.
- */
-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 KogitoOracleSqlContainer() {
- withLogConsumer(getLogger());
- withLogConsumer(new Slf4jLogConsumer(LOGGER));
- withStartupTimeout(Constants.CONTAINER_START_TIMEOUT);
- }
-
- private Consumer getLogger() {
- return f -> System.out.print(f.getUtf8String());
- }
-
- @Override
- public void start() {
- super.start();
- LOGGER.info("Oracle server: {}", this.getContainerIpAddress() + ":" + this.getOraclePort());
- }
-
- @Override
- public int getMappedPort() {
- return getOraclePort();
- }
-
- @Override
- public String getResourceName() {
- return "oracle";
- }
-
- 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 void stop() {
- super.stop();
- }
-}
diff --git a/quarkus/addons/persistence/jdbc/runtime/src/main/java/org/kie/kogito/persistence/quarkus/JDBCorrelationServiceProducer.java b/quarkus/addons/persistence/jdbc/runtime/src/main/java/org/kie/kogito/persistence/quarkus/JDBCorrelationServiceProducer.java
index 8bbcc59412e..a2bbcbf0a55 100644
--- a/quarkus/addons/persistence/jdbc/runtime/src/main/java/org/kie/kogito/persistence/quarkus/JDBCorrelationServiceProducer.java
+++ b/quarkus/addons/persistence/jdbc/runtime/src/main/java/org/kie/kogito/persistence/quarkus/JDBCorrelationServiceProducer.java
@@ -18,33 +18,29 @@
*/
package org.kie.kogito.persistence.quarkus;
-import java.sql.Connection;
-import java.sql.SQLException;
+import java.util.Optional;
import javax.sql.DataSource;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.kie.kogito.correlation.CorrelationService;
import org.kie.kogito.event.correlation.DefaultCorrelationService;
-import org.kie.kogito.persistence.jdbc.DatabaseType;
-import org.kie.kogito.persistence.jdbc.correlation.JDBCCorrelationService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.kie.kogito.persistence.jdbc.correlation.PostgreSQLCorrelationService;
import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Inject;
+
+import static org.kie.kogito.persistence.quarkus.KogitoAddOnPersistenceJDBCConfigSourceFactory.DATASOURCE_DB_KIND;
+import static org.kie.kogito.persistence.quarkus.KogitoAddOnPersistenceJDBCConfigSourceFactory.POSTGRESQL;
public class JDBCorrelationServiceProducer {
- private static final Logger LOGGER = LoggerFactory.getLogger(JDBCorrelationServiceProducer.class);
+ @Inject
+ @ConfigProperty(name = DATASOURCE_DB_KIND)
+ Optional dbKind;
@Produces
public CorrelationService jdbcCorrelationService(DataSource dataSource) {
- try (Connection connection = dataSource.getConnection()) {
- if (!DatabaseType.POSTGRES.equals(DatabaseType.getDataBaseType(connection))) {
- return new DefaultCorrelationService();
- }
- } catch (SQLException e) {
- LOGGER.error("Error getting connection for {}", dataSource);
- }
- return new JDBCCorrelationService(dataSource);
+ return dbKind.filter(POSTGRESQL::equals).isPresent() ? new PostgreSQLCorrelationService(dataSource) : new DefaultCorrelationService();
}
}
diff --git a/quarkus/addons/persistence/jdbc/runtime/src/main/java/org/kie/kogito/persistence/quarkus/KogitoAddOnPersistenceJDBCConfigSourceFactory.java b/quarkus/addons/persistence/jdbc/runtime/src/main/java/org/kie/kogito/persistence/quarkus/KogitoAddOnPersistenceJDBCConfigSourceFactory.java
index 010aa970b63..5f5493d351a 100644
--- a/quarkus/addons/persistence/jdbc/runtime/src/main/java/org/kie/kogito/persistence/quarkus/KogitoAddOnPersistenceJDBCConfigSourceFactory.java
+++ b/quarkus/addons/persistence/jdbc/runtime/src/main/java/org/kie/kogito/persistence/quarkus/KogitoAddOnPersistenceJDBCConfigSourceFactory.java
@@ -40,10 +40,9 @@ public class KogitoAddOnPersistenceJDBCConfigSourceFactory implements ConfigSour
private static final Logger LOGGER = LoggerFactory.getLogger(KogitoAddOnPersistenceJDBCConfigSourceFactory.class);
static final String FLYWAY_LOCATIONS = "quarkus.flyway.locations";
- private static final String DATASOURCE_DB_KIND = "quarkus.datasource.db-kind";
+ static final String DATASOURCE_DB_KIND = "quarkus.datasource.db-kind";
private static final String LOCATION_PREFIX = "classpath:/db/";
static final String POSTGRESQL = "postgresql";
- private static final String ORACLE = "oracle";
private static final String ANSI = "ansi";
@Override
@@ -77,8 +76,6 @@ public OptionalInt getPriority() {
private String getDBName(final String dbKind) {
if (POSTGRESQL.equals(dbKind)) {
return POSTGRESQL;
- } else if (ORACLE.equals(dbKind)) {
- return ORACLE;
} else {
return ANSI;
}
diff --git a/quarkus/test/src/main/java/org/kie/kogito/testcontainers/quarkus/OracleSqlQuarkusTestResource.java b/quarkus/test/src/main/java/org/kie/kogito/testcontainers/quarkus/OracleSqlQuarkusTestResource.java
deleted file mode 100644
index 19cc0ac5f53..00000000000
--- a/quarkus/test/src/main/java/org/kie/kogito/testcontainers/quarkus/OracleSqlQuarkusTestResource.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.kie.kogito.testcontainers.quarkus;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.kie.kogito.test.resources.ConditionalQuarkusTestResource;
-import org.kie.kogito.testcontainers.KogitoOracleSqlContainer;
-
-/**
- * Oracle SQL quarkus resource that works within the test lifecycle.
- */
-public class OracleSqlQuarkusTestResource extends ConditionalQuarkusTestResource {
-
- public static final String QUARKUS_DATASOURCE_JDBC_URL = "quarkus.datasource.jdbc.url";
- public static final String QUARKUS_DATASOURCE_USERNAME = "quarkus.datasource.username";
- public static final String QUARKUS_DATASOURCE_PASSWORD = "quarkus.datasource.password";
-
- public OracleSqlQuarkusTestResource() {
- super(new KogitoOracleSqlContainer());
- }
-
- @Override
- protected Map getProperties() {
- Map properties = new HashMap<>();
- properties.put(QUARKUS_DATASOURCE_JDBC_URL, getTestResource().getJdbcUrl());
- properties.put(QUARKUS_DATASOURCE_USERNAME, getTestResource().getUsername());
- properties.put(QUARKUS_DATASOURCE_PASSWORD, getTestResource().getPassword());
- return properties;
- }
-
- public static class Conditional extends OracleSqlQuarkusTestResource {
-
- public Conditional() {
- enableConditional();
- }
- }
-}
\ No newline at end of file
diff --git a/springboot/test/src/main/java/org/kie/kogito/testcontainers/springboot/OracleSqlSpringBootTestResource.java b/springboot/test/src/main/java/org/kie/kogito/testcontainers/springboot/OracleSqlSpringBootTestResource.java
deleted file mode 100644
index bd48d830a97..00000000000
--- a/springboot/test/src/main/java/org/kie/kogito/testcontainers/springboot/OracleSqlSpringBootTestResource.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.kie.kogito.testcontainers.springboot;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.kie.kogito.test.resources.ConditionalSpringBootTestResource;
-import org.kie.kogito.testcontainers.KogitoOracleSqlContainer;
-
-/**
- * Oracle SQL Springboot resource that works within the test lifecycle.
- *
- */
-public class OracleSqlSpringBootTestResource extends ConditionalSpringBootTestResource {
-
- public static final String SPRING_DATASOURCE_URL = "spring.datasource.url";
- public static final String SPRING_DATASOURCE_USERNAME = "spring.datasource.username";
- public static final String SPRING_DATASOURCE_PASSWORD = "spring.datasource.password";
-
- public OracleSqlSpringBootTestResource() {
- super(new KogitoOracleSqlContainer());
- }
-
- @Override
- protected Map getProperties() {
- Map properties = new HashMap<>();
- properties.put(SPRING_DATASOURCE_URL, getTestResource().getJdbcUrl());
- properties.put(SPRING_DATASOURCE_USERNAME, getTestResource().getUsername());
- properties.put(SPRING_DATASOURCE_PASSWORD, getTestResource().getPassword());
- return properties;
- }
-
- public static class Conditional extends OracleSqlSpringBootTestResource {
-
- public Conditional() {
- enableConditional();
- }
- }
-}