Search in sources :

Example 1 with WrappedTextNodeOMDataSourceFromReader

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

the class TestWrappedTextNodeOMDataSourceFromReader method runTest.

@Override
protected void runTest() throws Throwable {
    Random random = new Random();
    StringBuilder buffer = new StringBuilder(40000);
    for (int i = 0; i < 40000; i++) {
        buffer.append((char) (32 + random.nextInt(96)));
    }
    String testData = buffer.toString();
    QName qname = new QName("data");
    OMDataSource ds = new WrappedTextNodeOMDataSourceFromReader(qname, new StringReader(testData));
    OMFactory factory = metaFactory.getOMFactory();
    OMSourcedElement element = factory.createOMElement(ds, qname);
    assertEquals(testData, element.getText());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) Random(java.util.Random) OMDataSource(org.apache.axiom.om.OMDataSource) QName(javax.xml.namespace.QName) StringReader(java.io.StringReader) OMSourcedElement(org.apache.axiom.om.OMSourcedElement) WrappedTextNodeOMDataSourceFromReader(org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromReader)

Aggregations

StringReader (java.io.StringReader)1 Random (java.util.Random)1 QName (javax.xml.namespace.QName)1 OMDataSource (org.apache.axiom.om.OMDataSource)1 OMFactory (org.apache.axiom.om.OMFactory)1 OMSourcedElement (org.apache.axiom.om.OMSourcedElement)1 WrappedTextNodeOMDataSourceFromReader (org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromReader)1