Browse Source

Switch to Testcontainers Oracle Free.

Timeout increased from the default because that cause problems on CI.
Brought SD JDBC now uses `ojdbc11` as R2DBC.

Closes #1665
Original pull request #1668
3.1.x
Jens Schauder 2 years ago
parent
commit
e010fab1f2
No known key found for this signature in database
GPG Key ID: 14C72020B3B56291
  1. 4
      spring-data-jdbc/pom.xml
  2. 8
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/OracleDataSourceConfiguration.java
  3. 2
      spring-data-r2dbc/pom.xml
  4. 6
      spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/testing/OracleTestSupport.java

4
spring-data-jdbc/pom.xml

@ -208,7 +208,7 @@
<dependency> <dependency>
<groupId>com.oracle.database.jdbc</groupId> <groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId> <artifactId>ojdbc11</artifactId>
<version>${oracle.version}</version> <version>${oracle.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
@ -251,7 +251,7 @@
<dependency> <dependency>
<groupId>org.testcontainers</groupId> <groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId> <artifactId>oracle-free</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

8
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/OracleDataSourceConfiguration.java

@ -24,7 +24,8 @@ import org.springframework.context.annotation.Profile;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.testcontainers.containers.OracleContainer; import org.testcontainers.oracle.OracleContainer;
import org.testcontainers.utility.DockerImageName;
/** /**
* {@link DataSource} setup for Oracle Database XE. Starts a docker container with an Oracle database. * {@link DataSource} setup for Oracle Database XE. Starts a docker container with an Oracle database.
@ -50,7 +51,10 @@ public class OracleDataSourceConfiguration extends DataSourceConfiguration {
if (ORACLE_CONTAINER == null) { if (ORACLE_CONTAINER == null) {
LOG.info("Oracle starting..."); LOG.info("Oracle starting...");
OracleContainer container = new OracleContainer("gvenzl/oracle-xe:21.3.0-slim").withReuse(true); DockerImageName dockerImageName = DockerImageName.parse("gvenzl/oracle-free:23.3-slim");
OracleContainer container = new OracleContainer(dockerImageName) //
.withStartupTimeoutSeconds(200) //
.withReuse(true);
container.start(); container.start();
LOG.info("Oracle started"); LOG.info("Oracle started");

2
spring-data-r2dbc/pom.xml

@ -310,7 +310,7 @@
<dependency> <dependency>
<groupId>org.testcontainers</groupId> <groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId> <artifactId>oracle-free</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

6
spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/testing/OracleTestSupport.java

@ -29,7 +29,7 @@ import org.springframework.data.r2dbc.testing.ExternalDatabase.ProvidedDatabase;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import org.testcontainers.containers.OracleContainer; import org.testcontainers.oracle.OracleContainer;
/** /**
* Utility class for testing against Oracle. * Utility class for testing against Oracle.
@ -128,7 +128,9 @@ public class OracleTestSupport {
if (testContainerDatabase == null) { if (testContainerDatabase == null) {
try { try {
OracleContainer container = new OracleContainer("gvenzl/oracle-xe:21.3.0-slim").withReuse(true); OracleContainer container = new OracleContainer("23.3-slim") //
.withReuse(true) //
.withStartupTimeoutSeconds(200); // the default of 60s isn't sufficient
container.start(); container.start();
testContainerDatabase = ProvidedDatabase.builder(container) // testContainerDatabase = ProvidedDatabase.builder(container) //

Loading…
Cancel
Save