use of org.neo4j.values.storable.DateTimeValue in project neo4j by neo4j.
the class CompositeIndexAccessorCompatibility method testIndexSeekRangeWithExistsByTemporal.
@Test
public void testIndexSeekRangeWithExistsByTemporal() throws Exception {
DateTimeValue d1 = datetime(9999, 100, ZoneId.of("+18:00"));
DateTimeValue d2 = datetime(10000, 100, ZoneId.of("UTC"));
DateTimeValue d3 = datetime(10000, 100, ZoneId.of("+01:00"));
DateTimeValue d4 = datetime(10000, 100, ZoneId.of("Europe/Stockholm"));
DateTimeValue d5 = datetime(10000, 100, ZoneId.of("+03:00"));
testIndexSeekRangeWithExists(d1, d2, d3, d4, d5);
}
use of org.neo4j.values.storable.DateTimeValue in project neo4j by neo4j.
the class LiteralJavaccParserTest method shouldInterpretDateTime.
@Test
void shouldInterpretDateTime() throws ParseException {
DateTimeValue date = DateTimeValue.datetime(2020, 12, 10, 6, 41, 23, 0, DEFAULT_ZONE_ID);
DateTimeValue dateTimeZone = DateTimeValue.datetime(2020, 12, 10, 6, 41, 23, 0, ZoneId.of("America/Los_Angeles"));
assertEquals(date, parseLiteral("datetime('2020-12-10T6:41:23.0')"));
assertEquals(date, parseLiteral("datetime({year:2020, month:12, day:10, hour: 6, minute: 41, second: 23})"));
assertEquals(dateTimeZone, parseLiteral("datetime({year:2020, month:12, day:10, hour: 6, minute: 41, second: 23, timezone: 'America/Los Angeles'})"));
// should not throw
assertNotNull(parseLiteral("datetime()"));
assertThrows(IllegalArgumentException.class, () -> parseLiteral("datetime(2020, 12, 10, 6, 41, 23, 0)"));
assertNull(parseLiteral("datetime(null)"));
}
use of org.neo4j.values.storable.DateTimeValue in project neo4j by neo4j.
the class TestPropertyTypes method testDateTimeTypeWithZoneId.
@Test
void testDateTimeTypeWithZoneId() {
DateTimeValue dateTime = DateTimeValue.datetime(1991, 1, 1, 0, 0, 13, 37, ZoneId.of("Europe/Stockholm"));
String key = "dt";
try (Transaction transaction = getGraphDb().beginTx()) {
transaction.getNodeById(node1.getId()).setProperty(key, dateTime);
transaction.commit();
}
try (Transaction transaction = getGraphDb().beginTx()) {
Object property = transaction.getNodeById(node1.getId()).getProperty(key);
assertEquals(dateTime.asObjectCopy(), property);
transaction.commit();
}
}
use of org.neo4j.values.storable.DateTimeValue in project neo4j by neo4j.
the class TestPropertyTypes method testDateTimeTypeWithZoneOffset.
@Test
void testDateTimeTypeWithZoneOffset() {
DateTimeValue dateTime = DateTimeValue.datetime(1991, 1, 1, 0, 0, 13, 37, "+01:00");
String key = "dt";
try (Transaction transaction = getGraphDb().beginTx()) {
transaction.getNodeById(node1.getId()).setProperty(key, dateTime);
transaction.commit();
}
try (Transaction transaction = getGraphDb().beginTx()) {
Object property = transaction.getNodeById(node1.getId()).getProperty(key);
assertEquals(dateTime.asObjectCopy(), property);
transaction.commit();
}
}
use of org.neo4j.values.storable.DateTimeValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleDateTimeWithTimeZoneId.
@Test
void shouldHandleDateTimeWithTimeZoneId() {
DateTimeValue datetime = datetime(2045, 2, 7, 12, 0, 40, 999888999, "Europe/London");
PrettyPrinter printer = new PrettyPrinter();
datetime.writeTo(printer);
assertEquals("{datetime: \"2045-02-07T12:00:40.999888999Z[Europe/London]\"}", printer.value());
}
Aggregations