TSK-1916: test history when requesting changes
This commit is contained in:
parent
cc32b10d82
commit
d83678ac54
|
|
@ -4,6 +4,7 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000001', 'ETI:0000000
|
||||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000002', 'ETI:000000000000000000000000000000000002', '2018-01-29 15:55:02', '2018-01-30 15:55:00', null , '2018-01-30 15:55:02', null , '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Task02' , 'creator_user_id' , 'Lorem ipsum was n Quatsch t. Aber stimmt.', 'Some custom Note' , 2 , -1 , 'CLAIMED' , 'MANUAL' , 'T2000' , 'CLI:100000000000000000000000000000000016', 'WBI:100000000000000000000000000000000006' , 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user-1-1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000002', 'ETI:000000000000000000000000000000000002', '2018-01-29 15:55:02', '2018-01-30 15:55:00', null , '2018-01-30 15:55:02', null , '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Task02' , 'creator_user_id' , 'Lorem ipsum was n Quatsch t. Aber stimmt.', 'Some custom Note' , 2 , -1 , 'CLAIMED' , 'MANUAL' , 'T2000' , 'CLI:100000000000000000000000000000000016', 'WBI:100000000000000000000000000000000006' , 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user-1-1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000066', 'ETI:000000000000000000000000000000000066', '2018-01-29 15:55:02', '2018-01-29 15:55:00', null , '2018-01-30 15:55:02', null , '2018-01-29 15:55:00', '2018-01-29 15:55:00', 'Task03' , 'creator_user_id' , 'Lorem ipsum was n Quatsch t. Aber stimmt.', 'Some custom Note' , 2 , -1 , 'CLAIMED' , 'MANUAL' , 'T2001' , 'CLI:100000000000000000000000000000000024', 'WBI:100000000000000000000000000000000006' , 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user-1-1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000066', 'ETI:000000000000000000000000000000000066', '2018-01-29 15:55:02', '2018-01-29 15:55:00', null , '2018-01-30 15:55:02', null , '2018-01-29 15:55:00', '2018-01-29 15:55:00', 'Task03' , 'creator_user_id' , 'Lorem ipsum was n Quatsch t. Aber stimmt.', 'Some custom Note' , 2 , -1 , 'CLAIMED' , 'MANUAL' , 'T2001' , 'CLI:100000000000000000000000000000000024', 'WBI:100000000000000000000000000000000006' , 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user-1-1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||||
INSERT INTO TASK VALUES('TKI:100000000000000000000000000000000066', 'ETI:100000000000000000000000000000000066', '2012-01-29 15:55:02', '2012-01-29 15:55:00', null , '2012-01-30 15:55:02', null , '2012-01-29 15:55:00', '2012-01-29 15:55:00', 'Task003' , 'creator_user_id' , 'was n Quatsch t. Aber stimmt.' , 'Some other custom Note' , 67 , -1 , 'IN_REVIEW' , 'MANUAL' , 'T2001' , 'CLI:100000000000000000000000000000000024', 'WBI:100000000000000000000000000000000006' , 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user-1-1' , 'ACompany1' , 'ASystem1' , 'AnInstance1' , 'AType1' , 'AValue1' , true , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
INSERT INTO TASK VALUES('TKI:100000000000000000000000000000000066', 'ETI:100000000000000000000000000000000066', '2012-01-29 15:55:02', '2012-01-29 15:55:00', null , '2012-01-30 15:55:02', null , '2012-01-29 15:55:00', '2012-01-29 15:55:00', 'Task003' , 'creator_user_id' , 'was n Quatsch t. Aber stimmt.' , 'Some other custom Note' , 67 , -1 , 'IN_REVIEW' , 'MANUAL' , 'T2001' , 'CLI:100000000000000000000000000000000024', 'WBI:100000000000000000000000000000000006' , 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user-1-1' , 'ACompany1' , 'ASystem1' , 'AnInstance1' , 'AType1' , 'AValue1' , true , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||||
|
INSERT INTO TASK VALUES('TKI:200000000000000000000000000000000066', 'ETI:200000000000000000000000000000000066', '2012-01-29 15:55:02', '2012-01-29 15:55:00', null , '2012-01-30 15:55:02', null , '2012-01-29 15:55:00', '2012-01-29 15:55:00', 'Task003' , 'creator_user_id' , 'was n Quatsch t. Aber stimmt.' , 'Some other custom Note' , 67 , -1 , 'CLAIMED' , 'MANUAL' , 'T2001' , 'CLI:100000000000000000000000000000000024', 'WBI:100000000000000000000000000000000006' , 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user-1-1' , 'ACompany1' , 'ASystem1' , 'AnInstance1' , 'AType1' , 'AValue1' , true , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000003', 'ETI:000000000000000000000000000000000003', '2018-01-29 15:55:03', null , null , '2018-01-29 15:55:03', null , '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'creator_user_id' , 'Widerruf' , null , 2 , -1 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000003', 'WBI:100000000000000000000000000000000001' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000003' , 'DOC_0000000000000000003' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , 'NONE' , null , 'efg' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000003', 'ETI:000000000000000000000000000000000003', '2018-01-29 15:55:03', null , null , '2018-01-29 15:55:03', null , '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'creator_user_id' , 'Widerruf' , null , 2 , -1 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000003', 'WBI:100000000000000000000000000000000001' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000003' , 'DOC_0000000000000000003' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , 'NONE' , null , 'efg' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000004', 'ETI:000000000000000000000000000000000004', '2018-01-29 15:55:04', null , null , '2018-01-29 15:55:04', null , '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'creator_user_id' , 'Widerruf' , null , 2 , -1 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000003', 'WBI:100000000000000000000000000000000001' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000004' , 'DOC_0000000000000000004' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , 'NONE' , null , '' , 'ade' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000004', 'ETI:000000000000000000000000000000000004', '2018-01-29 15:55:04', null , null , '2018-01-29 15:55:04', null , '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'creator_user_id' , 'Widerruf' , null , 2 , -1 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000003', 'WBI:100000000000000000000000000000000001' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000004' , 'DOC_0000000000000000004' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , 'NONE' , null , '' , 'ade' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000005', 'ETI:000000000000000000000000000000000005', '2018-01-29 15:55:05', null , null , '2018-01-29 15:55:05', null , '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'creator_user_id' , 'Widerruf' , null , 2 , -1 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000003', 'WBI:100000000000000000000000000000000001' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000005' , 'DOC_0000000000000000005' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000005', 'ETI:000000000000000000000000000000000005', '2018-01-29 15:55:05', null , null , '2018-01-29 15:55:05', null , '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'creator_user_id' , 'Widerruf' , null , 2 , -1 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000003', 'WBI:100000000000000000000000000000000001' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000005' , 'DOC_0000000000000000005' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class CreateHistoryEventOnTaskRequestChangesAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
@WithAccessId(user = "user-1-1")
|
@WithAccessId(user = "user-1-1")
|
||||||
@Test
|
@Test
|
||||||
void should_CreateClaimedHistoryEvent_When_TaskIsClaimed() throws Exception {
|
void should_CreateChangesRequestedHistoryEvent_When_ChangesAreRequested() throws Exception {
|
||||||
final String taskId = "TKI:100000000000000000000000000000000066";
|
final String taskId = "TKI:100000000000000000000000000000000066";
|
||||||
final Instant oldModified = taskService.getTask(taskId).getModified();
|
final Instant oldModified = taskService.getTask(taskId).getModified();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
package acceptance.events.task;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
|
import pro.taskana.common.test.security.JaasExtension;
|
||||||
|
import pro.taskana.common.test.security.WithAccessId;
|
||||||
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
|
import pro.taskana.simplehistory.impl.TaskHistoryQueryImpl;
|
||||||
|
import pro.taskana.simplehistory.impl.task.TaskHistoryQueryMapper;
|
||||||
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEventType;
|
||||||
|
import pro.taskana.task.api.TaskService;
|
||||||
|
import pro.taskana.task.api.TaskState;
|
||||||
|
import pro.taskana.task.api.models.Task;
|
||||||
|
|
||||||
|
@ExtendWith(JaasExtension.class)
|
||||||
|
class CreateHistoryEventOnTaskRequestReviewAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
|
private final TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
private final SimpleHistoryServiceImpl historyService = getHistoryService();
|
||||||
|
|
||||||
|
@WithAccessId(user = "user-1-1")
|
||||||
|
@Test
|
||||||
|
void should_CreateRequestReviewHistoryEvent_When_ReviewIsRequested() throws Exception {
|
||||||
|
final String taskId = "TKI:200000000000000000000000000000000066";
|
||||||
|
final Instant oldModified = taskService.getTask(taskId).getModified();
|
||||||
|
|
||||||
|
TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper();
|
||||||
|
|
||||||
|
List<TaskHistoryEvent> events =
|
||||||
|
taskHistoryQueryMapper.queryHistoryEvents(
|
||||||
|
(TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId));
|
||||||
|
|
||||||
|
assertThat(events).isEmpty();
|
||||||
|
|
||||||
|
assertThat(taskService.getTask(taskId).getState()).isEqualTo(TaskState.CLAIMED);
|
||||||
|
Task task = taskService.requestReview(taskId);
|
||||||
|
|
||||||
|
assertThat(task.getState()).isEqualTo(TaskState.READY_FOR_REVIEW);
|
||||||
|
|
||||||
|
events =
|
||||||
|
taskHistoryQueryMapper.queryHistoryEvents(
|
||||||
|
(TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId));
|
||||||
|
|
||||||
|
TaskHistoryEvent event = events.get(0);
|
||||||
|
|
||||||
|
assertThat(event.getEventType()).isEqualTo(TaskHistoryEventType.REQUESTED_REVIEW.getName());
|
||||||
|
|
||||||
|
event = historyService.getTaskHistoryEvent(event.getId());
|
||||||
|
|
||||||
|
assertThat(event.getDetails()).isNotNull();
|
||||||
|
|
||||||
|
JSONArray changes = new JSONObject(event.getDetails()).getJSONArray("changes");
|
||||||
|
|
||||||
|
JSONObject expectedModified =
|
||||||
|
new JSONObject()
|
||||||
|
.put("newValue", task.getModified().toString())
|
||||||
|
.put("fieldName", "modified")
|
||||||
|
.put("oldValue", oldModified.toString());
|
||||||
|
JSONObject expectedState =
|
||||||
|
new JSONObject()
|
||||||
|
.put("newValue", "READY_FOR_REVIEW")
|
||||||
|
.put("fieldName", "state")
|
||||||
|
.put("oldValue", "CLAIMED");
|
||||||
|
JSONObject expectedOwner =
|
||||||
|
new JSONObject().put("newValue", "").put("fieldName", "owner").put("oldValue", "user-1-1");
|
||||||
|
|
||||||
|
JSONArray expectedChanges =
|
||||||
|
new JSONArray().put(expectedModified).put(expectedState).put(expectedOwner);
|
||||||
|
assertThat(changes.similar(expectedChanges)).isTrue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
|
||||||
taskService.completeTask(taskId);
|
taskService.completeTask(taskId);
|
||||||
|
|
||||||
long totalTasksCount = taskService.createTaskQuery().count();
|
long totalTasksCount = taskService.createTaskQuery().count();
|
||||||
assertThat(totalTasksCount).isEqualTo(99);
|
assertThat(totalTasksCount).isEqualTo(100);
|
||||||
|
|
||||||
taskanaEngine.getConfiguration().setTaskCleanupJobAllCompletedSameParentBusiness(false);
|
taskanaEngine.getConfiguration().setTaskCleanupJobAllCompletedSameParentBusiness(false);
|
||||||
|
|
||||||
|
|
@ -58,14 +58,14 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
|
||||||
job.run();
|
job.run();
|
||||||
|
|
||||||
totalTasksCount = taskService.createTaskQuery().count();
|
totalTasksCount = taskService.createTaskQuery().count();
|
||||||
assertThat(totalTasksCount).isEqualTo(80);
|
assertThat(totalTasksCount).isEqualTo(81);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
@Test
|
@Test
|
||||||
void shouldCleanCompletedTasksUntilDateWithSameParentBussiness() throws Exception {
|
void shouldCleanCompletedTasksUntilDateWithSameParentBussiness() throws Exception {
|
||||||
long totalTasksCount = taskService.createTaskQuery().count();
|
long totalTasksCount = taskService.createTaskQuery().count();
|
||||||
assertThat(totalTasksCount).isEqualTo(98);
|
assertThat(totalTasksCount).isEqualTo(99);
|
||||||
|
|
||||||
taskanaEngine.getConfiguration().setTaskCleanupJobAllCompletedSameParentBusiness(true);
|
taskanaEngine.getConfiguration().setTaskCleanupJobAllCompletedSameParentBusiness(true);
|
||||||
|
|
||||||
|
|
@ -84,7 +84,7 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
|
||||||
job.run();
|
job.run();
|
||||||
|
|
||||||
totalTasksCount = taskService.createTaskQuery().count();
|
totalTasksCount = taskService.createTaskQuery().count();
|
||||||
assertThat(totalTasksCount).isEqualTo(78);
|
assertThat(totalTasksCount).isEqualTo(79);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ class SetOwnerAccTest extends AbstractAccTest {
|
||||||
allTaskSummaries.stream().map(TaskSummary::getId).collect(Collectors.toList());
|
allTaskSummaries.stream().map(TaskSummary::getId).collect(Collectors.toList());
|
||||||
BulkOperationResults<String, TaskanaException> results =
|
BulkOperationResults<String, TaskanaException> results =
|
||||||
taskanaEngine.getTaskService().setOwnerOfTasks("theWorkaholic", allTaskIds);
|
taskanaEngine.getTaskService().setOwnerOfTasks("theWorkaholic", allTaskIds);
|
||||||
assertThat(allTaskSummaries).hasSize(98);
|
assertThat(allTaskSummaries).hasSize(99);
|
||||||
assertThat(results.containsErrors()).isTrue();
|
assertThat(results.containsErrors()).isTrue();
|
||||||
|
|
||||||
Condition<Object> invalidTaskStateException =
|
Condition<Object> invalidTaskStateException =
|
||||||
|
|
@ -177,11 +177,11 @@ class SetOwnerAccTest extends AbstractAccTest {
|
||||||
c -> c.getClass() == MismatchedWorkbasketPermissionException.class,
|
c -> c.getClass() == MismatchedWorkbasketPermissionException.class,
|
||||||
"MismatchedWorkbasketPermissionException");
|
"MismatchedWorkbasketPermissionException");
|
||||||
assertThat(results.getErrorMap())
|
assertThat(results.getErrorMap())
|
||||||
.hasSize(96)
|
.hasSize(97)
|
||||||
.extractingFromEntries(Entry::getValue)
|
.extractingFromEntries(Entry::getValue)
|
||||||
.hasOnlyElementsOfTypes(InvalidTaskStateException.class, NotAuthorizedException.class)
|
.hasOnlyElementsOfTypes(InvalidTaskStateException.class, NotAuthorizedException.class)
|
||||||
.areExactly(37, invalidTaskStateException)
|
.areExactly(37, invalidTaskStateException)
|
||||||
.areExactly(59, mismatchedWorkbasketPermissionException);
|
.areExactly(60, mismatchedWorkbasketPermissionException);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
|
|
@ -193,10 +193,10 @@ class SetOwnerAccTest extends AbstractAccTest {
|
||||||
allTaskSummaries.stream().map(TaskSummary::getId).collect(Collectors.toList());
|
allTaskSummaries.stream().map(TaskSummary::getId).collect(Collectors.toList());
|
||||||
BulkOperationResults<String, TaskanaException> results =
|
BulkOperationResults<String, TaskanaException> results =
|
||||||
taskanaEngine.getTaskService().setOwnerOfTasks("theWorkaholic", allTaskIds);
|
taskanaEngine.getTaskService().setOwnerOfTasks("theWorkaholic", allTaskIds);
|
||||||
assertThat(allTaskSummaries).hasSize(98);
|
assertThat(allTaskSummaries).hasSize(99);
|
||||||
assertThat(results.containsErrors()).isTrue();
|
assertThat(results.containsErrors()).isTrue();
|
||||||
assertThat(results.getErrorMap())
|
assertThat(results.getErrorMap())
|
||||||
.hasSize(50)
|
.hasSize(51)
|
||||||
.extractingFromEntries(Entry::getValue)
|
.extractingFromEntries(Entry::getValue)
|
||||||
.hasOnlyElementsOfType(InvalidStateException.class);
|
.hasOnlyElementsOfType(InvalidStateException.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,14 +54,14 @@ class TerminateTaskAccTest extends AbstractAccTest {
|
||||||
void should_TerminateTask_When_TaskStateIsClaimed() throws Exception {
|
void should_TerminateTask_When_TaskStateIsClaimed() throws Exception {
|
||||||
List<TaskSummary> taskSummaries =
|
List<TaskSummary> taskSummaries =
|
||||||
taskService.createTaskQuery().stateIn(TaskState.CLAIMED).list();
|
taskService.createTaskQuery().stateIn(TaskState.CLAIMED).list();
|
||||||
assertThat(taskSummaries.size()).isEqualTo(20);
|
assertThat(taskSummaries.size()).isEqualTo(21);
|
||||||
|
|
||||||
long numTasksTerminated = taskService.createTaskQuery().stateIn(TaskState.TERMINATED).count();
|
long numTasksTerminated = taskService.createTaskQuery().stateIn(TaskState.TERMINATED).count();
|
||||||
assertThat(numTasksTerminated).isEqualTo(5);
|
assertThat(numTasksTerminated).isEqualTo(5);
|
||||||
|
|
||||||
taskService.terminateTask(taskSummaries.get(0).getId());
|
taskService.terminateTask(taskSummaries.get(0).getId());
|
||||||
long numTasksClaimed = taskService.createTaskQuery().stateIn(TaskState.CLAIMED).count();
|
long numTasksClaimed = taskService.createTaskQuery().stateIn(TaskState.CLAIMED).count();
|
||||||
assertThat(numTasksClaimed).isEqualTo(19);
|
assertThat(numTasksClaimed).isEqualTo(20);
|
||||||
numTasksTerminated = taskService.createTaskQuery().stateIn(TaskState.TERMINATED).count();
|
numTasksTerminated = taskService.createTaskQuery().stateIn(TaskState.TERMINATED).count();
|
||||||
assertThat(numTasksTerminated).isEqualTo(6);
|
assertThat(numTasksTerminated).isEqualTo(6);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
.ownerNotIn("user-b-1")
|
.ownerNotIn("user-b-1")
|
||||||
.orderByOwnerLongName(ASCENDING)
|
.orderByOwnerLongName(ASCENDING)
|
||||||
.list();
|
.list();
|
||||||
assertThat(tasks).extracting(TaskSummary::getOwnerLongName).hasSize(17).isSorted();
|
assertThat(tasks).extracting(TaskSummary::getOwnerLongName).hasSize(18).isSorted();
|
||||||
|
|
||||||
tasks =
|
tasks =
|
||||||
taskService
|
taskService
|
||||||
|
|
@ -173,7 +173,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
.orderByOwnerLongName(DESCENDING)
|
.orderByOwnerLongName(DESCENDING)
|
||||||
.list();
|
.list();
|
||||||
assertThat(tasks)
|
assertThat(tasks)
|
||||||
.hasSize(17)
|
.hasSize(18)
|
||||||
.extracting(TaskSummary::getOwnerLongName)
|
.extracting(TaskSummary::getOwnerLongName)
|
||||||
.isSortedAccordingTo(Comparator.reverseOrder());
|
.isSortedAccordingTo(Comparator.reverseOrder());
|
||||||
}
|
}
|
||||||
|
|
@ -254,7 +254,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
List<TaskSummary> query =
|
List<TaskSummary> query =
|
||||||
taskService.createTaskQuery().customAttributeIn(TaskCustomField.CUSTOM_1, "").list();
|
taskService.createTaskQuery().customAttributeIn(TaskCustomField.CUSTOM_1, "").list();
|
||||||
assertThat(query).hasSize(95);
|
assertThat(query).hasSize(96);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|
@ -280,7 +280,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
Triplet.of(TaskCustomField.CUSTOM_11, new String[] {"%ert"}, 3),
|
Triplet.of(TaskCustomField.CUSTOM_11, new String[] {"%ert"}, 3),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_12, new String[] {"dd%"}, 1),
|
Triplet.of(TaskCustomField.CUSTOM_12, new String[] {"dd%"}, 1),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_13, new String[] {"%dd_"}, 1),
|
Triplet.of(TaskCustomField.CUSTOM_13, new String[] {"%dd_"}, 1),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_14, new String[] {"%"}, 98),
|
Triplet.of(TaskCustomField.CUSTOM_14, new String[] {"%"}, 99),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_15, new String[] {"___"}, 4),
|
Triplet.of(TaskCustomField.CUSTOM_15, new String[] {"___"}, 4),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_16, new String[] {"___"}, 4));
|
Triplet.of(TaskCustomField.CUSTOM_16, new String[] {"___"}, 4));
|
||||||
assertThat(list).hasSameSizeAs(TaskCustomField.values());
|
assertThat(list).hasSameSizeAs(TaskCustomField.values());
|
||||||
|
|
@ -312,22 +312,22 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
// carefully constructed to always return exactly 2 results
|
// carefully constructed to always return exactly 2 results
|
||||||
List<Triplet<TaskCustomField, String[], Integer>> list =
|
List<Triplet<TaskCustomField, String[], Integer>> list =
|
||||||
List.of(
|
List.of(
|
||||||
Triplet.of(TaskCustomField.CUSTOM_1, new String[] {"custom1"}, 97),
|
Triplet.of(TaskCustomField.CUSTOM_1, new String[] {"custom1"}, 98),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_2, new String[] {""}, 2),
|
Triplet.of(TaskCustomField.CUSTOM_2, new String[] {""}, 2),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_3, new String[] {"custom3"}, 97),
|
Triplet.of(TaskCustomField.CUSTOM_3, new String[] {"custom3"}, 98),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_4, new String[] {""}, 2),
|
Triplet.of(TaskCustomField.CUSTOM_4, new String[] {""}, 2),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_5, new String[] {"ew", "al", "el"}, 91),
|
Triplet.of(TaskCustomField.CUSTOM_5, new String[] {"ew", "al", "el"}, 92),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_6, new String[] {"11", "vvg"}, 94),
|
Triplet.of(TaskCustomField.CUSTOM_6, new String[] {"11", "vvg"}, 95),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_7, new String[] {"custom7", "ijk"}, 96),
|
Triplet.of(TaskCustomField.CUSTOM_7, new String[] {"custom7", "ijk"}, 97),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_8, new String[] {"not_existing"}, 98),
|
Triplet.of(TaskCustomField.CUSTOM_8, new String[] {"not_existing"}, 99),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_9, new String[] {"custom9"}, 97),
|
Triplet.of(TaskCustomField.CUSTOM_9, new String[] {"custom9"}, 98),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_10, new String[] {"custom10"}, 97),
|
Triplet.of(TaskCustomField.CUSTOM_10, new String[] {"custom10"}, 98),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_11, new String[] {"custom11"}, 97),
|
Triplet.of(TaskCustomField.CUSTOM_11, new String[] {"custom11"}, 98),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_12, new String[] {"custom12"}, 97),
|
Triplet.of(TaskCustomField.CUSTOM_12, new String[] {"custom12"}, 98),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_13, new String[] {"custom13"}, 97),
|
Triplet.of(TaskCustomField.CUSTOM_13, new String[] {"custom13"}, 98),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_14, new String[] {"abc"}, 0),
|
Triplet.of(TaskCustomField.CUSTOM_14, new String[] {"abc"}, 0),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_15, new String[] {"custom15"}, 97),
|
Triplet.of(TaskCustomField.CUSTOM_15, new String[] {"custom15"}, 98),
|
||||||
Triplet.of(TaskCustomField.CUSTOM_16, new String[] {"custom16"}, 97));
|
Triplet.of(TaskCustomField.CUSTOM_16, new String[] {"custom16"}, 98));
|
||||||
assertThat(list).hasSameSizeAs(TaskCustomField.values());
|
assertThat(list).hasSameSizeAs(TaskCustomField.values());
|
||||||
|
|
||||||
return DynamicTest.stream(
|
return DynamicTest.stream(
|
||||||
|
|
@ -376,7 +376,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
List<TaskSummary> results =
|
List<TaskSummary> results =
|
||||||
taskService.createTaskQuery().customAttributeIn(TaskCustomField.CUSTOM_9, "").list();
|
taskService.createTaskQuery().customAttributeIn(TaskCustomField.CUSTOM_9, "").list();
|
||||||
assertThat(results).hasSize(96);
|
assertThat(results).hasSize(97);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
|
|
@ -388,7 +388,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
.createTaskQuery()
|
.createTaskQuery()
|
||||||
.customAttributeIn(TaskCustomField.CUSTOM_9, "", null)
|
.customAttributeIn(TaskCustomField.CUSTOM_9, "", null)
|
||||||
.list();
|
.list();
|
||||||
assertThat(results).hasSize(97);
|
assertThat(results).hasSize(98);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
|
|
@ -400,14 +400,14 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
.createTaskQuery()
|
.createTaskQuery()
|
||||||
.customAttributeNotIn(TaskCustomField.CUSTOM_9, new String[] {null})
|
.customAttributeNotIn(TaskCustomField.CUSTOM_9, new String[] {null})
|
||||||
.list();
|
.list();
|
||||||
assertThat(results).hasSize(97);
|
assertThat(results).hasSize(98);
|
||||||
|
|
||||||
results =
|
results =
|
||||||
taskService
|
taskService
|
||||||
.createTaskQuery()
|
.createTaskQuery()
|
||||||
.customAttributeNotIn(TaskCustomField.CUSTOM_9, null, "custom9")
|
.customAttributeNotIn(TaskCustomField.CUSTOM_9, null, "custom9")
|
||||||
.list();
|
.list();
|
||||||
assertThat(results).hasSize(96);
|
assertThat(results).hasSize(97);
|
||||||
|
|
||||||
results =
|
results =
|
||||||
taskService
|
taskService
|
||||||
|
|
@ -415,7 +415,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
.customAttributeNotIn(TaskCustomField.CUSTOM_9, new String[] {null})
|
.customAttributeNotIn(TaskCustomField.CUSTOM_9, new String[] {null})
|
||||||
.customAttributeNotIn(TaskCustomField.CUSTOM_10, "custom10")
|
.customAttributeNotIn(TaskCustomField.CUSTOM_10, "custom10")
|
||||||
.list();
|
.list();
|
||||||
assertThat(results).hasSize(96);
|
assertThat(results).hasSize(97);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class QueryTasksByRoleAccTest extends AbstractAccTest {
|
||||||
switch (taskanaEngine.getCurrentUserContext().getUserid()) {
|
switch (taskanaEngine.getCurrentUserContext().getUserid()) {
|
||||||
case "admin":
|
case "admin":
|
||||||
case "taskadmin":
|
case "taskadmin":
|
||||||
expectedSize = 98;
|
expectedSize = 99;
|
||||||
break;
|
break;
|
||||||
case "businessadmin":
|
case "businessadmin":
|
||||||
case "monitor":
|
case "monitor":
|
||||||
|
|
@ -58,7 +58,7 @@ class QueryTasksByRoleAccTest extends AbstractAccTest {
|
||||||
expectedSize = 26;
|
expectedSize = 26;
|
||||||
break;
|
break;
|
||||||
case "user-1-1":
|
case "user-1-1":
|
||||||
expectedSize = 8;
|
expectedSize = 9;
|
||||||
break;
|
break;
|
||||||
case "user-taskrouter":
|
case "user-taskrouter":
|
||||||
expectedSize = 0;
|
expectedSize = 0;
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
|
||||||
List<TaskSummary> results =
|
List<TaskSummary> results =
|
||||||
taskService.createTaskQuery().createdWithin(interval1).orderByCreated(asc).list();
|
taskService.createTaskQuery().createdWithin(interval1).orderByCreated(asc).list();
|
||||||
|
|
||||||
assertThat(results).hasSize(39);
|
assertThat(results).hasSize(40);
|
||||||
TaskSummary previousSummary = null;
|
TaskSummary previousSummary = null;
|
||||||
for (TaskSummary taskSummary : results) {
|
for (TaskSummary taskSummary : results) {
|
||||||
Instant cr = taskSummary.getCreated();
|
Instant cr = taskSummary.getCreated();
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ class QueryTasksWithPaginationAccTest extends AbstractAccTest {
|
||||||
void testQueryAllPaged() {
|
void testQueryAllPaged() {
|
||||||
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
|
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
|
||||||
long numberOfTasks = taskQuery.count();
|
long numberOfTasks = taskQuery.count();
|
||||||
assertThat(numberOfTasks).isEqualTo(98);
|
assertThat(numberOfTasks).isEqualTo(99);
|
||||||
List<TaskSummary> tasks = taskQuery.orderByDue(DESCENDING).list();
|
List<TaskSummary> tasks = taskQuery.orderByDue(DESCENDING).list();
|
||||||
assertThat(tasks).hasSize(98);
|
assertThat(tasks).hasSize(99);
|
||||||
List<TaskSummary> tasksp = taskQuery.orderByDue(DESCENDING).listPage(4, 5);
|
List<TaskSummary> tasksp = taskQuery.orderByDue(DESCENDING).listPage(4, 5);
|
||||||
assertThat(tasksp).hasSize(5);
|
assertThat(tasksp).hasSize(5);
|
||||||
tasksp = taskQuery.orderByDue(DESCENDING).listPage(5, 5);
|
tasksp = taskQuery.orderByDue(DESCENDING).listPage(5, 5);
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,8 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
|
||||||
taskService.forceCompleteTask(task.getId());
|
taskService.forceCompleteTask(task.getId());
|
||||||
task = (TaskImpl) taskService.getTask("TKI:100000000000000000000000000000000066");
|
task = (TaskImpl) taskService.getTask("TKI:100000000000000000000000000000000066");
|
||||||
taskService.forceCompleteTask(task.getId());
|
taskService.forceCompleteTask(task.getId());
|
||||||
|
task = (TaskImpl) taskService.getTask("TKI:200000000000000000000000000000000066");
|
||||||
|
taskService.forceCompleteTask(task.getId());
|
||||||
|
|
||||||
boolean canBeDeletedNow = workbasketService.deleteWorkbasket(wb.getId());
|
boolean canBeDeletedNow = workbasketService.deleteWorkbasket(wb.getId());
|
||||||
assertThat(canBeDeletedNow).isFalse();
|
assertThat(canBeDeletedNow).isFalse();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue