Skip to content

Commit

Permalink
integrated customer testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
arolfes committed Jul 31, 2023
1 parent b123348 commit b5bf617
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000021', 'ETI:0000000
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000022', 'ETI:000000000000000000000000000000000022', '2018-01-29 15:55:22', null , null , '2018-01-29 15:55:22', 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_0000000000022' , 'DOC_0000000000000000022' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000023', 'ETI:000000000000000000000000000000000023', '2018-01-29 15:55:23', null , null , '2018-01-29 15:55:23', 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_0000000000023' , 'DOC_0000000000000000023' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , 'lnp' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000024', 'ETI:000000000000000000000000000000000024', '2018-01-29 15:55:24', null , null , '2018-01-29 15:55:24', 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_0000000000024' , 'DOC_0000000000000000024' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , null , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000201', 'ETI:000000000000000000000000000000000201', '2023-07-31 15:55:01', '2023-07-31 15:55:00', null , '2023-07-31 15:55:01', null , '2023-07-31 15:55:00', '2023-08-02 15:55:00', 'Task201' , 'creator_user_id' , 'Lorem ipsum was n Quatsch dolor sit amet.', 'Some custom Note' , 2 , -1 , 'READY' , 'EXTERN' , 'L110102' , 'CLI:100000000000000000000000000000000002', 'WBI:100000000000000000000000000000000006' , 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user-1-1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , 'NONE' , null , 'pqr' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'abc' , '' , '' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
-- TASK TABLE (ID , EXTERNAL_ID , CREATED , CLAIMED , COMPLETED , modified , received , planned , due , name , creator , description , note , priority, manual_priority, state , classification_category , classification_key, classification_id , workbasket_id , workbasket_key, domain , business_process_id, parent_business_process_id, owner , por_company , por_system , por_system_instance, por_type , por_value , is_read, is_transferred,callback_info , callback_state , custom_attributes ,custom1 ,custom2, ,custom3, ,custom4 ,custom5 ,custom6 ,custom7 ,custom8 ,custom9 ,custom10 ,custom11, ,custom12 ,custom13 ,custom14 ,custom15 ,custom16 , custom-int-1, custom-int-2, custom-int-3, custom-int-4, custom-int-5, custom-int-6, custom-int-7, custom-int-8
-- Tasks for WorkOnTaskAccTest
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000025', 'ETI:000000000000000000000000000000000025', '2018-01-29 15:55:24', null , null , '2018-01-29 15:55:24', '2018-01-29 15:55:24', '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:100000000000000000000000000000000007' , 'USER-1-2' , 'DOMAIN_A', 'PI_0000000000025' , 'DOC_0000000000000000025' , null , 'abcd00' , 'PASystem' , '00' , 'SDNR' , '98765432' , false , false , null , 'NONE' , null , '' , '' , '' , '' , '' , '' , '' , '' , '' , 'ert' , 'ert' , 'ert' , 'ert' , 'abc' , 'ert' , 'ert' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ void should_CleanCompletedTasksUntilDate() throws Exception {
taskService.completeTask(taskId);

long totalTasksCount = taskService.createTaskQuery().count();
assertThat(totalTasksCount).isEqualTo(100);
assertThat(totalTasksCount).isEqualTo(101);

TaskCleanupJob job = new TaskCleanupJob(taskanaEngine, null, null);
job.run();

totalTasksCount = taskService.createTaskQuery().count();
assertThat(totalTasksCount).isEqualTo(81);
assertThat(totalTasksCount).isEqualTo(82);
}

@WithAccessId(user = "admin")
@Test
void shouldCleanCompletedTasksUntilDateWithSameParentBusiness() throws Exception {
long totalTasksCount = taskService.createTaskQuery().count();
assertThat(totalTasksCount).isEqualTo(99);
assertThat(totalTasksCount).isEqualTo(100);

TaskanaConfiguration taskanaConfiguration =
new TaskanaConfiguration.Builder(AbstractAccTest.taskanaEngine.getConfiguration())
Expand Down Expand Up @@ -103,7 +103,7 @@ void shouldCleanCompletedTasksUntilDateWithSameParentBusiness() throws Exception
job.run();

totalTasksCount = taskanaEngine.getTaskService().createTaskQuery().count();
assertThat(totalTasksCount).isEqualTo(79);
assertThat(totalTasksCount).isEqualTo(80);
}

@WithAccessId(user = "admin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,17 @@ void should_UpdateTaskPlannedOrDue_When_PlannedOrDueAreWeekendDays() throws Exce
assertThat(task.getDue()).isEqualTo(getInstant("2024-04-19T07:00:00")); // Friday
}

@WithAccessId(user = "user-1-1")
@Test
void should_UpdateTaskPlannedAndDueDate_When_PlannedDateIsNotWorkingDay() throws Exception {
Task task = taskService.getTask("TKI:000000000000000000000000000000000201"); // SL=P2D
assertThat(task.getClassificationSummary().getServiceLevel()).isEqualTo("P2D");
task.setPlanned(getInstant("2024-03-29T07:00:00")); // planned = Good Friday
task = taskService.updateTask(task);
assertThat(task.getPlanned()).isEqualTo(getInstant("2024-04-02T07:00:00")); // Tuesday
assertThat(task.getDue()).isEqualTo(getInstant("2024-04-04T07:00:00")); // Thursday
}

@WithAccessId(user = "user-1-1")
@Test
void should_UpdateTaskPlannedOrDue_When_PlannedOrDueAreOnWeekends_ServiceLevel_P0D()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void testSetOwnerWithAllTasksAndVariousExceptions() throws Exception {
allTaskSummaries.stream().map(TaskSummary::getId).collect(Collectors.toList());
BulkOperationResults<String, TaskanaException> results =
taskanaEngine.getTaskService().setOwnerOfTasks("theWorkaholic", allTaskIds);
assertThat(allTaskSummaries).hasSize(99);
assertThat(allTaskSummaries).hasSize(100);
assertThat(results.containsErrors()).isTrue();

Condition<Object> invalidTaskStateException =
Expand All @@ -205,12 +205,12 @@ void testSetOwnerWithAllTasksAndVariousExceptions() throws Exception {
c -> c.getClass() == NotAuthorizedOnWorkbasketException.class,
"MismatchedWorkbasketPermissionException");
assertThat(results.getErrorMap())
.hasSize(95)
.hasSize(96)
.extractingFromEntries(Entry::getValue)
.hasOnlyElementsOfTypes(
InvalidTaskStateException.class, NotAuthorizedOnWorkbasketException.class)
.areExactly(35, invalidTaskStateException)
.areExactly(60, mismatchedWorkbasketPermissionException);
.areExactly(61, mismatchedWorkbasketPermissionException);
}

