Create service connections from Testcontainers-managed containers

Building upon the auto-configuration support for service connections,
this commit adds support for deriving connection details from a
Testcontainers-managed container. Several service-specific
annotations have been introduced. These annotations can be used on a
container field to indicate that it is a source of the details for
a service connection.

See gh-34658

Co-Authored-By: Phillip Webb <pwebb@vmware.com>
Co-Authored-By: Mortitz Halbritter <mkammerer@vmware.com>
This commit is contained in:
Andy Wilkinson
2023-03-22 12:39:20 +00:00
parent 8ec266bea4
commit 95f45eab1f
80 changed files with 2748 additions and 264 deletions

View File

@@ -32,12 +32,18 @@ public final class DockerImageNames {
private static final String ELASTICSEARCH_VERSION = "7.17.5";
private static final String KAFKA_VERSION = "5.4.3";
private static final String INFLUX_DB_VERSION = "2.6.1";
private static final String MONGO_VERSION = "4.0.23";
private static final String NEO4J_VERSION = "4.4.11";
private static final String POSTGRESQL_VERSION = "14.0";
private static final String RABBIT_VERSION = "3.11-alpine";
private static final String REDIS_VERSION = "4.0.14";
private static final String REGISTRY_VERSION = "2.7.1";
@@ -69,6 +75,22 @@ public final class DockerImageNames {
return DockerImageName.parse("docker.elastic.co/elasticsearch/elasticsearch").withTag(ELASTICSEARCH_VERSION);
}
/**
* Return a {@link DockerImageName} suitable for running InfluxDB.
* @return a docker image name for running Kafka
*/
public static DockerImageName influxDb() {
return DockerImageName.parse("influxdb").withTag(INFLUX_DB_VERSION);
}
/**
* Return a {@link DockerImageName} suitable for running Kafka.
* @return a docker image name for running Kafka
*/
public static DockerImageName kafka() {
return DockerImageName.parse("confluentinc/cp-kafka").withTag(KAFKA_VERSION);
}
/**
* Return a {@link DockerImageName} suitable for running Mongo.
* @return a docker image name for running mongo
@@ -93,6 +115,14 @@ public final class DockerImageNames {
return DockerImageName.parse("postgres").withTag(POSTGRESQL_VERSION);
}
/**
* Return a {@link DockerImageName} suitable for running RabbitMQ.
* @return a docker image name for running redis
*/
public static DockerImageName rabbit() {
return DockerImageName.parse("rabbitmq").withTag(RABBIT_VERSION);
}
/**
* Return a {@link DockerImageName} suitable for running Redis.
* @return a docker image name for running redis