mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 22:43:12 +00:00
only do step of workflow whose action is being tested
This commit is contained in:
@@ -2187,12 +2187,7 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
public void defaultWorkflowTest_UntilEditStep_Reject() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
//** GIVEN **
|
||||
//1. two reviewers
|
||||
EPerson reviewer1 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer1@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
//1. reviewer of 2nd step
|
||||
EPerson reviewer2 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer2@example.com")
|
||||
.withPassword(password)
|
||||
@@ -2206,7 +2201,6 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1")
|
||||
.withWorkflowGroup(1, reviewer1)
|
||||
.withWorkflowGroup(2, reviewer2)
|
||||
.build();
|
||||
|
||||
@@ -2229,63 +2223,11 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String reviewer1Token = getAuthToken(reviewer1.getEmail(), password);
|
||||
String reviewer2Token = getAuthToken(reviewer2.getEmail(), password);
|
||||
String adminToken = getAuthToken(admin.getEmail(), password);
|
||||
|
||||
AtomicReference<Integer> idRef = new AtomicReference<Integer>();
|
||||
|
||||
// step 1
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "reviewstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 1
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// verify that the underline item is still unpublished
|
||||
getClient(adminToken).perform(get("/api/core/items/" + item.getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.inArchive", is(false)));
|
||||
|
||||
// step 2
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
@@ -2358,12 +2300,7 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
public void defaultWorkflowTest_UntilEditStep_NonValidOption() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
//** GIVEN **
|
||||
//1. two reviewers
|
||||
EPerson reviewer1 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer1@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
//1. reviewer of 2nd step
|
||||
EPerson reviewer2 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer2@example.com")
|
||||
.withPassword(password)
|
||||
@@ -2377,7 +2314,6 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1")
|
||||
.withWorkflowGroup(1, reviewer1)
|
||||
.withWorkflowGroup(2, reviewer2)
|
||||
.build();
|
||||
|
||||
@@ -2400,63 +2336,11 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String reviewer1Token = getAuthToken(reviewer1.getEmail(), password);
|
||||
String reviewer2Token = getAuthToken(reviewer2.getEmail(), password);
|
||||
String adminToken = getAuthToken(admin.getEmail(), password);
|
||||
|
||||
AtomicReference<Integer> idRef = new AtomicReference<Integer>();
|
||||
|
||||
// step 1
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "reviewstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 1
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// verify that the underline item is still unpublished
|
||||
getClient(adminToken).perform(get("/api/core/items/" + item.getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.inArchive", is(false)));
|
||||
|
||||
// step 2
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
@@ -2524,17 +2408,7 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
public void defaultWorkflowTest_UntilFinalEditStep_Reject() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
//** GIVEN **
|
||||
//1. three reviewers
|
||||
EPerson reviewer1 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer1@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
EPerson reviewer2 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer2@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
//1. reviewer of 3rd step
|
||||
EPerson reviewer3 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer3@example.com")
|
||||
.withPassword(password)
|
||||
@@ -2548,8 +2422,6 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1")
|
||||
.withWorkflowGroup(1, reviewer1)
|
||||
.withWorkflowGroup(2, reviewer2)
|
||||
.withWorkflowGroup(3, reviewer3)
|
||||
.build();
|
||||
|
||||
@@ -2572,115 +2444,11 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String reviewer1Token = getAuthToken(reviewer1.getEmail(), password);
|
||||
String reviewer2Token = getAuthToken(reviewer2.getEmail(), password);
|
||||
String reviewer3Token = getAuthToken(reviewer3.getEmail(), password);
|
||||
String adminToken = getAuthToken(admin.getEmail(), password);
|
||||
|
||||
AtomicReference<Integer> idRef = new AtomicReference<Integer>();
|
||||
|
||||
// step 1
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "reviewstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 1
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// verify that the underline item is still unpublished
|
||||
getClient(adminToken).perform(get("/api/core/items/" + item.getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.inArchive", is(false)));
|
||||
|
||||
// step 2
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "editstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer2Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 2
|
||||
getClient(reviewer2Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// verify that the underline item is still unpublished
|
||||
getClient(adminToken).perform(get("/api/core/items/" + item.getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.inArchive", is(false)));
|
||||
|
||||
// step 3
|
||||
getClient(reviewer3Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer3.getID().toString()))
|
||||
@@ -2748,17 +2516,7 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
public void defaultWorkflowTest_UntilFinalEditStep_EditMetadata() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
//** GIVEN **
|
||||
//1. three reviewers
|
||||
EPerson reviewer1 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer1@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
EPerson reviewer2 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer2@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
//1. reviewer of 3rd step
|
||||
EPerson reviewer3 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer3@example.com")
|
||||
.withPassword(password)
|
||||
@@ -2772,8 +2530,6 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1")
|
||||
.withWorkflowGroup(1, reviewer1)
|
||||
.withWorkflowGroup(2, reviewer2)
|
||||
.withWorkflowGroup(3, reviewer3)
|
||||
.build();
|
||||
|
||||
@@ -2796,115 +2552,11 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String reviewer1Token = getAuthToken(reviewer1.getEmail(), password);
|
||||
String reviewer2Token = getAuthToken(reviewer2.getEmail(), password);
|
||||
String reviewer3Token = getAuthToken(reviewer3.getEmail(), password);
|
||||
String adminToken = getAuthToken(admin.getEmail(), password);
|
||||
|
||||
AtomicReference<Integer> idRef = new AtomicReference<Integer>();
|
||||
|
||||
// step 1
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "reviewstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 1
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// verify that the underline item is still unpublished
|
||||
getClient(adminToken).perform(get("/api/core/items/" + item.getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.inArchive", is(false)));
|
||||
|
||||
// step 2
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "editstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer2Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 2
|
||||
getClient(reviewer2Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// verify that the underline item is still unpublished
|
||||
getClient(adminToken).perform(get("/api/core/items/" + item.getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.inArchive", is(false)));
|
||||
|
||||
// step 3
|
||||
getClient(reviewer3Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer3.getID().toString()))
|
||||
@@ -2962,17 +2614,7 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
public void defaultWorkflowTest_UntilFinalEditStep_NonValidOption() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
//** GIVEN **
|
||||
//1. three reviewers
|
||||
EPerson reviewer1 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer1@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
EPerson reviewer2 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer2@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
//1. reviewer of 3rd step
|
||||
EPerson reviewer3 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer3@example.com")
|
||||
.withPassword(password)
|
||||
@@ -2986,8 +2628,6 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1")
|
||||
.withWorkflowGroup(1, reviewer1)
|
||||
.withWorkflowGroup(2, reviewer2)
|
||||
.withWorkflowGroup(3, reviewer3)
|
||||
.build();
|
||||
|
||||
@@ -3010,115 +2650,11 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String reviewer1Token = getAuthToken(reviewer1.getEmail(), password);
|
||||
String reviewer2Token = getAuthToken(reviewer2.getEmail(), password);
|
||||
String reviewer3Token = getAuthToken(reviewer3.getEmail(), password);
|
||||
String adminToken = getAuthToken(admin.getEmail(), password);
|
||||
|
||||
AtomicReference<Integer> idRef = new AtomicReference<Integer>();
|
||||
|
||||
// step 1
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "reviewstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 1
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// verify that the underline item is still unpublished
|
||||
getClient(adminToken).perform(get("/api/core/items/" + item.getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.inArchive", is(false)));
|
||||
|
||||
// step 2
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "editstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer2Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 2
|
||||
getClient(reviewer2Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// verify that the underline item is still unpublished
|
||||
getClient(adminToken).perform(get("/api/core/items/" + item.getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.inArchive", is(false)));
|
||||
|
||||
// step 3
|
||||
getClient(reviewer3Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer3.getID().toString()))
|
||||
@@ -3243,12 +2779,7 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
public void unclaimedTaskTest_Patch_EditMetadataOptionAllowed() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
//** GIVEN **
|
||||
//1. two reviewers
|
||||
EPerson reviewer1 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer1@example.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
|
||||
//1. reviewer for second step
|
||||
EPerson reviewer2 = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("reviewer2@example.com")
|
||||
.withPassword(password)
|
||||
@@ -3262,7 +2793,6 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1")
|
||||
.withWorkflowGroup(1, reviewer1)
|
||||
.withWorkflowGroup(2, reviewer2)
|
||||
.build();
|
||||
|
||||
@@ -3283,57 +2813,10 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String reviewer1Token = getAuthToken(reviewer1.getEmail(), password);
|
||||
String reviewer2Token = getAuthToken(reviewer2.getEmail(), password);
|
||||
|
||||
AtomicReference<Integer> idRef = new AtomicReference<Integer>();
|
||||
|
||||
// step 1
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.pooltasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
Matchers.is(PoolTaskMatcher.matchPoolTask(null, "reviewstep")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/pooltasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.pooltasks[0].id"))));
|
||||
|
||||
// claim the task
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/pooltasks/" + idRef.get())
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// get the id of the claimed task
|
||||
getClient(reviewer1Token).perform(get("/api/workflow/claimedtasks/search/findByUser")
|
||||
.param("uuid", reviewer1.getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._embedded.claimedtasks", Matchers.contains(
|
||||
Matchers.allOf(
|
||||
hasJsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks/")),
|
||||
hasJsonPath("$.type", Matchers.is("claimedtask")),
|
||||
hasJsonPath("$._embedded.workflowitem",
|
||||
Matchers.is(WorkflowItemMatcher.matchItemWithTitleAndDateIssuedAndSubject(
|
||||
witem, "Test item full workflow", "2019-03-06", "ExtraEntry")))
|
||||
))))
|
||||
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/workflow/claimedtasks")))
|
||||
.andExpect(jsonPath("$.page.size", is(20)))
|
||||
.andExpect(jsonPath("$.page.totalElements", is(1)))
|
||||
.andDo((result -> idRef
|
||||
.set(read(result.getResponse().getContentAsString(), "$._embedded.claimedtasks[0].id"))));
|
||||
|
||||
// approve the claimedTask, wf step 1
|
||||
getClient(reviewer1Token).perform(post("/api/workflow/claimedtasks/" + idRef.get())
|
||||
.param("submit_approve", "true")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// step 2
|
||||
getClient(reviewer2Token).perform(get("/api/workflow/pooltasks/search/findByUser")
|
||||
.param("uuid", reviewer2.getID().toString()))
|
||||
|
Reference in New Issue
Block a user