mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
DS-4210 demonstate the bug: Deposit on collection without workflow seems to fail (405 but succeed)
This commit is contained in:
@@ -657,6 +657,55 @@ public class WorkflowItemRestRepositoryIT extends AbstractControllerIntegrationT
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
/**
|
||||||
|
* Test the deposit of a workspaceitem POSTing to the resource workflowitems collection endpoint a workspaceitem (as
|
||||||
|
* uri-list) in a collection without workflow. This corresponds to the deposit action done by the submitter.
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void depositWorkspaceItemWithoutWorkflowTest() throws Exception {
|
||||||
|
context.turnOffAuthorisationSystem();
|
||||||
|
|
||||||
|
//** GIVEN **
|
||||||
|
//1. create a normal user to use as submitter
|
||||||
|
EPerson submitter = EPersonBuilder.createEPerson(context)
|
||||||
|
.withEmail("submitter@example.com")
|
||||||
|
.withPassword(password)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//2. A community with one collection.
|
||||||
|
parentCommunity = CommunityBuilder.createCommunity(context)
|
||||||
|
.withName("Parent Community")
|
||||||
|
.build();
|
||||||
|
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity)
|
||||||
|
.withName("Collection 1")
|
||||||
|
.withSubmitterGroup(submitter)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
context.setCurrentUser(submitter);
|
||||||
|
|
||||||
|
//3. a workspace item ready to go
|
||||||
|
InputStream pdf = getClass().getResourceAsStream("simple-article.pdf");
|
||||||
|
|
||||||
|
WorkspaceItem wsitem = WorkspaceItemBuilder.createWorkspaceItem(context, col1)
|
||||||
|
.withTitle("Submission Item")
|
||||||
|
.withIssueDate("2017-10-17")
|
||||||
|
.withFulltext("simple-article.pdf", "/local/path/simple-article.pdf", pdf)
|
||||||
|
.grantLicense()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
context.restoreAuthSystemState();
|
||||||
|
String authToken = getAuthToken(submitter.getEmail(), password);
|
||||||
|
|
||||||
|
// submit the workspaceitem to complete the deposit (as there is no workflow configured)
|
||||||
|
getClient(authToken)
|
||||||
|
.perform(post(BASE_REST_SERVER_URL + "/api/workflow/workflowitems")
|
||||||
|
.content("/api/submission/workspaceitems/" + wsitem.getID())
|
||||||
|
.contentType(textUriContentType))
|
||||||
|
.andExpect(status().isCreated());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
/**
|
/**
|
||||||
* Test the creation of workflowitem POSTing to the resource workflowitems collection endpoint a workspaceitem (as
|
* Test the creation of workflowitem POSTing to the resource workflowitems collection endpoint a workspaceitem (as
|
||||||
|
@@ -72,6 +72,23 @@ public class CollectionBuilder extends AbstractDSpaceObjectBuilder<Collection> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a submitter group for the collection with the specified members
|
||||||
|
*
|
||||||
|
* @param members epersons to add to the submitter group
|
||||||
|
* @return this builder
|
||||||
|
* @throws SQLException
|
||||||
|
* @throws AuthorizeException
|
||||||
|
*/
|
||||||
|
public CollectionBuilder withSubmitterGroup(EPerson... members) throws SQLException, AuthorizeException {
|
||||||
|
Group g = collectionService.createSubmitters(context, collection);
|
||||||
|
for (EPerson e : members) {
|
||||||
|
groupService.addMember(context, g, e);
|
||||||
|
}
|
||||||
|
groupService.update(context, g);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public CollectionBuilder withWorkflowGroup(int step, EPerson... members) throws SQLException, AuthorizeException {
|
public CollectionBuilder withWorkflowGroup(int step, EPerson... members) throws SQLException, AuthorizeException {
|
||||||
Group g = collectionService.createWorkflowGroup(context, collection, step);
|
Group g = collectionService.createWorkflowGroup(context, collection, step);
|
||||||
for (EPerson e : members) {
|
for (EPerson e : members) {
|
||||||
|
Reference in New Issue
Block a user