use of org.flywaydb.core.internal.util.jdbc.DriverDataSource in project flyway by flyway.
the class PostgreSQLDbSupportMediumTest method createDataSource.
/**
* Creates a datasource for use in tests.
*
* @return The new datasource.
*/
private DataSource createDataSource() 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 user = customProperties.getProperty("postgresql.user", "flyway");
String password = customProperties.getProperty("postgresql.password", "flyway");
String url = customProperties.getProperty("postgresql.url", "jdbc:postgresql://localhost/flyway_db");
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 PostgreSQLSuperUserMigrationMediumTest 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("postgresql.password", "flyway");
String url = customProperties.getProperty("postgresql.url", "jdbc:postgresql://localhost/flyway_db");
flyway = new Flyway();
flyway.setSchemas("super_user_test");
flyway.setDataSource(new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, url, "postgres", password, null));
flyway.setValidateOnMigrate(true);
flyway.clean();
}
use of org.flywaydb.core.internal.util.jdbc.DriverDataSource in project flyway by flyway.
the class RedshiftDbSupportMediumTest method createDataSource.
/**
* Creates a datasource for use in tests.
*
* @return The new datasource.
*/
private DataSource createDataSource() 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 user = customProperties.getProperty("postgresql.user", "flyway");
// Password must be at least 8 characters, with upper and lower case:
String password = customProperties.getProperty("postgresql.password", "Flyway123");
// Create an ssh tunnel on port 5439 to your Redshift instance before running this test!
String url = customProperties.getProperty("postgresql.url", "jdbc:postgresql://localhost:5439/flyway");
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 RedshiftMigrationMediumTest 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(), null) {
@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();
}
use of org.flywaydb.core.internal.util.jdbc.DriverDataSource in project flyway by flyway.
the class PhoenixMigrationMediumTest method beforeClassSetUp.
@BeforeClass
public static void beforeClassSetUp() throws Exception {
// Startup HBase in-memory cluster
LOG.info("Starting mini-cluster");
testUtility = new HBaseTestingUtility();
testUtility.startMiniCluster();
// Set up Phoenix schema
String server = testUtility.getConfiguration().get("hbase.zookeeper.quorum");
String port = testUtility.getConfiguration().get("hbase.zookeeper.property.clientPort");
String zkServer = server + ":" + port;
dataSource = new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, "jdbc:phoenix:" + zkServer, "", "", null);
}
Aggregations