Search in sources :

Example 1 with JUnitResourceAccessor

use of liquibase.test.JUnitResourceAccessor 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 2 with JUnitResourceAccessor

use of liquibase.test.JUnitResourceAccessor 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 {
        assertSame(otherXmlParser, parserFactory.getParser("asdf.xml", new JUnitResourceAccessor()));
        assertNotSame(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 3 with JUnitResourceAccessor

use of liquibase.test.JUnitResourceAccessor in project liquibase by liquibase.

the class ChangeLogParserFactoryTest method getParsers.

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

Example 4 with JUnitResourceAccessor

use of liquibase.test.JUnitResourceAccessor in project liquibase by liquibase.

the class ChangeLogParserFactoryTest method getParser_byFile.

@Test
public void getParser_byFile() throws Exception {
    ChangeLogParserFactory.getInstance().unregisterAllParsers();
    assumeThat(ChangeLogParserFactory.getInstance().getParsers(), empty());
    XMLChangeLogSAXParser xmlChangeLogParser = new XMLChangeLogSAXParser();
    ChangeLogParserFactory.getInstance().register(xmlChangeLogParser);
    ChangeLogParserFactory.getInstance().register(new SqlChangeLogParser());
    ChangeLogParser parser = ChangeLogParserFactory.getInstance().getParser("path/to/a/file.xml", new JUnitResourceAccessor());
    assertNotNull(parser);
    assertSame(xmlChangeLogParser, parser);
}
Also used : SqlChangeLogParser(liquibase.parser.core.sql.SqlChangeLogParser) MockChangeLogParser(liquibase.parser.MockChangeLogParser) SqlChangeLogParser(liquibase.parser.core.sql.SqlChangeLogParser) ChangeLogParser(liquibase.parser.ChangeLogParser) JUnitResourceAccessor(liquibase.test.JUnitResourceAccessor) XMLChangeLogSAXParser(liquibase.parser.core.xml.XMLChangeLogSAXParser) Test(org.junit.Test)

Example 5 with JUnitResourceAccessor

use of liquibase.test.JUnitResourceAccessor in project liquibase by liquibase.

the class ChangeLogParserFactoryTest method getParser_noneMatching.

@Test(expected = UnknownChangelogFormatException.class)
public void getParser_noneMatching() throws Exception {
    ChangeLogParserFactory.getInstance().unregisterAllParsers();
    XMLChangeLogSAXParser xmlChangeLogParser = new XMLChangeLogSAXParser();
    ChangeLogParserFactory.getInstance().register(xmlChangeLogParser);
    ChangeLogParserFactory.getInstance().register(new SqlChangeLogParser());
    ChangeLogParserFactory.getInstance().getParser("badextension", new JUnitResourceAccessor());
}
Also used : SqlChangeLogParser(liquibase.parser.core.sql.SqlChangeLogParser) JUnitResourceAccessor(liquibase.test.JUnitResourceAccessor) XMLChangeLogSAXParser(liquibase.parser.core.xml.XMLChangeLogSAXParser) Test(org.junit.Test)

Aggregations

JUnitResourceAccessor (liquibase.test.JUnitResourceAccessor)11 Test (org.junit.Test)11 XMLChangeLogSAXParser (liquibase.parser.core.xml.XMLChangeLogSAXParser)6 SqlChangeLogParser (liquibase.parser.core.sql.SqlChangeLogParser)5 Database (liquibase.database.Database)3 MockChangeLogParser (liquibase.parser.MockChangeLogParser)3 ArrayList (java.util.ArrayList)2 ChangeLogParameters (liquibase.changelog.ChangeLogParameters)2 ChangeLogParser (liquibase.parser.ChangeLogParser)2 SqlStatement (liquibase.statement.SqlStatement)2 Contexts (liquibase.Contexts)1 LabelExpression (liquibase.LabelExpression)1 RuntimeEnvironment (liquibase.RuntimeEnvironment)1 Change (liquibase.change.Change)1 ChangeFactory (liquibase.change.ChangeFactory)1 ChangeMetaData (liquibase.change.ChangeMetaData)1 ChangeParameterMetaData (liquibase.change.ChangeParameterMetaData)1 LoadDataColumnConfig (liquibase.change.core.LoadDataColumnConfig)1 ChangeLogIterator (liquibase.changelog.ChangeLogIterator)1 ChangeSet (liquibase.changelog.ChangeSet)1