use of liquibase.parser.core.sql.SqlChangeLogParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method unregister_instance.
@Test
public void unregister_instance() {
ChangeLogParserFactory factory = ChangeLogParserFactory.getInstance();
factory.getParsers().clear();
assertEquals(5, factory.getParsers().size());
XMLChangeLogSAXParser changeLogParser = new XMLChangeLogSAXParser();
factory.register(new SqlChangeLogParser());
factory.register(changeLogParser);
assertEquals(7, factory.getParsers().size());
factory.unregister(changeLogParser);
assertEquals(6, factory.getParsers().size());
}
use of liquibase.parser.core.sql.SqlChangeLogParser 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);
}
use of liquibase.parser.core.sql.SqlChangeLogParser 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());
}
use of liquibase.parser.core.sql.SqlChangeLogParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method unregister_instance.
@Test
public void unregister_instance() {
ChangeLogParserFactory factory = ChangeLogParserFactory.getInstance();
factory.unregisterAllParsers();
assumeThat(ChangeLogParserFactory.getInstance().getParsers(), empty());
ChangeLogParser mockChangeLogParser = new MockChangeLogParser(".test");
factory.register(new XMLChangeLogSAXParser());
factory.register(mockChangeLogParser);
factory.register(new SqlChangeLogParser());
assertEquals(3, factory.getParsers().size());
factory.unregister(mockChangeLogParser);
assertEquals(2, factory.getParsers().size());
}
use of liquibase.parser.core.sql.SqlChangeLogParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method getParser_byExtension.
@Test
public void getParser_byExtension() 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("xml", new JUnitResourceAccessor());
assertNotNull(parser);
assertSame(xmlChangeLogParser, parser);
}
Aggregations