Search in sources :

Example 56 with DateTime

use of org.joda.time.DateTime in project druid by druid-io.

the class QueryGranularityTest method testIterableWeek.

@Test
public void testIterableWeek() throws Exception {
    final DateTimeZone tz = DateTimeZone.forID("America/Los_Angeles");
    final DateTime baseTime = new DateTime("2012-11-03T10:00:00", tz);
    assertSameInterval(Lists.newArrayList(new DateTime("2012-10-29T00:00:00.000-07:00"), new DateTime("2012-11-05T00:00:00.000-08:00"), new DateTime("2012-11-12T00:00:00.000-08:00"), new DateTime("2012-11-19T00:00:00.000-08:00")), new PeriodGranularity(new Period("P1W"), null, tz).getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Weeks.weeks(3)).getMillis())));
    assertSameInterval(Lists.newArrayList(new DateTime("2012-11-03T10:00:00.000-07:00"), new DateTime("2012-11-10T10:00:00.000-08:00"), new DateTime("2012-11-17T10:00:00.000-08:00")), new PeriodGranularity(new Period("P1W"), baseTime, tz).getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Weeks.weeks(3)).getMillis())));
}
Also used : PeriodGranularity(io.druid.java.util.common.granularity.PeriodGranularity) Period(org.joda.time.Period) DateTimeZone(org.joda.time.DateTimeZone) DateTime(org.joda.time.DateTime) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 57 with DateTime

use of org.joda.time.DateTime in project druid by druid-io.

the class QueryGranularityTest method testIterableAllComplex.

@Test
public void testIterableAllComplex() throws Exception {
    final DateTime baseTime = new DateTime("2011-01-01T09:38:02.992Z");
    assertSameInterval(Lists.newArrayList(baseTime), Granularities.ALL.getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Days.days(3)).getMillis())));
}
Also used : DateTime(org.joda.time.DateTime) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 58 with DateTime

use of org.joda.time.DateTime in project druid by druid-io.

the class QueryGranularityTest method testIterableDayComplex.

@Test
public void testIterableDayComplex() throws Exception {
    final DateTime baseTime = new DateTime("2011-01-01T09:38:02.992Z");
    assertSameInterval(Lists.newArrayList(new DateTime("2011-01-01T00:00:00.000Z"), new DateTime("2011-01-02T00:00:00.000Z"), new DateTime("2011-01-03T00:00:00.000Z"), new DateTime("2011-01-04T00:00:00.000Z")), Granularities.DAY.getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Days.days(3)).getMillis())));
}
Also used : DateTime(org.joda.time.DateTime) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 59 with DateTime

use of org.joda.time.DateTime in project druid by druid-io.

the class QueryGranularityTest method testIterableMinuteComplex.

@Test
public void testIterableMinuteComplex() throws Exception {
    final DateTime baseTime = new DateTime("2011-01-01T09:38:02.992Z");
    assertSameInterval(Lists.newArrayList(new DateTime("2011-01-01T09:38:00.000Z"), new DateTime("2011-01-01T09:39:00.000Z"), new DateTime("2011-01-01T09:40:00.000Z"), new DateTime("2011-01-01T09:41:00.000Z")), Granularities.MINUTE.getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Minutes.THREE).getMillis())));
}
Also used : DateTime(org.joda.time.DateTime) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 60 with DateTime

use of org.joda.time.DateTime in project druid by druid-io.

the class QueryGranularityTest method testIterable15MinuteSimple.

@Test
public void testIterable15MinuteSimple() throws Exception {
    final DateTime baseTime = new DateTime("2011-01-01T09:30:00.000Z");
    assertSameInterval(Lists.newArrayList(new DateTime("2011-01-01T09:30:00.000Z"), new DateTime("2011-01-01T09:45:00.000Z"), new DateTime("2011-01-01T10:00:00.000Z")), Granularities.FIFTEEN_MINUTE.getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Minutes.minutes(45)).getMillis())));
}
Also used : DateTime(org.joda.time.DateTime) Interval(org.joda.time.Interval) Test(org.junit.Test)

Aggregations

DateTime (org.joda.time.DateTime)5683 Test (org.junit.Test)1667 Test (org.testng.annotations.Test)774 ArrayList (java.util.ArrayList)545 Date (java.util.Date)389 LocalDate (org.joda.time.LocalDate)374 DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)353 ResponseBody (okhttp3.ResponseBody)335 Interval (org.joda.time.Interval)307 Test (org.junit.jupiter.api.Test)281 HashMap (java.util.HashMap)272 BigDecimal (java.math.BigDecimal)234 DateTimeZone (org.joda.time.DateTimeZone)220 UUID (java.util.UUID)195 List (java.util.List)194 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)178 Map (java.util.Map)171 IOException (java.io.IOException)158 Result (io.druid.query.Result)153 ServiceCall (com.microsoft.rest.ServiceCall)148