use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class CreateTaskAccTest method testGetExceptionIfWorkbasketDoesNotExist.
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test(expected = WorkbasketNotFoundException.class)
public void testGetExceptionIfWorkbasketDoesNotExist() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("UNKNOWN");
newTask.setClassificationKey("T2100");
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
taskService.createTask(newTask);
}
use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class QueryTasksAccTest method testQueryForClassificationKey.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testQueryForClassificationKey() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().classificationKeyLike("L10%").list();
assertThat(results.size(), equalTo(65));
String[] ids = results.stream().map(t -> t.getClassificationSummary().getKey()).collect(Collectors.toList()).toArray(new String[0]);
List<TaskSummary> result2 = taskService.createTaskQuery().classificationKeyIn(ids).list();
assertThat(result2.size(), equalTo(65));
}
use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class QueryTasksAccTest method testQueryForWorkbasketKeyDomain.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForWorkbasketKeyDomain() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<KeyDomain> workbasketIdentifiers = Arrays.asList(new KeyDomain("GPK_KSC", "DOMAIN_A"), new KeyDomain("USER_1_2", "DOMAIN_A"));
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(workbasketIdentifiers.toArray(new KeyDomain[0])).list();
assertThat(results.size(), equalTo(42));
String[] ids = results.stream().map(t -> t.getWorkbasketSummary().getId()).collect(Collectors.toList()).toArray(new String[0]);
List<TaskSummary> result2 = taskService.createTaskQuery().workbasketIdIn(ids).list();
assertThat(result2.size(), equalTo(42));
}
use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class QueryTasksAccTest method testQueryForCustom6.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForCustom6() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("6", "%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", "%n%", "%o%", "%p%", "%q%", "%r%", "%s%", "%w%").list();
assertThat(results.size(), equalTo(2));
String[] ids = results.stream().map(t -> {
try {
return t.getCustomAttribute("6");
} catch (InvalidArgumentException e) {
e.printStackTrace();
return "";
}
}).collect(Collectors.toList()).toArray(new String[0]);
List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("6", ids).list();
assertThat(result2.size(), equalTo(2));
}
use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class QueryTasksAccTest method testQueryForCustom9.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForCustom9() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("9", "%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", "%n%", "%o%", "%p%", "%q%", "%r%", "%s%", "%w%").list();
assertThat(results.size(), equalTo(1));
String[] ids = results.stream().map(t -> {
try {
return t.getCustomAttribute("9");
} catch (InvalidArgumentException e) {
e.printStackTrace();
return "";
}
}).collect(Collectors.toList()).toArray(new String[0]);
List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("9", ids).list();
assertThat(result2.size(), equalTo(1));
}
Aggregations