Search in sources :

Example 1 with ValidatingVisitor

use of liquibase.changelog.visitor.ValidatingVisitor in project liquibase by liquibase.

the class DatabaseChangeLog method validate.

public void validate(Database database, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException {
    ChangeLogIterator logIterator = new ChangeLogIterator(this, new DbmsChangeSetFilter(database), new ContextChangeSetFilter(contexts), new LabelChangeSetFilter(labelExpression));
    ValidatingVisitor validatingVisitor = new ValidatingVisitor(database.getRanChangeSetList());
    validatingVisitor.validate(database, this);
    logIterator.run(validatingVisitor, new RuntimeEnvironment(database, contexts, labelExpression));
    for (String message : validatingVisitor.getWarnings().getMessages()) {
        LogFactory.getLogger().warning(message);
    }
    if (!validatingVisitor.validationPassed()) {
        throw new ValidationFailedException(validatingVisitor);
    }
}
Also used : LabelChangeSetFilter(liquibase.changelog.filter.LabelChangeSetFilter) ValidatingVisitor(liquibase.changelog.visitor.ValidatingVisitor) RuntimeEnvironment(liquibase.RuntimeEnvironment) ValidationFailedException(liquibase.exception.ValidationFailedException) ContextChangeSetFilter(liquibase.changelog.filter.ContextChangeSetFilter) DbmsChangeSetFilter(liquibase.changelog.filter.DbmsChangeSetFilter)

Aggregations

RuntimeEnvironment (liquibase.RuntimeEnvironment)1 ContextChangeSetFilter (liquibase.changelog.filter.ContextChangeSetFilter)1 DbmsChangeSetFilter (liquibase.changelog.filter.DbmsChangeSetFilter)1 LabelChangeSetFilter (liquibase.changelog.filter.LabelChangeSetFilter)1 ValidatingVisitor (liquibase.changelog.visitor.ValidatingVisitor)1 ValidationFailedException (liquibase.exception.ValidationFailedException)1