Class DefaultTestResourcesClient
java.lang.Object
io.micronaut.testresources.client.DefaultTestResourcesClient
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,TestResourcesClient
,TestResourcesResolver
A simple implementation of the test resources client.
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Fields inherited from interface io.micronaut.testresources.client.TestResourcesClient
CLIENT_READ_TIMEOUT, SERVER_URI
Fields inherited from interface io.micronaut.testresources.core.TestResourcesResolver
TEST_RESOURCES_PROPERTY
-
Constructor Summary
ConstructorDescriptionDefaultTestResourcesClient
(String baseUri, String accessToken, int clientReadTimeout) -
Method Summary
Modifier and TypeMethodDescriptionboolean
closeAll()
Closes all test resources.boolean
closeScope
(@Nullable String id) Closes a test resource scope.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.Resolves the given property.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
Methods inherited from interface io.micronaut.testresources.client.TestResourcesClient
getResolvableProperties
Methods inherited from interface io.micronaut.testresources.core.TestResourcesResolver
getDisplayName, getId
-
Field Details
-
ACCESS_TOKEN
- See Also:
-
-
Constructor Details
-
DefaultTestResourcesClient
-
-
Method Details
-
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 interfaceTestResourcesClient
- Specified by:
getResolvableProperties
in interfaceTestResourcesResolver
- Parameters:
propertyEntries
- the property entriestestResourcesConfig
- the test resources configuration- Returns:
- the list of properties
-
resolve
public Optional<String> resolve(String name, Map<String, Object> properties, Map<String, Object> testResourcesConfig) Description copied from interface:TestResourcesResolver
Resolves the given property.- Specified by:
resolve
in interfaceTestResourcesClient
- Specified by:
resolve
in interfaceTestResourcesResolver
- Parameters:
name
- the property to resolveproperties
- the resolved required propertiestestResourcesConfig
- the test resources configuration- Returns:
- the resolved property or empty if not found
-
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.- Specified by:
getRequiredProperties
in interfaceTestResourcesClient
- Specified by:
getRequiredProperties
in interfaceTestResourcesResolver
- Parameters:
expression
- the expression which needs to be resolved.- Returns:
- the list of configuration properties this resolver requires
-
getRequiredPropertyEntries
- Specified by:
getRequiredPropertyEntries
in interfaceTestResourcesClient
- Specified by:
getRequiredPropertyEntries
in interfaceTestResourcesResolver
-
closeAll
public boolean closeAll()Description copied from interface:TestResourcesClient
Closes all test resources.- Specified by:
closeAll
in interfaceTestResourcesClient
- Returns:
- true if the operation was successful
-
closeScope
Description copied from interface:TestResourcesClient
Closes a test resource scope.- Specified by:
closeScope
in interfaceTestResourcesClient
- Parameters:
id
- the scope id- Returns:
- true if the operation was successful
-