use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class SqlMigrationResolverSmallTest method resolveMigrations.
@Test
public void resolveMigrations() {
SqlMigrationResolver sqlMigrationResolver = new SqlMigrationResolver(null, scanner, new Location("migration/subdir"), PlaceholderReplacer.NO_PLACEHOLDERS, FlywayConfigurationForTests.create());
Collection<ResolvedMigration> migrations = sqlMigrationResolver.resolveMigrations();
assertEquals(3, migrations.size());
List<ResolvedMigration> migrationList = new ArrayList<ResolvedMigration>(migrations);
assertEquals("1", migrationList.get(0).getVersion().toString());
assertEquals("1.1", migrationList.get(1).getVersion().toString());
assertEquals("2.0", migrationList.get(2).getVersion().toString());
assertEquals("dir1/V1__First.sql", migrationList.get(0).getScript());
assertEquals("V1_1__Populate_table.sql", migrationList.get(1).getScript());
assertEquals("dir2/V2_0__Add_foreign_key.sql", migrationList.get(2).getScript());
}
use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class SqlMigrationResolverSmallTest method extractScriptNameFileSystemPrefix.
@Test
public void extractScriptNameFileSystemPrefix() {
SqlMigrationResolver sqlMigrationResolver = new SqlMigrationResolver(null, scanner, new Location("filesystem:/some/dir"), PlaceholderReplacer.NO_PLACEHOLDERS, FlywayConfigurationForTests.create());
assertEquals("V3.171__patch.sql", sqlMigrationResolver.extractScriptName(new FileSystemResource("/some/dir/V3.171__patch.sql")));
}
use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class JdbcMigrationResolverSmallTest method resolveMigrations.
@Test
public void resolveMigrations() throws SQLException {
JdbcMigrationResolver jdbcMigrationResolver = new JdbcMigrationResolver(scanner, new Location("org/flywaydb/core/internal/resolver/jdbc/dummy"), config);
Collection<ResolvedMigration> migrations = jdbcMigrationResolver.resolveMigrations();
assertEquals(3, migrations.size());
List<ResolvedMigration> migrationList = new ArrayList<ResolvedMigration>(migrations);
ResolvedMigration migrationInfo = migrationList.get(0);
assertEquals("2", migrationInfo.getVersion().toString());
assertEquals("InterfaceBasedMigration", migrationInfo.getDescription());
assertNull(migrationInfo.getChecksum());
// do a test execute, since the migration does not do anything, we simply test whether the
// configuration has been set correctly
migrationInfo.getExecutor().execute(null);
ResolvedMigration migrationInfo1 = migrationList.get(1);
assertEquals("3.5", migrationInfo1.getVersion().toString());
assertEquals("Three Dot Five", migrationInfo1.getDescription());
assertEquals(35, migrationInfo1.getChecksum().intValue());
ResolvedMigration migrationInfo2 = migrationList.get(2);
assertEquals("4", migrationInfo2.getVersion().toString());
}
use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class SpringJdbcMigrationResolverSmallTest method resolveMigrations.
@Test
public void resolveMigrations() {
SpringJdbcMigrationResolver springJdbcMigrationResolver = new SpringJdbcMigrationResolver(scanner, new Location("org/flywaydb/core/internal/resolver/spring/dummy"), config);
Collection<ResolvedMigration> migrations = springJdbcMigrationResolver.resolveMigrations();
assertEquals(2, migrations.size());
List<ResolvedMigration> migrationList = new ArrayList<ResolvedMigration>(migrations);
assertEquals("2", migrationList.get(0).getVersion().toString());
assertEquals("3.5", migrationList.get(1).getVersion().toString());
assertEquals("InterfaceBasedMigration", migrationList.get(0).getDescription());
assertEquals("Three Dot Five", migrationList.get(1).getDescription());
assertNull(migrationList.get(0).getChecksum());
assertEquals(35, migrationList.get(1).getChecksum().intValue());
}
use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class ClassPathScannerSmallTest method scanForResourcesSplitDirectory.
@Test
public void scanForResourcesSplitDirectory() throws Exception {
Resource[] resources = classPathScanner.scanForResources(new Location("classpath:org/flywaydb/core/internal/dbsupport"), "create", ".sql");
assertTrue(resources.length > 7);
assertEquals("org/flywaydb/core/internal/dbsupport/db2/createMetaDataTable.sql", resources[0].getLocation());
}
Aggregations