use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerSkipable.
@Test
public void testGetTasksAssignedAsPotentialOwnerSkipable() {
// One potential owner, should go straight to state Reserved
String str = "(with (new Task()) { 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());
}
use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedAsBusinessAdministratorWithUserOfWrongGroupLangOneTask.
@Test
public void testGetTasksAssignedAsBusinessAdministratorWithUserOfWrongGroupLangOneTask() {
// JBPM-4862
String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
str += "peopleAssignments = (with ( new PeopleAssignments() ) { businessAdministrators = [new Group('Crusaders')], }),";
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.getTasksAssignedAsBusinessAdministrator("nocrusadaer", "en-UK");
assertEquals(0, tasks.size());
}
use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedAsRecipientWithUserLangOneTask.
@Test
public void testGetTasksAssignedAsRecipientWithUserLangOneTask() {
// 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() ) { recipients = [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<TaskSummary> tasks = taskService.getTasksAssignedAsRecipient("Bobba Fet");
assertEquals(1, tasks.size());
}
use of org.kie.api.task.model.TaskSummary in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerByStatusWithUserStatusLangOneTask.
@Test
public void testGetTasksAssignedAsPotentialOwnerByStatusWithUserStatusLangOneTask() {
// 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.Created);
statuses.add(Status.Ready);
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwnerByStatus("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 testGetTasksAssignedAsPotentialOwnerWithUserLangOneTask.
@Test
public void testGetTasksAssignedAsPotentialOwnerWithUserLangOneTask() {
// 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<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Bobba Fet", "en-UK");
assertEquals(1, tasks.size());
assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
}
Aggregations