use of org.apache.axiom.soap.SOAPCloneOptions in project webservices-axiom by apache.
the class TestClone method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeader header = soapFactory.createSOAPHeader();
OMNamespace ns = soapFactory.createOMNamespace("urn:test", "p");
SOAPHeaderBlock unprocessedHeaderBlock = header.addHeaderBlock("unprocessed", ns);
SOAPHeaderBlock processedHeaderBlock = header.addHeaderBlock("processed", ns);
processedHeaderBlock.setProcessed();
SOAPCloneOptions options = new SOAPCloneOptions();
options.setPreserveModel(true);
options.setProcessedFlag(processed);
SOAPHeader clonedHeader = (SOAPHeader) header.clone(options);
checkProcessed(clonedHeader, unprocessedHeaderBlock);
checkProcessed(clonedHeader, processedHeaderBlock);
}
use of org.apache.axiom.soap.SOAPCloneOptions in project webservices-axiom by apache.
the class TestCloneProcessedWithoutPreservingModel method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeaderBlock headerBlock = soapFactory.createSOAPHeaderBlock("test", soapFactory.createOMNamespace("urn:test", "p"));
headerBlock.setProcessed();
OMElement clone = (OMElement) headerBlock.clone(new SOAPCloneOptions());
assertThat(clone).isNotInstanceOf(SOAPHeaderBlock.class);
}
use of org.apache.axiom.soap.SOAPCloneOptions in project webservices-axiom by apache.
the class CopyUtils method copy.
/**
* @deprecated This method has the same effect as calling
* {@link OMInformationItem#clone(OMCloneOptions)} on the source
* {@link SOAPEnvelope} with the following options enabled:
* <ul>
* <li>{@link OMCloneOptions#setFetchDataHandlers(boolean)}
* <li>{@link OMCloneOptions#setPreserveModel(boolean)}
* <li>{@link OMCloneOptions#setCopyOMDataSources(boolean)}
* </ul>
* Instead of using this method, application code should use
* {@link OMInformationItem#clone(OMCloneOptions)} directly and fine tune the
* options for the particular use case.
*/
public static SOAPEnvelope copy(SOAPEnvelope sourceEnv) {
SOAPCloneOptions options = new SOAPCloneOptions();
options.setFetchDataHandlers(true);
options.setPreserveModel(true);
options.setCopyOMDataSources(true);
return (SOAPEnvelope) sourceEnv.clone(options);
}
use of org.apache.axiom.soap.SOAPCloneOptions in project webservices-axiom by apache.
the class CloneTestCase method copyAndCheck.
/**
* Make a copy of the source envelope and validate the target tree
* @param sourceEnv
* @throws Exception
*/
protected void copyAndCheck(SOAPEnvelope sourceEnv) throws Exception {
SOAPCloneOptions options = new SOAPCloneOptions();
options.setFetchDataHandlers(true);
options.setPreserveModel(true);
options.setCopyOMDataSources(true);
SOAPEnvelope targetEnv = (SOAPEnvelope) sourceEnv.clone(options);
identityCheck(sourceEnv, targetEnv, "");
assertAbout(xml()).that(targetEnv.toString()).hasSameContentAs(sourceEnv.toString());
sourceEnv.close(false);
}
Aggregations