Package liquibase.statement.core

Examples of liquibase.statement.core.MockSqlStatement


    @Test
    public void generateSql_nullGenerators() {
        SqlGeneratorChain chain = new SqlGeneratorChain(null);

        assertNull(chain.generateSql(new MockSqlStatement(), new MockDatabase()));
    }
View Full Code Here


    @Test
    public void generateSql_noGenerators() {
        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        SqlGeneratorChain chain = new SqlGeneratorChain(generators);

        assertEquals(0, chain.generateSql(new MockSqlStatement(), new MockDatabase()).length);
    }
View Full Code Here

    public void generateSql_oneGenerators() {
        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(1, "A1", "A2"));
        SqlGeneratorChain chain = new SqlGeneratorChain(generators);

        Sql[] sql = chain.generateSql(new MockSqlStatement(), new MockDatabase());
        assertEquals(2, sql.length);
        assertEquals("A1", sql[0].toSql());
        assertEquals("A2", sql[1].toSql());
    }
View Full Code Here

        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(2, "B1", "B2"));
        generators.add(new MockSqlGenerator(1, "A1", "A2"));
        SqlGeneratorChain chain = new SqlGeneratorChain(generators);

        Sql[] sql = chain.generateSql(new MockSqlStatement(), new MockDatabase());
        assertEquals(4, sql.length);
        assertEquals("B1", sql[0].toSql());
        assertEquals("B2", sql[1].toSql());
        assertEquals("A1", sql[2].toSql());
        assertEquals("A2", sql[3].toSql());
View Full Code Here

        generators.add(new MockSqlGenerator(2, "B1", "B2"));
        generators.add(new MockSqlGenerator(1, "A1", "A2"));
        generators.add(new MockSqlGenerator(3, "C1", "C2"));
        SqlGeneratorChain chain = new SqlGeneratorChain(generators);

        Sql[] sql = chain.generateSql(new MockSqlStatement(), new MockDatabase());
        assertEquals(6, sql.length);
        assertEquals("C1", sql[0].toSql());
        assertEquals("C2", sql[1].toSql());
        assertEquals("B1", sql[2].toSql());
        assertEquals("B2", sql[3].toSql());
View Full Code Here

    }

    @Test
    public void validate_nullGenerators() {
        SqlGeneratorChain chain = new SqlGeneratorChain(null);
        ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
        assertFalse(validationErrors.hasErrors());
    }
View Full Code Here

    public void validate_oneGenerators_noErrors() {
        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(1, "A1", "A2"));

        SqlGeneratorChain chain = new SqlGeneratorChain(generators);
        ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
        assertFalse(validationErrors.hasErrors());
    }
View Full Code Here

    public void validate_oneGenerators_hasErrors() {
        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(1, "A1", "A2").addValidationError("E1"));

        SqlGeneratorChain chain = new SqlGeneratorChain(generators);
        ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
        assertTrue(validationErrors.hasErrors());
    }
View Full Code Here

        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(2, "B1", "B2"));
        generators.add(new MockSqlGenerator(1, "A1", "A2"));

        SqlGeneratorChain chain = new SqlGeneratorChain(generators);
        ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
        assertFalse(validationErrors.hasErrors());
    }
View Full Code Here

        SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
        generators.add(new MockSqlGenerator(2, "B1", "B2").addValidationError("E1"));
        generators.add(new MockSqlGenerator(1, "A1", "A2"));

        SqlGeneratorChain chain = new SqlGeneratorChain(generators);
        ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
        assertTrue(validationErrors.hasErrors());
    }
View Full Code Here

TOP

Related Classes of liquibase.statement.core.MockSqlStatement

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.