Txn transaction = transact.beginTransaction();
System.out.println("Transaction started ...");
XmldbURI docPath = TestConstants.TEST_COLLECTION_URI.append(DOCUMENT_NAME_URI);
BinaryDocument binDoc = (BinaryDocument) broker
.getXMLResource(docPath, Lock.READ_LOCK);
// if document is not present, null is returned
if(binDoc == null){
fail("Binary document '" + docPath + " does not exist.");
} else {
InputStream is = broker.getBinaryResource(binDoc);
data = new byte[(int)broker.getBinaryResourceSize(binDoc)];
is.read(data);
is.close();
binDoc.getUpdateLock().release(Lock.READ_LOCK);
}
Collection collection = broker.getCollection(TestConstants.TEST_COLLECTION_URI);
broker.removeCollection(transaction, collection);