use of pro.taskana.TaskService in project taskana by Taskana.
the class QueryTasksByTimeIntervalsAccTest method testCompletedWithin.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testCompletedWithin() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval(getInstant("2018-01-30T16:55:23"), getInstant("2018-01-30T16:55:25"));
List<TaskSummary> results = taskService.createTaskQuery().completedWithin(interval).orderByCompleted(asc).list();
assertThat(results.size(), equalTo(5));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getCompleted();
Assert.assertTrue(interval.contains(cr));
if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getCompleted().isAfter(taskSummary.getCompleted()));
}
previousSummary = taskSummary;
}
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class QueryTasksByTimeIntervalsAccTest method testCreatedAfter.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testCreatedAfter() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval(getInstant("2018-01-29T15:55:17"), null);
List<TaskSummary> results = taskService.createTaskQuery().createdWithin(interval1).orderByCreated(asc).list();
assertThat(results.size(), equalTo(36));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getCreated();
Assert.assertTrue(interval1.contains(cr));
if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated()));
}
previousSummary = taskSummary;
}
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class QueryTasksByTimeIntervalsAccTest method testDueWithin.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testDueWithin() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval(getInstant("2018-01-29T15:55:00"), getInstant("2018-01-30T15:55:22"));
List<TaskSummary> results = taskService.createTaskQuery().dueWithin(interval).orderByPlanned(asc).list();
assertThat(results.size(), equalTo(70));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getDue();
Assert.assertTrue(interval.contains(cr));
if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getPlanned().isAfter(taskSummary.getPlanned()));
}
previousSummary = taskSummary;
}
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class QueryTasksWithPaginationAccTest method testPaginationNullAndNegativeLimitsIgnoring.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testPaginationNullAndNegativeLimitsIgnoring() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
// 0 limit/size = 0 results
int pageNumber = 2;
int pageSize = 0;
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
assertThat(results.size(), equalTo(0));
// Negative size will be 0 = 0 results
pageNumber = 2;
pageSize = -1;
results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
assertThat(results.size(), equalTo(0));
// Negative page = first page
pageNumber = -1;
pageSize = 10;
results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
assertThat(results.size(), equalTo(10));
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class QueryTasksWithPaginationAccTest method testGetFirstPageOfTaskQueryWithOffset.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testGetFirstPageOfTaskQueryWithOffset() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).list(0, 10);
assertThat(results.size(), equalTo(10));
}
Aggregations