当前位置: 首页>>代码示例>>Java>>正文


Java ChangeLogParserFactory类代码示例

本文整理汇总了Java中liquibase.parser.ChangeLogParserFactory的典型用法代码示例。如果您正苦于以下问题:Java ChangeLogParserFactory类的具体用法?Java ChangeLogParserFactory怎么用?Java ChangeLogParserFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ChangeLogParserFactory类属于liquibase.parser包,在下文中一共展示了ChangeLogParserFactory类的34个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: update

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
public void update(String contexts) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    LockService lockService = LockService.getInstance(database);
    lockService.waitForLock();

    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    try {
        DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);

        checkDatabaseChangeLogTable(true, changeLog, contexts);

        changeLog.validate(database, contexts);
        ChangeLogIterator changeLogIterator = getStandardChangelogIterator(contexts, changeLog);

        changeLogIterator.run(new UpdateVisitor(database), database);
    } finally {
        try {
            lockService.releaseLock();
        } catch (LockException e) {
            log.severe("Could not release lock", e);
        }
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:25,代码来源:Liquibase.java


示例2: rollback

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
public void rollback(String tagToRollBackTo, String contexts) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    LockService lockService = LockService.getInstance(database);
    lockService.waitForLock();

    try {

        DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);
        checkDatabaseChangeLogTable(false, changeLog, contexts);

        changeLog.validate(database, contexts);

        List<RanChangeSet> ranChangeSetList = database.getRanChangeSetList();
        ChangeLogIterator logIterator = new ChangeLogIterator(ranChangeSetList, changeLog,
                new AfterTagChangeSetFilter(tagToRollBackTo, ranChangeSetList),
                new AlreadyRanChangeSetFilter(ranChangeSetList),
                new ContextChangeSetFilter(contexts),
                new DbmsChangeSetFilter(database));

        logIterator.run(new RollbackVisitor(database), database);
    } finally {
        lockService.releaseLock();
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:27,代码来源:Liquibase.java


示例3: changeLogSync

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
public void changeLogSync(String contexts) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    LockService lockService = LockService.getInstance(database);
    lockService.waitForLock();

    try {
        DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);
        checkDatabaseChangeLogTable(true, changeLog, contexts);
        changeLog.validate(database, contexts);

        ChangeLogIterator logIterator = new ChangeLogIterator(changeLog,
                new NotRanChangeSetFilter(database.getRanChangeSetList()),
                new ContextChangeSetFilter(contexts),
                new DbmsChangeSetFilter(database));

        logIterator.run(new ChangeLogSyncVisitor(database), database);
    } finally {
        lockService.releaseLock();
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:23,代码来源:Liquibase.java


示例4: markNextChangeSetRan

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
public void markNextChangeSetRan(String contexts) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    LockService lockService = LockService.getInstance(database);
    lockService.waitForLock();

    try {
        DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);
        checkDatabaseChangeLogTable(false, changeLog, contexts);
        changeLog.validate(database, contexts);

        ChangeLogIterator logIterator = new ChangeLogIterator(changeLog,
                new NotRanChangeSetFilter(database.getRanChangeSetList()),
                new ContextChangeSetFilter(contexts),
                new DbmsChangeSetFilter(database),
                new CountChangeSetFilter(1));

        logIterator.run(new ChangeLogSyncVisitor(database), database);
    } finally {
        lockService.releaseLock();
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:24,代码来源:Liquibase.java


示例5: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
	if (connection == null) {
		return;
	}

	Database database = liquiBase.getDatabase();
	ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

	ChangeLogParameters changeLogParameters = new ChangeLogParameters();

	DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
			changeLogParameters, resourceAccessor);

       liquiBase.checkLiquibaseTables(false, changeLog, new Contexts(), new LabelExpression());
	changeLog.validate(database);

	List<ChangeSet> changeSets = changeLog.getChangeSets();
	Change change = changeSets.get(0).getChanges().get(0);
	Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);

	String expected = "DROP SYNONYM new_synonym";
	assertEquals(expected, sql[0].toSql());
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:25,代码来源:DropSynonymTest.java


