use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testForceCompleteClaimedTaskOfAnotherUser.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testForceCompleteClaimedTaskOfAnotherUser() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000035");
taskService.completeTask(claimedTask.getId(), true);
Task completedTask = taskService.getTask("TKI:000000000000000000000000000000000035");
assertNotNull(completedTask);
assertEquals(TaskState.COMPLETED, completedTask.getState());
assertNotNull(completedTask.getCompleted());
assertEquals(completedTask.getCompleted(), completedTask.getModified());
assertTrue(completedTask.isRead());
assertEquals("user_1_2", completedTask.getOwner());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testForceCompleteUnclaimedTask.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testForceCompleteUnclaimedTask() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000033");
taskService.completeTask(claimedTask.getId(), true);
Task completedTask = taskService.getTask("TKI:000000000000000000000000000000000033");
assertNotNull(completedTask);
assertEquals(TaskState.COMPLETED, completedTask.getState());
assertNotNull(completedTask.getCompleted());
assertEquals(completedTask.getCompleted(), completedTask.getModified());
assertTrue(completedTask.isRead());
assertEquals("user_1_2", completedTask.getOwner());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testBulkDeleteTasksWithException.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testBulkDeleteTasksWithException() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService();
List<String> taskIdList = new ArrayList<>();
taskIdList.add("TKI:000000000000000000000000000000000102");
taskIdList.add("TKI:000000000000000000000000000000003333");
BulkOperationResults<String, TaskanaException> results = taskService.deleteTasks(taskIdList);
assertTrue(results.containsErrors());
assertThat(results.getErrorMap().size(), equalTo(2));
assertTrue(results.getErrorForId("TKI:000000000000000000000000000000003333") instanceof TaskNotFoundException);
assertTrue(results.getErrorForId("TKI:000000000000000000000000000000000102") instanceof InvalidStateException);
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class TaskQueryAccTest method testTaskQueryUnauthenticated.
public void testTaskQueryUnauthenticated() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().ownerLike("%a%", "%u%").list();
assertThat(results.size(), equalTo(0));
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class CreateTaskAccTest method testCreatedTaskObjectEqualsReadTaskObject.
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void testCreatedTaskObjectEqualsReadTaskObject() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
newTask.setClassificationKey("T2100");
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
for (int i = 1; i < 16; i++) {
newTask.setCustomAttribute(Integer.toString(i), "VALUE " + i);
}
newTask.setCustomAttributes(createSimpleCustomProperties(5));
newTask.setDescription("Description of test task");
newTask.setNote("My note");
newTask.addAttachment(createAttachment("DOCTYPE_DEFAULT", createObjectReference("COMPANY_A", "SYSTEM_B", "INSTANCE_B", "ArchiveId", "12345678901234567890123456789012345678901234567890"), "E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
Task createdTask = taskService.createTask(newTask);
Task readTask = taskService.getTask(createdTask.getId());
assertEquals(createdTask, readTask);
}
Aggregations