Package io.micronaut.testresources.mysql
Class MySQLTestResourceProvider
java.lang.Object
io.micronaut.testresources.testcontainers.AbstractTestContainersProvider<T>
io.micronaut.testresources.jdbc.AbstractJdbcTestResourceProvider<org.testcontainers.containers.MySQLContainer<?>>
io.micronaut.testresources.mysql.MySQLTestResourceProvider
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,TestResourcesResolver
,ToggableTestResourcesResolver
public class MySQLTestResourceProvider
extends AbstractJdbcTestResourceProvider<org.testcontainers.containers.MySQLContainer<?>>
A test resource provider which will spawn a MySQL test container.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final String
static final String
static final String
static final String
static final String
Fields inherited from class io.micronaut.testresources.jdbc.AbstractJdbcTestResourceProvider
PREFIX
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 TypeMethodDescriptionprotected void
configureContainer
(org.testcontainers.containers.MySQLContainer<?> container, Map<String, Object> properties, Map<String, Object> testResourcesConfig) protected org.testcontainers.containers.MySQLContainer<?>
createContainer
(org.testcontainers.utility.DockerImageName imageName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Creates the test container.protected String
Returns the default image name.Returns a display name for a test resources resolver, used for debugging purposes.getResolvableProperties
(Map<String, Collection<String>> propertyEntries, Map<String, Object> testResourcesConfig) Returns the list of properties that this resolver is able to support.protected String
Returns the name of the resource resolver, for example "kafka" or "mysql".protected String
resolveDbSpecificProperty
(String propertyName, org.testcontainers.containers.JdbcDatabaseContainer<?> container) Given the started container, resolves properties which are specific to a particular JDBC implementation.Methods inherited from class io.micronaut.testresources.jdbc.AbstractJdbcTestResourceProvider
datasourceExpressionOf, datasourceNameFrom, datasourcePropertyFrom, getDbTypes, getRequiredProperties, getRequiredPropertyEntries, isDatasourceExpression, resolveProperty, shouldAnswer
Methods inherited from class io.micronaut.testresources.testcontainers.AbstractTestContainersProvider
getName, getOrder, resolve, resolveWithoutContainer, 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
isEnabled
-
Field Details
-
DISPLAY_NAME
- See Also:
-
MYSQL_OFFICIAL_IMAGE
- See Also:
-
DOCKER_OFFICIAL_IMAGE
- See Also:
-
SIMPLE_NAME
- See Also:
-
X_PROTOCOL_URL
- See Also:
-
DEFAULT_X_PROTOCOL_PORT
public static final int DEFAULT_X_PROTOCOL_PORT- See Also:
-
-
Constructor Details
-
MySQLTestResourceProvider
public MySQLTestResourceProvider()
-
-
Method Details
-
getDisplayName
Description copied from interface:TestResourcesResolver
Returns a display name for a test resources resolver, used for debugging purposes.- Returns:
- the display name
-
getSimpleName
Description copied from class:AbstractTestContainersProvider
Returns the name of the resource resolver, for example "kafka" or "mysql".- Specified by:
getSimpleName
in classAbstractTestContainersProvider<org.testcontainers.containers.MySQLContainer<?>>
- Returns:
- the name of the resolver
-
getDefaultImageName
Description copied from class:AbstractTestContainersProvider
Returns the default image name.- Specified by:
getDefaultImageName
in classAbstractTestContainersProvider<org.testcontainers.containers.MySQLContainer<?>>
- Returns:
- the default image name.
-
createContainer
protected org.testcontainers.containers.MySQLContainer<?> createContainer(org.testcontainers.utility.DockerImageName imageName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Description copied from class:AbstractTestContainersProvider
Creates the test container.- Specified by:
createContainer
in classAbstractTestContainersProvider<org.testcontainers.containers.MySQLContainer<?>>
- Parameters:
imageName
- the docker image namerequestedProperties
- the resolved propertiestestResourcesConfig
- the test resources configuration- Returns:
- a container
-
configureContainer
protected void configureContainer(org.testcontainers.containers.MySQLContainer<?> container, Map<String, Object> properties, Map<String, Object> testResourcesConfig) - Overrides:
configureContainer
in classAbstractJdbcTestResourceProvider<org.testcontainers.containers.MySQLContainer<?>>
-
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.- Specified by:
getResolvableProperties
in interfaceTestResourcesResolver
- Overrides:
getResolvableProperties
in classAbstractJdbcTestResourceProvider<org.testcontainers.containers.MySQLContainer<?>>
- Parameters:
propertyEntries
- the property entriestestResourcesConfig
- the test resources configuration- Returns:
- the list of properties
-
resolveDbSpecificProperty
protected String resolveDbSpecificProperty(String propertyName, org.testcontainers.containers.JdbcDatabaseContainer<?> container) Description copied from class:AbstractJdbcTestResourceProvider
Given the started container, resolves properties which are specific to a particular JDBC implementation.- Overrides:
resolveDbSpecificProperty
in classAbstractJdbcTestResourceProvider<org.testcontainers.containers.MySQLContainer<?>>
- Parameters:
propertyName
- the property to resolvecontainer
- the started container- Returns:
- the resolved property, or null if not resolvable
-