Polish contribution

Closes gh-4973
This commit is contained in:
Stephane Nicoll 2016-01-21 14:06:01 +01:00
parent a749855cb5
commit 58ebfdcbd3
2 changed files with 17 additions and 2 deletions

View File

@ -48,6 +48,7 @@ import org.springframework.util.Assert;
*
* @author Dave Syer
* @author Phillip Webb
* @author Jacques-Etienne Beaudet
* @since 1.1.0
*/
@Configuration
@ -114,8 +115,9 @@ public class FlywayAutoConfiguration {
else {
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]));
return flyway;
}

View File

@ -104,7 +104,20 @@ public class FlywayAutoConfigurationTests {
@Test
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");
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
FlywayAutoConfiguration.class,