use of liquibase.parser.MockChangeLogParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method getParser_shouldNotGiveAbilityToChangeParsers.
@Test
public void getParser_shouldNotGiveAbilityToChangeParsers() {
ChangeLogParserFactory factory = ChangeLogParserFactory.getInstance();
MockChangeLogParser mockChangeLogParser = new MockChangeLogParser();
factory.getParsers().add(mockChangeLogParser);
assertThat(factory.getParsers(), not(hasItem(mockChangeLogParser)));
}
use of liquibase.parser.MockChangeLogParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method register.
@Test
public void register() {
ChangeLogParserFactory.getInstance().unregisterAllParsers();
assumeThat(ChangeLogParserFactory.getInstance().getParsers(), empty());
ChangeLogParserFactory.getInstance().register(new MockChangeLogParser(".test"));
assertEquals(1, ChangeLogParserFactory.getInstance().getParsers().size());
}
use of liquibase.parser.MockChangeLogParser 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.MockChangeLogParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method unregisterAllParsers_ShouldRemoveAllParsers.
@Test
public void unregisterAllParsers_ShouldRemoveAllParsers() {
ChangeLogParserFactory factory = ChangeLogParserFactory.getInstance();
factory.register(new MockChangeLogParser());
assumeThat(factory.getParsers(), not(empty()));
factory.unregisterAllParsers();
assertThat(factory.getParsers(), empty());
}
use of liquibase.parser.MockChangeLogParser in project liquibase by liquibase.
the class ChangeLogParserFactoryTest method getParser_shouldAssumePriority.
@Test
public void getParser_shouldAssumePriority() throws Exception {
ChangeLogParserFactory factory = ChangeLogParserFactory.getInstance();
MockChangeLogParser higherPriorityParser = new MockChangeLogParser("banana") {
@Override
public int getPriority() {
return Integer.MAX_VALUE;
}
};
factory.register(new MockChangeLogParser("banana"));
factory.register(higherPriorityParser);
assertEquals(higherPriorityParser, factory.getParser("banana", new JUnitResourceAccessor()));
}
Aggregations