use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class ClassPathScannerSmallTest method scanForClassesSplitPackage.
@Test
public void scanForClassesSplitPackage() throws Exception {
Class<?>[] classes = classPathScanner.scanForClasses(new Location("classpath:org/flywaydb/core/internal/util"), UrlResolver.class);
assertTrue(classes.length >= 2);
assertTrue(Arrays.asList(classes).contains(JBossVFSv2UrlResolver.class));
}
use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class ClassPathScannerSmallTest method scanForResources.
@Test
public void scanForResources() throws Exception {
Resource[] resources = classPathScanner.scanForResources(new Location("classpath:migration/sql"), "V", ".sql");
assertEquals(4, resources.length);
assertEquals("migration/sql/V1.1__View.sql", resources[0].getLocation());
assertEquals("migration/sql/V1_2__Populate_table.sql", resources[1].getLocation());
assertEquals("migration/sql/V1__First.sql", resources[2].getLocation());
assertEquals("migration/sql/V2_0__Add_foreign_key_and_super_mega_humongous_padding_to_exceed_the_maximum_column_length_in_the_metadata_table.sql", resources[3].getLocation());
}
use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class SqlMigrationResolverSmallTest method extractScriptName.
@Test
public void extractScriptName() {
SqlMigrationResolver sqlMigrationResolver = new SqlMigrationResolver(null, scanner, new Location("db/migration"), PlaceholderReplacer.NO_PLACEHOLDERS, FlywayConfigurationForTests.createWithPrefix("db_"));
assertEquals("db_0__init.sql", sqlMigrationResolver.extractScriptName(new ClassPathResource("db/migration/db_0__init.sql", Thread.currentThread().getContextClassLoader())));
}
use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class SqlMigrationResolverSmallTest method extractScriptNameRootLocation.
@Test
public void extractScriptNameRootLocation() {
SqlMigrationResolver sqlMigrationResolver = new SqlMigrationResolver(null, scanner, new Location(""), PlaceholderReplacer.NO_PLACEHOLDERS, FlywayConfigurationForTests.createWithPrefix("db_"));
assertEquals("db_0__init.sql", sqlMigrationResolver.extractScriptName(new ClassPathResource("db_0__init.sql", Thread.currentThread().getContextClassLoader())));
}
use of org.flywaydb.core.internal.util.Location in project flyway by flyway.
the class SqlMigrationResolverSmallTest method resolveMigrationsRoot.
@Test
public void resolveMigrationsRoot() {
FlywayConfigurationForTests configuration = FlywayConfigurationForTests.createWithPrefix("CheckValidate");
configuration.setRepeatableSqlMigrationPrefix("X");
SqlMigrationResolver sqlMigrationResolver = new SqlMigrationResolver(null, scanner, new Location(""), PlaceholderReplacer.NO_PLACEHOLDERS, configuration);
// changed to 3 as new test cases are added for SybaseASE and DB2
assertEquals(3, sqlMigrationResolver.resolveMigrations().size());
}
Aggregations