@@ -16,6 +16,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.2.2.jre8'
|
||||
dependency 'com.zaxxer:HikariCP:3.3.1'
|
||||
dependency 'edu.umd.cs.mtc:multithreadedtc:1.01'
|
||||
|
||||
@@ -14,6 +14,7 @@ dependencies {
|
||||
testRuntime "org.junit.jupiter:junit-jupiter-engine"
|
||||
|
||||
integrationTestCompile "com.h2database:h2"
|
||||
integrationTestCompile "com.ibm.db2:jcc"
|
||||
integrationTestCompile "com.microsoft.sqlserver:mssql-jdbc"
|
||||
integrationTestCompile "com.zaxxer:HikariCP"
|
||||
integrationTestCompile "mysql:mysql-connector-java"
|
||||
@@ -21,6 +22,7 @@ dependencies {
|
||||
integrationTestCompile "org.hsqldb:hsqldb"
|
||||
integrationTestCompile "org.mariadb.jdbc:mariadb-java-client"
|
||||
integrationTestCompile "org.postgresql:postgresql"
|
||||
integrationTestCompile "org.testcontainers:db2"
|
||||
integrationTestCompile "org.testcontainers:mariadb"
|
||||
integrationTestCompile "org.testcontainers:mssqlserver"
|
||||
integrationTestCompile "org.testcontainers:mysql"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.session.jdbc;
|
||||
|
||||
import org.testcontainers.containers.Db2Container;
|
||||
import org.testcontainers.containers.JdbcDatabaseContainer;
|
||||
import org.testcontainers.containers.MSSQLServerContainer;
|
||||
import org.testcontainers.containers.MariaDBContainer;
|
||||
@@ -33,6 +34,10 @@ final class DatabaseContainers {
|
||||
private DatabaseContainers() {
|
||||
}
|
||||
|
||||
static Db211Container db211() {
|
||||
return new Db211Container();
|
||||
}
|
||||
|
||||
static MariaDBContainer mariaDb5() {
|
||||
return new MariaDb5Container();
|
||||
}
|
||||
@@ -69,6 +74,14 @@ final class DatabaseContainers {
|
||||
return new SqlServer2017Container();
|
||||
}
|
||||
|
||||
private static class Db211Container extends Db2Container {
|
||||
|
||||
Db211Container() {
|
||||
super("ibmcom/db2:11.5.0.0a");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class MariaDb5Container extends MariaDBContainer<MariaDb5Container> {
|
||||
|
||||
MariaDb5Container() {
|
||||
|
||||
@@ -30,6 +30,10 @@ final class DatabasePopulators {
|
||||
private DatabasePopulators() {
|
||||
}
|
||||
|
||||
static ResourceDatabasePopulator db2() {
|
||||
return new ResourceDatabasePopulator(new ClassPathResource("org/springframework/session/jdbc/schema-db2.sql"));
|
||||
}
|
||||
|
||||
static ResourceDatabasePopulator mySql() {
|
||||
return new ResourceDatabasePopulator(
|
||||
new ClassPathResource("org/springframework/session/jdbc/schema-mysql.sql"));
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed 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
|
||||
*
|
||||
* https://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.springframework.session.jdbc;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.testcontainers.containers.Db2Container;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link JdbcOperationsSessionRepository} using IBM DB2 11.x
|
||||
* database.
|
||||
*
|
||||
* @author Vedran Pavic
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
class Db211JdbcOperationsSessionRepositoryITests extends AbstractContainerJdbcOperationsSessionRepositoryITests {
|
||||
|
||||
@Configuration
|
||||
static class Config extends BaseContainerConfig {
|
||||
|
||||
@Bean
|
||||
public Db2Container databaseContainer() {
|
||||
Db2Container databaseContainer = DatabaseContainers.db211();
|
||||
databaseContainer.start();
|
||||
return databaseContainer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceDatabasePopulator databasePopulator() {
|
||||
return DatabasePopulators.db2();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
ibmcom/db2:11.5.0.0a
|
||||
mcr.microsoft.com/mssql/server:2017-CU15
|
||||
|
||||
Reference in New Issue
Block a user