Search in sources :

Example 1 with PLANNING_USER

use of org.kie.server.services.taskassigning.core.model.ModelConstants.PLANNING_USER in project droolsjbpm-integration by kiegroup.

the class AddTaskProblemFactChangeTest method addTaskProblemFactChange.

private void addTaskProblemFactChange(TaskAssigningSolution solution, List<Long> taskIds) throws Exception {
    solution.getUserList().add(PLANNING_USER);
    List<ProgrammedProblemFactChange<AddTaskProblemFactChange>> programmedChanges = taskIds.stream().map(id -> new ProgrammedProblemFactChange<>(new AddTaskProblemFactChange(new Task(id, "NewTask_" + id, 1)))).collect(Collectors.toList());
    // each partial solution must have the change that was applied on it.
    executeSequentialChanges(solution, programmedChanges);
    programmedChanges.forEach(change -> assertAddTaskProblemFactChangeWasProduced(change.getChange(), change.getSolutionAfterChange()));
    // finally the last solution must have the result of all the changes.
    TaskAssigningSolution lastSolution = programmedChanges.get(programmedChanges.size() - 1).getSolutionAfterChange();
    programmedChanges.forEach(change -> assertAddTaskProblemFactChangeWasProduced(change.getChange(), lastSolution));
}
Also used : Arrays(java.util.Arrays) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) PLANNING_USER(org.kie.server.services.taskassigning.core.model.ModelConstants.PLANNING_USER) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) Objects(java.util.Objects) SET_OF_50TASKS_5USERS_SOLUTION(org.kie.server.services.taskassigning.core.TestDataSet.SET_OF_50TASKS_5USERS_SOLUTION) List(java.util.List) SET_OF_100TASKS_5USERS_SOLUTION(org.kie.server.services.taskassigning.core.TestDataSet.SET_OF_100TASKS_5USERS_SOLUTION) TaskAssigningSolution(org.kie.server.services.taskassigning.core.model.TaskAssigningSolution) Assertions(org.assertj.core.api.Assertions) SET_OF_500TASKS_20USERS_SOLUTION(org.kie.server.services.taskassigning.core.TestDataSet.SET_OF_500TASKS_20USERS_SOLUTION) Collections(java.util.Collections) Task(org.kie.server.services.taskassigning.core.model.Task) SET_OF_24TASKS_8USERS_SOLUTION(org.kie.server.services.taskassigning.core.TestDataSet.SET_OF_24TASKS_8USERS_SOLUTION) Task(org.kie.server.services.taskassigning.core.model.Task) TaskAssigningSolution(org.kie.server.services.taskassigning.core.model.TaskAssigningSolution)

Aggregations

ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Objects (java.util.Objects)1 Collectors (java.util.stream.Collectors)1 Assertions (org.assertj.core.api.Assertions)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Test (org.junit.Test)1 SET_OF_100TASKS_5USERS_SOLUTION (org.kie.server.services.taskassigning.core.TestDataSet.SET_OF_100TASKS_5USERS_SOLUTION)1 SET_OF_24TASKS_8USERS_SOLUTION (org.kie.server.services.taskassigning.core.TestDataSet.SET_OF_24TASKS_8USERS_SOLUTION)1 SET_OF_500TASKS_20USERS_SOLUTION (org.kie.server.services.taskassigning.core.TestDataSet.SET_OF_500TASKS_20USERS_SOLUTION)1 SET_OF_50TASKS_5USERS_SOLUTION (org.kie.server.services.taskassigning.core.TestDataSet.SET_OF_50TASKS_5USERS_SOLUTION)1 PLANNING_USER (org.kie.server.services.taskassigning.core.model.ModelConstants.PLANNING_USER)1 Task (org.kie.server.services.taskassigning.core.model.Task)1 TaskAssigningSolution (org.kie.server.services.taskassigning.core.model.TaskAssigningSolution)1