Search in sources :

Example 1 with SpringLiquibase

use of liquibase.integration.spring.SpringLiquibase in project spring-boot by spring-projects.

the class LiquibaseAutoConfigurationTests method testJsonChangeLog.

@Test
public void testJsonChangeLog() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.context, "liquibase.change-log:classpath:/db/changelog/db.changelog-override.json");
    this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
    assertThat(liquibase.getChangeLog()).isEqualTo("classpath:/db/changelog/db.changelog-override.json");
}
Also used : SpringLiquibase(liquibase.integration.spring.SpringLiquibase) Test(org.junit.Test)

Example 2 with SpringLiquibase

use of liquibase.integration.spring.SpringLiquibase in project spring-boot by spring-projects.

the class LiquibaseAutoConfigurationTests method testOverrideDefaultSchema.

@Test
public void testOverrideDefaultSchema() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.context, "liquibase.default-schema:public");
    this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
    assertThat(liquibase.getDefaultSchema()).isEqualTo("public");
}
Also used : SpringLiquibase(liquibase.integration.spring.SpringLiquibase) Test(org.junit.Test)

Example 3 with SpringLiquibase

use of liquibase.integration.spring.SpringLiquibase in project spring-boot by spring-projects.

the class LiquibaseAutoConfigurationTests method testSqlChangeLog.

@Test
public void testSqlChangeLog() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.context, "liquibase.change-log:classpath:/db/changelog/db.changelog-override.sql");
    this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
    assertThat(liquibase.getChangeLog()).isEqualTo("classpath:/db/changelog/db.changelog-override.sql");
}
Also used : SpringLiquibase(liquibase.integration.spring.SpringLiquibase) Test(org.junit.Test)

Example 4 with SpringLiquibase

use of liquibase.integration.spring.SpringLiquibase in project spring-boot by spring-projects.

the class LiquibaseAutoConfigurationTests method testLogger.

@Test
public void testLogger() throws Exception {
    this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
    Object log = ReflectionTestUtils.getField(liquibase, "log");
    assertThat(log).isInstanceOf(CommonsLoggingLiquibaseLogger.class);
    assertThat(this.outputCapture.toString()).doesNotContain(": liquibase:");
}
Also used : SpringLiquibase(liquibase.integration.spring.SpringLiquibase) Test(org.junit.Test)

Example 5 with SpringLiquibase

use of liquibase.integration.spring.SpringLiquibase in project spring-boot by spring-projects.

the class LiquibaseAutoConfigurationTests method testOverrideParameters.

@Test
@SuppressWarnings("unchecked")
public void testOverrideParameters() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.context, "liquibase.parameters.foo:bar");
    this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
    Map<String, String> parameters = (Map<String, String>) ReflectionTestUtils.getField(liquibase, "parameters");
    assertThat(parameters.containsKey("foo")).isTrue();
    assertThat(parameters.get("foo")).isEqualTo("bar");
}
Also used : SpringLiquibase(liquibase.integration.spring.SpringLiquibase) Map(java.util.Map) Test(org.junit.Test)

Aggregations

SpringLiquibase (liquibase.integration.spring.SpringLiquibase)14 Test (org.junit.Test)13 Map (java.util.Map)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 DataSource (javax.sql.DataSource)1 StandardChangeLogHistoryService (liquibase.changelog.StandardChangeLogHistoryService)1 Database (liquibase.database.Database)1 DatabaseFactory (liquibase.database.DatabaseFactory)1 JdbcConnection (liquibase.database.jvm.JdbcConnection)1 LiquibaseReport (org.springframework.boot.actuate.endpoint.LiquibaseEndpoint.LiquibaseReport)1