Search in sources :

Example 6 with XMLChangeLogSAXParser

use of liquibase.parser.core.xml.XMLChangeLogSAXParser in project liquibase by liquibase.

the class ChangeLogParserFactoryTest method getExtensionParser.

@Test
public void getExtensionParser() throws Exception {
    ChangeLogParserFactory parserFactory = ChangeLogParserFactory.getInstance();
    ChangeLogParser defaultParser = parserFactory.getParser("asdf.xml", new JUnitResourceAccessor());
    assertNotNull(defaultParser);
    assertTrue(defaultParser instanceof XMLChangeLogSAXParser);
    ChangeLogParser otherXmlParser = new XMLChangeLogSAXParser() {

        @Override
        public int getPriority() {
            return 100;
        }
    };
    parserFactory.register(otherXmlParser);
    try {
        assertTrue(otherXmlParser == parserFactory.getParser("asdf.xml", new JUnitResourceAccessor()));
        assertFalse(defaultParser == parserFactory.getParser("asdf.xml", new JUnitResourceAccessor()));
    } finally {
        parserFactory.unregister(otherXmlParser);
    }
}
Also used : SqlChangeLogParser(liquibase.parser.core.sql.SqlChangeLogParser) JUnitResourceAccessor(liquibase.test.JUnitResourceAccessor) XMLChangeLogSAXParser(liquibase.parser.core.xml.XMLChangeLogSAXParser) Test(org.junit.Test)

Example 7 with XMLChangeLogSAXParser

use of liquibase.parser.core.xml.XMLChangeLogSAXParser in project liquibase by liquibase.

the class IntXMLChangeLogSAXParserTest method sampleChangeLogs.

@Test
public void sampleChangeLogs() throws Exception {
    new XMLChangeLogSAXParser().parse("changelogs/cache/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/db2/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/derby/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/firebird/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/h2/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/hsqldb/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/maxdb/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/mysql/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/oracle/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/pgsql/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/sybase/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/asany/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
    new XMLChangeLogSAXParser().parse("changelogs/unsupported/complete/root.changelog.xml", new ChangeLogParameters(), new JUnitResourceAccessor());
}
Also used : ChangeLogParameters(liquibase.changelog.ChangeLogParameters) JUnitResourceAccessor(liquibase.test.JUnitResourceAccessor) XMLChangeLogSAXParser(liquibase.parser.core.xml.XMLChangeLogSAXParser) Test(org.junit.Test)

Example 8 with XMLChangeLogSAXParser

use of liquibase.parser.core.xml.XMLChangeLogSAXParser in project liquibase by liquibase.

the class ChangeLogParserFactoryTest method getParser_byExtension.

@Test
public void getParser_byExtension() throws Exception {
    ChangeLogParserFactory.getInstance().getParsers().clear();
    XMLChangeLogSAXParser xmlChangeLogParser = new XMLChangeLogSAXParser();
    ChangeLogParserFactory.getInstance().register(xmlChangeLogParser);
    ChangeLogParserFactory.getInstance().register(new SqlChangeLogParser());
    ChangeLogParser parser = ChangeLogParserFactory.getInstance().getParser("xml", new JUnitResourceAccessor());
    assertNotNull(parser);
    assertTrue(xmlChangeLogParser == parser);
}
Also used : SqlChangeLogParser(liquibase.parser.core.sql.SqlChangeLogParser) SqlChangeLogParser(liquibase.parser.core.sql.SqlChangeLogParser) ChangeLogParser(liquibase.parser.ChangeLogParser) JUnitResourceAccessor(liquibase.test.JUnitResourceAccessor) XMLChangeLogSAXParser(liquibase.parser.core.xml.XMLChangeLogSAXParser) Test(org.junit.Test)

Aggregations

XMLChangeLogSAXParser (liquibase.parser.core.xml.XMLChangeLogSAXParser)8 Test (org.junit.Test)8 SqlChangeLogParser (liquibase.parser.core.sql.SqlChangeLogParser)7 JUnitResourceAccessor (liquibase.test.JUnitResourceAccessor)6 ChangeLogParser (liquibase.parser.ChangeLogParser)3 ChangeLogParameters (liquibase.changelog.ChangeLogParameters)1 ChangeLogParseException (liquibase.exception.ChangeLogParseException)1 ChangeLogParserFactory (liquibase.parser.ChangeLogParserFactory)1