mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 13:03:11 +00:00
Export all collections of a community recursively
This commit is contained in:
@@ -766,6 +766,37 @@ public class CommunityTest extends AbstractDSpaceObjectTest
|
||||
assertThat("testGetAllParents 4", son.getAllParents()[0], equalTo(c));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAllCollections method, of class Community.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllCollections() throws Exception
|
||||
{
|
||||
new NonStrictExpectations()
|
||||
{
|
||||
AuthorizeManager authManager;
|
||||
{
|
||||
AuthorizeManager.authorizeAction((Context) any, (Community) any,
|
||||
Constants.ADD); result = null;
|
||||
AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any,
|
||||
Constants.ADD); result = true;
|
||||
}
|
||||
};
|
||||
|
||||
//empty by default
|
||||
assertThat("testGetAllCollections 0",c.getAllCollections(), notNullValue());
|
||||
assertTrue("testGetAllCollections 1", c.getAllCollections().length == 0);
|
||||
|
||||
//community has a collection and a subcommunity, subcommunity has a collection
|
||||
Collection collOfC = c.createCollection();
|
||||
Community sub = Community.create(c, context);
|
||||
Collection collOfSub = sub.createCollection();
|
||||
assertThat("testGetAllCollections 2",c.getAllCollections(), notNullValue());
|
||||
assertTrue("testGetAllCollections 3", c.getAllCollections().length == 2);
|
||||
assertThat("testGetAllCollections 4", c.getAllCollections()[0], equalTo(collOfSub));
|
||||
assertThat("testGetAllCollections 5", c.getAllCollections()[1], equalTo(collOfC));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of createCollection method, of class Community.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user