forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry picked fix about integration tests (#750)
Co-authored-by: Tim Donohue <[email protected]>
- Loading branch information
1 parent
6a1d7aa
commit 47b45b6
Showing
12 changed files
with
577 additions
and
895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,12 @@ | |
|
||
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.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 @@ | |
* @author Mark H. Wood <[email protected]> | ||
*/ | ||
public class StructBuilderIT | ||
extends AbstractIntegrationTest { | ||
extends AbstractIntegrationTestWithDatabase { | ||
private static final Logger log = LogManager.getLogger(); | ||
|
||
private static final CommunityService communityService | ||
|
@@ -79,7 +79,8 @@ public static void tearDownClass() { | |
* @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 void testImportStructureWithHandles() | |
* @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"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.