use of org.flywaydb.core.api.Location in project flyway by flyway.
the class ClasspathClassScanner method scanForType.
public List<String> scanForType(String location, Class<?> classType, boolean errorOnNotFound) {
ClassPathScanner<?> s = new ClassPathScanner<>(classType, classLoader, Charset.defaultCharset(), new Location("classpath:" + location), resourceNameCache, locationScannerCache, errorOnNotFound);
List<String> discoveredTypes = new ArrayList<>();
for (LoadableResource resource : s.scanForResources()) {
if (resource.getAbsolutePath().endsWith(".class")) {
discoveredTypes.add(toClassName(resource.getAbsolutePath()));
}
}
return discoveredTypes;
}
use of org.flywaydb.core.api.Location in project spring-boot by spring-projects.
the class Flyway7xAutoConfigurationTests method defaultFlyway.
@Test
void defaultFlyway() {
this.contextRunner.withUserConfiguration(DataSourceAutoConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
assertThat(flyway.getConfiguration().getLocations()).containsExactly(new Location("classpath:db/migration"));
});
}
use of org.flywaydb.core.api.Location in project spring-boot by spring-projects.
the class FlywayAutoConfigurationTests method defaultFlyway.
@Test
void defaultFlyway() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
assertThat(flyway.getConfiguration().getLocations()).containsExactly(new Location("classpath:db/migration"));
});
}
use of org.flywaydb.core.api.Location in project spring-boot by spring-projects.
the class FlywayAutoConfigurationTests method overrideLocationsList.
@Test
void overrideLocationsList() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class).withPropertyValues("spring.flyway.locations[0]:classpath:db/changelog", "spring.flyway.locations[1]:classpath:db/migration").run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
assertThat(flyway.getConfiguration().getLocations()).containsExactly(new Location("classpath:db/changelog"), new Location("classpath:db/migration"));
});
}
use of org.flywaydb.core.api.Location in project spring-boot by spring-projects.
the class FlywayAutoConfigurationTests method overrideLocations.
@Test
void overrideLocations() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class).withPropertyValues("spring.flyway.locations:classpath:db/changelog,classpath:db/migration").run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
assertThat(flyway.getConfiguration().getLocations()).containsExactly(new Location("classpath:db/changelog"), new Location("classpath:db/migration"));
});
}
Aggregations