Search in sources :

Example 31 with ChangeSet

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

the class CountChangeSetFilterTest method acceptsOneCorrectly.

@Test
public void acceptsOneCorrectly() {
    CountChangeSetFilter filter = new CountChangeSetFilter(1);
    assertTrue(filter.accepts(new ChangeSet("a1", "b1", false, false, "c1", null, null, null)).isAccepted());
    assertFalse(filter.accepts(new ChangeSet("a2", "b2", false, false, "c2", null, null, null)).isAccepted());
}
Also used : ChangeSet(liquibase.changelog.ChangeSet) Test(org.junit.Test)

Example 32 with ChangeSet

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

the class CountChangeSetFilterTest method acceptsZeroCorrectly.

@Test
public void acceptsZeroCorrectly() {
    CountChangeSetFilter filter = new CountChangeSetFilter(0);
    assertFalse(filter.accepts(new ChangeSet("a1", "b1", false, false, "c1", null, null, null)).isAccepted());
    assertFalse(filter.accepts(new ChangeSet("a2", "b2", false, false, "c2", null, null, null)).isAccepted());
}
Also used : ChangeSet(liquibase.changelog.ChangeSet) Test(org.junit.Test)

Example 33 with ChangeSet

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

the class ExecutedAfterChangeSetFilterTest method accepts_noRan.

@Test
public void accepts_noRan() throws Exception {
    ExecutedAfterChangeSetFilter filter = new ExecutedAfterChangeSetFilter(new Date(), new ArrayList<RanChangeSet>());
    assertFalse(filter.accepts(new ChangeSet("1", "testAuthor", false, false, "path/changelog", null, null, null)).isAccepted());
}
Also used : RanChangeSet(liquibase.changelog.RanChangeSet) ChangeSet(liquibase.changelog.ChangeSet) Date(java.util.Date) RanChangeSet(liquibase.changelog.RanChangeSet) Test(org.junit.Test)

Example 34 with ChangeSet

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

the class ExecutedAfterChangeSetFilterTest method accepts_nullDate.

@Test
public void accepts_nullDate() throws Exception {
    ArrayList<RanChangeSet> ranChanges = new ArrayList<RanChangeSet>();
    ranChanges.add(new RanChangeSet("path/changelog", "1", "testAuthor", CheckSum.parse("12345"), new Date(), null, null, null, null, null, null, null));
    ranChanges.add(new RanChangeSet("path/changelog", "2", "testAuthor", CheckSum.parse("12345"), null, null, null, null, null, null, null, null));
    ranChanges.add(new RanChangeSet("path/changelog", "3", "testAuthor", CheckSum.parse("12345"), new Date(), null, null, null, null, null, null, null));
    ExecutedAfterChangeSetFilter filter = new ExecutedAfterChangeSetFilter(new Date(), ranChanges);
    assertFalse(filter.accepts(new ChangeSet("1", "testAuthor", false, false, "path/changelog", null, null, null)).isAccepted());
}
Also used : ArrayList(java.util.ArrayList) RanChangeSet(liquibase.changelog.RanChangeSet) ChangeSet(liquibase.changelog.ChangeSet) Date(java.util.Date) RanChangeSet(liquibase.changelog.RanChangeSet) Test(org.junit.Test)

Example 35 with ChangeSet

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

the class ExecutedAfterChangeSetFilterTest method accepts.

@Test
public void accepts() throws Exception {
    ArrayList<RanChangeSet> ranChanges = new ArrayList<RanChangeSet>();
    ranChanges.add(new RanChangeSet("path/changelog", "1", "testAuthor", CheckSum.parse("12345"), new Date(new Date().getTime() - (10 * 1000 * 60 * 60)), null, null, null, null, null, null, null));
    ranChanges.add(new RanChangeSet("path/changelog", "2", "testAuthor", CheckSum.parse("12345"), new Date(new Date().getTime() - (8 * 1000 * 60 * 60)), null, null, null, null, null, null, null));
    ranChanges.add(new RanChangeSet("path/changelog", "3", "testAuthor", CheckSum.parse("12345"), new Date(new Date().getTime() - (4 * 1000 * 60 * 60)), null, null, null, null, null, null, null));
    ExecutedAfterChangeSetFilter filter = new ExecutedAfterChangeSetFilter(new Date(new Date().getTime() - (6 * 1000 * 60 * 60)), ranChanges);
    assertFalse(filter.accepts(new ChangeSet("1", "testAuthor", false, false, "path/changelog", null, null, null)).isAccepted());
    assertFalse(filter.accepts(new ChangeSet("2", "testAuthor", false, false, "path/changelog", null, null, null)).isAccepted());
    assertTrue(filter.accepts(new ChangeSet("3", "testAuthor", false, false, "path/changelog", null, null, null)).isAccepted());
}
Also used : ArrayList(java.util.ArrayList) RanChangeSet(liquibase.changelog.RanChangeSet) ChangeSet(liquibase.changelog.ChangeSet) Date(java.util.Date) RanChangeSet(liquibase.changelog.RanChangeSet) 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