Interface TestResourcesResolver

All Superinterfaces:
io.micronaut.core.order.Ordered
All Known Subinterfaces:
TestResourcesClient, ToggableTestResourcesResolver
All Known Implementing Classes:
AbstractHibernateReactiveTestResourceProvider, AbstractJdbcTestResourceProvider, AbstractR2DBCTestResourceProvider, AbstractTestContainersProvider, DefaultTestResourcesClient, ElasticsearchTestResourceProvider, GenericTestContainerProvider, HibernateReactiveMariaDBTestResourceProvider, HibernateReactiveMSSQLTestResourceProvider, HibernateReactiveMySQLTestResourceProvider, HibernateReactiveOracleXETestResourceProvider, HibernateReactivePostgreSQLTestResourceProvider, HiveMQTestResourceProvider, KafkaTestResourceProvider, LocalStackTestResourceProvider, MariaDBTestResourceProvider, MongoDBTestResourceProvider, MSSQLTestResourceProvider, MySQLTestResourceProvider, Neo4jTestResourceProvider, OracleXETestResourceProvider, PostgreSQLTestResourceProvider, R2DBCMariaDBTestResourceProvider, R2DBCMSSQLTestResourceProvider, R2DBCMySQLTestResourceProvider, R2DBCOracleXETestResourceProvider, R2DBCPoolTestResourceProvider, R2DBCPostgreSQLTestResourceProvider, RabbitMQTestResourceProvider, RedisClusterTestResourceProvider, RedisTestResourceProvider, TestResourcesController, VaultTestResourceProvider

public interface TestResourcesResolver extends io.micronaut.core.order.Ordered
A test resources resolver is responsible for resolving test resources. This should be done when the resolve(String, Map, Map) method is called. This method is called with a property, corresponding to a property which doesn't exist in the user configuration. For example, if the "jdbc.driver" property is missing, a resolver may declare that it can resolve that property. As part of the process, it may start a test container for example.
  • Field Details

    • TEST_RESOURCES_PROPERTY

      static final String TEST_RESOURCES_PROPERTY
      The name of the top-level test resources property configuration key.
      See Also:
  • Method Details

    • getDisplayName

      default String getDisplayName()
      Returns a display name for a test resources resolver, used for debugging purposes.
      Returns:
      the display name
    • getId

      default String getId()
      Returns an id for the resolver.
      Returns:
      the id
    • getResolvableProperties

      List<String> getResolvableProperties(Map<String,Collection<String>> propertyEntries, Map<String,Object> testResourcesConfig)
      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 calling getRequiredPropertyEntries() and values are those property entries resolved.
      Parameters:
      propertyEntries - the property entries
      testResourcesConfig - the test resources configuration
      Returns:
      the list of properties
    • getRequiredProperties

      default List<String> 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.
      Parameters:
      expression - the expression which needs to be resolved.
      Returns:
      the list of configuration properties this resolver requires
    • getRequiredPropertyEntries

      default List<String> getRequiredPropertyEntries()
    • resolve

      Optional<String> resolve(String propertyName, Map<String,Object> properties, Map<String,Object> testResourcesConfig)
      Resolves the given property.
      Parameters:
      propertyName - the property to resolve
      properties - the resolved required properties
      testResourcesConfig - the test resources configuration
      Returns:
      the resolved property or empty if not found