Package io.micronaut.testresources.jdbc
Class AbstractJdbcTestResourceProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
java.lang.Object
io.micronaut.testresources.testcontainers.AbstractTestContainersProvider<T>
io.micronaut.testresources.jdbc.AbstractJdbcTestResourceProvider<T>
- Type Parameters:
- T- the type of the container
- All Implemented Interfaces:
- io.micronaut.core.order.Ordered,- TestResourcesResolver,- ToggableTestResourcesResolver
- Direct Known Subclasses:
- MariaDBTestResourceProvider,- MSSQLTestResourceProvider,- MySQLTestResourceProvider,- OracleXETestResourceProvider,- PostgreSQLTestResourceProvider
public abstract class AbstractJdbcTestResourceProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
extends AbstractTestContainersProvider<T>
Superclass for JDBC test containers providers.
- 
Field SummaryFields inherited from interface io.micronaut.core.order.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCEFields inherited from interface io.micronaut.testresources.core.TestResourcesResolverTEST_RESOURCES_PROPERTY
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidconfigureContainer(T container, Map<String, Object> properties, Map<String, Object> testResourcesConfig) protected static StringdatasourceExpressionOf(String datasource, String property) protected static StringdatasourceNameFrom(String expression) protected static StringdatasourcePropertyFrom(String expression) Returns the list of db-types supported by this provider.getRequiredProperties(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.protected static booleanisDatasourceExpression(String expression) protected StringresolveDbSpecificProperty(String propertyName, org.testcontainers.containers.JdbcDatabaseContainer<?> container) Given the started container, resolves properties which are specific to a particular JDBC implementation.resolveProperty(String expression, T container) protected booleanshouldAnswer(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.AbstractTestContainersProvidercreateContainer, getDefaultImageName, getName, getOrder, getSimpleName, isEnabled, resolve, resolveWithoutContainer, stringOrNullMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.testresources.core.TestResourcesResolvergetIdMethods inherited from interface io.micronaut.testresources.core.ToggableTestResourcesResolvergetDisplayName
- 
Constructor Details- 
AbstractJdbcTestResourceProviderpublic AbstractJdbcTestResourceProvider()
 
- 
- 
Method Details- 
getDbTypesReturns the list of db-types supported by this provider.- Returns:
- the list of db types
 
- 
getResolvablePropertiespublic List<String> getResolvableProperties(Map<String, Collection<String>> propertyEntries, Map<String, Object> testResourcesConfig) Description copied from interface:TestResourcesResolverReturns 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 entries
- testResourcesConfig- the test resources configuration
- Returns:
- the list of properties
 
- 
getRequiredPropertyEntries
- 
getRequiredPropertiesDescription copied from interface:TestResourcesResolverReturns 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
 
- 
shouldAnswerprotected boolean shouldAnswer(String propertyName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Description copied from class:AbstractTestContainersProviderDetermines 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:
- shouldAnswerin class- AbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
- Parameters:
- propertyName- the property to resolve
- requestedProperties- the resolved properties
- testResourcesConfig- the test resources configuration
- Returns:
- if this resolver should answer
 
- 
resolveProperty- Specified by:
- resolvePropertyin class- AbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
 
- 
resolveDbSpecificPropertyprotected String resolveDbSpecificProperty(String propertyName, org.testcontainers.containers.JdbcDatabaseContainer<?> container) Given the started container, resolves properties which are specific to a particular JDBC implementation.- Parameters:
- propertyName- the property to resolve
- container- the started container
- Returns:
- the resolved property, or null if not resolvable
 
- 
configureContainerprotected void configureContainer(T container, Map<String, Object> properties, Map<String, Object> testResourcesConfig) - Overrides:
- configureContainerin class- AbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
 
- 
isDatasourceExpression
- 
datasourceNameFrom
- 
datasourcePropertyFrom
- 
datasourceExpressionOf
 
-