use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class RenameViewGenerator method validate.
@Override
public ValidationErrors validate(RenameViewStatement renameViewStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("oldViewName", renameViewStatement.getOldViewName());
validationErrors.checkRequiredField("newViewName", renameViewStatement.getNewViewName());
validationErrors.checkDisallowedField("schemaName", renameViewStatement.getSchemaName(), database, OracleDatabase.class);
return validationErrors;
}
use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class SetColumnRemarksGenerator method validate.
@Override
public ValidationErrors validate(SetColumnRemarksStatement setColumnRemarksStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("tableName", setColumnRemarksStatement.getTableName());
validationErrors.checkRequiredField("columnName", setColumnRemarksStatement.getColumnName());
return validationErrors;
}
use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class ValidatingVisitorTest method visit_torunOnly.
@Test
public void visit_torunOnly() 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>();
ran.add(new RanChangeSet(changeSet1));
ValidatingVisitor handler = new ValidatingVisitor(ran);
handler.visit(changeSet1, new DatabaseChangeLog(), null, null);
assertEquals(0, handler.getSetupExceptions().size());
assertTrue(handler.validationPassed());
}
use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class MockSqlGenerator method validate.
@Override
public ValidationErrors validate(SqlStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = sqlGeneratorChain.validate(statement, database);
validationErrors.addAll(errors);
return validationErrors;
}
use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class SqlGeneratorChainTest method validate_twoGenerators_noErrors.
@Test
public void validate_twoGenerators_noErrors() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
generators.add(new MockSqlGenerator(2, "B1", "B2"));
generators.add(new MockSqlGenerator(1, "A1", "A2"));
SqlGeneratorChain chain = new SqlGeneratorChain(generators);
ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
assertFalse(validationErrors.hasErrors());
}
Aggregations