use of org.flywaydb.core.internal.util.jdbc.DriverDataSource in project flyway by flyway.
the class EnterpriseDBConcurrentMigrationMediumTest method createDataSource.
@Override
protected DataSource createDataSource(Properties customProperties) throws Exception {
String user = customProperties.getProperty("enterprisedb.user", "flyway");
String password = customProperties.getProperty("enterprisedb.password", "flyway");
String url = customProperties.getProperty("enterprisedb.url", "jdbc:edb://localhost/flyway_db");
return new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, url, user, password, new Properties());
}
use of org.flywaydb.core.internal.util.jdbc.DriverDataSource in project flyway by flyway.
the class GoogleCloudSQLMigrationMediumTest method createDataSource.
@Override
protected DataSource createDataSource(Properties customProperties) throws Exception {
String user = customProperties.getProperty("mysql.user", "flyway");
String password = customProperties.getProperty("mysql.password", "flyway");
String url = customProperties.getProperty("mysql.cloudsql_url", "jdbc:mysql://localhost:3306/flyway_cloudsql_db");
LocalRdbmsServiceTestConfig config = new LocalRdbmsServiceTestConfig();
config.setServerType(LocalRdbmsService.ServerType.LOCAL);
ClassUtils.instantiate("com.mysql.jdbc.Driver", Thread.currentThread().getContextClassLoader());
config.setDriverClass("com.mysql.jdbc.Driver");
config.setJdbcConnectionStringFormat(url);
config.setUser(user);
config.setPassword(password);
helper = new LocalServiceTestHelper(config);
helper.setUp();
return new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, "jdbc:google:rdbms://localhost/flyway_cloudsql_db", "", "", null);
}
use of org.flywaydb.core.internal.util.jdbc.DriverDataSource in project flyway by flyway.
the class OracleDbSupportMediumTest method createDataSource.
/**
* Creates a datasource for use in tests.
*
* @return The new datasource.
*/
private DataSource createDataSource() throws Exception {
Properties customProperties = getConnectionProperties();
String user = customProperties.getProperty("oracle.user");
String password = customProperties.getProperty("oracle.password");
String url = customProperties.getProperty("oracle.url");
return new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, url, user, password, null);
}
use of org.flywaydb.core.internal.util.jdbc.DriverDataSource in project flyway by flyway.
the class FlywayMediumTest method repeatableOnly.
@Test
public void repeatableOnly() {
DriverDataSource dataSource = new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, "jdbc:h2:mem:flyway_repeatable_only;DB_CLOSE_DELAY=-1", "sa", "", null);
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setLocations("migration/repeatable");
assertEquals(2, flyway.migrate());
}
use of org.flywaydb.core.internal.util.jdbc.DriverDataSource in project flyway by flyway.
the class FlywayMediumTest method callback.
@Test
public void callback() throws Exception {
DriverDataSource dataSource = new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, "jdbc:h2:mem:flyway_db_callback;DB_CLOSE_DELAY=-1", "sa", "", null, "SET AUTOCOMMIT OFF");
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setSqlMigrationPrefix("");
flyway.setLocations("migration/callback");
flyway.migrate();
assertEquals("1", flyway.info().current().getVersion().toString());
assertEquals(MigrationState.SUCCESS, flyway.info().current().getState());
assertEquals("Mr Callback", new JdbcTemplate(dataSource.getConnection(), 0).queryForString("SELECT name FROM test_user"));
}
Aggregations