Package liquibase.exception

Examples of liquibase.exception.ValidationErrors


    public void validate_oneGenerators_hasErrors() {
        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(1, "A1", "A2").addValidationError("E1"));

        SqlGeneratorChain chain = new SqlGeneratorChain(generators);
        ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
        assertTrue(validationErrors.hasErrors());
    }
View Full Code Here


        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());
    }
View Full Code Here

        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(2, "B1", "B2").addValidationError("E1"));
        generators.add(new MockSqlGenerator(1, "A1", "A2"));

        SqlGeneratorChain chain = new SqlGeneratorChain(generators);
        ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
        assertTrue(validationErrors.hasErrors());
    }
View Full Code Here

        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(2, "B1", "B2"));
        generators.add(new MockSqlGenerator(1, "A1", "A2").addValidationError("E1"));

        SqlGeneratorChain chain = new SqlGeneratorChain(generators);
        ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
        assertTrue(validationErrors.hasErrors());
    }
View Full Code Here

                    serializedValue = formatParameter(paramValue);
                    state.addComment("Change Parameter: " + param.getParameterName() + "=" + serializedValue);
                    param.setValue(change, paramValue);
                }

                ValidationErrors errors = change.validate(database);
                assertFalse("Validation errors for " + changeMetaData.getName() + " on " + database.getShortName() + ": " + errors.toString(), errors.hasErrors());

                SqlStatement[] sqlStatements = change.generateStatements(database);
                for (SqlStatement statement : sqlStatements) {
                    Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(statement, database);
                    if (sql == null) {
View Full Code Here

                        state.addComment("Optional Change Parameter: "+ param.getParameterName()+"="+ serializedValue);
                        param.setValue(change, paramValue);

                    }

                    ValidationErrors errors = change.validate(database);
                    assertFalse("Validation errors for " + changeMetaData.getName() + " on "+database.getShortName()+": " +errors.toString(), errors.hasErrors());
//
//                    SqlStatement[] sqlStatements = change.generateStatements(database);
//                    for (SqlStatement statement : sqlStatements) {
//                        Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(statement, database);
//                        if (sql == null) {
View Full Code Here

        return (!(database instanceof SQLiteDatabase));
    }

    @Override
    public ValidationErrors validate(AddForeignKeyConstraintStatement addForeignKeyConstraintStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
        ValidationErrors validationErrors = new ValidationErrors();

        if ((addForeignKeyConstraintStatement.isInitiallyDeferred() || addForeignKeyConstraintStatement.isDeferrable()) && !database.supportsInitiallyDeferrableColumns()) {
            validationErrors.checkDisallowedField("initiallyDeferred", addForeignKeyConstraintStatement.isInitiallyDeferred(), database);
            validationErrors.checkDisallowedField("deferrable", addForeignKeyConstraintStatement.isDeferrable(), database);
        }

        validationErrors.checkRequiredField("baseColumnNames", addForeignKeyConstraintStatement.getBaseColumnNames());
        validationErrors.checkRequiredField("baseTableNames", addForeignKeyConstraintStatement.getBaseTableName());
        validationErrors.checkRequiredField("referencedColumnNames", addForeignKeyConstraintStatement.getReferencedColumnNames());
        validationErrors.checkRequiredField("referencedTableName", addForeignKeyConstraintStatement.getReferencedTableName());
        validationErrors.checkRequiredField("constraintName", addForeignKeyConstraintStatement.getConstraintName());

        return validationErrors;
    }
View Full Code Here

        return database instanceof PostgresDatabase;
    }

    @Override
    public ValidationErrors validate(FindForeignKeyConstraintsStatement findForeignKeyConstraintsStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
        ValidationErrors validationErrors = new ValidationErrors();
        validationErrors.checkRequiredField("baseTableName", findForeignKeyConstraintsStatement.getBaseTableName());
        return validationErrors;
    }
View Full Code Here

        return (!(database instanceof SQLiteDatabase));
    }

    @Override
    public ValidationErrors validate(DropPrimaryKeyStatement dropPrimaryKeyStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
        ValidationErrors validationErrors = new ValidationErrors();
        validationErrors.checkRequiredField("tableName", dropPrimaryKeyStatement.getTableName());

        if (database instanceof FirebirdDatabase || database instanceof InformixDatabase) {
            validationErrors.checkRequiredField("constraintName", dropPrimaryKeyStatement.getConstraintName());
        }
   
        return validationErrors;
    }
View Full Code Here

        return (database instanceof SQLiteDatabase);
    }

    @Override
    public ValidationErrors validate(ReindexStatement reindexStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
        ValidationErrors validationErrors = new ValidationErrors();
        validationErrors.checkRequiredField("tableName", reindexStatement.getTableName());
        return validationErrors;
    }
View Full Code Here

TOP

Related Classes of liquibase.exception.ValidationErrors

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.