示例6: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
	if (connection == null) {
		return;
	}

	Database database = liquiBase.getDatabase();
	ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

	ChangeLogParameters changeLogParameters = new ChangeLogParameters();

	DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
			changeLogParameters, resourceAccessor);

       liquiBase.checkLiquibaseTables(false, changeLog, new Contexts(), new LabelExpression());
	changeLog.validate(database);

	List<ChangeSet> changeSets = changeLog.getChangeSets();
	Change change = changeSets.get(0).getChanges().get(0);
	Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);

	String expected = "CREATE SYNONYM new_synonym FOR object";
	assertEquals(expected, sql[0].toSql());
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:25,代码来源:CreateSynonymTest.java


示例7: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
	Database database = liquiBase.getDatabase();
	ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

	ChangeLogParameters changeLogParameters = new ChangeLogParameters();

	DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser( changeLogFile, resourceAccessor ).parse( changeLogFile, changeLogParameters, resourceAccessor );
	liquiBase.checkLiquibaseTables( true, changeLog, new Contexts() );
	changeLog.validate( database );

	List<ChangeSet> changeSets = changeLog.getChangeSets();

	List<String> expectedQuery = new ArrayList<String>();

	expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview1 AS select 1 as One from dual", database.getLiquibaseSchemaName() ) );
	expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview2 AS select * from mytable", database.getLiquibaseSchemaName() ) );
	expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview2 AS select * from mytable where rownum = 1", database.getLiquibaseSchemaName() ) );
	expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview4 AS select 1 as One from dual", database.getLiquibaseSchemaName() ) );
	expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview3 AS select * from mytable", database.getLiquibaseSchemaName() ) );
	expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview3 AS select * from mytable where one like '%%'", database.getLiquibaseSchemaName() ) );
	expectedQuery.add( String.format( "Drop materialized view myview2" ) );

	int i = 0;
	for ( ChangeSet changeSet : changeSets ) {
		for ( Change change : changeSet.getChanges() ) {
			Sql[] sql = SqlGeneratorFactory.getInstance().generateSql( change.generateStatements( database )[0], database );
			
			if ( change instanceof CreateFlexibleViewChange ) {
				for ( Sql s : sql ) {
					System.out.println( "--------------------------------------------------------------------------------------------------------" );
					System.out.println( "ACTUAL: " + s.toSql() );
					System.out.println( "EXPECT: " + expectedQuery.get( i ) );
					assertEquals( expectedQuery.get( i ), s.toSql() );
					i++;
				}
			}
		}
	}
}
 
开发者ID:mrswadge,项目名称:liquibase-flexibleview,代码行数:41,代码来源:CreateFlexibleViewTest.java


示例8: handleIncludedChangeLog

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
protected boolean handleIncludedChangeLog(String fileName,
		boolean isRelativePath, String relativeBaseFileName)
		throws LiquibaseException {
	if (!(fileName.endsWith(".xml") || fileName.endsWith(".sql"))) {
		log.debug(relativeBaseFileName + "/" + fileName
				+ " is not a recognized file type");
		return false;
	}

       if (fileName.equalsIgnoreCase(".svn") || fileName.equalsIgnoreCase("cvs")) {
           return false;
       }

	if (isRelativePath) {
		// workaround for FilenameUtils.normalize() returning null for relative paths like ../conf/liquibase.xml
		String tempFile = FilenameUtils.concat(FilenameUtils.getFullPath(relativeBaseFileName), fileName);
		if(tempFile != null && new File(tempFile).exists() == true) {
			fileName = tempFile;
		} else {
			fileName = FilenameUtils.getFullPath(relativeBaseFileName) + fileName;
		}
	}
	DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(fileName, resourceAccessor).parse(fileName, changeLogParameters,
					resourceAccessor);
	PreconditionContainer preconditions = changeLog.getPreconditions();
	if (preconditions != null) {
		if (null == databaseChangeLog.getPreconditions()) {
			databaseChangeLog.setPreconditions(new PreconditionContainer());
		}
		databaseChangeLog.getPreconditions().addNestedPrecondition(
				preconditions);
	}
	for (ChangeSet changeSet : changeLog.getChangeSets()) {
		handleChangeSet(changeSet);
	}

	return true;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:39,代码来源:XMLChangeLogSAXHandler.java


示例9: listUnrunChangeSets

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
public List<ChangeSet> listUnrunChangeSets(String contexts) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);

    changeLog.validate(database, contexts);

    ChangeLogIterator logIterator = getStandardChangelogIterator(contexts, changeLog);

    ListVisitor visitor = new ListVisitor();
    logIterator.run(visitor, database);
    return visitor.getSeenChangeSets();
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:15,代码来源:Liquibase.java


