Search in sources :

Example 1 with DriverDataSource

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());
}
Also used : DriverDataSource(org.flywaydb.core.internal.util.jdbc.DriverDataSource) Properties(java.util.Properties)

Example 2 with DriverDataSource

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);
}
Also used : LocalRdbmsServiceTestConfig(com.google.appengine.tools.development.testing.LocalRdbmsServiceTestConfig) DriverDataSource(org.flywaydb.core.internal.util.jdbc.DriverDataSource) LocalServiceTestHelper(com.google.appengine.tools.development.testing.LocalServiceTestHelper)

Example 3 with DriverDataSource

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);
}
Also used : DriverDataSource(org.flywaydb.core.internal.util.jdbc.DriverDataSource) Properties(java.util.Properties)

Example 4 with DriverDataSource

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());
}
Also used : DriverDataSource(org.flywaydb.core.internal.util.jdbc.DriverDataSource) Test(org.junit.Test)

Example 5 with DriverDataSource

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"));
}
Also used : DriverDataSource(org.flywaydb.core.internal.util.jdbc.DriverDataSource) JdbcTemplate(org.flywaydb.core.internal.dbsupport.JdbcTemplate) Test(org.junit.Test)

Aggregations

DriverDataSource (org.flywaydb.core.internal.util.jdbc.DriverDataSource)45 Test (org.junit.Test)29 Properties (java.util.Properties)11 File (java.io.File)6 FileInputStream (java.io.FileInputStream)6 Connection (java.sql.Connection)6 Flyway (org.flywaydb.core.Flyway)6 MigrationInfo (org.flywaydb.core.api.MigrationInfo)5 SQLException (java.sql.SQLException)4 Statement (java.sql.Statement)4 FlywayException (org.flywaydb.core.api.FlywayException)4 DataSource (javax.sql.DataSource)3 HashMap (java.util.HashMap)2 JdbcTemplate (org.flywaydb.core.internal.dbsupport.JdbcTemplate)2 Before (org.junit.Before)2 LocalRdbmsServiceTestConfig (com.google.appengine.tools.development.testing.LocalRdbmsServiceTestConfig)1 LocalServiceTestHelper (com.google.appengine.tools.development.testing.LocalServiceTestHelper)1 PrintWriter (java.io.PrintWriter)1 Map (java.util.Map)1 HBaseTestingUtility (org.apache.hadoop.hbase.HBaseTestingUtility)1