test = DatabaseManager.getCollection(baseUri + "/db/securityTest3", "test3", "test3");
cms = (CollectionManagementServiceImpl) test.getService("CollectionManagementService", "1.0");
cms.copy("/db/securityTest3/source", "/db/securityTest3", "copy-of-source");
UserManagementService ums = (UserManagementService) test.getService("UserManagementService", "1.0");
final Collection copyOfSource = test.getChildCollection("copy-of-source");
Permission permissions = ums.getPermissions(copyOfSource);
//collection should be owned by test3:guest, i.e. permissions were not preserved from the test1 users doc /db/securityTest3/source
assertEquals("test3", permissions.getOwner().getName());
assertEquals("guest", permissions.getGroup().getName());
ums = (UserManagementService) copyOfSource.getService("UserManagementService", "1.0");
final Resource resCopyOfSource = copyOfSource.getResource("source.xml");
permissions = ums.getPermissions(resCopyOfSource);
//resource in collection should be owned by test3:guest, i.e. permissions were not preserved from the test1 users doc /db/securityTest3/source.xml
assertEquals("test3", permissions.getOwner().getName());
assertEquals("guest", permissions.getGroup().getName());
}