use of pro.taskana.KeyDomain in project taskana by Taskana.
the class QueryTasksWithSortingAccTest method testSortByPorCompanyAndClaimed.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByPorCompanyAndClaimed() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByPrimaryObjectReferenceCompany(desc).orderByClaimed(asc).list();
assertThat(results.size(), equalTo(25));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
// + taskSummary.getClaimed());
if (previousSummary != null) {
Assert.assertTrue(taskSummary.getPrimaryObjRef().getCompany().compareToIgnoreCase(previousSummary.getPrimaryObjRef().getCompany()) <= 0);
}
previousSummary = taskSummary;
}
}
use of pro.taskana.KeyDomain in project taskana by Taskana.
the class TaskServiceImplIntExplicitTest method should_ReturnList_when_BuilderIsUsed.
@WithAccessId(userName = "Elena", groupNames = { "DummyGroup", "businessadmin" })
@Test
public void should_ReturnList_when_BuilderIsUsed() throws SQLException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, SystemException, WorkbasketAlreadyExistException, DomainNotFoundException {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
generateSampleAccessItems();
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket("k1", "DOMAIN_A");
workbasket.setName("workbasket");
Classification classification = classificationService.newClassification("TEST", "DOMAIN_A", "TASK");
classificationService.createClassification(classification);
// set id manually for authorization tests
workbasket.setId("1");
workbasket.setType(WorkbasketType.GROUP);
workbasket = (WorkbasketImpl) workbasketService.createWorkbasket(workbasket);
Task task = taskServiceImpl.newTask(workbasket.getId());
task.setName("Unit Test Task");
task.setClassificationKey(classification.getKey());
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
task = taskServiceImpl.createTask(task);
List<TaskSummary> results = taskServiceImpl.createTaskQuery().nameIn("bla", "test").descriptionLike("test").priorityIn(1, 2, 2).stateIn(TaskState.CLAIMED).workbasketKeyDomainIn(new KeyDomain("k1", "DOMAIN_A")).ownerIn("test", "test2", "bla").customAttributeLike("13", "test").classificationKeyIn("pId1", "pId2").primaryObjectReferenceCompanyIn("first comp", "sonstwo gmbh").primaryObjectReferenceSystemIn("sys").primaryObjectReferenceTypeIn("type1", "type2").primaryObjectReferenceSystemInstanceIn("sysInst1", "sysInst2").primaryObjectReferenceValueIn("val1", "val2", "val3").list();
Assert.assertEquals(0, results.size());
connection.commit();
}
use of pro.taskana.KeyDomain in project taskana by Taskana.
the class UpdateWorkbasketAuthorizationsAccTest method testUpdatedAccessItemLeadsToNotAuthorizedException.
@WithAccessId(userName = "user_1_1", groupNames = { "group_2", "businessadmin" })
@Test
public void testUpdatedAccessItemLeadsToNotAuthorizedException() throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
TaskService taskService = taskanaEngine.getTaskService();
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
String wbKey = "USER_2_1";
String wbDomain = "DOMAIN_A";
String groupName = "group_2";
Task newTask = taskService.newTask(wbKey, wbDomain);
newTask.setClassificationKey("T2100");
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
Task createdTask = taskService.createTask(newTask);
List<TaskSummary> tasks = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain(wbKey, wbDomain)).list();
Assert.assertEquals(1, tasks.size());
assertThat(createdTask, not(equalTo(null)));
List<WorkbasketAccessItem> accessItems = workbasketService.getWorkbasketAccessItems("WBI:100000000000000000000000000000000008");
WorkbasketAccessItem theAccessItem = accessItems.stream().filter(x -> groupName.equals(x.getAccessId())).findFirst().orElse(null);
Assert.assertTrue(theAccessItem != null);
theAccessItem.setPermOpen(false);
workbasketService.updateWorkbasketAccessItem(theAccessItem);
try {
taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain(wbKey, wbDomain)).list();
fail("NotAuthorizedToQueryWorkbasketException was expected ");
} catch (NotAuthorizedToQueryWorkbasketException ignored) {
// nothing to do
}
}
use of pro.taskana.KeyDomain in project taskana by Taskana.
the class QueryTasksWithSortingAccTest method testSortByPorSystemNoteDueAndOwner.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByPorSystemNoteDueAndOwner() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByPrimaryObjectReferenceSystem(SortDirection.DESCENDING).orderByNote(null).orderByDue(null).orderByOwner(asc).list();
assertThat(results.size(), equalTo(25));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
if (previousSummary != null) {
Assert.assertTrue(taskSummary.getPrimaryObjRef().getSystem().compareToIgnoreCase(previousSummary.getPrimaryObjRef().getSystem()) <= 0);
}
previousSummary = taskSummary;
}
}
use of pro.taskana.KeyDomain in project taskana by Taskana.
the class QueryTasksWithSortingAccTest method testSortByPorSystemInstanceParentProcPlannedAndState.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByPorSystemInstanceParentProcPlannedAndState() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByPrimaryObjectReferenceSystemInstance(desc).orderByParentBusinessProcessId(asc).orderByPlanned(asc).orderByState(asc).list();
assertThat(results.size(), equalTo(25));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
if (previousSummary != null) {
Assert.assertTrue(taskSummary.getPrimaryObjRef().getSystemInstance().compareToIgnoreCase(previousSummary.getPrimaryObjRef().getSystemInstance()) <= 0);
}
previousSummary = taskSummary;
}
}
Aggregations