Search in sources :

Example 1 with SqlMigrationResolver

use of org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver in project flyway by flyway.

the class MigrationTestCase method assertChecksum.

/**
     * Compares the DB checksum to the classpath checksum of this migration.
     *
     * @param migrationInfo
     *            The migration to check.
     */
protected void assertChecksum(MigrationInfo migrationInfo) {
    SqlMigrationResolver sqlMigrationResolver = new SqlMigrationResolver(dbSupport, new Scanner(Thread.currentThread().getContextClassLoader()), new Location(getBasedir()), 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)

Example 2 with SqlMigrationResolver

use of org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver 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

ResolvedMigration (org.flywaydb.core.api.resolver.ResolvedMigration)2 SqlMigrationResolver (org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver)2 Location (org.flywaydb.core.internal.util.Location)2 Scanner (org.flywaydb.core.internal.util.scanner.Scanner)2