Search in sources :

Example 1 with Locations

use of org.flywaydb.core.internal.util.Locations in project flyway by flyway.

the class CompositeMigrationResolverSmallTest method skipDefaultResolvers.

@Test
public void skipDefaultResolvers() {
    FlywayConfigurationForTests config = FlywayConfigurationForTests.create();
    config.setSkipDefaultResolvers(true);
    MigrationResolver migrationResolver = new CompositeMigrationResolver(null, new Scanner(Thread.currentThread().getContextClassLoader()), config, new Locations("migration/outoforder", "org/flywaydb/core/internal/resolver/jdbc/dummy"), PlaceholderReplacer.NO_PLACEHOLDERS);
    Collection<ResolvedMigration> migrations = migrationResolver.resolveMigrations();
    assertTrue(migrations.isEmpty());
}
Also used : Scanner(org.flywaydb.core.internal.util.scanner.Scanner) Locations(org.flywaydb.core.internal.util.Locations) ResolvedMigration(org.flywaydb.core.api.resolver.ResolvedMigration) MigrationResolver(org.flywaydb.core.api.resolver.MigrationResolver) Test(org.junit.Test)

Example 2 with Locations

use of org.flywaydb.core.internal.util.Locations in project flyway by flyway.

the class CompositeMigrationResolverSmallTest method resolveMigrationsMultipleLocations.

@Test
public void resolveMigrationsMultipleLocations() {
    FlywayConfigurationForTests config = FlywayConfigurationForTests.create();
    PlaceholderReplacer placeholderReplacer = new PlaceholderReplacer(new HashMap<String, String>(), "${", "}");
    MigrationResolver migrationResolver = new CompositeMigrationResolver(null, new Scanner(Thread.currentThread().getContextClassLoader()), config, new Locations("migration/subdir/dir2", "migration.outoforder", "migration/subdir/dir1"), placeholderReplacer, new MyCustomMigrationResolver());
    Collection<ResolvedMigration> migrations = migrationResolver.resolveMigrations();
    List<ResolvedMigration> migrationList = new ArrayList<ResolvedMigration>(migrations);
    assertEquals(4, migrations.size());
    assertEquals("First", migrationList.get(0).getDescription());
    assertEquals("Late arrivals", migrationList.get(1).getDescription());
    assertEquals("Virtual Migration", migrationList.get(2).getDescription());
    assertEquals("Add foreign key", migrationList.get(3).getDescription());
}
Also used : Scanner(org.flywaydb.core.internal.util.scanner.Scanner) PlaceholderReplacer(org.flywaydb.core.internal.util.PlaceholderReplacer) Locations(org.flywaydb.core.internal.util.Locations) ResolvedMigration(org.flywaydb.core.api.resolver.ResolvedMigration) MigrationResolver(org.flywaydb.core.api.resolver.MigrationResolver) Test(org.junit.Test)

Aggregations

MigrationResolver (org.flywaydb.core.api.resolver.MigrationResolver)2 ResolvedMigration (org.flywaydb.core.api.resolver.ResolvedMigration)2 Locations (org.flywaydb.core.internal.util.Locations)2 Scanner (org.flywaydb.core.internal.util.scanner.Scanner)2 Test (org.junit.Test)2 PlaceholderReplacer (org.flywaydb.core.internal.util.PlaceholderReplacer)1