Search in sources :

Example 26 with Location

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

the class ClassPathScannerSmallTest method scanForClasses.

@Test
public void scanForClasses() throws Exception {
    Class<?>[] classes = classPathScanner.scanForClasses(new Location("classpath:org/flywaydb/core/internal/resolver/jdbc/dummy"), JdbcMigration.class);
    assertEquals(3, classes.length);
    assertEquals(V2__InterfaceBasedMigration.class, classes[0]);
    assertEquals(Version3dot5.class, classes[2]);
    assertEquals(V4__DummyExtendedAbstractJdbcMigration.class, classes[1]);
}
Also used : Location(org.flywaydb.core.internal.util.Location) Test(org.junit.Test) DB2MigrationMediumTest(org.flywaydb.core.internal.dbsupport.db2.DB2MigrationMediumTest)

Example 27 with Location

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

the class ClassPathScannerSmallTest method scanForResourcesDefaultPackage.

@Test
public void scanForResourcesDefaultPackage() throws Exception {
    Resource[] resources = classPathScanner.scanForResources(new Location("classpath:"), "logback", "");
    assertEquals(1, resources.length);
    assertEquals("logback.xml", resources[0].getLocation());
}
Also used : Resource(org.flywaydb.core.internal.util.scanner.Resource) Location(org.flywaydb.core.internal.util.Location) Test(org.junit.Test) DB2MigrationMediumTest(org.flywaydb.core.internal.dbsupport.db2.DB2MigrationMediumTest)

Example 28 with Location

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

the class ClassPathScannerSmallTest method scanForClassesSubPackage.

@Test
public void scanForClassesSubPackage() throws Exception {
    Class<?>[] classes = classPathScanner.scanForClasses(new Location("classpath:org/flywaydb/core/internal/dbsupport"), MigrationTestCase.class);
    assertTrue(classes.length >= 10);
    assertEquals(DB2MigrationMediumTest.class, classes[0]);
}
Also used : Location(org.flywaydb.core.internal.util.Location) Test(org.junit.Test) DB2MigrationMediumTest(org.flywaydb.core.internal.dbsupport.db2.DB2MigrationMediumTest)

Example 29 with Location

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

the class DB2zOSMigrationMediumTest method assertChecksum.

@Override
protected void assertChecksum(MigrationInfo migrationInfo) {
    SqlMigrationResolver sqlMigrationResolver = new SqlMigrationResolver(dbSupport, new Scanner(Thread.currentThread().getContextClassLoader()), new Location(getBasedir() + "/default"), PlaceholderReplacer.NO_PLACEHOLDERS, FlywayConfigurationForTests.create());
    List<ResolvedMigration> migrations = sqlMigrationResolver.resolveMigrations();
    for (ResolvedMigration migration : migrations) {
        if (migration.getVersion().toString().equals(migrationInfo.getVersion().toString())) {
            assertEquals("Wrong checksum for " + migrationInfo.getScript(), migration.getChecksum(), migrationInfo.getChecksum());
        }
    }
}
Also used : Scanner(org.flywaydb.core.internal.util.scanner.Scanner) SqlMigrationResolver(org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver) ResolvedMigration(org.flywaydb.core.api.resolver.ResolvedMigration) Location(org.flywaydb.core.internal.util.Location)

Aggregations

Location (org.flywaydb.core.internal.util.Location)29 Test (org.junit.Test)20 DB2MigrationMediumTest (org.flywaydb.core.internal.dbsupport.db2.DB2MigrationMediumTest)11 Resource (org.flywaydb.core.internal.util.scanner.Resource)11 ResolvedMigration (org.flywaydb.core.api.resolver.ResolvedMigration)7 FileSystemResource (org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource)6 ArrayList (java.util.ArrayList)5 Test (org.testng.annotations.Test)5 Scanner (org.flywaydb.core.internal.util.scanner.Scanner)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 SqlMigrationResolver (org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver)2 ClassPathResource (org.flywaydb.core.internal.util.scanner.classpath.ClassPathResource)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 Hashing (com.google.common.hash.Hashing)1 ByteSource (com.google.common.io.ByteSource)1 File (java.io.File)1 IOException (java.io.IOException)1 String.format (java.lang.String.format)1