Closed dadrus closed 7 years ago
Actually already supported by a corresponding implementation of a bootstrapping method (see below). Dedicated annotations might however be helpful.
@RunWith(JpaUnitRunner.class)
public class FlywaydbTest {
@PersistenceContext(unitName = "my-verification-unit")
private EntityManager manager;
@Bootstrapping
public static void prepareDataBase(final DataSource ds) throws Exception {
final Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(ds.getConnection()));
final Liquibase liquibase = new Liquibase("changelog/changelog.xml", new ClassLoaderResourceAccessor(), database);
liquibase.dropAll();
liquibase.update((String) null);
}
@Test
public void someTest() {
// test code here
}
}
Since the desired functionality is already supported using the @Bootstrapping
method, the ticket is closed.
Liquibase (http://www.liquibase.org) is a powerful tool which enables versioning control for the DB schema and contents. Adding support for it would give more added value to the test extension.