use of org.kie.server.api.model.taskassigning.PlanningTask in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method addPinReservedOrInProgressOrSuspendedTaskWhenPublishedAndNotYetPinned.
private void addPinReservedOrInProgressOrSuspendedTaskWhenPublishedAndNotYetPinned(Status status, boolean addActualOwnerToSolution) {
TaskData taskData = mockTaskData(TASK_ID, NAME, status, ACTUAL_OWNER_ENTITY_ID);
PlanningTask planningTask = mockPlanningTask(taskData.getTaskId(), true);
planningTask.setIndex(0);
taskData.setPlanningTask(planningTask);
Task task = fromTaskData(taskData);
task.setPinned(false);
User actualOwner = mockUser(ACTUAL_OWNER_ENTITY_ID);
task.setUser(actualOwner);
List<User> userList = new ArrayList<>();
if (addActualOwnerToSolution) {
userList.add(actualOwner);
}
TaskAssigningSolution solution = mockSolution(Collections.singletonList(task), userList);
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withSolution(solution).withTasks(mockTaskDataList(taskData)).withUserSystem(userSystemService).withContext(context).build();
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, new AssignTaskProblemFactChange(task, mockUser(ACTUAL_OWNER_ENTITY_ID), true));
assertTaskChangeRegistered(taskData.getTaskId(), taskData.getLastModificationDate());
}
use of org.kie.server.api.model.taskassigning.PlanningTask in project droolsjbpm-integration by kiegroup.
the class SolutionBuilderTest method buildAndCheckReservedForPlanningUserTaskWithModifiedPlanningTaskNotPublishedWasProcessedCorrect.
@Test
public void buildAndCheckReservedForPlanningUserTaskWithModifiedPlanningTaskNotPublishedWasProcessedCorrect() {
PlanningTask planningTask = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(false).index(1).build();
TaskData taskData = mockTaskData(1L, Reserved, PLANNING_USER_ID);
buildAndCheckTaskWithPlanningTaskWasProcessedCorrect(taskData, planningTask, taskData.getActualOwner(), false);
}
use of org.kie.server.api.model.taskassigning.PlanningTask in project droolsjbpm-integration by kiegroup.
the class SolutionBuilderTest method buildAndCheckReservedTaskWithModifiedPlanningTaskPublishedWasProcessedCorrect.
@Test
public void buildAndCheckReservedTaskWithModifiedPlanningTaskPublishedWasProcessedCorrect() {
PlanningTask planningTask = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(true).index(1).build();
TaskData taskData = mockTaskData(1L, Reserved, USER2);
buildAndCheckTaskWithPlanningTaskWasProcessedCorrect(taskData, planningTask, taskData.getActualOwner(), true);
}
use of org.kie.server.api.model.taskassigning.PlanningTask in project droolsjbpm-integration by kiegroup.
the class SolutionBuilderTest method buildAnExample.
@Test
public void buildAnExample() {
PlanningTask planningTask1 = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(false).index(1).build();
TaskData taskData1 = mockTaskData(1L, Reserved, USER1);
taskData1.setPlanningTask(planningTask1);
PlanningTask planningTask2 = PlanningTask.builder().taskId(2L).assignedUser(USER1).published(true).index(2).build();
TaskData taskData2 = mockTaskData(2L, Suspended, USER1);
taskData2.setPlanningTask(planningTask2);
PlanningTask planningTask3 = PlanningTask.builder().taskId(3L).assignedUser(USER1).published(true).index(3).build();
TaskData taskData3 = mockTaskData(3L, InProgress, USER1);
taskData3.setPlanningTask(planningTask3);
PlanningTask planningTask4 = PlanningTask.builder().taskId(4L).assignedUser(USER2).published(false).index(4).build();
TaskData taskData4 = mockTaskData(4L, InProgress, USER1);
taskData4.setPlanningTask(planningTask4);
List<org.kie.server.services.taskassigning.user.system.api.User> externalUsers = buildExternalUsers();
List<TaskData> taskDataList = Arrays.asList(taskData4, taskData1, taskData3, taskData2);
TaskAssigningSolution solution = SolutionBuilder.create().withTasks(taskDataList).withUsers(externalUsers).withContext(context).build();
assertEquals(5, solution.getTaskList().size());
User user1 = solution.getUserList().stream().filter(user -> user.getEntityId().equals(USER1)).findFirst().orElse(null);
assertNotNull(user1);
List<Task> user1Tasks = extractTasks(user1, (task) -> true);
assertEquals(4L, user1Tasks.size(), 0);
assertExpectedTaskAtPosition(taskData2.getTaskId(), 0, true, user1Tasks);
assertExpectedTaskAtPosition(taskData3.getTaskId(), 1, true, user1Tasks);
assertExpectedTaskAtPosition(taskData4.getTaskId(), 2, true, user1Tasks);
assertExpectedTaskAtPosition(taskData1.getTaskId(), 3, false, user1Tasks);
taskDataList.forEach(taskData -> assertTaskChangeWasProcessed(taskData.getTaskId(), taskData.getLastModificationDate()));
}
use of org.kie.server.api.model.taskassigning.PlanningTask in project droolsjbpm-integration by kiegroup.
the class SolutionBuilderTest method buildAndCheckInProgressTaskWithUnChangedPlanningTaskNotPublishedWasProcessedCorrect.
@Test
public void buildAndCheckInProgressTaskWithUnChangedPlanningTaskNotPublishedWasProcessedCorrect() {
PlanningTask planningTask = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(false).index(1).build();
TaskData taskData = mockTaskData(1L, InProgress, planningTask.getAssignedUser());
buildAndCheckTaskWithPlanningTaskWasProcessedCorrect(taskData, planningTask, planningTask.getAssignedUser(), true);
}
Aggregations