Search in sources :

Example 1 with Time

use of com.yahoo.elide.datastores.aggregation.timegrains.Time in project elide by yahoo.

the class TimeSerdeTest method testTimeDeserializeDate.

@Test
public void testTimeDeserializeDate() {
    LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
    Time expectedDate = new Time(localDate, true, true, true, false, false, false, (unused) -> "");
    Serde serde = new Time.TimeSerde();
    Object actualDate = serde.deserialize(DATE);
    assertEquals(expectedDate, actualDate);
    assertEquals(DATE, serde.serialize(actualDate));
}
Also used : LocalDateTime(java.time.LocalDateTime) Serde(com.yahoo.elide.core.utils.coerce.converters.Serde) Time(com.yahoo.elide.datastores.aggregation.timegrains.Time) LocalDateTime(java.time.LocalDateTime) Test(org.junit.jupiter.api.Test)

Example 2 with Time

use of com.yahoo.elide.datastores.aggregation.timegrains.Time in project elide by yahoo.

the class TimeSerdeTest method testTimeDeserializeSecond.

@Test
public void testTimeDeserializeSecond() {
    LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
    Time expectedDate = new Time(localDate, true, true, true, true, true, true, (unused) -> "");
    Serde serde = new Time.TimeSerde();
    Object actualDate = serde.deserialize(SECOND);
    assertEquals(expectedDate, actualDate);
    assertEquals(SECOND, serde.serialize(actualDate));
}
Also used : LocalDateTime(java.time.LocalDateTime) Serde(com.yahoo.elide.core.utils.coerce.converters.Serde) Time(com.yahoo.elide.datastores.aggregation.timegrains.Time) LocalDateTime(java.time.LocalDateTime) Test(org.junit.jupiter.api.Test)

Example 3 with Time

use of com.yahoo.elide.datastores.aggregation.timegrains.Time in project elide by yahoo.

the class TimeSerdeTest method testTimeDeserializeHour.

@Test
public void testTimeDeserializeHour() {
    LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
    Time expectedDate = new Time(localDate, true, true, true, true, true, true, (unused) -> "");
    Serde serde = new Time.TimeSerde();
    Object actualDate = serde.deserialize(HOUR);
    assertEquals(expectedDate, actualDate);
    assertEquals(HOUR, serde.serialize(actualDate));
}
Also used : LocalDateTime(java.time.LocalDateTime) Serde(com.yahoo.elide.core.utils.coerce.converters.Serde) Time(com.yahoo.elide.datastores.aggregation.timegrains.Time) LocalDateTime(java.time.LocalDateTime) Test(org.junit.jupiter.api.Test)

Example 4 with Time

use of com.yahoo.elide.datastores.aggregation.timegrains.Time in project elide by yahoo.

the class TimeSerdeTest method testTimeDeserializeMinute.

@Test
public void testTimeDeserializeMinute() {
    LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
    Time expectedDate = new Time(localDate, true, true, true, true, true, true, (unused) -> "");
    Serde serde = new Time.TimeSerde();
    Object actualDate = serde.deserialize(MINUTE);
    assertEquals(expectedDate, actualDate);
    assertEquals(MINUTE, serde.serialize(actualDate));
}
Also used : LocalDateTime(java.time.LocalDateTime) Serde(com.yahoo.elide.core.utils.coerce.converters.Serde) Time(com.yahoo.elide.datastores.aggregation.timegrains.Time) LocalDateTime(java.time.LocalDateTime) Test(org.junit.jupiter.api.Test)

Example 5 with Time

use of com.yahoo.elide.datastores.aggregation.timegrains.Time in project elide by yahoo.

the class TimeSerdeTest method testTimeDeserializeMonth.

@Test
public void testTimeDeserializeMonth() {
    LocalDateTime localDate = LocalDateTime.of(2020, java.time.Month.of(01), 01, 00, 00, 00);
    Time expectedDate = new Time(localDate, true, true, false, false, false, false, (unused) -> "");
    Serde serde = new Time.TimeSerde();
    Object actualDate = serde.deserialize(MONTH);
    assertEquals(expectedDate, actualDate);
    assertEquals(MONTH, serde.serialize(actualDate));
}
Also used : LocalDateTime(java.time.LocalDateTime) Serde(com.yahoo.elide.core.utils.coerce.converters.Serde) Time(com.yahoo.elide.datastores.aggregation.timegrains.Time) LocalDateTime(java.time.LocalDateTime) Test(org.junit.jupiter.api.Test)

Aggregations

Serde (com.yahoo.elide.core.utils.coerce.converters.Serde)6 Time (com.yahoo.elide.datastores.aggregation.timegrains.Time)6 LocalDateTime (java.time.LocalDateTime)6 Test (org.junit.jupiter.api.Test)6