mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
#9806: Use builders for group, comm, coll creation in StructBuilderIT
(cherry picked from commit 2ef69045d1
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
a678870078
commit
ba8385117c
@@ -23,11 +23,12 @@ import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.AbstractIntegrationTest;
|
||||
import org.dspace.AbstractIntegrationTestWithDatabase;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.builder.CollectionBuilder;
|
||||
import org.dspace.builder.CommunityBuilder;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
@@ -38,7 +39,6 @@ import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xmlunit.builder.DiffBuilder;
|
||||
import org.xmlunit.diff.Comparison;
|
||||
import org.xmlunit.diff.ComparisonFormatter;
|
||||
@@ -52,7 +52,7 @@ import org.xmlunit.diff.Difference;
|
||||
* @author Mark H. Wood <mwood@iupui.edu>
|
||||
*/
|
||||
public class StructBuilderIT
|
||||
extends AbstractIntegrationTest {
|
||||
extends AbstractIntegrationTestWithDatabase {
|
||||
private static final Logger log = LogManager.getLogger();
|
||||
|
||||
private static final CommunityService communityService
|
||||
@@ -79,7 +79,8 @@ public class StructBuilderIT
|
||||
* @throws IOException passed through.
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws SQLException, AuthorizeException, IOException {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
// Clear out all communities and collections.
|
||||
context.turnOffAuthorisationSystem();
|
||||
for (Community community : communityService.findAllTop(context)) {
|
||||
@@ -285,19 +286,15 @@ public class StructBuilderIT
|
||||
* @throws org.dspace.authorize.AuthorizeException passed through.
|
||||
*/
|
||||
@Test
|
||||
public void testExportStructure()
|
||||
throws ParserConfigurationException, SAXException, IOException,
|
||||
SQLException, AuthorizeException {
|
||||
public void testExportStructure() {
|
||||
// Create some structure to test.
|
||||
context.turnOffAuthorisationSystem();
|
||||
Community community0 = communityService.create(null, context);
|
||||
communityService.setMetadataSingleValue(context, community0,
|
||||
MetadataSchemaEnum.DC.getName(), "title", null,
|
||||
null, "Top Community 0");
|
||||
Collection collection0_0 = collectionService.create(context, community0);
|
||||
collectionService.setMetadataSingleValue(context, collection0_0,
|
||||
MetadataSchemaEnum.DC.getName(), "title", null,
|
||||
null, "Collection 0.0");
|
||||
// Top level community
|
||||
Community community0 = CommunityBuilder.createCommunity(context)
|
||||
.withName("Top Community 0").build();
|
||||
// Collection below top level community
|
||||
Collection collection0_0 = CollectionBuilder.createCollection(context, community0)
|
||||
.withName("Collection 0.0").build();
|
||||
|
||||
// Export the current structure.
|
||||
System.out.println("exportStructure");
|
||||
|
Reference in New Issue
Block a user