@WithAccessId(user = "admin")
Expand All @@ -222,7 +222,7 @@ void testSetOwnerWithAllTasksAndVariousExceptionsAsAdmin() throws Exception {
allTaskSummaries.stream().map(TaskSummary::getId).collect(Collectors.toList());
BulkOperationResults<String, TaskanaException> results =
taskanaEngine.getTaskService().setOwnerOfTasks("theWorkaholic", allTaskIds);
assertThat(allTaskSummaries).hasSize(99);
assertThat(allTaskSummaries).hasSize(100);
assertThat(results.containsErrors()).isTrue();
assertThat(results.getErrorMap())
.hasSize(49)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ void testQueryCancelledTasks() {
@Test
void testCancelReadyTask() throws Exception {
List<TaskSummary> taskSummaries = taskService.createTaskQuery().stateIn(TaskState.READY).list();
assertThat(taskSummaries).hasSize(48);
assertThat(taskSummaries).hasSize(49);
taskService.cancelTask(taskSummaries.get(0).getId());
long numTasks = taskService.createTaskQuery().stateIn(TaskState.READY).count();
assertThat(numTasks).isEqualTo(47);
assertThat(numTasks).isEqualTo(48);
numTasks = taskService.createTaskQuery().stateIn(TaskState.CANCELLED).count();
assertThat(numTasks).isEqualTo(6);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ void should_ReturnAllTerminatedTasks_When_QueryTerminatedState() {
@TestTemplate
void should_TerminateTask_When_TaskStateIsReady() throws Exception {
List<TaskSummary> taskSummaries = taskService.createTaskQuery().stateIn(TaskState.READY).list();
assertThat(taskSummaries).hasSize(48);
assertThat(taskSummaries).hasSize(49);
taskService.terminateTask(taskSummaries.get(0).getId());
long numTasks = taskService.createTaskQuery().stateIn(TaskState.READY).count();
assertThat(numTasks).isEqualTo(47);
assertThat(numTasks).isEqualTo(48);
numTasks = taskService.createTaskQuery().stateIn(TaskState.TERMINATED).count();
assertThat(numTasks).isEqualTo(6);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Stream<DynamicTest> should_ReturnCorrectResults_When_QueryingForCustomXStatement
List<Triplet<TaskCustomField, String[], Integer>> list =
List.of(
Triplet.of(
TaskCustomField.CUSTOM_1, new String[] {"custom%", "p%", "%xyz%", "efg"}, 3),
TaskCustomField.CUSTOM_1, new String[] {"custom%", "p%", "%xyz%", "efg"}, 4),
Triplet.of(TaskCustomField.CUSTOM_2, new String[] {"custom%", "a%"}, 2),
Triplet.of(TaskCustomField.CUSTOM_3, new String[] {"ffg"}, 1),
Triplet.of(TaskCustomField.CUSTOM_4, new String[] {"%ust%", "%ty"}, 2),
Expand All @@ -359,7 +359,7 @@ Stream<DynamicTest> should_ReturnCorrectResults_When_QueryingForCustomXStatement
Triplet.of(TaskCustomField.CUSTOM_11, new String[] {"%ert"}, 3),
Triplet.of(TaskCustomField.CUSTOM_12, new String[] {"dd%"}, 1),
Triplet.of(TaskCustomField.CUSTOM_13, new String[] {"%dd_"}, 1),
Triplet.of(TaskCustomField.CUSTOM_14, new String[] {"%"}, 99),
Triplet.of(TaskCustomField.CUSTOM_14, new String[] {"%"}, 100),
Triplet.of(TaskCustomField.CUSTOM_15, new String[] {"___"}, 4),
Triplet.of(TaskCustomField.CUSTOM_16, new String[] {"___"}, 4));
assertThat(list).hasSameSizeAs(TaskCustomField.values());
Expand Down Expand Up @@ -391,22 +391,22 @@ Stream<DynamicTest> should_ReturnCorrectResults_When_QueryingForCustomXNotIn() {
// carefully constructed to always return exactly 2 results
List<Triplet<TaskCustomField, String[], Integer>> list =
List.of(
Triplet.of(TaskCustomField.CUSTOM_1, new String[] {"custom1"}, 98),
Triplet.of(TaskCustomField.CUSTOM_1, new String[] {"custom1"}, 99),
Triplet.of(TaskCustomField.CUSTOM_2, new String[] {""}, 2),
Triplet.of(TaskCustomField.CUSTOM_3, new String[] {"custom3"}, 98),
Triplet.of(TaskCustomField.CUSTOM_3, new String[] {"custom3"}, 99),
Triplet.of(TaskCustomField.CUSTOM_4, new String[] {""}, 2),
Triplet.of(TaskCustomField.CUSTOM_5, new String[] {"ew", "al", "el"}, 92),
Triplet.of(TaskCustomField.CUSTOM_6, new String[] {"11", "vvg"}, 95),
Triplet.of(TaskCustomField.CUSTOM_7, new String[] {"custom7", "ijk"}, 97),
Triplet.of(TaskCustomField.CUSTOM_8, new String[] {"not_existing"}, 99),
Triplet.of(TaskCustomField.CUSTOM_9, new String[] {"custom9"}, 98),
Triplet.of(TaskCustomField.CUSTOM_10, new String[] {"custom10"}, 98),
Triplet.of(TaskCustomField.CUSTOM_11, new String[] {"custom11"}, 98),
Triplet.of(TaskCustomField.CUSTOM_12, new String[] {"custom12"}, 98),
Triplet.of(TaskCustomField.CUSTOM_13, new String[] {"custom13"}, 98),
Triplet.of(TaskCustomField.CUSTOM_5, new String[] {"ew", "al", "el"}, 93),
Triplet.of(TaskCustomField.CUSTOM_6, new String[] {"11", "vvg"}, 96),
Triplet.of(TaskCustomField.CUSTOM_7, new String[] {"custom7", "ijk"}, 98),
Triplet.of(TaskCustomField.CUSTOM_8, new String[] {"not_existing"}, 100),
Triplet.of(TaskCustomField.CUSTOM_9, new String[] {"custom9"}, 99),
Triplet.of(TaskCustomField.CUSTOM_10, new String[] {"custom10"}, 99),
Triplet.of(TaskCustomField.CUSTOM_11, new String[] {"custom11"}, 99),
Triplet.of(TaskCustomField.CUSTOM_12, new String[] {"custom12"}, 99),
Triplet.of(TaskCustomField.CUSTOM_13, new String[] {"custom13"}, 99),
Triplet.of(TaskCustomField.CUSTOM_14, new String[] {"abc"}, 0),
Triplet.of(TaskCustomField.CUSTOM_15, new String[] {"custom15"}, 98),
Triplet.of(TaskCustomField.CUSTOM_16, new String[] {"custom16"}, 98));
Triplet.of(TaskCustomField.CUSTOM_15, new String[] {"custom15"}, 99),
Triplet.of(TaskCustomField.CUSTOM_16, new String[] {"custom16"}, 99));
assertThat(list).hasSameSizeAs(TaskCustomField.values());

return DynamicTest.stream(
Expand Down Expand Up @@ -455,7 +455,7 @@ void should_ReturnTasksWithNullCustomField_When_QueriedByCustomFieldWhichIsEmpty
throws InvalidArgumentException {
List<TaskSummary> results =
taskService.createTaskQuery().customAttributeIn(TaskCustomField.CUSTOM_9, "").list();
assertThat(results).hasSize(97);
assertThat(results).hasSize(98);
}

@WithAccessId(user = "admin")
Expand All @@ -467,7 +467,7 @@ void should_AllowToQueryTasksByCustomFieldWithNullAndEmptyInParallel()
.createTaskQuery()
.customAttributeIn(TaskCustomField.CUSTOM_9, "", null)
.list();
assertThat(results).hasSize(98);
assertThat(results).hasSize(99);
}

@WithAccessId(user = "admin")
Expand All @@ -479,22 +479,22 @@ void should_ReturnTasksWithEmptyCustomField_When_QueriedByCustomFieldWhichIsNotN
.createTaskQuery()
.customAttributeNotIn(TaskCustomField.CUSTOM_9, new String[] {null})
.list();
assertThat(results).hasSize(98);
assertThat(results).hasSize(99);

results =
taskService
.createTaskQuery()
.customAttributeNotIn(TaskCustomField.CUSTOM_9, null, "custom9")
.list();
assertThat(results).hasSize(97);
assertThat(results).hasSize(98);

results =
taskService
.createTaskQuery()
.customAttributeNotIn(TaskCustomField.CUSTOM_9, new String[] {null})
.customAttributeNotIn(TaskCustomField.CUSTOM_10, "custom10")
.list();
assertThat(results).hasSize(97);
assertThat(results).hasSize(98);
}

@WithAccessId(user = "admin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void should_FindAllAccessibleTasksDependentOnTheUser_When_MakingTaskQuery() {
switch (taskanaEngine.getCurrentUserContext().getUserid()) {
case "admin":
case "taskadmin":
expectedSize = 99;
expectedSize = 100;
break;
case "businessadmin":
case "monitor":
Expand All @@ -57,7 +57,7 @@ void should_FindAllAccessibleTasksDependentOnTheUser_When_MakingTaskQuery() {
expectedSize = 26;
break;
case "user-1-1":
expectedSize = 9;
expectedSize = 10;
break;
case "user-taskrouter":
expectedSize = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void testCreatedAfter() {
List<TaskSummary> results =
taskService.createTaskQuery().createdWithin(interval1).orderByCreated(asc).list();

assertThat(results).hasSize(61);
assertThat(results).hasSize(62);
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getCreated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void testQueryTaskValuesForClassificationName() {
.ownerLike("%user%")
.orderByClassificationName(ASCENDING)
.listValues(TaskQueryColumnName.CLASSIFICATION_NAME, null);
assertThat(columnValueList).hasSize(5);
assertThat(columnValueList).hasSize(6);
}

@WithAccessId(user = "admin")
Expand Down
Loading

0 comments on commit b5bf617

Please sign in to comment.