Package liquibase.sdk.executor

Examples of liquibase.sdk.executor.MockExecutor


   
    @Test
    public void executeRollbackStatements_WithStatementsOverload_ShouldNotIncludeAppendTextFromApplyToRollbackFalseVisitor() throws Exception {
        Database database = getDatabase();
       
        final MockExecutor mockExecutor = new MockExecutor();
       
        ExecutorService.getInstance().setExecutor(database, mockExecutor);
       
        final List<SqlVisitor> sqlVisitors = new ArrayList<SqlVisitor>();
       
        final SqlStatement dropTableStatement = new DropTableStatement(null, null, "test_table", false);
       
        final AppendSqlVisitor appendSqlVisitor = new AppendSqlVisitor();
        appendSqlVisitor.setApplyToRollback(false);
        appendSqlVisitor.setValue(" SHOULD NOT BE APPENDED");
       
        sqlVisitors.add(appendSqlVisitor);
               
        database.executeRollbackStatements(new SqlStatement[] {dropTableStatement}, sqlVisitors);

        assertEquals("DROP TABLE test_table;", mockExecutor.getRanSql().trim());       
    }
View Full Code Here


    @Test
    public void executeRollbackStatements_WithStatementsOverload_ShouldIncludeAppendTextFromApplyToRollbackTrueVisitor() throws Exception {
        Database database = getDatabase();
       
        final MockExecutor mockExecutor = new MockExecutor();
       
        ExecutorService.getInstance().setExecutor(database, mockExecutor);
       
        final List<SqlVisitor> sqlVisitors = new ArrayList<SqlVisitor>();
       
        final SqlStatement dropTableStatement = new DropTableStatement(null, null, "test_table", false);       
       
        final AppendSqlVisitor appendSqlVisitor = new AppendSqlVisitor();
       
        appendSqlVisitor.setApplyToRollback(true);
        appendSqlVisitor.setValue(" SHOULD BE APPENDED");
       
        sqlVisitors.add(appendSqlVisitor);
               
        database.executeRollbackStatements(new SqlStatement[] {dropTableStatement}, sqlVisitors);

        assertEquals("DROP TABLE test_table SHOULD BE APPENDED;", mockExecutor.getRanSql().trim());
    }
View Full Code Here

   
    @Test
    public void executeRollbackStatements_WithChangeOverload_ShouldNotIncludeAppendTextFromApplyToRollbackFalseVisitor() throws Exception {
        Database database = getDatabase();
       
        final MockExecutor mockExecutor = new MockExecutor();
       
        ExecutorService.getInstance().setExecutor(database, mockExecutor);
       
        final List<SqlVisitor> sqlVisitors = new ArrayList<SqlVisitor>();
       
        final CreateTableChange change = new CreateTableChange();
        change.setTableName("test_table");
       
        final AppendSqlVisitor appendSqlVisitor = new AppendSqlVisitor();
        appendSqlVisitor.setApplyToRollback(false);
        appendSqlVisitor.setValue(" SHOULD NOT BE APPENDED");
       
        sqlVisitors.add(appendSqlVisitor);
               
        database.executeRollbackStatements(change, sqlVisitors);

        assertEquals("DROP TABLE test_table;", mockExecutor.getRanSql().trim());
    }
View Full Code Here

    @Test
    public void executeRollbackStatements_WithChangeOverload_ShouldIncludeAppendTextFromApplyToRollbackTrueVisitor() throws Exception {
        Database database = getDatabase();
       
        final MockExecutor mockExecutor = new MockExecutor();
       
        ExecutorService.getInstance().setExecutor(database, mockExecutor);
       
        final List<SqlVisitor> sqlVisitors = new ArrayList<SqlVisitor>();
       
        final CreateTableChange change = new CreateTableChange();
        change.setTableName("test_table");
       
        final AppendSqlVisitor appendSqlVisitor = new AppendSqlVisitor();
       
        appendSqlVisitor.setApplyToRollback(true);
        appendSqlVisitor.setValue(" SHOULD BE APPENDED");
       
        sqlVisitors.add(appendSqlVisitor);
               
        database.executeRollbackStatements(change, sqlVisitors);

        assertEquals("DROP TABLE test_table SHOULD BE APPENDED;", mockExecutor.getRanSql().trim());
    }
View Full Code Here

TOP

Related Classes of liquibase.sdk.executor.MockExecutor

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.