use of org.kie.kogito.taskassigning.core.model.TaskAssignment in project kogito-apps by kiegroup.
the class AssignTaskExecutableProblemFactChangeTest method assignTaskProblemFactChangeUserNotFound.
@Test
void assignTaskProblemFactChangeUserNotFound() {
TaskAssigningSolution solution = readTaskAssigningSolution(SET_OF_24TASKS_8USERS_SOLUTION.resource());
TaskAssignment taskAssignment = solution.getTaskAssignmentList().get(0);
User user = new User("Non Existing");
Assertions.assertThatThrownBy(() -> executeSequentialChanges(solution, Collections.singletonList(new ProgrammedAssignTaskProblemFactChange(taskAssignment, user)))).hasMessage("Expected user: %s was not found in current working solution", user);
}
use of org.kie.kogito.taskassigning.core.model.TaskAssignment in project kogito-apps by kiegroup.
the class AssignTaskExecutableProblemFactChangeTest method assignTaskProblemFactChangeRandomChangeSet.
private void assignTaskProblemFactChangeRandomChangeSet(String solutionResource) throws Exception {
TaskAssigningSolution solution = readTaskAssigningSolution(solutionResource);
solution.getUserList().add(PLANNING_USER);
int taskCount = solution.getTaskAssignmentList().size();
int userCount = solution.getUserList().size();
int randomChanges = taskCount / 2 + random.nextInt(taskCount / 2);
// prepare the list of changes to program
List<ProgrammedAssignTaskProblemFactChange> programmedChanges = new ArrayList<>();
TaskAssignment randomTask;
User randomUser;
for (int i = 0; i < randomChanges; i++) {
randomTask = solution.getTaskAssignmentList().get(random.nextInt(taskCount));
randomUser = solution.getUserList().get(random.nextInt(userCount));
programmedChanges.add(new ProgrammedAssignTaskProblemFactChange(randomTask, randomUser));
}
assignTaskProblemFactChange(solution, solutionResource, RANDOM_TEST, programmedChanges);
}
Aggregations