use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerCheckSubject.
@Test
public void testGetTasksAssignedAsPotentialOwnerCheckSubject() {
// One potential owner, should go straight to state Reserved
String str = "(with (new Task()) { subject = 'test subject', priority = 55, taskData = (with( new TaskData()) {skipable=true } ), ";
str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet') ],businessAdministrators = [ new User('Administrator') ], }),";
str += "name = 'This is my task name' })";
Task task = TaskFactory.evalTask(new StringReader(str));
taskService.addTask(task, new HashMap<String, Object>());
List<String> groupIds = new ArrayList<String>();
groupIds.add("Crusaders");
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Bobba Fet", groupIds);
assertEquals(1, tasks.size());
assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
assertEquals(true, tasks.get(0).isSkipable());
assertEquals("test subject", tasks.get(0).getSubject());
}
use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerWithExcluded.
@Test
public void testGetTasksAssignedAsPotentialOwnerWithExcluded() {
// One potential owner, should go straight to state Reserved
String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet'), new User('Darth Vader') ], excludedOwners = [new User('Darth Vader')],businessAdministrators = [ new User('Administrator') ], }),";
str += "name = 'This is my task name' })";
Task task = TaskFactory.evalTask(new StringReader(str));
taskService.addTask(task, new HashMap<String, Object>());
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Bobba Fet", "en-UK");
assertEquals(1, tasks.size());
tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(0, tasks.size());
}
use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksOwnedWithUserStatusLangOneTaskCompleted.
@Test
public void testGetTasksOwnedWithUserStatusLangOneTaskCompleted() {
// One potential owner, should go straight to state Reserved
String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet') ],businessAdministrators = [ new User('Administrator') ], }),";
str += "name = 'This is my task name' })";
Task task = TaskFactory.evalTask(new StringReader(str));
taskService.addTask(task, new HashMap<String, Object>());
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Completed);
List<TaskSummary> tasks = taskService.getTasksOwnedByStatus("Bobba Fet", statuses, "en-UK");
assertEquals(0, tasks.size());
}
use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerWithUserGroupsLangOffsetCountTwoTasksTwoMaxResults.
@Test
public void testGetTasksAssignedAsPotentialOwnerWithUserGroupsLangOffsetCountTwoTasksTwoMaxResults() {
// One potential owner, should go straight to state Reserved
String str1 = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
str1 += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet') ],businessAdministrators = [ new User('Administrator') ], }),";
str1 += "name = 'First task' })";
String str2 = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
str2 += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet') ],businessAdministrators = [ new User('Administrator') ], }),";
str2 += "name = 'Second task' })";
Task task1 = TaskFactory.evalTask(new StringReader(str1));
taskService.addTask(task1, new HashMap<String, Object>());
Task task2 = TaskFactory.evalTask(new StringReader(str2));
taskService.addTask(task2, new HashMap<String, Object>());
List<String> groupIds = new ArrayList<String>();
groupIds.add("Crusaders");
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Bobba Fet", groupIds, null, 0, 2);
assertEquals(2, tasks.size());
// FIXME tasks are returned in random order
// assertEquals("First task", tasks.get(0).getName());
// assertEquals("Second task", tasks.get(1).getName());
}
use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksOwnedByExpirationDateWithUserStatusDateOneTaskCompleted.
@Test
public void testGetTasksOwnedByExpirationDateWithUserStatusDateOneTaskCompleted() {
// One potential owner, should go straight to state Reserved
String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { expirationTime = new Date( 10000000 ), } ), ";
str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet') ],businessAdministrators = [ new User('Administrator') ], }),";
str += "name = 'This is my task name' })";
Task task = TaskFactory.evalTask(new StringReader(str));
taskService.addTask(task, new HashMap<String, Object>());
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Completed);
Date date = new Date(10000000);
List<TaskSummary> tasks = taskService.getTasksOwnedByExpirationDate("Bobba Fet", statuses, date);
assertEquals(0, tasks.size());
}
Aggregations