示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleDateTimeWithTimeZoneOffset()
        internal virtual void ShouldHandleDateTimeWithTimeZoneOffset()
        {
            DateTimeValue datetime = datetime(1988, 4, 19, 10, 12, 59, 112233445, ZoneOffset.ofHoursMinutes(3, 15));
            PrettyPrinter printer  = new PrettyPrinter();

            datetime.WriteTo(printer);

            assertEquals("{datetime: \"1988-04-19T10:12:59.112233445+03:15\"}", printer.Value());
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleDateTimeWithTimeZoneId()
        internal virtual void ShouldHandleDateTimeWithTimeZoneId()
        {
            DateTimeValue datetime = datetime(2045, 2, 7, 12, 0x0, 40, 999888999, "Europe/London");
            PrettyPrinter printer  = new PrettyPrinter();

            datetime.WriteTo(printer);

            assertEquals("{datetime: \"2045-02-07T12:00:40.999888999Z[Europe/London]\"}", printer.Value());
        }
示例#3
0
        // VALUE GROUP SCAN
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testValueGroupRange()
        public virtual void TestValueGroupRange()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.internal.kernel.api.IndexQuery.RangePredicate<?> p = IndexQuery.range(propId, org.neo4j.values.storable.ValueGroup.DATE);
            RangePredicate <object> p = IndexQuery.Range(_propId, ValueGroup.DATE);

            assertTrue(Test(p, DateValue.date(-4000, 1, 31)));
            assertTrue(Test(p, DateValue.date(2018, 3, 7)));
            assertFalse(Test(p, DateTimeValue.datetime(2018, 3, 7, 0, 0, 0, 0, ZoneOffset.UTC)));
            assertFalse(Test(p, stringValue("hej")));
            assertFalse(Test(p, _gps2_3d));
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void compareToSameAsValue()
        public virtual void CompareToSameAsValue()
        {
            Value[] values = new Value[] { DateTimeValue.datetime(9999, 100, ZoneId.of("+18:00")), DateTimeValue.datetime(10000, 100, ZoneId.of("-18:00")), DateTimeValue.datetime(10000, 100, ZoneOffset.of("-17:59:59")), DateTimeValue.datetime(10000, 100, ZoneId.of("UTC")), DateTimeValue.datetime(10000, 100, ZoneId.of("+01:00")), DateTimeValue.datetime(10000, 100, ZoneId.of("Europe/Stockholm")), DateTimeValue.datetime(10000, 100, ZoneId.of("+03:00")), DateTimeValue.datetime(10000, 101, ZoneId.of("-18:00")) };

            ZonedDateTimeIndexKey keyI = new ZonedDateTimeIndexKey();
            ZonedDateTimeIndexKey keyJ = new ZonedDateTimeIndexKey();

            int len = values.Length;

            for (int i = 0; i < len; i++)
            {
                for (int j = 0; j < len; j++)
                {
                    Value vi = values[i];
                    Value vj = values[j];
                    vi.WriteTo(keyI);
                    vj.WriteTo(keyJ);

                    int expected = Integer.signum(Values.COMPARATOR.Compare(vi, vj));
                    assertEquals(format("comparing %s and %s", vi, vj), expected, Integer.signum(i - j));
                    assertEquals(format("comparing %s and %s", vi, vj), expected, Integer.signum(keyI.CompareValueTo(keyJ)));
                }
            }
        }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadAndWriteConsistentValues()
        public virtual void ShouldReadAndWriteConsistentValues()
        {
            Value[] values = new Value[] { DateTimeValue.datetime(9999, 100, ZoneId.of("+18:00")), DateTimeValue.datetime(10000, 100, ZoneId.of("-18:00")), DateTimeValue.datetime(10000, 100, ZoneOffset.of("-17:59:59")), DateTimeValue.datetime(10000, 100, ZoneId.of("UTC")), DateTimeValue.datetime(10000, 100, ZoneId.of("+01:00")), DateTimeValue.datetime(10000, 100, ZoneId.of("Europe/Stockholm")), DateTimeValue.datetime(10000, 100, ZoneId.of("+03:00")), DateTimeValue.datetime(10000, 101, ZoneId.of("-18:00")) };

            ZonedDateTimeLayout   layout   = new ZonedDateTimeLayout();
            PageCursor            cursor   = new StubPageCursor(0, 8 * 1024);
            ZonedDateTimeIndexKey writeKey = layout.NewKey();
            ZonedDateTimeIndexKey readKey  = layout.NewKey();

            // Write all
            foreach (Value value in values)
            {
                value.WriteTo(writeKey);
                layout.WriteKey(cursor, writeKey);
            }

            // Read all
            cursor.Offset = 0;
            foreach (Value value in values)
            {
                layout.ReadKey(cursor, readKey, ZonedDateTimeIndexKey.Size);
                assertEquals(value, readKey.AsValue());
            }
        }
示例#6
0
 public override Value AsValue()
 {
     return(TimeZones.validZoneId(ZoneId) ? DateTimeValue.datetime(EpochSecondUTC, NanoOfSecond, ZoneId.of(TimeZones.map(ZoneId))) : DateTimeValue.datetime(EpochSecondUTC, NanoOfSecond, ZoneOffset.ofTotalSeconds(ZoneOffsetSeconds)));
 }
示例#7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDateTimeWithPrecedingNotInLinedLong()
        public virtual void TestDateTimeWithPrecedingNotInLinedLong()
        {
            TestDateTypeWithPrecedingNotInLinedLong(DateTimeValue.datetime(DateValue.parse("2018-04-01"), LocalTimeValue.parse("01:02:03"), ZoneId.of("Europe/Stockholm")));
        }
示例#8
0
 public override Value MapDateTime(DateTimeValue value)
 {
     throw new CypherTypeException("Don't know how to treat that as a boolean: " + value, null);
 }
示例#9
0
 internal static ZonedDateTime AsValueRaw(long long0, long long1, long long2, long long3)
 {
     return(TimeZones.validZoneId(( short )long2) ? DateTimeValue.datetimeRaw(long0, long1, ZoneId.of(TimeZones.map(( short )long2))) : DateTimeValue.datetimeRaw(long0, long1, ZoneOffset.ofTotalSeconds(( int )long3)));
 }
示例#10
0
 internal static DateTimeValue AsValue(long long0, long long1, long long2, long long3)
 {
     return(DateTimeValue.datetime(AsValueRaw(long0, long1, long2, long3)));
 }
示例#11
0
 public override AnyValue MapDateTime(DateTimeValue value)
 {
     return(value);
 }