Class AbstractHibernateReactiveTestResourceProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
java.lang.Object
io.micronaut.testresources.testcontainers.AbstractTestContainersProvider<T>
io.micronaut.testresources.hibernate.reactive.core.AbstractHibernateReactiveTestResourceProvider<T>
- Type Parameters:
T
- the container type
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,TestResourcesResolver
,ToggableTestResourcesResolver
- Direct Known Subclasses:
HibernateReactiveMariaDBTestResourceProvider
,HibernateReactiveMSSQLTestResourceProvider
,HibernateReactiveMySQLTestResourceProvider
,HibernateReactiveOracleFreeTestResourceProvider
,HibernateReactiveOracleXETestResourceProvider
,HibernateReactivePostgreSQLTestResourceProvider
public abstract class AbstractHibernateReactiveTestResourceProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
extends AbstractTestContainersProvider<T>
Base class for R2DBC test resources. Unlike JDBC test resources, this
resolver is capable of reusing an existing JDBC test resources and
expose it via R2DBC: this can be useful for Flyway database migrations
which work over JDBC for example. For this to work, a datasource of
the same name must exist, in which case it would be resolved first.
If no such datasource exists, then a new container will be created.
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Fields inherited from interface io.micronaut.testresources.core.TestResourcesResolver
TEST_RESOURCES_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetRequiredProperties
(String expression) Returns the list of properties which should be read before resolving an expression: this can be used if the resolver itself needs some configuration properties.getResolvableProperties
(Map<String, Collection<String>> propertyEntries, Map<String, Object> testResourcesConfig) Returns the list of properties that this resolver is able to support.resolveProperty
(String expression, T container) resolveWithoutContainer
(String propertyName, Map<String, Object> properties, Map<String, Object> testResourcesConfig) Lets a resolver provide a value for the requested property without triggering the creation of a test container.protected boolean
shouldAnswer
(String propertyName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Determines if this resolver can resolve the requested property.Methods inherited from class io.micronaut.testresources.testcontainers.AbstractTestContainersProvider
configureContainer, createContainer, getDefaultImageName, getName, getOrder, getSimpleName, resolve, stringOrNull
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.testresources.core.TestResourcesResolver
getId
Methods inherited from interface io.micronaut.testresources.core.ToggableTestResourcesResolver
getDisplayName, isEnabled
-
Constructor Details
-
AbstractHibernateReactiveTestResourceProvider
public AbstractHibernateReactiveTestResourceProvider()
-
-
Method Details
-
getRequiredPropertyEntries
-
getRequiredProperties
Description copied from interface:TestResourcesResolver
Returns the list of properties which should be read before resolving an expression: this can be used if the resolver itself needs some configuration properties.- Parameters:
expression
- the expression which needs to be resolved.- Returns:
- the list of configuration properties this resolver requires
-
getResolvableProperties
public List<String> getResolvableProperties(Map<String, Collection<String>> propertyEntries, Map<String, Object> testResourcesConfig) Description copied from interface:TestResourcesResolver
Returns the list of properties that this resolver is able to support. The property entries map is a map which keys are the property entries retrieved from callingTestResourcesResolver.getRequiredPropertyEntries()
and values are those property entries resolved.- Parameters:
propertyEntries
- the property entriestestResourcesConfig
- the test resources configuration- Returns:
- the list of properties
-
shouldAnswer
protected boolean shouldAnswer(String propertyName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Description copied from class:AbstractTestContainersProvider
Determines if this resolver can resolve the requested property. It is used in order to make sure that a "Postgres" resolver wouldn't provide a value if the requested container type is for MySQL, for example.- Overrides:
shouldAnswer
in classAbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
- Parameters:
propertyName
- the property to resolverequestedProperties
- the resolved propertiestestResourcesConfig
- the test resources configuration- Returns:
- if this resolver should answer
-
resolveWithoutContainer
protected Optional<String> resolveWithoutContainer(String propertyName, Map<String, Object> properties, Map<String, Object> testResourcesConfig) Description copied from class:AbstractTestContainersProvider
Lets a resolver provide a value for the requested property without triggering the creation of a test container. This can be used in case a resolver wants to check existing containers first.- Overrides:
resolveWithoutContainer
in classAbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
- Parameters:
propertyName
- the name of the property to resolveproperties
- the properties used to resolvetestResourcesConfig
- the test resources configuration- Returns:
- a resolved property
-
resolveProperty
- Specified by:
resolveProperty
in classAbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
-