use of org.kie.server.api.model.taskassigning.TaskData 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.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionBuilderTest method buildAndCheckReadyTaskWasProcessedCorrect.
@Test
public void buildAndCheckReadyTaskWasProcessedCorrect() {
List<org.kie.server.services.taskassigning.user.system.api.User> externalUsers = buildExternalUsers();
TaskData taskData = mockTaskData(1L, Ready);
TaskAssigningSolution solution = SolutionBuilder.create().withTasks(Collections.singletonList(taskData)).withUsers(externalUsers).withContext(context).build();
assertEquals(2, solution.getTaskList().size());
assertContainsNotAssignedTask(taskData, solution);
}
use of org.kie.server.api.model.taskassigning.TaskData 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);
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionBuilderTest method buildAndCheckSuspendedTaskWithModifiedPlanningTaskNotPublishedWasProcessedCorrect.
@Test
public void buildAndCheckSuspendedTaskWithModifiedPlanningTaskNotPublishedWasProcessedCorrect() {
PlanningTask planningTask = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(false).index(1).build();
TaskData taskData = mockTaskData(1L, Suspended, USER2);
buildAndCheckTaskWithPlanningTaskWasProcessedCorrect(taskData, planningTask, taskData.getActualOwner(), true);
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionBuilderTest method buildAndCheckInProgressTaskWithUnChangedPlanningTaskPublishedWasProcessedCorrect.
@Test
public void buildAndCheckInProgressTaskWithUnChangedPlanningTaskPublishedWasProcessedCorrect() {
PlanningTask planningTask = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(true).index(1).build();
TaskData taskData = mockTaskData(1L, InProgress, planningTask.getAssignedUser());
buildAndCheckTaskWithPlanningTaskWasProcessedCorrect(taskData, planningTask, planningTask.getAssignedUser(), true);
}
Aggregations