@@ -18,6 +18,7 @@ dependencyManagement {
|
||||
dependency 'com.h2database:h2:1.4.199'
|
||||
dependency 'com.ibm.db2:jcc:11.5.0.0'
|
||||
dependency 'com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8'
|
||||
dependency 'com.oracle.ojdbc:ojdbc8:19.3.0.0'
|
||||
dependency 'com.zaxxer:HikariCP:3.3.1'
|
||||
dependency 'edu.umd.cs.mtc:multithreadedtc:1.01'
|
||||
dependency 'io.lettuce:lettuce-core:5.1.8.RELEASE'
|
||||
|
||||
@@ -16,6 +16,7 @@ dependencies {
|
||||
integrationTestCompile "com.h2database:h2"
|
||||
integrationTestCompile "com.ibm.db2:jcc"
|
||||
integrationTestCompile "com.microsoft.sqlserver:mssql-jdbc"
|
||||
integrationTestCompile "com.oracle.ojdbc:ojdbc8"
|
||||
integrationTestCompile "com.zaxxer:HikariCP"
|
||||
integrationTestCompile "mysql:mysql-connector-java"
|
||||
integrationTestCompile "org.apache.derby:derby"
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.springframework.session.jdbc;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import org.testcontainers.containers.Db2Container;
|
||||
import org.testcontainers.containers.JdbcDatabaseContainer;
|
||||
import org.testcontainers.containers.MSSQLServerContainer;
|
||||
@@ -23,6 +26,7 @@ import org.testcontainers.containers.MariaDBContainer;
|
||||
import org.testcontainers.containers.MySQLContainer;
|
||||
import org.testcontainers.containers.OracleContainer;
|
||||
import org.testcontainers.containers.PostgreSQLContainer;
|
||||
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
|
||||
|
||||
/**
|
||||
* Factories for various {@link JdbcDatabaseContainer}s.
|
||||
@@ -54,8 +58,8 @@ final class DatabaseContainers {
|
||||
return new MySql8Container();
|
||||
}
|
||||
|
||||
static OracleContainer oracle() {
|
||||
return new OracleContainer();
|
||||
static OracleXeContainer oracleXe() {
|
||||
return new OracleXeContainer();
|
||||
}
|
||||
|
||||
static PostgreSQLContainer postgreSql9() {
|
||||
@@ -149,6 +153,24 @@ final class DatabaseContainers {
|
||||
|
||||
}
|
||||
|
||||
private static class OracleXeContainer extends OracleContainer {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
super.configure();
|
||||
this.waitStrategy = new LogMessageWaitStrategy().withRegEx(".*DATABASE IS READY TO USE!.*\\s")
|
||||
.withStartupTimeout(Duration.of(10, ChronoUnit.MINUTES));
|
||||
setShmSize(1024L * 1024L * 1024L);
|
||||
addEnv("ORACLE_PWD", getPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void waitUntilContainerStarted() {
|
||||
getWaitStrategy().waitUntilReady(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class PostgreSql9Container extends PostgreSQLContainer<PostgreSql9Container> {
|
||||
|
||||
PostgreSql9Container() {
|
||||
|
||||
@@ -28,13 +28,12 @@ import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link JdbcIndexedSessionRepository} using Oracle database.
|
||||
* <p>
|
||||
* This test is conditional on presence of Oracle JDBC driver on the classpath and
|
||||
* Testcontainers property {@code oracle.container.image} being set.
|
||||
* This test is conditional on Testcontainers property {@code oracle.container.image}
|
||||
* being set.
|
||||
*
|
||||
* @author Vedran Pavic
|
||||
*/
|
||||
@@ -45,10 +44,8 @@ class OracleJdbcIndexedSessionRepositoryITests extends AbstractContainerJdbcInde
|
||||
|
||||
@BeforeAll
|
||||
static void setUpClass() {
|
||||
Assumptions.assumeTrue(ClassUtils.isPresent("oracle.jdbc.OracleDriver", null),
|
||||
"Oracle JDBC driver is present on the classpath");
|
||||
Assumptions.assumeTrue(
|
||||
TestcontainersConfiguration.getInstance().getProperties().getProperty("oracle.container.image") != null,
|
||||
TestcontainersConfiguration.getInstance().getProperties().containsKey("oracle.container.image"),
|
||||
"Testcontainers property `oracle.container.image` is set");
|
||||
}
|
||||
|
||||
@@ -57,7 +54,7 @@ class OracleJdbcIndexedSessionRepositoryITests extends AbstractContainerJdbcInde
|
||||
|
||||
@Bean
|
||||
public OracleContainer databaseContainer() {
|
||||
OracleContainer databaseContainer = DatabaseContainers.oracle();
|
||||
OracleContainer databaseContainer = DatabaseContainers.oracleXe();
|
||||
databaseContainer.start();
|
||||
return databaseContainer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user