Class AbstractHibernateReactiveTestResourceProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>

java.lang.Object
io.micronaut.testresources.testcontainers.AbstractTestContainersProvider<T>
io.micronaut.testresources.hibernate.reactive.core.AbstractHibernateReactiveTestResourceProvider<T>
Type Parameters:
T - the container type
All Implemented Interfaces:
io.micronaut.core.order.Ordered, TestResourcesResolver, ToggableTestResourcesResolver
Direct Known Subclasses:
HibernateReactiveMariaDBTestResourceProvider, HibernateReactiveMSSQLTestResourceProvider, HibernateReactiveMySQLTestResourceProvider, HibernateReactiveOracleXETestResourceProvider, HibernateReactivePostgreSQLTestResourceProvider

public abstract class AbstractHibernateReactiveTestResourceProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>> extends AbstractTestContainersProvider<T>
Base class for R2DBC test resources. Unlike JDBC test resources, this resolver is capable of reusing an existing JDBC test resources and expose it via R2DBC: this can be useful for Flyway database migrations which work over JDBC for example. For this to work, a datasource of the same name must exist, in which case it would be resolved first. If no such datasource exists, then a new container will be created.
  • Constructor Details

    • AbstractHibernateReactiveTestResourceProvider

      public AbstractHibernateReactiveTestResourceProvider()
  • Method Details

    • getRequiredPropertyEntries

      public List<String> getRequiredPropertyEntries()
    • getRequiredProperties

      public List<String> getRequiredProperties(String expression)
      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.
      Parameters:
      expression - the expression which needs to be resolved.
      Returns:
      the list of configuration properties this resolver requires
    • 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 calling TestResourcesResolver.getRequiredPropertyEntries() and values are those property entries resolved.
      Parameters:
      propertyEntries - the property entries
      testResourcesConfig - the test resources configuration
      Returns:
      the list of properties
    • shouldAnswer

      protected boolean shouldAnswer(String propertyName, Map<String,Object> requestedProperties, Map<String,Object> testResourcesConfig)
      Description copied from class: AbstractTestContainersProvider
      Determines 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:
      shouldAnswer in class AbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
      Parameters:
      propertyName - the property to resolve
      requestedProperties - the resolved properties
      testResourcesConfig - the test resources configuration
      Returns:
      if this resolver should answer
    • resolveWithoutContainer

      protected Optional<String> resolveWithoutContainer(String propertyName, Map<String,Object> properties, Map<String,Object> testResourcesConfig)
      Description copied from class: AbstractTestContainersProvider
      Lets a resolver provide a value for the requested property without triggering the creation of a test container. This can be used in case a resolver wants to check existing containers first.
      Overrides:
      resolveWithoutContainer in class AbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>
      Parameters:
      propertyName - the name of the property to resolve
      properties - the properties used to resolve
      testResourcesConfig - the test resources configuration
      Returns:
      a resolved property
    • resolveProperty

      protected final Optional<String> resolveProperty(String expression, T container)
      Specified by:
      resolveProperty in class AbstractTestContainersProvider<T extends org.testcontainers.containers.JdbcDatabaseContainer<? extends T>>