use of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource in project che by eclipse.
the class SqlScriptCreatorTest method createsScript.
@Test
public void createsScript() throws Exception {
final Location location = new Location("filesystem:schema");
final Resource resource = new FileSystemResource("schema/5.0.0-M7/v1__init.sql");
final SqlScriptCreator scriptsCreator = new SqlScriptCreator();
final SqlScript script = scriptsCreator.createScript(location, resource);
assertEquals(script.name, "v1__init.sql");
assertEquals(script.location, location);
assertEquals(script.dir, "5.0.0-M7");
assertEquals(script.resource.getLocation(), resource.getLocation());
assertNull(script.vendor);
}
use of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource in project che by eclipse.
the class SqlScriptCreatorTest method failsToCreateResourceWhenPathIsInvalid.
@Test(expectedExceptions = FlywayException.class)
public void failsToCreateResourceWhenPathIsInvalid() throws Exception {
final Location location = new Location("filesystem:schema");
final Resource resource = new FileSystemResource("schema/v1__init.sql");
new SqlScriptCreator().createScript(location, resource);
}
use of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource in project che by eclipse.
the class SqlScriptCreatorTest method createsVendorScript.
@Test
public void createsVendorScript() throws Exception {
final Location location = new Location("filesystem:schema");
final Resource resource = new FileSystemResource("schema/5.0.0-M7/postgresql/v1__init.sql");
final SqlScriptCreator scriptsCreator = new SqlScriptCreator();
final SqlScript script = scriptsCreator.createScript(location, resource);
assertEquals(script.name, "v1__init.sql");
assertEquals(script.location, location);
assertEquals(script.dir, "5.0.0-M7");
assertEquals(script.resource.getLocation(), resource.getLocation());
assertEquals(script.vendor, "postgresql");
}
use of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource in project che by eclipse.
the class VersionResolverTest method failsToResolveVersions.
@Test(dataProvider = "invalidScripts", expectedExceptions = FlywayException.class)
public void failsToResolveVersions(String dir, String name) throws Exception {
final SqlScript script = new SqlScript(new FileSystemResource("sql/" + dir + "/" + name), new Location("filesystem:sql"), dir, null, name);
resolver.resolve(script, flyway);
}
use of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource in project che by eclipse.
the class VersionResolverTest method resolvesVersion.
@Test(dataProvider = "validScripts")
public void resolvesVersion(String dir, String name, String expectedVersion) {
final SqlScript script = new SqlScript(new FileSystemResource("sql/" + dir + "/" + name), new Location("filesystem:sql"), dir, null, name);
assertEquals(resolver.resolve(script, flyway), MigrationVersion.fromVersion(expectedVersion));
}
Aggregations