use of org.flywaydb.core.Flyway in project flyway by flyway.
the class SQLiteMigrationMediumTest method singleConnectionExternalDataSource.
@Test
public void singleConnectionExternalDataSource() {
SQLiteConfig config = new SQLiteConfig();
config.setJournalMode(SQLiteConfig.JournalMode.WAL);
config.setSynchronous(SQLiteConfig.SynchronousMode.NORMAL);
SQLiteDataSource dataSource = new SQLiteDataSource(config);
dataSource.setUrl("jdbc:sqlite:target/single_external");
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setLocations("migration/sql");
flyway.clean();
flyway.migrate();
}
use of org.flywaydb.core.Flyway in project flyway by flyway.
the class SQLServerCaseSensitiveMigrationTestCase method caseSensitiveCollation.
@Test
public void caseSensitiveCollation() throws Exception {
File customPropertiesFile = new File(System.getProperty("user.home") + "/flyway-mediumtests.properties");
Properties customProperties = new Properties();
if (customPropertiesFile.canRead()) {
customProperties.load(new FileInputStream(customPropertiesFile));
}
DataSource dataSource = createDataSource(customProperties);
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setLocations("migration/sql");
flyway.clean();
flyway.migrate();
assertEquals("2.0", flyway.info().current().getVersion().toString());
assertEquals(0, flyway.migrate());
assertEquals(4, flyway.info().applied().length);
Connection connection = dataSource.getConnection();
DbSupport dbSupport = DbSupportFactory.createDbSupport(connection, true);
assertEquals(2, dbSupport.getJdbcTemplate().queryForInt("select count(*) from all_misters"));
connection.close();
}
use of org.flywaydb.core.Flyway in project flyway by flyway.
the class EnterpriseDBSuperUserMigrationMediumTest method setUp.
@Before
public void setUp() throws Exception {
File customPropertiesFile = new File(System.getProperty("user.home") + "/flyway-mediumtests.properties");
Properties customProperties = new Properties();
if (customPropertiesFile.canRead()) {
customProperties.load(new FileInputStream(customPropertiesFile));
}
String password = customProperties.getProperty("enterprisedb.password", "flyway");
String url = customProperties.getProperty("enterprisedb.url", "jdbc:edb://localhost/flyway_db");
flyway = new Flyway();
flyway.setSchemas("super_user_test");
flyway.setDataSource(new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, url, "flyway", password, new Properties()));
flyway.setValidateOnMigrate(true);
flyway.clean();
}
use of org.flywaydb.core.Flyway in project flyway by flyway.
the class DerbyMigrationMediumTest method testFlyway1331.
@Test
public void testFlyway1331() throws Exception {
try {
Flyway flyway = new Flyway();
flyway.setDataSource("jdbc:derby:memory:fw1331db;create=true", "sa", "sa");
flyway.setLocations("migration/sql");
flyway.setBaselineOnMigrate(true);
flyway.migrate();
} finally {
try {
JdbcUtils.closeConnection(DriverManager.getConnection("jdbc:derby:memory:fw1331db;shutdown=true", "sa", "sa"));
} catch (Exception e) {
// Suppress
}
}
}
use of org.flywaydb.core.Flyway in project flyway by flyway.
the class EnterpriseDBMigrationMediumTest method emptySearchPath.
@Test
public void emptySearchPath() {
Flyway flyway1 = new Flyway();
DriverDataSource driverDataSource = (DriverDataSource) dataSource;
flyway1.setDataSource(new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, driverDataSource.getUrl(), driverDataSource.getUser(), driverDataSource.getPassword(), new Properties()) {
@Override
public Connection getConnection() throws SQLException {
Connection connection = super.getConnection();
Statement statement = null;
try {
statement = connection.createStatement();
statement.execute("SELECT set_config('search_path', '', false)");
} finally {
JdbcUtils.closeStatement(statement);
}
return connection;
}
});
flyway1.setLocations(getBasedir());
flyway1.setSchemas("public");
flyway1.migrate();
}
Aggregations