use of org.kie.server.services.taskassigning.core.model.Task in project droolsjbpm-integration by kiegroup.
the class StartAndEndTimeUpdatingVariableListenerTest method setUp.
@Before
public void setUp() {
listener = new StartAndEndTimeUpdatingVariableListener();
anchor = new User(1, "User1");
task1 = new Task(1, "Task1", 1);
task1.setStartTimeInMinutes(anchor.getEndTimeInMinutes());
task1.setDurationInMinutes(1);
task1.setEndTime(task1.getStartTimeInMinutes() + task1.getDurationInMinutes());
task1.setPreviousTaskOrUser(anchor);
task2 = new Task(2, "Task2", 1);
task2.setDurationInMinutes(2);
task2.setPreviousTaskOrUser(task1);
task2.setStartTimeInMinutes(task1.getEndTimeInMinutes());
task2.setEndTime(task2.getStartTimeInMinutes() + task2.getDurationInMinutes());
task1.setNextTask(task2);
task3 = new Task(3, "Task3", 1);
task3.setDurationInMinutes(3);
task3.setPreviousTaskOrUser(task2);
task4 = new Task(4, "Task4", 1);
task4.setDurationInMinutes(4);
task4.setPreviousTaskOrUser(task3);
task3.setNextTask(task4);
task5 = new Task(5, "Task5", 1);
task5.setDurationInMinutes(5);
task5.setPreviousTaskOrUser(task4);
task4.setNextTask(task5);
}
use of org.kie.server.services.taskassigning.core.model.Task in project droolsjbpm-integration by kiegroup.
the class TaskHelperTest method extractTasksFiltered.
@Test
public void extractTasksFiltered() {
TaskOrUser taskOrUser = buildTaskOrUser();
List<Task> result = TaskHelper.extractTasks(taskOrUser, testedTask -> testedTask.getId() == 1 || testedTask.getId() == 4);
assertThat(result.size()).isEqualTo(2);
assertThat(result.get(0).getId()).isEqualTo(1);
assertThat(result.get(1).getId()).isEqualTo(4);
}
use of org.kie.server.services.taskassigning.core.model.Task in project droolsjbpm-integration by kiegroup.
the class TaskHelperTest method extractTasks.
@Test
public void extractTasks() {
TaskOrUser taskOrUser = buildTaskOrUser();
List<Task> result = TaskHelper.extractTasks(taskOrUser);
assertThat(result.size()).isEqualTo(4);
assertThat(result.get(0).getId()).isEqualTo(1);
assertThat(result.get(1).getId()).isEqualTo(2);
assertThat(result.get(2).getId()).isEqualTo(3);
assertThat(result.get(3).getId()).isEqualTo(4);
}
use of org.kie.server.services.taskassigning.core.model.Task in project droolsjbpm-integration by kiegroup.
the class TaskHelperTest method isPotentialOwnerOfTaskWithGroupsAndUserNoGroups.
@Test
public void isPotentialOwnerOfTaskWithGroupsAndUserNoGroups() {
Task task = new Task();
task.getPotentialOwners().add(availableGroups.get(0));
User user = availableUsers.get(0);
assertThat(isPotentialOwner(task, user)).isFalse();
}
use of org.kie.server.services.taskassigning.core.model.Task in project droolsjbpm-integration by kiegroup.
the class TestSolver method assertConstraints.
/**
* Given a TaskAssigningSolution asserts the following constraints.
* <p>
* 1) All tasks are assigned to a user
* 2) The assigned user for a task is a potentialOwner for the task or the PLANNING_USER
* 3) All tasks are assigned.
* @param solution a solution.
*/
private void assertConstraints(TaskAssigningSolution solution) {
int totalTasks = 0;
for (User user : solution.getUserList()) {
List<Task> taskList = extractTasks(user);
totalTasks += taskList.size();
taskList.forEach(task -> assertAssignment(user, task, solution.getUserList()));
}
assertEquals(solution.getTaskList().size(), totalTasks);
}
Aggregations