Class ElasticsearchTestResourceProvider
java.lang.Object
io.micronaut.testresources.testcontainers.AbstractTestContainersProvider<org.testcontainers.elasticsearch.ElasticsearchContainer>
io.micronaut.testresources.elasticsearch.ElasticsearchTestResourceProvider
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,TestResourcesResolver
public class ElasticsearchTestResourceProvider
extends AbstractTestContainersProvider<org.testcontainers.elasticsearch.ElasticsearchContainer>
A test resource provider which will spawn an ElasticSearch test container.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCEFields inherited from interface io.micronaut.testresources.core.TestResourcesResolver
TEST_RESOURCES_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.testcontainers.elasticsearch.ElasticsearchContainercreateContainer(org.testcontainers.utility.DockerImageName imageName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Creates the test container.protected StringReturns the default image name.getResolvableProperties(Map<String, Collection<String>> propertyEntries, Map<String, Object> testResourcesConfig) Returns the list of properties that this resolver is able to support.protected StringReturns the name of the resource resolver, for example "kafka" or "mysql".resolveProperty(String propertyName, org.testcontainers.elasticsearch.ElasticsearchContainer 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.AbstractTestContainersProvider
configureContainer, getOrder, resolve, resolveWithoutContainer, stringOrNullMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.testresources.core.TestResourcesResolver
getRequiredProperties, getRequiredPropertyEntries
-
Field Details
-
ELASTICSEARCH_HOSTS
- See Also:
-
SIMPLE_NAME
- See Also:
-
DEFAULT_IMAGE
- See Also:
-
DEFAULT_TAG
- See Also:
-
-
Constructor Details
-
ElasticsearchTestResourceProvider
public ElasticsearchTestResourceProvider()
-
-
Method Details
-
getResolvableProperties
public 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 entriestestResourcesConfig- the test resources configuration- Returns:
- the list of properties
-
getSimpleName
Description copied from class:AbstractTestContainersProviderReturns the name of the resource resolver, for example "kafka" or "mysql".- Specified by:
getSimpleNamein classAbstractTestContainersProvider<org.testcontainers.elasticsearch.ElasticsearchContainer>- Returns:
- the name of the resolver
-
getDefaultImageName
Description copied from class:AbstractTestContainersProviderReturns the default image name.- Specified by:
getDefaultImageNamein classAbstractTestContainersProvider<org.testcontainers.elasticsearch.ElasticsearchContainer>- Returns:
- the default image name.
-
createContainer
protected org.testcontainers.elasticsearch.ElasticsearchContainer createContainer(org.testcontainers.utility.DockerImageName imageName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Description copied from class:AbstractTestContainersProviderCreates the test container.- Specified by:
createContainerin classAbstractTestContainersProvider<org.testcontainers.elasticsearch.ElasticsearchContainer>- Parameters:
imageName- the docker image namerequestedProperties- the resolved propertiestestResourcesConfig- the test resources configuration- Returns:
- a container
-
resolveProperty
protected Optional<String> resolveProperty(String propertyName, org.testcontainers.elasticsearch.ElasticsearchContainer container) - Specified by:
resolvePropertyin classAbstractTestContainersProvider<org.testcontainers.elasticsearch.ElasticsearchContainer>
-
shouldAnswer
protected 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 classAbstractTestContainersProvider<org.testcontainers.elasticsearch.ElasticsearchContainer>- Parameters:
propertyName- the property to resolverequestedProperties- the resolved propertiestestResourcesConfig- the test resources configuration- Returns:
- if this resolver should answer
-