示例10: calculateCheckSum

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
public CheckSum calculateCheckSum(final String filename, final String id, final String author) throws LiquibaseException {
    log.info(String.format("Calculating checksum for changeset %s::%s::%s", filename, id, author));
    final ChangeLogParameters changeLogParameters = this.getChangeLogParameters();
    final ResourceAccessor resourceAccessor = this.getFileOpener();
    final DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(this.changeLogFile, resourceAccessor).parse(this.changeLogFile, changeLogParameters, resourceAccessor);

    // TODO: validate?

    final ChangeSet changeSet = changeLog.getChangeSet(filename, author, id);
    if (changeSet == null) {
      throw new LiquibaseException(new IllegalArgumentException("No such changeSet: " + filename + "::" + id + "::" + author));
    }

    return changeSet.generateCheckSum();
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:16,代码来源:Liquibase.java


示例11: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("CREATE TABLE LBUSER.person (id NUMBER(10), name VARCHAR2(50))");
    expectedQuery.add("INSERT INTO LBUSER.person (id, name) VALUES ('1', 'James')");
    expectedQuery.add("ALTER TABLE LBUSER.person RENAME TO Tperson");
    expectedQuery.add("CREATE OR REPLACE VIEW LBUSER.person AS SELECT * FROM Tperson");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);

            assertEquals(expectedQuery.get(i), sql[0].toSql());
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:39,代码来源:EncapsulateTableWithViewTest.java


示例12: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("ALTER TRIGGER zuiolTrigger RENAME TO RenamedZuiolTrigger");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 4) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:37,代码来源:RenameTriggerTest.java


示例13: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("ALTER TABLE LBUSER.test DISABLE CONSTRAINT tom_check");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 2) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:37,代码来源:DisableConstraintChangeTest.java


示例14: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();
    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery
            .add("CREATE TRIGGER zuiolTrigger before INSERT ON TriggerTest FOR EACH ROW DECLARE v_username varchar2(10); BEGIN SELECT pierwsza INTO v_username FROM TriggerTest; :new.created_by := v_username; END;");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 2) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:37,代码来源:CreateTriggerTest.java


示例15: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
	if (connection == null) {
		return;
	}

	Database database = liquiBase.getDatabase();
	ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

	ChangeLogParameters changeLogParameters = new ChangeLogParameters();

	DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);

	changeLog.validate(database);

	List<ChangeSet> changeSets = changeLog.getChangeSets();

	List<String> expectedQuery = new ArrayList<String>();

	expectedQuery.add("CREATE TABLE LBUSER.AddDeferredPrimaryKeyTest (id NUMBER(10), name VARCHAR2(50))");
	expectedQuery.add("ALTER TABLE LBUSER.AddDeferredPrimaryKeyTest ADD CONSTRAINT PK_AddDeferredPrimaryKeyTest PRIMARY KEY (id) DEFERRABLE INITIALLY DEFERRED");

	int i = 0;

	for (ChangeSet changeSet : changeSets) {
		for (Change change : changeSet.getChanges()) {
			Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
			assertEquals(expectedQuery.get(i), sql[0].toSql());
		}
		i++;
	}
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:33,代码来源:AddDeferredPrimaryKeyChangeTest.java


示例16: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);
    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery
            .add("declare commit_interval  integer; sleep_seconds integer; c integer; begin commit_interval := 5; sleep_seconds := 1; c := 1; while c > 0 loop UPDATE LongUpdateTest SET name='checked' where name='test' and rownum <= 5; c := SQL%ROWCOUNT; COMMIT; dbms_lock.sleep(1); end loop; end;");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 2) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:36,代码来源:LongUpdateTest.java


