Polish contribution

Closes gh-4973
1.2.x
Stephane Nicoll 9 years ago
parent a749855cb5
commit 58ebfdcbd3

@ -48,6 +48,7 @@ import org.springframework.util.Assert;
* *
* @author Dave Syer * @author Dave Syer
* @author Phillip Webb * @author Phillip Webb
* @author Jacques-Etienne Beaudet
* @since 1.1.0 * @since 1.1.0
*/ */
@Configuration @Configuration
@ -114,8 +115,9 @@ public class FlywayAutoConfiguration {
else { else {
flyway.setDataSource(this.dataSource); flyway.setDataSource(this.dataSource);
} }
//Explicitly set locations because the getter doesn't return a mutable value // TODO: remove this line once SPR-13749 is fixed
flyway.setLocations(this.properties.getLocations().toArray(new String[0])); flyway.setLocations(this.properties.getLocations().toArray(new String[0]));
return flyway; return flyway;
} }

@ -104,7 +104,20 @@ public class FlywayAutoConfigurationTests {
@Test @Test
public void overrideLocations() throws Exception { public void overrideLocations() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, "flyway.locations[0]:classpath:db/changelog", EnvironmentTestUtils.addEnvironment(this.context,
"flyway.locations:classpath:db/changelog,classpath:db/migration");
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
FlywayAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Flyway flyway = this.context.getBean(Flyway.class);
assertEquals("[classpath:db/changelog, classpath:db/migration]",
Arrays.asList(flyway.getLocations()).toString());
}
@Test
public void overrideLocationsList() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"flyway.locations[0]:classpath:db/changelog",
"flyway.locations[1]:classpath:db/migration"); "flyway.locations[1]:classpath:db/migration");
registerAndRefresh(EmbeddedDataSourceConfiguration.class, registerAndRefresh(EmbeddedDataSourceConfiguration.class,
FlywayAutoConfiguration.class, FlywayAutoConfiguration.class,

Loading…
Cancel
Save