Examples of OMDataSourceExt


Examples of org.apache.axiom.om.OMDataSourceExt

        assertTrue("The payload was not present in the output",
                   output.indexOf(payload1) > 0);
        assertTrue("OMSourcedElement is expanded.  This is unexpected", !child.isExpanded());
       
        // Test getting the raw bytes from the ByteArrayDataSource.
        OMDataSourceExt ds = (OMDataSourceExt) child.getDataSource();
        byte[] bytes = ds.getXMLBytes("UTF-16")// Get the bytes as UTF-16
        String payload = new String(bytes, "utf-16");
        assertTrue("The obtained bytes did not match the payload",
                   payload1.equals(payload));
    }
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

            !(ds instanceof OMDataSourceExt)) {
            return super.clone(options, targetParent);
        }
       
        // If copying is destructive, then copy the OM tree
        OMDataSourceExt sourceDS = (OMDataSourceExt) ds;
        if (sourceDS.isDestructiveRead() ||
            sourceDS.isDestructiveWrite()) {
            return super.clone(options, targetParent);
        }
        OMDataSourceExt targetDS = ((OMDataSourceExt) ds).copy();
        if (targetDS == null) {
            return super.clone(options, targetParent);
        }
        // Otherwise create a target OMSE with the copied DataSource
        OMSourcedElementImpl targetOMSE;
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

        parent.addChild(omse);
        firstChild = parent.getFirstOMChild();
        child = (OMSourcedElement) firstChild;
       
        // Test getting the raw bytes from the ByteArrayDataSource.
        OMDataSourceExt ds = (OMDataSourceExt) child.getDataSource();
        byte[] bytes = ds.getXMLBytes(encoding)// Get the bytes as UTF-16
        String payload = new String(bytes, encoding);
        assertTrue("The obtained bytes did not match the payload",
                   payload1.equals(payload));
    }
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

        assertTrue("The payload was not present in the output",
                   output.indexOf(payload1) > 0);
        assertTrue("OMSourcedElement is expanded.  This is unexpected", !child.isExpanded());
       
        // Test getting the raw bytes from the ByteArrayDataSource.
        OMDataSourceExt ds = (OMDataSourceExt) child.getDataSource();
        char[] chars = (char[]) ds.getObject()// Get the chars
        String payload = new String(chars);
        assertTrue("The obtained chars did not match the payload",
                   payload1.equals(payload));
       
        // Validate close
        ds.close();
        assertTrue("Close should free the resource", ds.getObject() == null);
    }
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

        assertNull(element.getNextOMSibling());
        assertFalse(element.isExpanded());
    }

    public void testSerializeModifiedOMSEWithNonDestructiveDataSource() throws Exception {
        OMDataSourceExt ds = new CharArrayDataSource("<element><child/></element>".toCharArray());
        assertFalse(ds.isDestructiveWrite());
       
        OMFactory f = new OMLinkedListImplFactory();
        OMElement element = new OMSourcedElementImpl("element", null, f, ds);
       
        element.getFirstElement().setText("TEST");
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

        assertTrue("OMSourcedElement is expanded after build().  This is unexpected", !child.isExpanded());
        parent.buildWithAttachments();
        assertTrue("OMSourcedElement is expanded after buildWithAttachments().  This is unexpected", !child.isExpanded());
       
        // Test getting the raw bytes from the ByteArrayDataSource.
        OMDataSourceExt ds = (OMDataSourceExt) child.getDataSource();
        byte[] bytes = ds.getXMLBytes("UTF-16")// Get the bytes as UTF-16
        String payload = new String(bytes, "utf-16");
        assertTrue("The obtained bytes did not match the payload",
                   payload1.equals(payload));
       
      
        // Test getting the raw bytes with the default encoding
        OMOutputFormat outputFormat = new OMOutputFormat();
        baos = new ByteArrayOutputStream();
        ds.serialize(baos, outputFormat);
        output = baos.toString(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
//        System.out.println(output);
        assertTrue("The obtained bytes did not match the payload",
                   payload1.equals(output));    
    }
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

            copyOMElement(factory, targetParent, sourceOMSE);
            return;
        }
       
        // If copying is destructive, then copy the OM tree
        OMDataSourceExt sourceDS = (OMDataSourceExt) ds;
        if (sourceDS.isDestructiveRead() ||
            sourceDS.isDestructiveWrite()) {
            copyOMElement(factory, targetParent, sourceOMSE);
            return;
        }
        OMDataSourceExt targetDS = ((OMDataSourceExt) ds).copy();
        if (targetDS == null) {
            copyOMElement(factory, targetParent, sourceOMSE);
            return;
        }
        // Otherwise create a target OMSE with the copied DataSource
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

            copySOAPHeaderBlock_NoDataSource(factory, targetParent, sourceSHB);
            return;
        }
       
        // If copying is destructive, then copy the OM tree
        OMDataSourceExt sourceDS = (OMDataSourceExt) ds;
        if (sourceDS.isDestructiveRead() ||
            sourceDS.isDestructiveWrite()) {
            copySOAPHeaderBlock_NoDataSource(factory, targetParent, sourceSHB);
            return;
        }
       
        // Otherwise create a copy of the OMDataSource
        OMDataSourceExt targetDS = ((OMDataSourceExt) ds).copy();
        SOAPHeaderBlock targetSHB =
            factory.createSOAPHeaderBlock(sourceSHB.getLocalName(),
                                          sourceSHB.getNamespace(),
                                          targetDS);
        targetParent.addChild(targetSHB);
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

        assertNull(element.getNextOMSibling());
        assertFalse(element.isExpanded());
    }

    public void testSerializeModifiedOMSEWithNonDestructiveDataSource() throws Exception {
        OMDataSourceExt ds = new CharArrayDataSource("<element><child/></element>".toCharArray());
        assertFalse(ds.isDestructiveWrite());
       
        OMFactory f = new OMLinkedListImplFactory();
        OMElement element = new OMSourcedElementImpl("element", null, f, ds);
       
        element.getFirstElement().setText("TEST");
View Full Code Here

Examples of org.apache.axiom.om.OMDataSourceExt

            copyOMElement(factory, targetParent, sourceOMSE);
            return;
        }
       
        // If copying is destructive, then copy the OM tree
        OMDataSourceExt sourceDS = (OMDataSourceExt) ds;
        if (sourceDS.isDestructiveRead() ||
            sourceDS.isDestructiveWrite()) {
            copyOMElement(factory, targetParent, sourceOMSE);
            return;
        }
        OMDataSourceExt targetDS = ((OMDataSourceExt) ds).copy();
        if (targetDS == null) {
            copyOMElement(factory, targetParent, sourceOMSE);
            return;
        }
        // Otherwise create a target OMSE with the copied DataSource
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.