|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2014 the original author or authors.
|
|
|
|
* Copyright 2012-2015 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -16,6 +16,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.autoconfigure.liquibase;
|
|
|
|
package org.springframework.boot.autoconfigure.liquibase;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import org.junit.After;
|
|
|
|
import org.junit.After;
|
|
|
|
import org.junit.Before;
|
|
|
|
import org.junit.Before;
|
|
|
|
import org.junit.Rule;
|
|
|
|
import org.junit.Rule;
|
|
|
@ -167,4 +169,31 @@ public class LiquibaseAutoConfigurationTests {
|
|
|
|
assertThat(log, instanceOf(CommonsLoggingLiquibaseLogger.class));
|
|
|
|
assertThat(log, instanceOf(CommonsLoggingLiquibaseLogger.class));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testOverrideLabels() throws Exception {
|
|
|
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.context,
|
|
|
|
|
|
|
|
"liquibase.labels:test, production");
|
|
|
|
|
|
|
|
this.context.register(EmbeddedDataSourceConfiguration.class,
|
|
|
|
|
|
|
|
LiquibaseAutoConfiguration.class,
|
|
|
|
|
|
|
|
PropertyPlaceholderAutoConfiguration.class);
|
|
|
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
|
|
|
SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
|
|
|
|
|
|
|
|
assertEquals("test, production", liquibase.getLabels());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@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");
|
|
|
|
|
|
|
|
assertTrue(parameters.containsKey("foo"));
|
|
|
|
|
|
|
|
assertEquals("bar", parameters.get("foo"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|