示例17: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("Drop materialized view zuiolView");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 5) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:37,代码来源:DropMaterializedViewTest.java


示例18: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("CREATE MATERIALIZED VIEW zuiolView AS select * from Table1");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 4) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:37,代码来源:CreateMaterializedViewTest.java


示例19: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }
    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("SET TRANSACTION NAME 'zuiolTransaction'");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            // if(i == 2)
            assertEquals(expectedQuery.get(i), sql[0].toSql());
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:35,代码来源:SetTransactionTest.java


示例20: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("CREATE TABLE LBUSER.truncatetest (id NUMBER(10), name VARCHAR2(50))");
    expectedQuery.add("insert into truncatetest (id, name) values (1, 'dgolda')");
    expectedQuery.add("TRUNCATE TABLE LBUSER.truncatetest PURGE MATERIALIZED VIEW LOG REUSE STORAGE");
    // expectedQuery.add("TRUNCATE TABLE artur.truncatetest PURGE MATERIALIZED VIEW LOG REUSE STORAGE");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            // Change change = changeSet.getChanges().get(0);
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);

            assertEquals(expectedQuery.get(i), sql[0].toSql());
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:40,代码来源:TruncateChangeTest.java


示例21: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }
    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance()
    		.getParser(changeLogFile, resourceAccessor)
    		.parse(changeLogFile, new ChangeLogParameters(), resourceAccessor);

    liquiBase.checkLiquibaseTables( false, changeLog, new Contexts(), new LabelExpression());

    changeLog.validate(database);

    List<String> expectedSql = new ArrayList<String>();
    expectedSql.add("BEGIN DBMS_MVIEW.REFRESH('TABLE1_MVIEW','?',ATOMIC_REFRESH=>TRUE); END;");
    expectedSql.add("BEGIN DBMS_MVIEW.REFRESH('TABLE1_MVIEW','C',ATOMIC_REFRESH=>FALSE); END;");
    expectedSql.add("BEGIN DBMS_MVIEW.REFRESH('LIQUIBASE.TABLE1_MVIEW','?',ATOMIC_REFRESH=>FALSE); END;");

    List<ChangeSet> changeSets = changeLog.getChangeSets();
    assertEquals( "Test is out of sync with the changelog.test.xml file.  # of changesets",
    		6, changeSets.size());
    ChangeSet changeSet = changeSets.get(changeSets.size()-1);
    assertEquals( "Test is out of sync with the changelog.test.xml file.  # of changes in changeset", 3, changeSet.getChanges().size() );

    List<String> actualSql = new ArrayList<String>();

    for (Change change : changeSet.getChanges()) {
        Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
        assertEquals( "Wrong number of SQL statements generated", 1, sql.length );
        actualSql.add(sql[0].toSql());
    }

    assertEquals( "Generated SQL statements incorrect", expectedSql, actualSql );
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:38,代码来源:RefreshMaterializedViewTest.java


