Class KafkaSchemaRegistryTestResourceProvider
java.lang.Object
io.micronaut.testresources.testcontainers.AbstractTestContainersProvider<org.testcontainers.containers.GenericContainer<?>>
io.micronaut.testresources.kafka.KafkaSchemaRegistryTestResourceProvider
- All Implemented Interfaces:
io.micronaut.core.order.Ordered, TestResourcesResolver, ToggableTestResourcesResolver
public class KafkaSchemaRegistryTestResourceProvider
extends AbstractTestContainersProvider<org.testcontainers.containers.GenericContainer<?>>
A test resource provider which will spawn a Schema Registry test container.
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractTestContainersProvider
AbstractTestContainersProvider.ContainerCommand -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final StringFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCEFields inherited from interface TestResourcesResolver
TEST_RESOURCES_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureService(org.testcontainers.containers.GenericContainer<?> container) protected final org.testcontainers.containers.GenericContainer<?> createContainer(org.testcontainers.utility.DockerImageName imageName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Creates the test container.protected final StringReturns the default image name.final StringReturns 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 final StringReturns the name of the resource resolver, for example "kafka" or "mysql".resolveProperty(String propertyName, org.testcontainers.containers.GenericContainer<?> container) protected final booleanshouldAnswer(String propertyName, Map<String, Object> requestedProperties, Map<String, Object> testResourcesConfig) Determines if this resolver can resolve the requested property.Methods inherited from class AbstractTestContainersProvider
configureContainer, executeInContainer, getContainerOwnerKey, getContainerQuery, getDefaultStartupTimeout, getName, getOrder, prepareContainer, resolve, resolveProperty, resolveWithoutContainer, stringOrNullMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TestResourcesResolver
getId, getRequiredPropertiesMethods inherited from interface ToggableTestResourcesResolver
isEnabled
-
Field Details
-
KAFKA_SCHEMA_REGISTRY_URL
- See Also:
-
DEFAULT_IMAGE
- See Also:
-
DISPLAY_NAME
- See Also:
-
SIMPLE_NAME
- See Also:
-
PORT
public static final int PORT- See Also:
-
-
Constructor Details
-
KafkaSchemaRegistryTestResourceProvider
public KafkaSchemaRegistryTestResourceProvider()
-
-
Method Details
-
configureService
protected void configureService(org.testcontainers.containers.GenericContainer<?> container) -
getResolvableProperties
public final 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
-
getRequiredPropertyEntries
-
getDisplayName
Description copied from interface:TestResourcesResolverReturns a display name for a test resources resolver, used for debugging purposes.- Returns:
- the display name
-
getSimpleName
Description copied from class:AbstractTestContainersProviderReturns the name of the resource resolver, for example "kafka" or "mysql".- Specified by:
getSimpleNamein classAbstractTestContainersProvider<org.testcontainers.containers.GenericContainer<?>>- Returns:
- the name of the resolver
-
getDefaultImageName
Description copied from class:AbstractTestContainersProviderReturns the default image name.- Specified by:
getDefaultImageNamein classAbstractTestContainersProvider<org.testcontainers.containers.GenericContainer<?>>- Returns:
- the default image name.
-
createContainer
protected final org.testcontainers.containers.GenericContainer<?> 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.containers.GenericContainer<?>>- Parameters:
imageName- the docker image namerequestedProperties- the resolved propertiestestResourcesConfig- the test resources configuration- Returns:
- a container
-
resolveProperty
protected final Optional<String> resolveProperty(String propertyName, org.testcontainers.containers.GenericContainer<?> container) - Specified by:
resolvePropertyin classAbstractTestContainersProvider<org.testcontainers.containers.GenericContainer<?>>
-
shouldAnswer
protected final 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.containers.GenericContainer<?>>- Parameters:
propertyName- the property to resolverequestedProperties- the resolved propertiestestResourcesConfig- the test resources configuration- Returns:
- if this resolver should answer
-