Search in sources :

Example 36 with ChangeSet

use of liquibase.changelog.ChangeSet in project liquibase by liquibase.

the class ValidatingVisitorPreConditionsTest method setUp.

/**
 * Create a DatabaseChangelog, one changeset, and a create sequence change
 */
@Before
public void setUp() {
    changeLog = new DatabaseChangeLog();
    changeSet1 = new ChangeSet("1", "testAuthor", false, false, "path/changelog", null, null, null);
    changeLog.addChangeSet(changeSet1);
    CreateTableChange change1 = new CreateTableChange();
    change1.setTableName("valid_test");
    change1.addColumn(new ColumnConfig().setName("id").setType("int"));
    changeSet1.addChange(change1);
}
Also used : ColumnConfig(liquibase.change.ColumnConfig) CreateTableChange(liquibase.change.core.CreateTableChange) RanChangeSet(liquibase.changelog.RanChangeSet) ChangeSet(liquibase.changelog.ChangeSet) DatabaseChangeLog(liquibase.changelog.DatabaseChangeLog) Before(org.junit.Before)

Example 37 with ChangeSet

use of liquibase.changelog.ChangeSet in project liquibase by liquibase.

the class DbmsChangeSetFilterTest method singleDbms.

// @Test
// public void emptyDbms() {
// DbmsChangeSetFilter filter = new DbmsChangeSetFilter();
// 
// assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, "mysql")));
// assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, "oracle")));
// assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, "oracle, mysql")));
// assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, null)));
// }
@Test
public void singleDbms() {
    DbmsChangeSetFilter filter = new DbmsChangeSetFilter(new MySQLDatabase());
    assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, "mysql", null)).isAccepted());
    assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, "mysql, oracle", null)).isAccepted());
    assertFalse(filter.accepts(new ChangeSet(null, null, false, false, null, null, "oracle", null)).isAccepted());
    assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, null, null)).isAccepted());
    assertFalse(filter.accepts(new ChangeSet(null, null, false, false, null, null, "h2,!mysql", null)).isAccepted());
}
Also used : MySQLDatabase(liquibase.database.core.MySQLDatabase) ChangeSet(liquibase.changelog.ChangeSet) Test(org.junit.Test)

Example 38 with ChangeSet

use of liquibase.changelog.ChangeSet in project liquibase by liquibase.

the class ChangeLogSyncVisitorTest method setUp.

@Before
public void setUp() {
    changeSet = new ChangeSet("1", "testAuthor", false, false, "path/changelog", null, null, null);
    databaseChangeLog = new DatabaseChangeLog();
}
Also used : ChangeSet(liquibase.changelog.ChangeSet) DatabaseChangeLog(liquibase.changelog.DatabaseChangeLog) Before(org.junit.Before)

Example 39 with ChangeSet

use of liquibase.changelog.ChangeSet in project liquibase by liquibase.

the class ContextChangeSetFilterTest method nullListContexts.

@Test
public void nullListContexts() {
    ContextChangeSetFilter filter = new ContextChangeSetFilter();
    assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, "test1", null, null)).isAccepted());
    assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, "test2", null, null)).isAccepted());
    assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, "test1, test2", null, null)).isAccepted());
    assertTrue(filter.accepts(new ChangeSet(null, null, false, false, null, null, null, null)).isAccepted());
}
Also used : ChangeSet(liquibase.changelog.ChangeSet) Test(org.junit.Test)

Example 40 with ChangeSet

use of liquibase.changelog.ChangeSet in project liquibase by liquibase.

the class ContextChangeSetFilterTest method visitorContextFilterLowerLower.

@Test
public void visitorContextFilterLowerLower() {
    ContextChangeSetFilter filter = new ContextChangeSetFilter(new Contexts("test1"));
    ChangeSet changeSet = new ChangeSet(null, null, false, false, null, null, null, null);
    changeSet.addSqlVisitor(new TestSqlVisitor("test1"));
    assertTrue(filter.accepts(changeSet).isAccepted());
    assertEquals(1, changeSet.getSqlVisitors().size());
}
Also used : Contexts(liquibase.Contexts) ChangeSet(liquibase.changelog.ChangeSet) Test(org.junit.Test)

Aggregations

ChangeSet (liquibase.changelog.ChangeSet)72 Test (org.junit.Test)41 Contexts (liquibase.Contexts)12 DatabaseChangeLog (liquibase.changelog.DatabaseChangeLog)11 RanChangeSet (liquibase.changelog.RanChangeSet)10 Liquibase (liquibase.Liquibase)9 Change (liquibase.change.Change)9 Database (liquibase.database.Database)9 LiquibaseException (liquibase.exception.LiquibaseException)8 ArrayList (java.util.ArrayList)7 DiffOutputControl (liquibase.diff.output.DiffOutputControl)7 DiffToChangeLog (liquibase.diff.output.changelog.DiffToChangeLog)7 ObjectQuotingStrategy (liquibase.database.ObjectQuotingStrategy)6 DiffResult (liquibase.diff.DiffResult)6 CompareControl (liquibase.diff.compare.CompareControl)6 IOException (java.io.IOException)5 Sql (liquibase.sql.Sql)5 MarkChangeSetRanStatement (liquibase.statement.core.MarkChangeSetRanStatement)5 Date (java.util.Date)4 Labels (liquibase.Labels)4