Merge pull request #8125 from eugenp/revert-8119-BAEL-3275-2

Revert "BAEL-3275: Using blocking queue for pub-sub"
This commit is contained in:
Eric Martin
2019-10-31 20:43:47 -05:00
committed by GitHub
parent db85c8f275
commit 3225470df5
20543 changed files with 1642750 additions and 0 deletions
@@ -0,0 +1,68 @@
package com.baeldung.flywaycallbacks;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.flywaydb.core.Flyway;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
@ContextConfiguration(classes = FlywayCallbackTestConfig.class)
public class FlywayApplicationUnitTest {
private Log log = LogFactory.getLog(getClass());
@Autowired
private DataSource dataSource;
@Test
public void migrateWithNoCallbacks() {
logTestBoundary("migrateWithNoCallbacks");
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setLocations("db/migration");
flyway.migrate();
}
@Test
public void migrateWithJavaCallbacks() {
logTestBoundary("migrateWithJavaCallbacks");
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setLocations("db/migration");
flyway.setCallbacks(new ExampleFlywayCallback());
flyway.migrate();
}
@Test
public void migrateWithSqlCallbacks() {
logTestBoundary("migrateWithSqlCallbacks");
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setLocations("db/migration", "db/callbacks");
flyway.migrate();
}
@Test
public void migrateWithSqlAndJavaCallbacks() {
logTestBoundary("migrateWithSqlAndJavaCallbacks");
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setLocations("db/migration", "db/callbacks");
flyway.setCallbacks(new ExampleFlywayCallback());
flyway.migrate();
}
private void logTestBoundary(String testName) {
System.out.println("\n");
log.info("> " + testName);
}
}
@@ -0,0 +1,21 @@
package com.baeldung.flywaycallbacks;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
@Configuration
public class FlywayCallbackTestConfig {
@Bean
public DataSource createDatasource() {
EmbeddedDatabaseBuilder dbBuilder = new EmbeddedDatabaseBuilder();
return dbBuilder.setType(EmbeddedDatabaseType.H2)
.setName("DATABASE")
.build();
}
}