use of org.kie.kogito.taskassigning.core.model.TaskAssignment in project kogito-apps by kiegroup.
the class SolutionChangesBuilderTest method addReservedTaskChangeForAnotherUserInExternalSystem.
@Test
void addReservedTaskChangeForAnotherUserInExternalSystem() {
TaskAssignment user1Assignment = new TaskAssignment(mockTask(TASK_1_ID));
User user1 = TestUtil.mockUser(USER_1, Collections.singletonList(user1Assignment));
org.kie.kogito.taskassigning.user.service.User user2 = mockExternalUser(USER_2);
doReturn(user2).when(userServiceConnector).findUser(USER_2);
TaskAssigningSolution solution = mockSolution(Collections.singletonList(user1), Collections.singletonList(user1Assignment));
TaskData taskData = mockTaskData(TASK_1_ID, RESERVED.value(), USER_2, TASK_1_LAST_UPDATE);
addReservedTaskChangeForAnotherUser(solution, taskData, mockUser(USER_2));
verify(userServiceConnector).findUser(USER_2);
assertThatUserProcessorsWereApplied(user2);
}
use of org.kie.kogito.taskassigning.core.model.TaskAssignment in project kogito-apps by kiegroup.
the class SolutionChangesBuilderTest method addReservedTaskChangeForAnotherUser.
private void addReservedTaskChangeForAnotherUser(TaskAssigningSolution solution, TaskData taskData, User user) {
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withContext(context).withUserServiceConnector(userServiceConnector).withProcessors(processorRegistry).fromTasksData(mockTaskDataList(taskData)).forSolution(solution).build();
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, new AssignTaskProblemFactChange(new TaskAssignment(fromTaskData(taskData)), user, true));
assertTaskPublishStatus(TASK_1_ID, true);
assertThatTaskProcessorsWhereNotApplied();
}
use of org.kie.kogito.taskassigning.core.model.TaskAssignment in project kogito-apps by kiegroup.
the class SolutionChangesBuilderTest method addReleasedTaskChange.
@Test
void addReleasedTaskChange() {
TaskAssignment user1Assignment = new TaskAssignment(mockTask(TASK_1_ID, RESERVED.value()));
User user1 = TestUtil.mockUser(USER_1, Collections.singletonList(user1Assignment));
TaskAssigningSolution solution = mockSolution(Collections.singletonList(user1), Collections.singletonList(user1Assignment));
TaskData taskData = mockTaskData(TASK_1_ID, READY.value(), TASK_1_LAST_UPDATE);
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withContext(context).withUserServiceConnector(userServiceConnector).withProcessors(processorRegistry).fromTasksData(mockTaskDataList(taskData)).forSolution(solution).build();
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, new ReleaseTaskProblemFactChange(new TaskAssignment(fromTaskData(taskData))));
assertTaskPublishStatus(TASK_1_ID, false);
assertThatTaskProcessorsWhereNotApplied();
assertThatUserProcessorsWereNotApplied();
}
use of org.kie.kogito.taskassigning.core.model.TaskAssignment in project kogito-apps by kiegroup.
the class SolutionChangesBuilderTest method addReservedTaskChangeForAnotherUserInSolution.
@Test
void addReservedTaskChangeForAnotherUserInSolution() {
TaskAssignment user1Assignment = new TaskAssignment(mockTask(TASK_1_ID));
User user1 = TestUtil.mockUser(USER_1, Collections.singletonList(user1Assignment));
User user2 = mockUser(USER_2);
TaskAssigningSolution solution = mockSolution(Arrays.asList(user1, user2), Collections.singletonList(user1Assignment));
TaskData taskData = mockTaskData(TASK_1_ID, RESERVED.value(), USER_2, TASK_1_LAST_UPDATE);
addReservedTaskChangeForAnotherUser(solution, taskData, user2);
assertThatUserProcessorsWereNotApplied();
}
use of org.kie.kogito.taskassigning.core.model.TaskAssignment in project kogito-apps by kiegroup.
the class SolutionChangesBuilderTest method addNewReservedTaskChangeWithActualOwner.
private void addNewReservedTaskChangeWithActualOwner(TaskAssigningSolution solution, TaskData taskData) {
List<TaskData> taskDataList = mockTaskDataList(taskData);
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withContext(context).withUserServiceConnector(userServiceConnector).withProcessors(processorRegistry).fromTasksData(taskDataList).forSolution(solution).build();
AssignTaskProblemFactChange expected = new AssignTaskProblemFactChange(new TaskAssignment(fromTaskData(taskData)), mockUser(USER_1), true);
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, expected);
assertTaskPublishStatus(taskData.getId(), true);
assertThatTaskProcessorsWereApplied(taskData.getId());
}
Aggregations