}
@Test
public void setGid_copyResource_resourceGroupInheritedFromParent() throws XMLDBException {
Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test1", "test1");
CollectionManagementServiceImpl cms = (CollectionManagementServiceImpl)test.getService("CollectionManagementService", "1.0");
UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");
//create the /db/securityTest2/test.xml resource
Resource resource = test.createResource("test.xml", XMLResource.RESOURCE_TYPE);
resource.setContent("<test/>");
test.storeResource(resource);
ums.chgrp(resource, "extusers");
//create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxrwsrwx"
Collection parentCollection = cms.createCollection("parentCollection");
ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
ums.chmod("rwxrwsrwx");
//now copy /db/securityTest2/test.xml to /db/securityTest2/parentCollection/test.xml
//as "user3:guest", it should inherit the group ownership 'users' from the parent collection which is setGid
//and it should NOT have its setGid bit set as it is a resource
test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
cms = (CollectionManagementServiceImpl)test.getService("CollectionManagementService", "1.0");
cms.copyResource("test.xml", "/db/securityTest2/parentCollection", "test.xml");
ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
parentCollection = test.getChildCollection("parentCollection");
resource = parentCollection.getResource("test.xml");