use of liquibase.Liquibase in project liquibase by liquibase.
the class AbstractIntegrationTest method testEncodingUpdating2SQL.
@Test
public void testEncodingUpdating2SQL() throws Exception {
if (database == null) {
return;
}
Liquibase liquibase = createLiquibase(encodingChangeLog);
StringWriter writer = new StringWriter();
liquibase.update(this.contexts, writer);
assertTrue("Update to SQL preserves encoding", new RegexMatcher(writer.toString(), new String[] { //For the UTF-8 encoded cvs
"^.*INSERT.*VALUES.*àèìòùáéíóúÀÈÌÒÙÁÉÍÓÚâêîôûäëïöü.*$", "çñ®", //For the latin1 one
"^.*INSERT.*VALUES.*àèìòùáéíóúÀÈÌÒÙÁÉÍÓÚâêîôûäëïöü.*$", "çñ®" }).allMatchedInSequentialOrder());
}
use of liquibase.Liquibase in project liquibase by liquibase.
the class AbstractIntegrationTest method testRollbackToChange.
@Test
public void testRollbackToChange() throws Exception {
if (database == null) {
return;
}
Liquibase liquibase = createLiquibase(rollbackChangeLog);
liquibase.dropAll(getSchemasToDrop());
liquibase = createLiquibase(rollbackChangeLog);
liquibase.update(this.contexts);
liquibase = createLiquibase(rollbackChangeLog);
liquibase.rollback(8, this.contexts);
liquibase.tag("testRollbackToChange");
liquibase = createLiquibase(rollbackChangeLog);
liquibase.update(this.contexts);
liquibase = createLiquibase(rollbackChangeLog);
liquibase.rollback("testRollbackToChange", this.contexts);
}
use of liquibase.Liquibase in project liquibase by liquibase.
the class AbstractIntegrationTest method testRollbackableChangeLog.
@Test
public void testRollbackableChangeLog() throws Exception {
if (database == null) {
return;
}
Liquibase liquibase = createLiquibase(rollbackChangeLog);
clearDatabase(liquibase);
liquibase = createLiquibase(rollbackChangeLog);
liquibase.update(this.contexts);
liquibase = createLiquibase(rollbackChangeLog);
liquibase.rollback(new Date(0), this.contexts);
liquibase = createLiquibase(rollbackChangeLog);
liquibase.update(this.contexts);
liquibase = createLiquibase(rollbackChangeLog);
liquibase.rollback(new Date(0), this.contexts);
}
use of liquibase.Liquibase in project liquibase by liquibase.
the class LiquibaseMigrateSQL method createLiquibase.
@Override
protected Liquibase createLiquibase(ResourceAccessor fo, Database db) throws MojoExecutionException {
Liquibase liquibase = super.createLiquibase(fo, db);
// Setup the output file writer
try {
if (!migrationSqlOutputFile.exists()) {
// Ensure the parent directories exist
migrationSqlOutputFile.getParentFile().mkdirs();
// Create the actual file
if (!migrationSqlOutputFile.createNewFile()) {
throw new MojoExecutionException("Cannot create the migration SQL file; " + migrationSqlOutputFile.getAbsolutePath());
}
}
outputWriter = getOutputWriter(migrationSqlOutputFile);
} catch (IOException e) {
getLog().error(e);
throw new MojoExecutionException("Failed to create SQL output writer", e);
}
getLog().info("Output SQL Migration File: " + migrationSqlOutputFile.getAbsolutePath());
return liquibase;
}
use of liquibase.Liquibase in project liquibase by liquibase.
the class LiquibaseRollbackSQL method createLiquibase.
@Override
protected Liquibase createLiquibase(ResourceAccessor fo, Database db) throws MojoExecutionException {
Liquibase liquibase = super.createLiquibase(fo, db);
// Setup the output file writer
try {
if (!migrationSqlOutputFile.exists()) {
// Ensure the parent directories exist
migrationSqlOutputFile.getParentFile().mkdirs();
// Create the actual file
if (!migrationSqlOutputFile.createNewFile()) {
throw new MojoExecutionException("Cannot create the migration SQL file; " + migrationSqlOutputFile.getAbsolutePath());
}
}
outputWriter = getOutputWriter(migrationSqlOutputFile);
} catch (IOException e) {
getLog().error(e);
throw new MojoExecutionException("Failed to create SQL output writer", e);
}
getLog().info("Output SQL Migration File: " + migrationSqlOutputFile.getAbsolutePath());
return liquibase;
}
Aggregations