transaction = transact.beginTransaction();
Collection root = broker.getOrCreateCollection(transaction,
TestConstants.TEST_COLLECTION_URI);
assertNotNull(root);
Permission perms = root.getPermissions();
// collection is world-writable
perms.setMode(0744);
broker.saveCollection(transaction, root);
Collection test = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI2);
assertNotNull(test);
perms = test.getPermissions();
// collection is world-writable
perms.setMode(0744);
broker.saveCollection(transaction, test);
IndexInfo info = test.validateXMLResource(transaction, broker,
XmldbURI.create("document.xml"), DATA);
assertNotNull(info);
test.store(transaction, broker, info, DATA, false);
Collection childCol1 = broker.getOrCreateCollection(transaction,
TestConstants.TEST_COLLECTION_URI2.append("test4"));
assertNotNull(childCol1);
perms = childCol1.getPermissions();
// collection only accessible to user
perms.setMode(0744);
broker.saveCollection(transaction, childCol1);
info = childCol1.validateXMLResource(transaction, broker,
XmldbURI.create("document.xml"), DATA);
assertNotNull(info);
childCol1.store(transaction, broker, info, DATA, false);
Collection childCol = broker.getOrCreateCollection(transaction,
TestConstants.TEST_COLLECTION_URI3);
assertNotNull(childCol);
perms = childCol.getPermissions();
// collection only accessible to user
perms.setMode(0700);
broker.saveCollection(transaction, childCol);
info = childCol.validateXMLResource(transaction, broker,
XmldbURI.create("document.xml"), DATA);
assertNotNull(info);