Refactor/streamline DOI unit tests. They were ignoring setup already done in AbstractUnitTest, creating a secondary context obj, and sending all new items through workflow approval.

This commit is contained in:
Tim Donohue
2014-07-31 15:53:16 -05:00
parent 5cfc8089d9
commit 790f4829d7
2 changed files with 122 additions and 109 deletions

View File

@@ -70,13 +70,11 @@ public class EZIDIdentifierProviderTest
throws SQLException, AuthorizeException, IOException
{
ctx.turnOffAuthorisationSystem();
ctx.setCurrentUser(eperson);
// Create an Item to play with
WorkspaceItem wsItem = WorkspaceItem.create(ctx, collection, false);
// Get it from the workspace and set some metadata
Item item = wsItem.getItem();
//Install a fresh item
WorkspaceItem wsItem = WorkspaceItem.create(context, collection, false);
Item item = InstallItem.installItem(context, wsItem);
itemID = item.getID();
item.addMetadata("dc", "contributor", "author", null, "Author, A. N.");
@@ -84,12 +82,6 @@ public class EZIDIdentifierProviderTest
item.addMetadata("dc", "publisher", null, null, "DSpace Test Harness");
item.update();
// I think we have to do this?
WorkflowItem wfItem = WorkflowManager.startWithoutNotify(ctx, wsItem);
WorkflowManager.advance(ctx, wfItem, ctx.getCurrentUser());
wfItem.update();
wfItem.deleteWrapper();
// Commit work, clean up
ctx.commit();
ctx.restoreAuthSystemState();