示例22: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("ALTER TABLE LBUSER.test drop CONSTRAINT tom_check");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 1) {
                assertEquals(expectedQuery.get(i - 1), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:37,代码来源:DropCheckChangeTest.java


示例23: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new FileSystemResourceAccessor("src/test/java");

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);

    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    // expectedQuery.add("ALTER TABLE addcheck ADD CONSTRAINT tom_check CHECK(id between 0 and 5 ) DEFERRABLE INITIALLY DEFERRED DISABLE");
    // expectedQuery.add("ALTER TABLE addcheck ADD CONSTRAINT tom_check1 CHECK(id between 10 and 15) ENABLE");
    expectedQuery.add("ALTER TABLE LBUSER.addcheck ADD CHECK(id between 0 and 5 ) DEFERRABLE INITIALLY DEFERRED DISABLE");

    ChangeSet changeSet = changeSets.get(1);
    Change change = changeSet.getChanges().get(0);
    Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
    assertEquals(expectedQuery.get(0), sql[0].toSql());
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:31,代码来源:AddCheckChangeTest.java


示例24: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new FileSystemResourceAccessor("src/test/java");

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();

    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance()
    		.getParser(changeLogFile, resourceAccessor)
    		.parse(changeLogFile,changeLogParameters, resourceAccessor);

    changeLog.validate(database);

    List<ChangeSet> changeSets = changeLog.getChangeSets();
    assertEquals( "number of changesets in the " + changeLogFile + " is incorrect", 2, changeSets.size() );
    ChangeSet changeSet = changeSets.get(1);

    assertEquals("Wrong number of changes found in changeset", 1, changeSet.getChanges().size());
    Change change = changeSet.getChanges().get(0);

    List<String> expectedQueries = new ArrayList<String>();
    expectedQueries.add("GRANT SELECT,UPDATE,INSERT,DELETE ON LIQUIBASE.addgrant TO SYSTEM");

    Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
    assertEquals( "wrong number of statements generated", expectedQueries.size(), sql.length );
    assertEquals(expectedQueries.get(0), sql[0].toSql());
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:32,代码来源:GrantObjectPermissionChangeTest.java


示例25: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new FileSystemResourceAccessor("src/test/java");

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();

    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance()
    		.getParser(changeLogFile, resourceAccessor)
    		.parse(changeLogFile,changeLogParameters, resourceAccessor);

    changeLog.validate(database);

    List<ChangeSet> changeSets = changeLog.getChangeSets();
    assertEquals( "number of changesets in the " + changeLogFile + " is incorrect", 3, changeSets.size() );
    ChangeSet changeSet = changeSets.get(2);

    assertEquals("Wrong number of changes found in changeset", 1, changeSet.getChanges().size());
    Change change = changeSet.getChanges().get(0);

    List<String> expectedQueries = new ArrayList<String>();
    expectedQueries.add("REVOKE UPDATE,INSERT,DELETE ON LIQUIBASE.addgrant FROM SYSTEM");

    Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
    assertEquals( "wrong number of statements generated", expectedQueries.size(), sql.length );
    assertEquals(expectedQueries.get(0), sql[0].toSql());
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:32,代码来源:RevokeObjectPermissionChangeTest.java


示例26: loadChangeLog

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
private DatabaseChangeLog loadChangeLog(String filename) throws Exception {
    ChangeLogParserFactory parserFactory = ChangeLogParserFactory.getInstance();
    ChangeLogParser parser = parserFactory.getParser(filename, resourceAccessor);
    return parser.parse(filename, new ChangeLogParameters(), resourceAccessor);
}
 
开发者ID:adangel,项目名称:liquibase-percona,代码行数:6,代码来源:ChangeLogParserTest.java


示例27: futureRollbackSQL

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
public void futureRollbackSQL(Integer count, String contexts, Writer output) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    LoggingExecutor outputTemplate = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);
    Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);
    ExecutorService.getInstance().setExecutor(database, outputTemplate);

    outputHeader("SQL to roll back currently unexecuted changes");

    LockService lockService = LockService.getInstance(database);
    lockService.waitForLock();

    try {
        DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);
        checkDatabaseChangeLogTable(false, changeLog, contexts);
        changeLog.validate(database, contexts);

        ChangeLogIterator logIterator;
        if (count == null) {
            logIterator = new ChangeLogIterator(changeLog,
                    new NotRanChangeSetFilter(database.getRanChangeSetList()),
                    new ContextChangeSetFilter(contexts),
                    new DbmsChangeSetFilter(database));
        } else {
            ChangeLogIterator forwardIterator = new ChangeLogIterator(changeLog,
                    new NotRanChangeSetFilter(database.getRanChangeSetList()),
                    new ContextChangeSetFilter(contexts),
                    new DbmsChangeSetFilter(database),
                    new CountChangeSetFilter(count));
            final ListVisitor listVisitor = new ListVisitor();
            forwardIterator.run(listVisitor, database);

            logIterator = new ChangeLogIterator(changeLog,
                    new NotRanChangeSetFilter(database.getRanChangeSetList()),
                    new ContextChangeSetFilter(contexts),
                    new DbmsChangeSetFilter(database),
                    new ChangeSetFilter() {
                        public boolean accepts(ChangeSet changeSet) {
                            return listVisitor.getSeenChangeSets().contains(changeSet);
                        }
                    });
        }

        logIterator.run(new RollbackVisitor(database), database);
    } finally {
        lockService.releaseLock();
        ExecutorService.getInstance().setExecutor(database, oldTemplate);
    }

    try {
        output.flush();
    } catch (IOException e) {
        throw new LiquibaseException(e);
    }

}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:58,代码来源:Liquibase.java


