Class GenericTestContainerProvider
- java.lang.Object
-
- io.micronaut.testresources.testcontainers.GenericTestContainerProvider
-
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,io.micronaut.testresources.core.TestResourcesResolver
public class GenericTestContainerProvider extends java.lang.Object implements io.micronaut.testresources.core.TestResourcesResolverA generic test containers provider. This provider is special in the sense that it requires user provided configuration in order to spawn containers. Therefore, the application configuration must contain entries under the "test-resources.containers" property prefix. A generic container is represented with a name, a container image, and exposes a number of ports. For example, imagine that a service requires an SMTP server to work property. Then it is likely that some configuration property needs to point to the server port. If that property issmtp.port, then it is possible to expose a test container which will resolve that property using the following configuration:test-resources: containers: fakesmtp: image-name: ghusta/fakesmtp:2.0 hostnames: - smtp.host exposed-ports: - smtp.port: 25The mapped port from test containers will then be automatically be assigned to thesmtp.portproperty, and the host name of the running test container will automatically be assigned to thesmtp.hostproperty.
-
-
Constructor Summary
Constructors Constructor Description GenericTestContainerProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetOrder()java.util.List<java.lang.String>getResolvableProperties(java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> propertyEntries, java.util.Map<java.lang.String,java.lang.Object> testResourcesConfig)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)
-
-
-
Method Detail
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceio.micronaut.core.order.Ordered
-
getResolvableProperties
public java.util.List<java.lang.String> getResolvableProperties(java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> propertyEntries, java.util.Map<java.lang.String,java.lang.Object> testResourcesConfig)- Specified by:
getResolvablePropertiesin interfaceio.micronaut.testresources.core.TestResourcesResolver
-
resolve
public 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)- Specified by:
resolvein interfaceio.micronaut.testresources.core.TestResourcesResolver
-
-