use of liquibase.changelog.DatabaseChangeLog in project liquibase by liquibase.
the class AbstractChangeLogParser method parse.
@Override
public DatabaseChangeLog parse(String physicalChangeLogLocation, ChangeLogParameters changeLogParameters, ResourceAccessor resourceAccessor) throws ChangeLogParseException {
ParsedNode parsedNode = parseToNode(physicalChangeLogLocation, changeLogParameters, resourceAccessor);
if (parsedNode == null) {
return null;
}
DatabaseChangeLog changeLog = new DatabaseChangeLog(DatabaseChangeLog.normalizePath(physicalChangeLogLocation));
changeLog.setChangeLogParameters(changeLogParameters);
try {
changeLog.load(parsedNode, resourceAccessor);
} catch (Exception e) {
throw new ChangeLogParseException(e);
}
return changeLog;
}
use of liquibase.changelog.DatabaseChangeLog in project liquibase by liquibase.
the class ValidatingVisitorTest method visit_validateError.
@Test
public void visit_validateError() throws Exception {
changeSet1.addChange(new CreateTableChange() {
@Override
public ValidationErrors validate(Database database) {
ValidationErrors changeValidationErrors = new ValidationErrors();
changeValidationErrors.addError("Test message");
return changeValidationErrors;
}
});
List<RanChangeSet> ran = new ArrayList<RanChangeSet>();
ValidatingVisitor handler = new ValidatingVisitor(ran);
handler.visit(changeSet1, new DatabaseChangeLog(), null, null);
assertEquals(1, handler.getValidationErrors().getErrorMessages().size());
assertTrue(handler.getValidationErrors().getErrorMessages().get(0).startsWith("Test message"));
assertFalse(handler.validationPassed());
}
use of liquibase.changelog.DatabaseChangeLog in project liquibase by liquibase.
the class OracleIntegrationTest method sqlplusChangelog.
@Test
public void sqlplusChangelog() throws Exception {
Database database = this.getDatabase();
assumeNotNull(database);
Liquibase liquibase = createLiquibase(this.customExecutorChangeLog);
clearDatabase();
//
// Add a visitor so we can assert
//
DatabaseChangeLog changeLog = liquibase.getDatabaseChangeLog();
for (ChangeSet changeSet : changeLog.getChangeSets()) {
changeSet.addSqlVisitor(new TestSqlVisitor());
}
try {
liquibase.update(this.contexts);
} catch (ValidationFailedException e) {
e.printDescriptiveError(System.out);
throw e;
}
database.commit();
}
Aggregations