use of pro.taskana.TimeInterval in project taskana by Taskana.
the class QueryTasksByTimeIntervalsAccTest method testClaimedWithin2Intervals.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testClaimedWithin2Intervals() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval(getInstant("2018-01-30T15:55:00"), getInstant("2018-01-30T15:55:10"));
TimeInterval interval2 = new TimeInterval(getInstant("2018-01-30T15:55:23"), getInstant("2018-01-30T15:55:25"));
List<TaskSummary> results = taskService.createTaskQuery().claimedWithin(interval1, interval2).orderByCreated(asc).list();
assertThat(results.size(), equalTo(24));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getClaimed();
Assert.assertTrue(interval1.contains(cr) || interval2.contains(cr));
if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getClaimed().isAfter(taskSummary.getClaimed()));
}
previousSummary = taskSummary;
}
}
use of pro.taskana.TimeInterval in project taskana by Taskana.
the class ClassificationServiceImplIntExplicitTest method today.
private TimeInterval today() {
Instant begin = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).atZone(ZoneId.systemDefault()).toInstant();
Instant end = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant();
return new TimeInterval(begin, end);
}
use of pro.taskana.TimeInterval in project taskana by Taskana.
the class AbstractAccTest method todaysInterval.
protected TimeInterval todaysInterval() {
Instant begin = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).atZone(ZoneId.systemDefault()).toInstant();
Instant end = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant();
return new TimeInterval(begin, end);
}
use of pro.taskana.TimeInterval in project taskana by Taskana.
the class WorkbasketServiceImplIntAutocommitTest method today.
private TimeInterval today() {
Instant begin = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).atZone(ZoneId.systemDefault()).toInstant();
Instant end = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant();
return new TimeInterval(begin, end);
}
use of pro.taskana.TimeInterval 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;
}
}
Aggregations