Search in sources :

Example 6 with TimeInterval

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;
    }
}
Also used : TimeInterval(pro.taskana.TimeInterval) TaskService(pro.taskana.TaskService) Instant(java.time.Instant) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 7 with TimeInterval

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);
}
Also used : TimeInterval(pro.taskana.TimeInterval) Instant(java.time.Instant)

Example 8 with TimeInterval

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);
}
Also used : TimeInterval(pro.taskana.TimeInterval) Instant(java.time.Instant)

Example 9 with TimeInterval

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);
}
Also used : TimeInterval(pro.taskana.TimeInterval) Instant(java.time.Instant)

Example 10 with TimeInterval

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;
    }
}
Also used : TimeInterval(pro.taskana.TimeInterval) TaskService(pro.taskana.TaskService) Instant(java.time.Instant) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

Instant (java.time.Instant)12 TimeInterval (pro.taskana.TimeInterval)12 AbstractAccTest (acceptance.AbstractAccTest)8 Test (org.junit.Test)8 TaskService (pro.taskana.TaskService)8 TaskSummary (pro.taskana.TaskSummary)8 WithAccessId (pro.taskana.security.WithAccessId)8