Search in sources :

Example 1 with XMLChangeLogSerializer

use of liquibase.serializer.core.xml.XMLChangeLogSerializer in project liquibase by liquibase.

the class ChangeLogSerializerFactoryTest method unregister_instance.

@Test
public void unregister_instance() {
    ChangeLogSerializerFactory factory = ChangeLogSerializerFactory.getInstance();
    factory.getSerializers().clear();
    assertEquals(0, factory.getSerializers().size());
    XMLChangeLogSerializer changeLogSerializer = new XMLChangeLogSerializer();
    factory.register(new StringChangeLogSerializer());
    factory.register(changeLogSerializer);
    assertEquals(2, factory.getSerializers().size());
    factory.unregister(changeLogSerializer);
    assertEquals(1, factory.getSerializers().size());
}
Also used : StringChangeLogSerializer(liquibase.serializer.core.string.StringChangeLogSerializer) XMLChangeLogSerializer(liquibase.serializer.core.xml.XMLChangeLogSerializer) Test(org.junit.Test)

Example 2 with XMLChangeLogSerializer

use of liquibase.serializer.core.xml.XMLChangeLogSerializer in project liquibase by liquibase.

the class ChangeLogSerializerFactoryTest method highestPrioritySerializerReturned.

@Test
public void highestPrioritySerializerReturned() {
    ChangeLogSerializerFactory factory = ChangeLogSerializerFactory.getInstance();
    XMLChangeLogSerializer highestPriority = new XMLChangeLogSerializer() {

        @Override
        public int getPriority() {
            return super.getPriority() + 4;
        }
    };
    factory.register(highestPriority);
    XMLChangeLogSerializer higherPriority = new XMLChangeLogSerializer() {

        @Override
        public int getPriority() {
            return super.getPriority() + 1;
        }
    };
    factory.register(higherPriority);
    assertSame(highestPriority, factory.getSerializer("xml"));
    assertEquals(3, factory.getSerializers().get("xml").size());
}
Also used : XMLChangeLogSerializer(liquibase.serializer.core.xml.XMLChangeLogSerializer) Test(org.junit.Test)

Aggregations

XMLChangeLogSerializer (liquibase.serializer.core.xml.XMLChangeLogSerializer)2 Test (org.junit.Test)2 StringChangeLogSerializer (liquibase.serializer.core.string.StringChangeLogSerializer)1