Search in sources :

Example 1 with CharacterStreamComparator

use of org.apache.axiom.testutils.io.CharacterStreamComparator in project webservices-axiom by apache.

the class TestWriteTextToWithNonDestructiveOMDataSource method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    DataSource ds = new RandomDataSource(665544, 32, 128, 20000000);
    QName qname = new QName("a");
    OMSourcedElement element = factory.createOMElement(new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, Charset.forName("ascii")), qname);
    Reader in = new InputStreamReader(ds.getInputStream(), "ascii");
    Writer out = new CharacterStreamComparator(in);
    // cache doesn't matter here
    element.writeTextTo(out, true);
    out.close();
    assertFalse(element.isExpanded());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) RandomDataSource(org.apache.axiom.testutils.activation.RandomDataSource) InputStreamReader(java.io.InputStreamReader) QName(javax.xml.namespace.QName) WrappedTextNodeOMDataSourceFromDataSource(org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromDataSource) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) CharacterStreamComparator(org.apache.axiom.testutils.io.CharacterStreamComparator) OMSourcedElement(org.apache.axiom.om.OMSourcedElement) Writer(java.io.Writer) WrappedTextNodeOMDataSourceFromDataSource(org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromDataSource) RandomDataSource(org.apache.axiom.testutils.activation.RandomDataSource) DataSource(javax.activation.DataSource)

Aggregations

InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 Writer (java.io.Writer)1 DataSource (javax.activation.DataSource)1 QName (javax.xml.namespace.QName)1 OMFactory (org.apache.axiom.om.OMFactory)1 OMSourcedElement (org.apache.axiom.om.OMSourcedElement)1 WrappedTextNodeOMDataSourceFromDataSource (org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromDataSource)1 RandomDataSource (org.apache.axiom.testutils.activation.RandomDataSource)1 CharacterStreamComparator (org.apache.axiom.testutils.io.CharacterStreamComparator)1