Merge branch '2.3.x'

Closes gh-24104
pull/24114/head
Stephane Nicoll 4 years ago
commit b6fc0913cf

@ -85,7 +85,7 @@ class CassandraAutoConfigurationWithPasswordAuthenticationIntegrationTests {
extends CassandraContainer<PasswordAuthenticatorCassandraContainer> {
PasswordAuthenticatorCassandraContainer() {
super(DockerImageNames.cassandra().toString());
super(DockerImageNames.cassandra());
}
@Override

@ -47,7 +47,7 @@ class CouchbaseAutoConfigurationIntegrationTests {
private static final String BUCKET_NAME = "cbbucket";
@Container
static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase().toString())
static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase())
.withCredentials("spring", "password").withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10))
.withBucket(new BucketDefinition(BUCKET_NAME).withPrimaryIndex(false));

@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class CassandraDataAutoConfigurationIntegrationTests {
@Container
static final CassandraContainer<?> cassandra = new CassandraContainer<>(DockerImageNames.cassandra().toString())
static final CassandraContainer<?> cassandra = new CassandraContainer<>(DockerImageNames.cassandra())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()

@ -49,9 +49,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class ElasticsearchRepositoriesAutoConfigurationTests {
@Container
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(
DockerImageNames.elasticsearch().toString()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(10));
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ElasticsearchRestClientAutoConfiguration.class,

@ -48,9 +48,8 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ReactiveElasticsearchRepositoriesAutoConfigurationTests {
@Container
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(
DockerImageNames.elasticsearch().toString()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(10));
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ReactiveElasticsearchRestClientAutoConfiguration.class,

@ -48,9 +48,8 @@ import static org.mockito.Mockito.mock;
public class ReactiveElasticsearchRestClientAutoConfigurationTests {
@Container
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(
DockerImageNames.elasticsearch().toString()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(10));
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ReactiveElasticsearchRestClientAutoConfiguration.class));

@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class Neo4jRepositoriesAutoConfigurationIntegrationTests {
@Container
private static final Neo4jContainer<?> neo4jServer = new Neo4jContainer<>(DockerImageNames.neo4j().toString());
private static final Neo4jContainer<?> neo4jServer = new Neo4jContainer<>(DockerImageNames.neo4j());
@DynamicPropertySource
static void neo4jProperties(DynamicPropertyRegistry registry) {

@ -59,9 +59,8 @@ import static org.mockito.Mockito.mock;
class ElasticsearchRestClientAutoConfigurationTests {
@Container
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(
DockerImageNames.elasticsearch().toString()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(10));
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ElasticsearchRestClientAutoConfiguration.class));

@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class Neo4jAutoConfigurationIntegrationTests {
@Container
private static final Neo4jContainer<?> neo4jServer = new Neo4jContainer<>(DockerImageNames.neo4j().toString());
private static final Neo4jContainer<?> neo4jServer = new Neo4jContainer<>(DockerImageNames.neo4j());
@DynamicPropertySource
static void neo4jProperties(DynamicPropertyRegistry registry) {

@ -48,8 +48,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class SessionAutoConfigurationMongoTests extends AbstractSessionAutoConfigurationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class, MongoDataAutoConfiguration.class,

@ -156,7 +156,7 @@ bom {
]
}
}
library("Testcontainers", "1.14.3") {
library("Testcontainers", "1.15.0") {
group("org.testcontainers") {
imports = [
"testcontainers-bom"

@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class DataCassandraTestIntegrationTests {
@Container
static final CassandraContainer<?> cassandra = new CassandraContainer<>(DockerImageNames.cassandra().toString())
static final CassandraContainer<?> cassandra = new CassandraContainer<>(DockerImageNames.cassandra())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
@DynamicPropertySource

@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataCassandraTestWithIncludeFilterIntegrationTests {
@Container
static final CassandraContainer<?> cassandra = new CassandraContainer<>(DockerImageNames.cassandra().toString())
static final CassandraContainer<?> cassandra = new CassandraContainer<>(DockerImageNames.cassandra())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
@DynamicPropertySource

@ -44,8 +44,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class DataMongoTestIntegrationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
@Autowired
private MongoTemplate mongoTemplate;

@ -41,8 +41,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataMongoTestReactiveIntegrationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
@Autowired
private ReactiveMongoTemplate mongoTemplate;

@ -42,8 +42,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataMongoTestWithIncludeFilterIntegrationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
@Autowired
private ExampleService service;

@ -48,8 +48,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class TransactionalDataMongoTestIntegrationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
@Autowired
private ExampleRepository exampleRepository;

@ -46,8 +46,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class DataNeo4jTestIntegrationTests {
@Container
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j().toString())
.withoutAuthentication().withStartupTimeout(Duration.ofMinutes(10));
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
.withStartupTimeout(Duration.ofMinutes(10));
@DynamicPropertySource
static void neo4jProperties(DynamicPropertyRegistry registry) {

@ -42,8 +42,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataNeo4jTestPropertiesIntegrationTests {
@Container
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j().toString())
.withoutAuthentication().withStartupTimeout(Duration.ofMinutes(10));
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
.withStartupTimeout(Duration.ofMinutes(10));
@DynamicPropertySource
static void neo4jProperties(DynamicPropertyRegistry registry) {

@ -55,8 +55,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class DataNeo4jTestReactiveIntegrationTests {
@Container
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j().toString())
.withoutAuthentication().withStartupTimeout(Duration.ofMinutes(10));
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
.withStartupTimeout(Duration.ofMinutes(10));
@DynamicPropertySource
static void neo4jProperties(DynamicPropertyRegistry registry) {

@ -43,8 +43,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataNeo4jTestWithIncludeFilterIntegrationTests {
@Container
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j().toString())
.withoutAuthentication().withStartupTimeout(Duration.ofMinutes(10));
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
.withStartupTimeout(Duration.ofMinutes(10));
@DynamicPropertySource
static void neo4jProperties(DynamicPropertyRegistry registry) {

@ -105,7 +105,7 @@ public class BootBuildImageRegistryIntegrationTests {
private static class RegistryContainer extends GenericContainer<RegistryContainer> {
RegistryContainer() {
super(DockerImageNames.registry().toString());
super(DockerImageNames.registry());
addExposedPorts(5000);
addEnv("SERVER_NAME", "localhost");
}

@ -80,7 +80,7 @@ public class BuildImageRegistryIntegrationTests extends AbstractArchiveIntegrati
private static class RegistryContainer extends GenericContainer<RegistryContainer> {
RegistryContainer() {
super(DockerImageNames.registry().toString());
super(DockerImageNames.registry());
addExposedPorts(5000);
addEnv("SERVER_NAME", "localhost");
}

@ -48,7 +48,7 @@ public final class DockerImageNames {
* @return a docker image name for running cassandra
*/
public static DockerImageName cassandra() {
return new DockerImageName("cassandra", CASSANDRA_VERSION);
return DockerImageName.parse("cassandra").withTag(CASSANDRA_VERSION);
}
/**
@ -56,7 +56,7 @@ public final class DockerImageNames {
* @return a docker image name for running cassandra
*/
public static DockerImageName couchbase() {
return new DockerImageName("couchbase/server", COUCHBASE_VERSION);
return DockerImageName.parse("couchbase/server").withTag(COUCHBASE_VERSION);
}
/**
@ -66,7 +66,7 @@ public final class DockerImageNames {
*/
public static DockerImageName elasticsearch() {
String version = org.elasticsearch.Version.CURRENT.toString();
return new DockerImageName("docker.elastic.co/elasticsearch/elasticsearch", version);
return DockerImageName.parse("docker.elastic.co/elasticsearch/elasticsearch").withTag(version);
}
/**
@ -74,7 +74,7 @@ public final class DockerImageNames {
* @return a docker image name for running mongo
*/
public static DockerImageName mongo() {
return new DockerImageName("mongo", MONGO_VERSION);
return DockerImageName.parse("mongo").withTag(MONGO_VERSION);
}
/**
@ -82,7 +82,7 @@ public final class DockerImageNames {
* @return a docker image name for running neo4j
*/
public static DockerImageName neo4j() {
return new DockerImageName("neo4j", NEO4J_VERSION);
return DockerImageName.parse("neo4j").withTag(NEO4J_VERSION);
}
/**
@ -90,7 +90,7 @@ public final class DockerImageNames {
* @return a docker image name for running postgresql
*/
public static DockerImageName postgresql() {
return new DockerImageName("postgres", POSTGRESQL_VERSION);
return DockerImageName.parse("postgres").withTag(POSTGRESQL_VERSION);
}
/**
@ -98,15 +98,16 @@ public final class DockerImageNames {
* @return a docker image name for running redis
*/
public static DockerImageName redis() {
return new DockerImageName("redis", REDIS_VERSION);
return DockerImageName.parse("redis").withTag(REDIS_VERSION);
}
/**
* Return a {@link DockerImageName} suitable for running a Docker registry.
* @return a docker image name for running a registry
* @since 2.4.0
*/
public static DockerImageName registry() {
return new DockerImageName("registry", REGISTRY_VERSION);
return DockerImageName.parse("registry").withTag(REGISTRY_VERSION);
}
}

@ -28,7 +28,7 @@ import org.testcontainers.containers.GenericContainer;
public class RedisContainer extends GenericContainer<RedisContainer> {
public RedisContainer() {
super(DockerImageNames.redis().toString());
super(DockerImageNames.redis());
addExposedPorts(6379);
}

@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class CityRepositoryTests {
@Container
static PostgreSQLContainer<?> postgresql = new PostgreSQLContainer<>(DockerImageNames.postgresql().toString())
static PostgreSQLContainer<?> postgresql = new PostgreSQLContainer<>(DockerImageNames.postgresql())
.withDatabaseName("test_flyway");
@DynamicPropertySource

@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class CityRepositoryTests {
@Container
static PostgreSQLContainer<?> postgresql = new PostgreSQLContainer<>(DockerImageNames.postgresql().toString())
static PostgreSQLContainer<?> postgresql = new PostgreSQLContainer<>(DockerImageNames.postgresql())
.withDatabaseName("test_liquibase");
@DynamicPropertySource

Loading…
Cancel
Save