use of pro.taskana.TaskSummary in project taskana by Taskana.
the class QueryTasksWithPaginationAccTest method testPaginationWithPages.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testPaginationWithPages() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
// Getting full page
int pageNumber = 2;
int pageSize = 4;
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
assertThat(results.size(), equalTo(4));
// Getting full page
pageNumber = 4;
pageSize = 1;
results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
assertThat(results.size(), equalTo(1));
// Getting last results on 1 big page
pageNumber = 1;
pageSize = 100;
results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
assertThat(results.size(), equalTo(22));
// Getting last results on multiple pages
pageNumber = 3;
pageSize = 10;
results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
assertThat(results.size(), equalTo(2));
}
use of pro.taskana.TaskSummary in project taskana by Taskana.
the class TaskQueryImplTest method should_ReturnOneItem_when_BuilderIsUsed.
@Test
public void should_ReturnOneItem_when_BuilderIsUsed() throws NotAuthorizedException, InvalidArgumentException {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new TaskSummaryImpl());
List<TaskSummary> intermediate = new ArrayList<>();
intermediate.add(new TaskSummaryImpl());
doReturn(intermediate).when(taskServiceMock).augmentTaskSummariesByContainedSummaries(any());
// when(taskServiceMock.augmentTaskSummariesByContainedSummaries(any())).thenReturn(intermediate);
TaskSummary result = taskQueryImpl.nameIn("test", "asd", "blubber").priorityIn(1, 2).stateIn(TaskState.CLAIMED, TaskState.COMPLETED).single();
Assert.assertNotNull(result);
}
use of pro.taskana.TaskSummary in project taskana by Taskana.
the class QueryTasksWithSortingAccTest method testSortByDomainNameAndCreated.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByDomainNameAndCreated() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByDomain(asc).orderByName(asc).orderByCreated(null).list();
assertThat(results.size(), equalTo(25));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
// created: " + taskSummary.getCreated());
if (previousSummary != null) {
Assert.assertTrue(taskSummary.getDomain().compareToIgnoreCase(previousSummary.getDomain()) >= 0);
if (taskSummary.getDomain().equals(previousSummary.getDomain())) {
Assert.assertTrue(taskSummary.getName().compareToIgnoreCase(previousSummary.getName()) >= 0);
if (taskSummary.getName().equals(previousSummary.getName())) {
Assert.assertTrue(!taskSummary.getCreated().isBefore(previousSummary.getCreated()));
}
}
}
previousSummary = taskSummary;
}
}
use of pro.taskana.TaskSummary in project taskana by Taskana.
the class QueryTasksWithSortingAccTest method testSortByModifiedAndDomain.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByModifiedAndDomain() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByModified(desc).orderByDomain(null).list();
assertThat(results.size(), equalTo(25));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getModified().isBefore(taskSummary.getModified()));
}
previousSummary = taskSummary;
}
}
use of pro.taskana.TaskSummary 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;
}
}
Aggregations