Search in sources :

Example 1 with ValidationFailedException

use of liquibase.exception.ValidationFailedException in project liquibase by liquibase.

the class H2IntegrationTest method runYamlChangelog.

@Test
public void runYamlChangelog() throws Exception {
    if (getDatabase() == null) {
        return;
    }
    Liquibase liquibase = createLiquibase(completeChangeLog);
    clearDatabase(liquibase);
    //run again to test changelog testing logic
    liquibase = createLiquibase("changelogs/yaml/common.tests.changelog.yaml");
    try {
        liquibase.update(this.contexts);
    } catch (ValidationFailedException e) {
        e.printDescriptiveError(System.out);
        throw e;
    }
}
Also used : Liquibase(liquibase.Liquibase) ValidationFailedException(liquibase.exception.ValidationFailedException) AbstractIntegrationTest(liquibase.dbtest.AbstractIntegrationTest) Test(org.junit.Test)

Example 2 with ValidationFailedException

use of liquibase.exception.ValidationFailedException in project liquibase by liquibase.

the class H2IntegrationTest method runJsonChangelog.

@Test
public void runJsonChangelog() throws Exception {
    if (getDatabase() == null) {
        return;
    }
    Liquibase liquibase = createLiquibase(completeChangeLog);
    clearDatabase(liquibase);
    //run again to test changelog testing logic
    liquibase = createLiquibase("changelogs/json/common.tests.changelog.json");
    try {
        liquibase.update(this.contexts);
    } catch (ValidationFailedException e) {
        e.printDescriptiveError(System.out);
        throw e;
    }
}
Also used : Liquibase(liquibase.Liquibase) ValidationFailedException(liquibase.exception.ValidationFailedException) AbstractIntegrationTest(liquibase.dbtest.AbstractIntegrationTest) Test(org.junit.Test)

Example 3 with ValidationFailedException

use of liquibase.exception.ValidationFailedException in project liquibase by liquibase.

the class OracleIntegrationTest method viewCreatedOnCorrectSchema.

@Test
public void viewCreatedOnCorrectSchema() throws Exception {
    if (this.getDatabase() == null) {
        return;
    }
    Liquibase liquibase = createLiquibase(this.viewOnSchemaChangeLog);
    clearDatabase(liquibase);
    try {
        liquibase.update(this.contexts);
    } catch (ValidationFailedException e) {
        e.printDescriptiveError(System.out);
        throw e;
    }
    Statement queryIndex = ((JdbcConnection) this.getDatabase().getConnection()).getUnderlyingConnection().createStatement();
    ResultSet indexOwner = queryIndex.executeQuery("SELECT owner FROM ALL_VIEWS WHERE view_name = 'V_BOOK2'");
    assertTrue(indexOwner.next());
    String owner = indexOwner.getString("owner");
    assertEquals("LIQUIBASEB", owner);
    // check that the automatically rollback now works too
    try {
        liquibase.rollback(new Date(0), this.contexts);
    } catch (ValidationFailedException e) {
        e.printDescriptiveError(System.out);
        throw e;
    }
}
Also used : Liquibase(liquibase.Liquibase) ValidationFailedException(liquibase.exception.ValidationFailedException) Statement(java.sql.Statement) ResultSet(java.sql.ResultSet) Date(java.util.Date) AbstractIntegrationTest(liquibase.dbtest.AbstractIntegrationTest) Test(org.junit.Test)

Example 4 with ValidationFailedException

use of liquibase.exception.ValidationFailedException in project liquibase by liquibase.

the class OracleIntegrationTest method smartDataLoad.

@Test
public void smartDataLoad() throws Exception {
    if (this.getDatabase() == null) {
        return;
    }
    Liquibase liquibase = createLiquibase("changelogs/common/smartDataLoad.changelog.xml");
    clearDatabase(liquibase);
    try {
        liquibase.update(this.contexts);
    } catch (ValidationFailedException e) {
        e.printDescriptiveError(System.out);
        throw e;
    }
    // check that the automatically rollback now works too
    try {
        liquibase.rollback(new Date(0), this.contexts);
    } catch (ValidationFailedException e) {
        e.printDescriptiveError(System.out);
        throw e;
    }
}
Also used : Liquibase(liquibase.Liquibase) ValidationFailedException(liquibase.exception.ValidationFailedException) Date(java.util.Date) AbstractIntegrationTest(liquibase.dbtest.AbstractIntegrationTest) Test(org.junit.Test)

Example 5 with ValidationFailedException

use of liquibase.exception.ValidationFailedException in project liquibase by liquibase.

the class AbstractIntegrationTest method runChangeLogFile.

protected void runChangeLogFile(String changeLogFile) throws Exception {
    Liquibase liquibase = createLiquibase(changeLogFile);
    clearDatabase(liquibase);
    //run again to test changelog testing logic
    liquibase = createLiquibase(changeLogFile);
    try {
        liquibase.update(this.contexts);
    } catch (ValidationFailedException e) {
        e.printDescriptiveError(System.out);
        throw e;
    }
}
Also used : Liquibase(liquibase.Liquibase) ValidationFailedException(liquibase.exception.ValidationFailedException)

Aggregations

ValidationFailedException (liquibase.exception.ValidationFailedException)11 Liquibase (liquibase.Liquibase)9 Test (org.junit.Test)8 AbstractIntegrationTest (liquibase.dbtest.AbstractIntegrationTest)6 Date (java.util.Date)4 ResultSet (java.sql.ResultSet)2 Statement (java.sql.Statement)2 DiffResult (liquibase.diff.DiffResult)2 CompareControl (liquibase.diff.compare.CompareControl)2 DiffOutputControl (liquibase.diff.output.DiffOutputControl)2 DiffToChangeLog (liquibase.diff.output.changelog.DiffToChangeLog)2 DiffToReport (liquibase.diff.output.report.DiffToReport)2 DatabaseSnapshot (liquibase.snapshot.DatabaseSnapshot)2 SnapshotControl (liquibase.snapshot.SnapshotControl)2 PooledDataSourceFactory (io.dropwizard.db.PooledDataSourceFactory)1 CatalogAndSchema (liquibase.CatalogAndSchema)1 RuntimeEnvironment (liquibase.RuntimeEnvironment)1 ContextChangeSetFilter (liquibase.changelog.filter.ContextChangeSetFilter)1 DbmsChangeSetFilter (liquibase.changelog.filter.DbmsChangeSetFilter)1 LabelChangeSetFilter (liquibase.changelog.filter.LabelChangeSetFilter)1