use of org.apache.jackrabbit.test.api.util.InputStreamWrapper in project jackrabbit by apache.
the class SerializationTest method testStreamHandling.
//----------------< tests input stream handling contract >----------------------
/**
* Tests whether <code>Session.importXML</code> and <code>Workspace.importXML</code>
* obey the stream handling contract.
*/
public void testStreamHandling() throws RepositoryException, IOException {
exportRepository(SAVEBINARY, RECURSE);
InputStreamWrapper in = new InputStreamWrapper(new FileInputStream(file));
session.importXML(treeComparator.targetFolder, in, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
assertTrue("Session.importXML(..., InputStream, ...) is expected to close the passed input stream", in.isClosed());
session.refresh(false);
in = new InputStreamWrapper(new FileInputStream(file));
workspace.importXML(treeComparator.targetFolder, in, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
assertTrue("Workspace.importXML(..., InputStream, ...) is expected to close the passed input stream", in.isClosed());
}
use of org.apache.jackrabbit.test.api.util.InputStreamWrapper in project jackrabbit by apache.
the class SetPropertyInputStreamTest method testInputStreamClosed.
/**
* Tests whether the passed input stream is closed.
* @throws Exception
*/
public void testInputStreamClosed() throws Exception {
InputStreamWrapper in = new InputStreamWrapper(new ByteArrayInputStream(bytes1));
testNode.setProperty(propertyName1, in);
assertTrue("Node.setProperty(..., InputStream) is expected to close the passed input stream", in.isClosed());
}
use of org.apache.jackrabbit.test.api.util.InputStreamWrapper in project jackrabbit by apache.
the class ValueFactoryTest method testInputStream.
/**
* Tests whether a passed <code>InputStream</code> is closed
* by the implementation.
*
* @throws RepositoryException
*/
public void testInputStream() throws RepositoryException {
InputStreamWrapper in = new InputStreamWrapper(new ByteArrayInputStream(binaryValue));
valueFactory.createValue(in);
assertTrue("ValueFactory.createValue(InputStream) is expected to close the passed input stream", in.isClosed());
in = new InputStreamWrapper(new ByteArrayInputStream(binaryValue));
Binary bin = valueFactory.createBinary(in);
assertTrue("ValueFactory.createBinary(InputStream) is expected to close the passed input stream", in.isClosed());
bin.dispose();
}
use of org.apache.jackrabbit.test.api.util.InputStreamWrapper in project jackrabbit by apache.
the class SetValueInputStreamTest method testInputStreamClosed.
/**
* Tests whether <code>Property.setValue(InputStream)</code> obeys the
* stream handling contract.
*/
public void testInputStreamClosed() throws RepositoryException, IOException {
InputStreamWrapper in = new InputStreamWrapper(new ByteArrayInputStream(data));
property1.setValue(in);
assertTrue("Property.setValue(InputStream) is expected to close the passed input stream", in.isClosed());
}
Aggregations