use of org.kie.api.task.model.Status in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerByStatusWithUserStatusLangOneTaskReserved.
@Test
public void testGetTasksAssignedAsPotentialOwnerByStatusWithUserStatusLangOneTaskReserved() {
// 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.Reserved);
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwnerByStatus("Bobba Fet", statuses, "en-UK");
assertEquals(1, tasks.size());
assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
}
use of org.kie.api.task.model.Status in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksOwnedWithUserStatusLangOneTask.
@Test
public void testGetTasksOwnedWithUserStatusLangOneTask() {
// 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.Reserved);
List<TaskSummary> tasks = taskService.getTasksOwnedByStatus("Bobba Fet", statuses, "en-UK");
assertEquals(1, tasks.size());
assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
}
use of org.kie.api.task.model.Status in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksOwnedByExpirationDateWithUserStatusDateOneTaskReserved.
@Test
public void testGetTasksOwnedByExpirationDateWithUserStatusDateOneTaskReserved() {
// 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.Reserved);
Date date = new Date(10000000);
List<TaskSummary> tasks = taskService.getTasksOwnedByExpirationDate("Bobba Fet", statuses, date);
assertEquals(1, tasks.size());
assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
}
use of org.kie.api.task.model.Status in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksAssignedByExpirationDateOptional.
@Test
public void testGetTasksAssignedByExpirationDateOptional() {
// 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.InProgress);
statuses.add(Status.Reserved);
statuses.add(Status.Created);
List<TaskSummary> tasks = taskService.getTasksOwnedByExpirationDateOptional("Bobba Fet", statuses, new Date());
assertEquals(1, tasks.size());
}
use of org.kie.api.task.model.Status in project jbpm by kiegroup.
the class TaskQueryServiceBaseTest method testGetTasksByStatusByProcessId.
@Test
public void testGetTasksByStatusByProcessId() {
// One potential owner, should go straight to state Reserved
String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) {processInstanceId = 99 } ), ";
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>());
str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) {processInstanceId = 100 } ), ";
str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet')],businessAdministrators = [ new User('Administrator') ], }),";
str += "name = 'Another name' })";
task = TaskFactory.evalTask(new StringReader(str));
taskService.addTask(task, new HashMap<String, Object>());
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Reserved);
List<TaskSummary> tasks = taskService.getTasksByStatusByProcessInstanceId(99L, statuses, "en-UK");
assertEquals(1, tasks.size());
}
Aggregations