Package liquibase.precondition.core

Examples of liquibase.precondition.core.PreconditionContainer


    }

    @Override
    public void setPreconditions(PreconditionContainer precond) {
        if (precond == null) {
            this.preconditionContainer = new PreconditionContainer();
        } else {
            preconditionContainer = precond;
        }
    }
View Full Code Here


                }
            }

            includeAll(path, node.getChildValue(null, "relativeToChangelogFile", false), resourceFilter, getStandardChangeLogComparator(), resourceAccessor);
        } else if (nodeName.equals("preConditions")) {
            this.preconditionContainer = new PreconditionContainer();
            try {
                this.preconditionContainer.load(node, resourceAccessor);
            } catch (ParsedNodeException e) {
                e.printStackTrace();
            }
View Full Code Here

            changeLog = ChangeLogParserFactory.getInstance().getParser(fileName, resourceAccessor).parse(fileName, changeLogParameters, resourceAccessor);
        } catch (UnknownChangelogFormatException e) {
            LogFactory.getInstance().getLog().warning("included file " + relativeBaseFileName + "/" + fileName + " is not a recognized file type");
            return false;
        }
        PreconditionContainer preconditions = changeLog.getPreconditions();
        if (preconditions != null) {
            if (null == this.getPreconditions()) {
                this.setPreconditions(new PreconditionContainer());
            }
            this.getPreconditions().addNestedPrecondition(preconditions);
        }
        for (ChangeSet changeSet : changeLog.getChangeSets()) {
            this.changeSets.add(changeSet);
View Full Code Here

                                String body = preconditionsMatcher.group(1);
                                Matcher onFailMatcher = onFailPattern.matcher(body);
                                Matcher onErrorMatcher = onErrorPattern.matcher(body);
                                Matcher onUpdateSqlMatcher = onUpdateSqlPattern.matcher(body);

                                PreconditionContainer pc = new PreconditionContainer();
                                pc.setOnFail(StringUtils.trimToNull(parseString(onFailMatcher)));
                                pc.setOnError(StringUtils.trimToNull(parseString(onErrorMatcher)));
                                pc.setOnSqlOutput(StringUtils.trimToNull(parseString(onUpdateSqlMatcher)));
                                changeSet.setPreconditions(pc);
                            }
                        } else if (preconditionMatcher.matches()) {
                            if (changeSet.getPreconditions() == null) {
                                // create the defaults
                                changeSet.setPreconditions(new PreconditionContainer());
                            }
                            if (preconditionMatcher.groupCount() == 2) {
                                String name = StringUtils.trimToNull(preconditionMatcher.group(1));
                                if (name != null) {
                                    String body = preconditionMatcher.group(2).trim();
View Full Code Here

                }
            }


        } else if (child.getName().equals("preConditions")) {
            this.preconditions = new PreconditionContainer();
            try {
                this.preconditions.load(child, resourceAccessor);
            } catch (ParsedNodeException e) {
                e.printStackTrace();
            }
View Full Code Here

     * validated because oracle supports creating sequences.
     */
    @Test
    public void testPreconditionForOracleOnOracleWithChangeLog() {
        // create the pre condition
        PreconditionContainer preCondition = new PreconditionContainer();
        preCondition.setOnFail(PreconditionContainer.FailOption.MARK_RAN.toString());

        DBMSPrecondition dbmsPrecondition = new DBMSPrecondition();
        dbmsPrecondition.setType("oracle");
        preCondition.addNestedPrecondition(dbmsPrecondition);

        changeSet1.setPreconditions(preCondition);

        OracleDatabase oracleDb = new OracleDatabase() {
            @Override
View Full Code Here

     * giving a MSSQL database.
     */
    @Test
    public void testPreConditionsForOracleOnMSSQLWithPreconditionTag() {
        // create the pre condition
        PreconditionContainer preCondition = new PreconditionContainer();
        preCondition.setOnFail(PreconditionContainer.FailOption.MARK_RAN.toString());

        DBMSPrecondition dbmsPrecondition = new DBMSPrecondition();
        dbmsPrecondition.setType("oracle");
        preCondition.addNestedPrecondition(dbmsPrecondition);

        changeSet1.setPreconditions(preCondition);


        MSSQLDatabase mssqlDb = new MSSQLDatabase() {
            @Override
            public List<RanChangeSet> getRanChangeSetList() throws DatabaseException {
                return new ArrayList<RanChangeSet>();
            }

            @Override
            public void rollback() throws DatabaseException {
                //super.rollback();
            }
        };

        boolean failedExceptionThrown = false;
        boolean errorExceptionThrown = false;
        try {
            preCondition.check(mssqlDb, changeLog, changeSet1);
        } catch (PreconditionFailedException ex) {
            failedExceptionThrown = true;
        } catch (PreconditionErrorException ex) {
            errorExceptionThrown = true;
        }
View Full Code Here

     */

    @Test
    public void testPreConditionsForOracleOnMSSQLWithChangeLog() {
        // create the pre condition
        PreconditionContainer preCondition = new PreconditionContainer();
        preCondition.setOnFail(PreconditionContainer.FailOption.MARK_RAN.toString());

        DBMSPrecondition dbmsPrecondition = new DBMSPrecondition();
        dbmsPrecondition.setType("oracle");
        preCondition.addNestedPrecondition(dbmsPrecondition);

        changeSet1.setPreconditions(preCondition);

        MSSQLDatabase mssqlDb = new MSSQLDatabase() {
            @Override
View Full Code Here

        }
    }

    public void validate(Database database, DatabaseChangeLog changeLog) {
        this.database = database;
        PreconditionContainer preconditions = changeLog.getPreconditions();
        try {
            if (preconditions == null) {
                return;
            }
            preconditions.check(database, changeLog, null);
        } catch (PreconditionFailedException e) {
            LogFactory.getLogger().debug("Precondition Failed: "+e.getMessage(), e);
            failedPreconditions.addAll(e.getFailedPreconditions());
        } catch (PreconditionErrorException e) {
            LogFactory.getLogger().debug("Precondition Error: "+e.getMessage(), e);
View Full Code Here

TOP

Related Classes of liquibase.precondition.core.PreconditionContainer

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.