示例28: generateDocumentation

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
public void generateDocumentation(String outputDirectory, String contexts) throws LiquibaseException {
        contexts = StringUtils.trimToNull(contexts);
        log.info("Generating Database Documentation");
        changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));
        LockService lockService = LockService.getInstance(database);
        lockService.waitForLock();

        try {
            DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);
            checkDatabaseChangeLogTable(false, changeLog, null);

            String[] splitContexts = null;
            if (StringUtils.trimToNull(contexts) != null) {
                splitContexts = contexts.split(",");
            }
            changeLog.validate(database, splitContexts);

            ChangeLogIterator logIterator = new ChangeLogIterator(changeLog,
                    new DbmsChangeSetFilter(database));

            DBDocVisitor visitor = new DBDocVisitor(database);
            logIterator.run(visitor, database);

            visitor.writeHTML(new File(outputDirectory), resourceAccessor);
        } catch (IOException e) {
            throw new LiquibaseException(e);
        } finally {
            lockService.releaseLock();
        }

//        try {
//            if (!LockService.getExecutor(database).waitForLock()) {
//                return;
//            }
//
//            DBDocChangeLogHandler changeLogHandler = new DBDocChangeLogHandler(outputDirectory, this, changeLogFile,resourceAccessor);
//            runChangeLogs(changeLogHandler);
//
//            changeLogHandler.writeHTML(this);
//        } finally {
//            releaseLock();
//        }
    }
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:44,代码来源:Liquibase.java


示例29: validate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
/**
 * Checks changelogs for bad MD5Sums and preconditions before attempting a migration
 */
public void validate() throws LiquibaseException {

    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);
    changeLog.validate(database);
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:9,代码来源:Liquibase.java


示例30: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {

    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("ALTER TRIGGER RenamedZuiolTrigger DISABLE");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 5) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:38,代码来源:DisableTriggerTest.java


示例31: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {

    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("DROP TRIGGER LBUSER.zuiolTrigger");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 4) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:38,代码来源:DropTriggerTest.java


示例32: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {

    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("ALTER TRIGGER RenamedZuiolTrigger ENABLE");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 5) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }
        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:38,代码来源:EnableTriggerTest.java


示例33: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("MERGE INTO LBUSER.myTable2 USING LBUSER.myTable ON (myTable2.pid=myTable.pid) WHEN MATCHED THEN UPDATE SET myTable2.sales=myTable2.sales+myTable.sales,myTable2.status=myTable.status DELETE WHERE (myTable2.status='OBS') WHEN NOT MATCHED THEN INSERT VALUES(myTable.pid,myTable.sales,'OLD')");

    int i = 0;

    for (ChangeSet changeSet : changeSets) {
        for (Change change : changeSet.getChanges()) {
            Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
            if (i == 3) {
                assertEquals(expectedQuery.get(0), sql[0].toSql());
            }

        }
        i++;
    }
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:38,代码来源:MergeChangeTest.java


示例34: parseAndGenerate

import liquibase.parser.ChangeLogParserFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {

    if (connection == null) {
        return;
    }

    Database database = liquiBase.getDatabase();
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();

    ChangeLogParameters changeLogParameters = new ChangeLogParameters();


    DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
            changeLogParameters, resourceAccessor);

    changeLog.validate(database);


    List<ChangeSet> changeSets = changeLog.getChangeSets();

    List<String> expectedQuery = new ArrayList<String>();

    expectedQuery.add("ALTER TABLE LBUSER.test ENABLE CONSTRAINT tom_check");

    ChangeSet changeSet = changeSets.get(2);
    Change change = changeSet.getChanges().get(0);
    Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);

    assertEquals(expectedQuery.get(0), sql[0].toSql());
}
 
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:32,代码来源:EnableCheckChangeTest.java



注:本文中的liquibase.parser.ChangeLogParserFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。