Class FlywayPreparer
java.lang.Object
de.softwareforge.testing.postgres.embedded.FlywayPreparer
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddCustomizer
(Consumer<org.flywaydb.core.api.configuration.FluentConfiguration> customizer) Add a customizer instance.addCustomizers
(Set<Consumer<org.flywaydb.core.api.configuration.FluentConfiguration>> customizers) Add customizer instances.static FlywayPreparer
forClasspathLocation
(String... locations) Creates a new instance using one or more classpath locations.void
prepare
(DataSource dataSource) Callback to customize a given object instance.
-
Constructor Details
-
FlywayPreparer
public FlywayPreparer()Create a new, uninitialized preparer instance. UseaddCustomizer(Consumer)
to modify the configuration for theFluentConfiguration
object.
-
-
Method Details
-
forClasspathLocation
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 theFluentConfiguration
instance before setting the datasource and callingFluentConfiguration.load()
andFlyway.migrate()
.- Parameters:
customizer
- AConsumer<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 theFluentConfiguration
instance before setting the datasource and callingFluentConfiguration.load()
andFlyway.migrate()
.- Parameters:
customizers
- A set ofConsumer<org.flywaydb.core.api.configuration.FluentConfiguration>
instances. Must not be null.- Returns:
- This object.
- Since:
- 3.0
-
prepare
Description copied from interface:EmbeddedPostgresPreparer
Callback to customize a given object instance.- Specified by:
prepare
in interfaceEmbeddedPostgresPreparer<DataSource>
- Parameters:
dataSource
- The instance. Must never be null. Any method on the builder can be called.- Throws:
IOException
- For any IO related problem.
-