use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method addStatusAndPriorityPropertyChange.
@Test
public void addStatusAndPriorityPropertyChange() {
TaskData taskData = mockTaskData(TASK_ID, NAME, Reserved, ACTUAL_OWNER_ENTITY_ID);
User actualOwner = mockUser(ACTUAL_OWNER_ENTITY_ID);
Task task = fromTaskData(taskData);
task.setUser(actualOwner);
task.setPinned(true);
task.setStatus(convertToString(InProgress));
task.setPriority(taskData.getPriority() + 1);
TaskAssigningSolution solution = mockSolution(Collections.singletonList(task), Collections.singletonList(actualOwner));
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withSolution(solution).withTasks(mockTaskDataList(taskData)).withUserSystem(userSystemService).withContext(context).build();
TaskPropertyChangeProblemFactChange change = new TaskPropertyChangeProblemFactChange(task);
change.setStatus(taskData.getStatus());
change.setPriority(taskData.getPriority());
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, new TaskPropertyChangeProblemFactChange(task));
assertTaskChangeRegistered(taskData.getTaskId(), taskData.getLastModificationDate());
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method addNewReservedOrInProgressOrSuspendedTaskChangeWithActualOwnerMissing.
private void addNewReservedOrInProgressOrSuspendedTaskChangeWithActualOwnerMissing(Status status) {
TaskData taskData = mockTaskData(TASK_ID, NAME, status, USER_ENTITY_ID);
TaskAssigningSolution solution = mockSolution(Collections.emptyList(), Collections.emptyList());
addNewReservedOrInProgressOrSuspendedTaskChangeWithActualOwner(solution, taskData);
verify(userSystemService).findUser(USER_ENTITY_ID);
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method addReleasedTaskChange.
@Test
public void addReleasedTaskChange() {
TaskData taskData = mockTaskData(TASK_ID, NAME, Ready, USER_ENTITY_ID);
Task task = fromTaskData(taskData);
task.setStatus(convertToString(Reserved));
TaskAssigningSolution solution = mockSolution(Collections.singletonList(task), Collections.emptyList());
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withSolution(solution).withTasks(mockTaskDataList(taskData)).withUserSystem(userSystemService).withContext(context).build();
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, new ReleaseTaskProblemFactChange(task));
assertTaskChangeRegistered(taskData.getTaskId(), taskData.getLastModificationDate());
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method addNewReservedOrInProgressOrSuspendedTaskChangeWithActualOwner.
private void addNewReservedOrInProgressOrSuspendedTaskChangeWithActualOwner(TaskAssigningSolution solution, TaskData taskData) {
List<TaskData> taskDataList = mockTaskDataList(taskData);
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withSolution(solution).withTasks(taskDataList).withUserSystem(userSystemService).withContext(context).build();
AssignTaskProblemFactChange expected = new AssignTaskProblemFactChange(fromTaskData(taskData), mockUser(USER_ENTITY_ID), true);
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, expected);
assertTaskChangeRegistered(taskData.getTaskId(), taskData.getLastModificationDate());
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method addRemoveTaskInSinkStatus.
private void addRemoveTaskInSinkStatus(Status sinkStatus) {
TaskData taskData = mockTaskData(TASK_ID, NAME, sinkStatus, ACTUAL_OWNER_ENTITY_ID);
User actualOwner = mockUser(ACTUAL_OWNER_ENTITY_ID);
Task task = fromTaskData(taskData);
task.setUser(actualOwner);
task.setStatus(convertToString(Reserved));
TaskAssigningSolution solution = mockSolution(Collections.singletonList(task), Collections.singletonList(actualOwner));
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withSolution(solution).withTasks(mockTaskDataList(taskData)).withUserSystem(userSystemService).withContext(context).build();
RemoveTaskProblemFactChange change = new RemoveTaskProblemFactChange(task);
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, change);
assertTaskChangeRegistered(taskData.getTaskId(), taskData.getLastModificationDate());
}
Aggregations