use of liquibase.Liquibase in project liquibase by liquibase.
the class AbstractIntegrationTest method testRollbackableChangeLogScriptOnExistingDatabase.
@Test
public void testRollbackableChangeLogScriptOnExistingDatabase() throws Exception {
if (database == null) {
return;
}
Liquibase liquibase = createLiquibase(rollbackChangeLog);
clearDatabase(liquibase);
liquibase = createLiquibase(rollbackChangeLog);
liquibase.update(this.contexts);
StringWriter writer = new StringWriter();
liquibase = createLiquibase(rollbackChangeLog);
liquibase.rollback(new Date(0), this.contexts, writer);
// System.out.println("Rollback SQL for "+driverName+StreamUtil.getLineSeparator()+StreamUtil.getLineSeparator()+writer.toString());
}
use of liquibase.Liquibase in project liquibase by liquibase.
the class AbstractIntegrationTest method testDbDoc.
@Test
public void testDbDoc() throws Exception {
if (database == null) {
return;
}
Liquibase liquibase = createLiquibase(completeChangeLog);
liquibase.dropAll(getSchemasToDrop());
liquibase = createLiquibase(completeChangeLog);
liquibase.update(this.contexts);
File outputDir = File.createTempFile("liquibase-dbdoctest", "dir");
outputDir.delete();
outputDir.mkdir();
liquibase = createLiquibase(completeChangeLog);
liquibase.generateDocumentation(outputDir.getAbsolutePath(), this.contexts);
deleteOnExit(outputDir);
}
use of liquibase.Liquibase in project liquibase by liquibase.
the class AbstractIntegrationTest method verifyObjectQuotingStrategy.
@Test
public void verifyObjectQuotingStrategy() throws Exception {
if (database == null) {
return;
}
if (!Arrays.asList("oracle,h2,hsqldb,postgresql,mysql").contains(database.getShortName())) {
return;
}
Liquibase liquibase = createLiquibase(objectQuotingStrategyChangeLog);
clearDatabase(liquibase);
liquibase.update(contexts);
clearDatabase(liquibase);
}
use of liquibase.Liquibase in project liquibase by liquibase.
the class AbstractIntegrationTest method contextsWithHyphensWorkInFormattedSql.
@Test
public void contextsWithHyphensWorkInFormattedSql() throws Exception {
if (database == null) {
return;
}
Liquibase liquibase = createLiquibase("changelogs/common/sqlstyle/formatted.changelog.sql");
liquibase.update("hyphen-context-using-sql,camelCaseContextUsingSql");
SnapshotGeneratorFactory tableSnapshotGenerator = SnapshotGeneratorFactory.getInstance();
assertNotNull(tableSnapshotGenerator.has(new Table().setName("hyphen_context"), database));
assertNotNull(tableSnapshotGenerator.has(new Table().setName("camel_context"), database));
assertNotNull(tableSnapshotGenerator.has(new Table().setName("bar_id"), database));
assertNotNull(tableSnapshotGenerator.has(new Table().setName("foo_id"), database));
}
use of liquibase.Liquibase in project liquibase by liquibase.
the class AbstractIntegrationTest method invalidIncludeDoesntBreakLiquibase.
@Test
public void invalidIncludeDoesntBreakLiquibase() throws Exception {
if (database == null) {
return;
}
Liquibase liquibase = createLiquibase(invalidReferenceChangeLog);
try {
liquibase.update(new Contexts());
fail("Did not fail with invalid include");
} catch (ChangeLogParseException ignored) {
//expected
}
LockService lockService = LockServiceFactory.getInstance().getLockService(database);
assertFalse(lockService.hasChangeLogLock());
}
Aggregations