Class FlywayPreparer

java.lang.Object
de.softwareforge.testing.postgres.embedded.FlywayPreparer
All Implemented Interfaces:
EmbeddedPostgresPreparer<DataSource>

public final class FlywayPreparer extends Object implements EmbeddedPostgresPreparer<DataSource>
An EmbeddedPostgresPreparer<DataSource> that uses the Flyway version control for your database framework to migrate a data source to a known state.
  • Constructor Details

    • FlywayPreparer

      public FlywayPreparer()
      Create a new, uninitialized preparer instance. Use addCustomizer(Consumer) to modify the configuration for the FluentConfiguration object.
  • Method Details

    • forClasspathLocation

      @NonNull public static FlywayPreparer forClasspathLocation(String... locations)
      Creates a new instance using one or more classpath locations.
      Parameters:
      locations - One or more locations on the classpath.
      Returns:
      A FlywayPreparer instance.
    • addCustomizer

      @NonNull public FlywayPreparer addCustomizer(@NonNull Consumer<org.flywaydb.core.api.configuration.FluentConfiguration> customizer)
      Add a customizer instance. Each customizer is called once with the FluentConfiguration instance before setting the datasource and calling FluentConfiguration.load() and Flyway.migrate().
      Parameters:
      customizer - A Consumer<org.flywaydb.core.api.configuration.FluentConfiguration> instance. Must not be null.
      Returns:
      This object.
      Since:
      3.0
    • addCustomizers

      @NonNull public FlywayPreparer addCustomizers(@NonNull Set<Consumer<org.flywaydb.core.api.configuration.FluentConfiguration>> customizers)
      Add customizer instances. Each customizer is called once with the FluentConfiguration instance before setting the datasource and calling FluentConfiguration.load() and Flyway.migrate().
      Parameters:
      customizers - A set of Consumer<org.flywaydb.core.api.configuration.FluentConfiguration> instances. Must not be null.
      Returns:
      This object.
      Since:
      3.0
    • customize

      @Deprecated @NonNull public FlywayPreparer customize(@NonNull Consumer<org.flywaydb.core.api.configuration.FluentConfiguration> customizer)
      Deprecated.
    • prepare

      public void prepare(@NonNull DataSource dataSource) throws IOException
      Description copied from interface: EmbeddedPostgresPreparer
      Callback to customize a given object instance.
      Specified by:
      prepare in interface EmbeddedPostgresPreparer<DataSource>
      Parameters:
      dataSource - The instance. Must never be null. Any method on the builder can be called.
      Throws:
      IOException - For any IO related problem.