Search in sources :

Example 1 with OMInformationItem

use of org.apache.axiom.om.OMInformationItem in project webservices-axiom by apache.

the class TestCreateDocumentFragmentInterfaces method runTest.

@Override
protected void runTest() throws Throwable {
    Document document = ((DOMMetaFactory) metaFactory).newDocumentBuilderFactory().newDocumentBuilder().newDocument();
    DocumentFragment fragment = document.createDocumentFragment();
    assertFalse(fragment instanceof OMInformationItem);
}
Also used : DOMMetaFactory(org.apache.axiom.om.dom.DOMMetaFactory) OMInformationItem(org.apache.axiom.om.OMInformationItem) Document(org.w3c.dom.Document) DocumentFragment(org.w3c.dom.DocumentFragment)

Example 2 with OMInformationItem

use of org.apache.axiom.om.OMInformationItem in project webservices-axiom by apache.

the class TestClone method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPMessage message = soapFactory.createSOAPMessage();
    message.addChild(soapFactory.getDefaultEnvelope());
    OMCloneOptions options = new OMCloneOptions();
    options.setPreserveModel(preserveModel);
    OMInformationItem clone = message.clone(options);
    if (preserveModel) {
        assertTrue(clone instanceof SOAPMessage);
    } else {
        assertTrue(clone instanceof OMDocument);
        assertFalse(clone instanceof SOAPMessage);
    }
    OMElement envelope = ((OMDocument) clone).getOMDocumentElement();
    if (preserveModel) {
        assertTrue(envelope instanceof SOAPEnvelope);
    } else {
        assertFalse(envelope instanceof SOAPEnvelope);
    }
    assertEquals("Envelope", envelope.getLocalName());
    assertEquals(spec.getEnvelopeNamespaceURI(), envelope.getNamespaceURI());
}
Also used : OMInformationItem(org.apache.axiom.om.OMInformationItem) OMCloneOptions(org.apache.axiom.om.OMCloneOptions) OMElement(org.apache.axiom.om.OMElement) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) SOAPMessage(org.apache.axiom.soap.SOAPMessage) OMDocument(org.apache.axiom.om.OMDocument)

Example 3 with OMInformationItem

use of org.apache.axiom.om.OMInformationItem in project webservices-axiom by apache.

the class TestCloneIncomplete method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPMessage message = SOAPSampleSet.WSA.getMessage(spec).getAdapter(SOAPSampleAdapter.class).getSOAPMessage(metaFactory);
    OMCloneOptions options = new OMCloneOptions();
    options.setPreserveModel(preserveModel);
    OMInformationItem clone = message.clone(options);
    if (preserveModel) {
        assertTrue(clone instanceof SOAPMessage);
        assertSame(soapFactory, clone.getOMFactory());
    } else {
        assertTrue(clone instanceof OMDocument);
        assertFalse(clone instanceof SOAPMessage);
    }
}
Also used : OMInformationItem(org.apache.axiom.om.OMInformationItem) OMCloneOptions(org.apache.axiom.om.OMCloneOptions) SOAPSampleAdapter(org.apache.axiom.ts.soap.SOAPSampleAdapter) SOAPMessage(org.apache.axiom.soap.SOAPMessage) OMDocument(org.apache.axiom.om.OMDocument)

Example 4 with OMInformationItem

use of org.apache.axiom.om.OMInformationItem in project webservices-axiom by apache.

the class DigestTestCase method runTest.

@Override
protected final void runTest() throws Throwable {
    OMInformationItem node = createInformationItem();
    DigestGenerator digestGenerator = new DigestGenerator();
    byte[] digest;
    if (node instanceof OMDocument) {
        digest = digestGenerator.getDigest((OMDocument) node, algorithm);
    } else if (node instanceof OMAttribute) {
        digest = digestGenerator.getDigest((OMAttribute) node, algorithm);
    } else {
        digest = digestGenerator.getDigest((OMNode) node, algorithm);
    }
    assertEquals(expectedDigest, DigestUtils.toHexString(digest));
}
Also used : OMInformationItem(org.apache.axiom.om.OMInformationItem) DigestGenerator(org.apache.axiom.om.util.DigestGenerator) OMAttribute(org.apache.axiom.om.OMAttribute) OMDocument(org.apache.axiom.om.OMDocument)

Aggregations

OMInformationItem (org.apache.axiom.om.OMInformationItem)4 OMDocument (org.apache.axiom.om.OMDocument)3 OMCloneOptions (org.apache.axiom.om.OMCloneOptions)2 SOAPMessage (org.apache.axiom.soap.SOAPMessage)2 OMAttribute (org.apache.axiom.om.OMAttribute)1 OMElement (org.apache.axiom.om.OMElement)1 DOMMetaFactory (org.apache.axiom.om.dom.DOMMetaFactory)1 DigestGenerator (org.apache.axiom.om.util.DigestGenerator)1 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)1 SOAPSampleAdapter (org.apache.axiom.ts.soap.SOAPSampleAdapter)1 Document (org.w3c.dom.Document)1 DocumentFragment (org.w3c.dom.DocumentFragment)1