use of org.kie.server.api.model.taskassigning.PlanningItem in project droolsjbpm-integration by kiegroup.
the class TaskAssigningRuntimeServiceBaseTest method executePlanningWithTaskNoLongerInActiveStatus.
@Test
public void executePlanningWithTaskNoLongerInActiveStatus() {
List<TaskData> taskDataList = Collections.emptyList();
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);
String errorMessage = String.format(TASK_MODIFIED_ERROR_MSG_3, planningItem.getPlanningTask().getTaskId(), Arrays.toString(new Status[] { Ready, Reserved, InProgress, Suspended }));
assertHasError(result, PlanningExecutionResult.ErrorCode.TASK_MODIFIED_SINCE_PLAN_CALCULATION_ERROR, errorMessage, CONTAINER_ID);
}
use of org.kie.server.api.model.taskassigning.PlanningItem in project droolsjbpm-integration by kiegroup.
the class TaskAssigningRuntimeServiceBaseTest method unexpectedErrorDuringPlanExecution.
@Test
public void unexpectedErrorDuringPlanExecution() {
TaskData taskData = mockTaskData(TASK_ID, Ready);
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);
when(userTaskService.execute(eq(CONTAINER_ID), any())).thenThrow(new RuntimeException(ERROR_MESSAGE));
PlanningExecutionResult result = serviceBase.executePlanning(planningItemList, USER_ID);
assertHasError(result, PlanningExecutionResult.ErrorCode.UNEXPECTED_ERROR, String.format(UNEXPECTED_ERROR_DURING_PLAN_EXECUTION, CONTAINER_ID, ERROR_MESSAGE), CONTAINER_ID);
}
use of org.kie.server.api.model.taskassigning.PlanningItem in project droolsjbpm-integration by kiegroup.
the class TaskAssigningRuntimeServiceBaseTest method executePlanningWithTaskInReadyStatus.
@Test
public void executePlanningWithTaskInReadyStatus() {
TaskData taskData = mockTaskData(TASK_ID, Ready);
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.PlanningItem in project droolsjbpm-integration by kiegroup.
the class TaskAssigningRuntimeDelegateTest method executePlanning.
@Test
public void executePlanning() {
PlanningItem item = new PlanningItem();
List<PlanningItem> planningItems = Collections.singletonList(item);
String targetUser = "TARGET_USER";
delegate.executePlanning(planningItems, targetUser);
verify(runtimeClient).executePlanning(planCaptor.capture(), eq(targetUser));
assertEquals(planningItems, planCaptor.getValue().getItems());
}
Aggregations