use of org.apache.axiom.testutils.io.InstrumentedStream in project webservices-axiom by apache.
the class TestClose method runTest.
protected void runTest() throws Throwable {
InstrumentedStream in = streamType.instrumentStream(streamType.getStream(XMLSample.SIMPLE));
XMLStreamReader reader = streamType.createXMLStreamReader(staxImpl.newNormalizedXMLInputFactory(), in);
reader.close();
assertFalse(in.isClosed());
}
use of org.apache.axiom.testutils.io.InstrumentedStream in project webservices-axiom by apache.
the class TestDetachWithStream method runTest.
@Override
protected final void runTest() throws Throwable {
InstrumentedStream stream = streamType.instrumentStream(streamType.getStream(XMLSample.LARGE));
OMXMLParserWrapper builder;
if (useStreamSource) {
builder = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(), streamType.createStreamSource(stream));
} else {
builder = streamType.getAdapter(StreamTypeAdapter.class).createOMBuilder(metaFactory.getOMFactory(), stream);
}
long countBeforeDetach = stream.getCount();
builder.detach();
assertThat(stream.getCount()).isGreaterThan(countBeforeDetach);
assertThat(stream.isClosed()).isFalse();
stream.close();
builder.getDocument().build();
}
use of org.apache.axiom.testutils.io.InstrumentedStream in project webservices-axiom by apache.
the class TestCloseWithStream method runTest.
@Override
protected void runTest() throws Throwable {
InstrumentedStream in = streamType.instrumentStream(streamType.getStream(XMLSample.SIMPLE));
try {
OMXMLParserWrapper builder = streamType.getAdapter(StreamTypeAdapter.class).createOMBuilder(metaFactory.getOMFactory(), in);
builder.getDocument().build();
builder.close();
// OMXMLParserWrapper#close() does _not_ close the underlying input stream
assertFalse(in.isClosed());
} finally {
in.close();
}
}
Aggregations