use of org.kie.server.api.model.taskassigning.PlanningTask in project droolsjbpm-integration by kiegroup.
the class TaskAssigningRuntimeServiceBaseTest method executePlanningWithTaskInReservedStatusWithPlanningTaskButReassigned.
@Test
public void executePlanningWithTaskInReservedStatusWithPlanningTaskButReassigned() {
PlanningTask planningTask = mockPlanningTask(TASK_ID, PREVIOUS_ASSIGNED_USER_ID);
TaskData taskData = mockTaskData(TASK_ID, Reserved, PREVIOUS_ASSIGNED_USER_ID_CHANGED, planningTask);
List<TaskData> taskDataList = Collections.singletonList(taskData);
PlanningItem planningItem = mockPlanningItem(TASK_ID, CONTAINER_ID, ASSIGNED_USER_ID);
PlanningItemList planningItemList = new PlanningItemList(Collections.singletonList(planningItem));
prepareExecution(taskDataList, CONTAINER_ID);
PlanningExecutionResult result = serviceBase.executePlanning(planningItemList, USER_ID);
verify(userTaskService, never()).execute(eq(CONTAINER_ID), any());
String errorMessage = String.format(TASK_MODIFIED_ERROR_MSG_1, taskData.getTaskId(), PREVIOUS_ASSIGNED_USER_ID_CHANGED, PREVIOUS_ASSIGNED_USER_ID);
assertHasError(result, PlanningExecutionResult.ErrorCode.TASK_MODIFIED_SINCE_PLAN_CALCULATION_ERROR, errorMessage, CONTAINER_ID);
}
use of org.kie.server.api.model.taskassigning.PlanningTask in project droolsjbpm-integration by kiegroup.
the class TaskAssigningRuntimeServiceBaseTest method executePlanningWithTaskInReservedStatusWithPlanningTaskDontReassigned.
@Test
public void executePlanningWithTaskInReservedStatusWithPlanningTaskDontReassigned() {
PlanningTask planningTask = mockPlanningTask(TASK_ID, PREVIOUS_ASSIGNED_USER_ID);
TaskData taskData = mockTaskData(TASK_ID, Reserved, PREVIOUS_ASSIGNED_USER_ID, planningTask);
List<TaskData> taskDataList = Collections.singletonList(taskData);
PlanningItem planningItem = mockPlanningItem(TASK_ID, CONTAINER_ID, ASSIGNED_USER_ID);
PlanningItemList planningItemList = new PlanningItemList(Collections.singletonList(planningItem));
prepareExecution(taskDataList, CONTAINER_ID);
PlanningExecutionResult result = serviceBase.executePlanning(planningItemList, USER_ID);
verify(userTaskService).execute(eq(CONTAINER_ID), planningCommandCaptor.capture());
assertDelegateAndSaveCommand(planningCommandCaptor.getAllValues(), 0, USER_ID, planningItem);
assertNoError(result);
}
use of org.kie.server.api.model.taskassigning.PlanningTask in project droolsjbpm-integration by kiegroup.
the class AbstractTaskAssigningDataQueryMapperTest method createTestValues.
protected List<List<Object>> createTestValues() {
PlanningTask task1PlanningTask = PlanningTask.builder().taskId(TASK1_PLANNING_TASK_ID).assignedUser(TASK1_PLANNING_TASK_ASSIGNED_USER).index(TASK1_PLANNING_TASK_INDEX).published(TASK1_PLANNING_TASK_PUBLISHED).build();
List<Pair<String, String>> task1PotentialOwners = Arrays.asList(Pair.of(TASK1_PO_1_ID, TASK1_PO_1_TYPE), Pair.of(TASK1_PO_2_ID, TASK1_PO_2_TYPE));
List<List<Object>> task1RawValues = mockRawValues(TASK1_ID, TASK1_CREATED_ON, TASK1_ACTUAL_OWNER, TASK1_DEPLOYMENT_ID, TASK1_NAME, TASK1_PRIORITY, TASK1_PROCESS_ID, TASK1_PROCESS_INSTANCE_ID, TASK1_STATUS, TASK1_LAST_MODIFICATION_DATE, task1PlanningTask, task1PotentialOwners);
PlanningTask task2PlanningTask = PlanningTask.builder().taskId(TASK2_PLANNING_TASK_ID).assignedUser(TASK2_PLANNING_TASK_ASSIGNED_USER).index(TASK2_PLANNING_TASK_INDEX).published(TASK2_PLANNING_TASK_PUBLISHED).build();
List<List<Object>> task2RawValues = mockRawValues(TASK2_ID, TASK2_CREATED_ON, TASK2_ACTUAL_OWNER, TASK2_DEPLOYMENT_ID, TASK2_NAME, TASK2_PRIORITY, TASK2_PROCESS_ID, TASK2_PROCESS_INSTANCE_ID, TASK2_STATUS, TASK2_LAST_MODIFICATION_DATE, task2PlanningTask, Collections.emptyList());
List<Pair<String, String>> task3PotentialOwners = Arrays.asList(Pair.of(TASK3_PO_1_ID, TASK3_PO_1_TYPE), Pair.of(TASK3_PO_2_ID, TASK3_PO_2_TYPE));
List<List<Object>> task3RawValues = mockRawValues(TASK3_ID, TASK3_CREATED_ON, TASK3_ACTUAL_OWNER, TASK3_DEPLOYMENT_ID, TASK3_NAME, TASK3_PRIORITY, TASK3_PROCESS_ID, TASK3_PROCESS_INSTANCE_ID, TASK3_STATUS, TASK3_LAST_MODIFICATION_DATE, null, task3PotentialOwners);
List<List<Object>> rawValues = new ArrayList<>();
rawValues.addAll(task1RawValues);
rawValues.addAll(task2RawValues);
rawValues.addAll(task3RawValues);
return rawValues;
}
Aggregations