use of liquibase.parser.core.xml.XMLChangeLogSAXParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method unregister_instance.
@Test
public void unregister_instance() {
ChangeLogParserFactory factory = ChangeLogParserFactory.getInstance();
factory.getParsers().clear();
assertEquals(0, factory.getParsers().size());
ChangeLogParser mockChangeLogParser = new MockChangeLogParser();
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.xml.XMLChangeLogSAXParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method getParser_noneMatching.
@Test
public void getParser_noneMatching() throws Exception {
ChangeLogParserFactory.getInstance().getParsers().clear();
ChangeLogParserFactory.getInstance().getParsers().clear();
XMLChangeLogSAXParser xmlChangeLogParser = new XMLChangeLogSAXParser();
ChangeLogParserFactory.getInstance().register(xmlChangeLogParser);
ChangeLogParserFactory.getInstance().register(new SqlChangeLogParser());
try {
ChangeLogParserFactory.getInstance().getParser("badextension", new JUnitResourceAccessor());
fail("Did not throw an exception");
} catch (Exception e) {
//what we want
}
}
use of liquibase.parser.core.xml.XMLChangeLogSAXParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method getParser_byFile.
@Test
public void getParser_byFile() throws Exception {
ChangeLogParserFactory.getInstance().getParsers().clear();
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);
assertTrue(xmlChangeLogParser == parser);
}
use of liquibase.parser.core.xml.XMLChangeLogSAXParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method unregister_instance.
@Test
public void unregister_instance() {
ChangeLogParserFactory factory = ChangeLogParserFactory.getInstance();
factory.getParsers().clear();
assertEquals(0, factory.getParsers().size());
XMLChangeLogSAXParser changeLogParser = new XMLChangeLogSAXParser();
factory.register(new SqlChangeLogParser());
factory.register(changeLogParser);
assertEquals(2, factory.getParsers().size());
factory.unregister(changeLogParser);
assertEquals(1, factory.getParsers().size());
}
use of liquibase.parser.core.xml.XMLChangeLogSAXParser 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);
}
Aggregations