Search in sources :

Example 1 with SerializeToOutputStream

use of org.apache.axiom.ts.dimension.serialization.SerializeToOutputStream in project webservices-axiom by apache.

the class TestSerializeOMDataSourceWritingToOutputStream method runTest.

@Override
protected void runTest() throws Throwable {
    OMDataSourceImpl ds = new OMDataSourceImpl();
    OMFactory factory = metaFactory.getOMFactory();
    OMSourcedElement element = factory.createOMElement(ds);
    OMElement elementToSerialize;
    if (serializeParent) {
        OMElement parent = factory.createOMElement("root", null);
        parent.addChild(element);
        elementToSerialize = parent;
    } else {
        elementToSerialize = element;
    }
    assertAbout(xml()).that(serializationStrategy.serialize(elementToSerialize).getInputSource()).hasSameContentAs(serializeParent ? "<root><test xmlns='urn:test'/></root>" : "<test xmlns='urn:test'/>");
    assertThat(ds.isOutputStreamUsed()).isEqualTo(serializationStrategy instanceof SerializeToOutputStream);
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) SerializeToOutputStream(org.apache.axiom.ts.dimension.serialization.SerializeToOutputStream) OMElement(org.apache.axiom.om.OMElement) OMSourcedElement(org.apache.axiom.om.OMSourcedElement)

Aggregations

OMElement (org.apache.axiom.om.OMElement)1 OMFactory (org.apache.axiom.om.OMFactory)1 OMSourcedElement (org.apache.axiom.om.OMSourcedElement)1 SerializeToOutputStream (org.apache.axiom.ts.dimension.serialization.SerializeToOutputStream)1