T
- the container typepublic abstract class AbstractTestContainersProvider<T extends org.testcontainers.containers.GenericContainer<? extends T>> extends java.lang.Object implements TestResourcesResolver
TEST_RESOURCES_PROPERTY
Constructor and Description |
---|
AbstractTestContainersProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
configureContainer(T container,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration) |
protected abstract T |
createContainer(org.testcontainers.utility.DockerImageName imageName,
java.util.Map<java.lang.String,java.lang.Object> requestedProperties,
java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
Creates the test container.
|
protected abstract java.lang.String |
getDefaultImageName()
Returns the default image name.
|
int |
getOrder() |
protected abstract java.lang.String |
getSimpleName()
Returns the name of the resource resolver, for example "kafka" or "mysql".
|
java.util.Optional<java.lang.String> |
resolve(java.lang.String propertyName,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
Resolves the given property.
|
protected abstract java.util.Optional<java.lang.String> |
resolveProperty(java.lang.String propertyName,
T container) |
protected java.util.Optional<java.lang.String> |
resolveWithoutContainer(java.lang.String propertyName,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
Lets a resolver provide a value for the requested property without triggering the
creation of a test container.
|
protected boolean |
shouldAnswer(java.lang.String propertyName,
java.util.Map<java.lang.String,java.lang.Object> requestedProperties,
java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
Determines if this resolver can resolve the requested property.
|
protected java.lang.String |
stringOrNull(java.lang.Object value) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRequiredProperties, getRequiredPropertyEntries, getResolvableProperties
public int getOrder()
getOrder
in interface io.micronaut.core.order.Ordered
protected abstract java.lang.String getSimpleName()
protected abstract java.lang.String getDefaultImageName()
protected abstract T createContainer(org.testcontainers.utility.DockerImageName imageName, java.util.Map<java.lang.String,java.lang.Object> requestedProperties, java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
imageName
- the docker image namerequestedProperties
- the resolved propertiestestResourcesConfiguration
- the test resources configurationprotected boolean shouldAnswer(java.lang.String propertyName, java.util.Map<java.lang.String,java.lang.Object> requestedProperties, java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
propertyName
- the property to resolverequestedProperties
- the resolved propertiestestResourcesConfiguration
- the test resources configurationprotected java.util.Optional<java.lang.String> resolveWithoutContainer(java.lang.String propertyName, java.util.Map<java.lang.String,java.lang.Object> properties, java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
propertyName
- the name of the property to resolveproperties
- the properties used to resolvetestResourcesConfiguration
- the test resources configurationpublic final java.util.Optional<java.lang.String> resolve(java.lang.String propertyName, java.util.Map<java.lang.String,java.lang.Object> properties, java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
TestResourcesResolver
resolve
in interface TestResourcesResolver
propertyName
- the property to resolveproperties
- the resolved required propertiestestResourcesConfiguration
- the test resources configurationprotected void configureContainer(T container, java.util.Map<java.lang.String,java.lang.Object> properties, java.util.Map<java.lang.String,java.lang.Object> testResourcesConfiguration)
protected abstract java.util.Optional<java.lang.String> resolveProperty(java.lang.String propertyName, T container)
protected final java.lang.String stringOrNull(java.lang.Object value)