use of org.flywaydb.core.internal.dbsupport.h2.H2DbSupport in project flyway by flyway.
the class FlywayMediumTest method multipleSetDataSourceCalls.
@Test
public void multipleSetDataSourceCalls() throws Exception {
DriverDataSource dataSource1 = new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, "jdbc:h2:mem:flyway_db_1;DB_CLOSE_DELAY=-1", "sa", "", null);
DriverDataSource dataSource2 = new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, "jdbc:h2:mem:flyway_db_2;DB_CLOSE_DELAY=-1", "sa", "", null);
Connection connection1 = dataSource1.getConnection();
Connection connection2 = dataSource2.getConnection();
Schema schema1 = new H2DbSupport(connection1).getSchema("PUBLIC");
Schema schema2 = new H2DbSupport(connection2).getSchema("PUBLIC");
assertTrue(schema1.empty());
assertTrue(schema2.empty());
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource1);
flyway.setDataSource(dataSource2);
flyway.setLocations("migration/sql");
flyway.migrate();
assertTrue(schema1.empty());
assertFalse(schema2.empty());
connection1.close();
connection2.close();
}
Aggregations