use of org.apache.axiom.om.OMCloneOptions in project webservices-axiom by apache.
the class TestCloneBinary method runTest.
@Override
protected void runTest() throws Throwable {
DataHandler dh = new DataHandler(new RandomDataSource(600613L, 4096));
StringReader rootPart = new StringReader("<root><xop:Include xmlns:xop='http://www.w3.org/2004/08/xop/include' href='cid:123456@example.org'/></root>");
DummyAttachmentAccessor attachmentAccessor = new DummyAttachmentAccessor("123456@example.org", dh);
OMElement root = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(), new StreamSource(rootPart), attachmentAccessor).getDocumentElement();
OMText text = (OMText) root.getFirstOMChild();
OMCloneOptions options = new OMCloneOptions();
options.setFetchDataHandlers(fetch);
OMText clone = (OMText) text.clone(options);
assertTrue(clone.isBinary());
assertEquals(fetch, attachmentAccessor.isLoaded());
assertSame(dh, clone.getDataHandler());
}
Aggregations