コード例 #1
0
        // ======================================================
        // Below is code for generating import data
        // ======================================================

        private IList <InputEntity> RandomNodeData()
        {
            IList <InputEntity> nodes = new List <InputEntity>();

            for (int i = 0; i < 300; i++)
            {
                InputEntity node = new InputEntity();
                node.Id(System.Guid.randomUUID().ToString(), [email protected]_Fields.Global);
                node.property("name", "Node " + i);
                node.property("pointA", "\"   { x : -4.2, y : " + i + ", crs: WGS-84 } \"");
                node.property("pointB", "\" { x : -8, y : " + i + " } \"");
                node.property("date", LocalDate.of(2018, i % 12 + 1, i % 28 + 1));
                node.property("time", OffsetTime.of(1, i % 60, 0, 0, ZoneOffset.ofHours(9)));
                node.property("dateTime", ZonedDateTime.of(2011, 9, 11, 8, i % 60, 0, 0, ZoneId.of("Europe/Stockholm")));
                node.property("dateTime2", new DateTime(2011, 9, 11, 8, i % 60, 0, 0));                             // No zone specified
                node.property("localTime", LocalTime.of(1, i % 60, 0));
                node.property("localDateTime", new DateTime(2011, 9, 11, 8, i % 60));
                node.property("duration", Period.of(2, -3, i % 30));
                node.Labels(RandomLabels(Random.random()));
                nodes.Add(node);
            }
            return(nodes);
        }
コード例 #2
0
 public override void writeTime(OffsetTime offsetTime)
 {
     _values.Add(time(offsetTime));
 }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWhenOffsetTimeIsSentWithRun() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailWhenOffsetTimeIsSentWithRun()
        {
            TestFailureWithV2Value(ValueUtils.of(OffsetTime.now()), "OffsetTime");
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _values = new List <Value>();
            // ZONED_DATE_TIME_ARRAY
            _values.Add(Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(2018, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(2017, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }));
            // LOCAL_DATE_TIME_ARRAY
            _values.Add(Values.localDateTimeArray(new DateTime[]
            {
                new DateTime(2018, 10, 9, 8, 7, 6, 5),
                new DateTime(2018, 10, 9, 8, 7, 6, 5)
            }));
            // DATE_ARRAY
            _values.Add(Values.dateArray(new LocalDate[] { LocalDate.of(1, 12, 28), LocalDate.of(1, 12, 28) }));
            // ZONED_TIME_ARRAY
            _values.Add(Values.timeArray(new OffsetTime[] { OffsetTime.of(19, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(19, 8, 7, 6, ZoneOffset.UTC) }));
            // LOCAL_TIME_ARRAY
            _values.Add(Values.localTimeArray(new LocalTime[] { LocalTime.of(19, 28), LocalTime.of(19, 28) }));
            // DURATION_ARRAY
            _values.Add(Values.durationArray(new DurationValue[] { DurationValue.duration(99, 10, 10, 10), DurationValue.duration(99, 10, 10, 10) }));
            // TEXT_ARRAY
            _values.Add(Values.of(new string[] { "someString1", "someString2" }));
            // BOOLEAN_ARRAY
            _values.Add(Values.of(new bool[] { true, true }));
            // NUMBER_ARRAY (byte, short, int, long, float, double)
            _values.Add(Values.of(new sbyte[] { ( sbyte )1, ( sbyte )12 }));
            _values.Add(Values.of(new short[] { 314, 1337 }));
            _values.Add(Values.of(new int[] { 3140, 13370 }));
            _values.Add(Values.of(new long[] { 31400, 133700 }));
            _values.Add(Values.of(new float[] { 0.5654f, 13432.14f }));
            _values.Add(Values.of(new double[] { 432453254.43243, 4354.7888 }));
            _values.Add(Values.of(new char[] { 'a', 'z' }));
            // ZONED_DATE_TIME
            _values.Add(DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "UTC"));
            // LOCAL_DATE_TIME
            _values.Add(LocalDateTimeValue.localDateTime(2018, 3, 1, 13, 50, 42, 1337));
            // DATE
            _values.Add(DateValue.epochDate(2));
            // ZONED_TIME
            _values.Add(TimeValue.time(43_200_000_000_000L, ZoneOffset.UTC));
            // LOCAL_TIME
            _values.Add(LocalTimeValue.localTime(100000));
            // DURATION
            _values.Add(DurationValue.duration(10, 20, 30, 40));
            // TEXT
            _values.Add(Values.of("string1"));
            // BOOLEAN
            _values.Add(Values.of(true));
            // NUMBER (byte, short, int, long, float, double)
            _values.Add(Values.of(sbyte.MaxValue));
            _values.Add(Values.of(short.MaxValue));
            _values.Add(Values.of(int.MaxValue));
            _values.Add(Values.of(long.MaxValue));
            _values.Add(Values.of(float.MaxValue));
            _values.Add(Values.of(double.MaxValue));
            _values.Add(Values.of(char.MaxValue));
            // GEOMETRY
            _values.Add(Values.pointValue(CoordinateReferenceSystem.WGS84, 12.78, 56.7));
            _values.Add(Values.pointArray(new PointValue[] { Values.pointValue(CoordinateReferenceSystem.WGS84, 12.7566548, 56.7163465), Values.pointValue(CoordinateReferenceSystem.WGS84, 12.13413478, 56.1343457) }));
            _values.Add(Values.pointValue(CoordinateReferenceSystem.WGS84_3D, 12.78, 56.7, 666));
            _values.Add(Values.pointArray(new PointValue[] { Values.pointValue(CoordinateReferenceSystem.WGS84_3D, 12.7566548, 56.7163465, 666), Values.pointValue(CoordinateReferenceSystem.WGS84_3D, 12.13413478, 56.1343457, 555) }));
            _values.Add(Values.pointValue(CoordinateReferenceSystem.Cartesian, 0.0000043, -0.0000000012341025786543));
            _values.Add(Values.pointArray(new PointValue[] { Values.pointValue(CoordinateReferenceSystem.Cartesian, 0.0000043, -0.0000000012341025786543), Values.pointValue(CoordinateReferenceSystem.Cartesian, 0.2000043, -0.0300000012341025786543) }));
            _values.Add(Values.pointValue(CoordinateReferenceSystem.Cartesian_3D, 0.0000043, -0.0000000012341025786543, 666));
            _values.Add(Values.pointArray(new PointValue[] { Values.pointValue(CoordinateReferenceSystem.Cartesian_3D, 0.0000043, -0.0000000012341025786543, 666), Values.pointValue(CoordinateReferenceSystem.Cartesian_3D, 0.2000043, -0.0300000012341025786543, 555) }));
        }
コード例 #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeTime(java.time.OffsetTime offsetTime) throws java.io.IOException
            public override void WriteTime(OffsetTime offsetTime)
            {
                ThrowUnsupportedTypeError("Time");
            }
コード例 #6
0
 protected override Offset GetProperty2Value(OffsetTime value) => value.Offset;
コード例 #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeTime(java.time.OffsetTime offsetTime) throws RuntimeException
        public override void WriteTime(OffsetTime offsetTime)
        {
            Buffer.Add(TimeValue.Time(offsetTime));
        }
コード例 #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeTime(java.time.OffsetTime offsetTime) throws RuntimeException
            public override void WriteTime(OffsetTime offsetTime)
            {
                Builder.Append(TimeValue.time(offsetTime).prettyPrint());
                Builder.Append('|');
            }
 protected override OffsetTime AdjustValue(OffsetTime value)
 {
     return(value.WithOffset(Offset.FromSeconds(value.Offset.Seconds / 60 * 60)));
 }
コード例 #10
0
        internal static Value AsValue(long long0, long long1)
        {
            OffsetTime time = AsValueRaw(long0, long1);

            return(time != null?TimeValue.time(time) : NO_VALUE);
        }
コード例 #11
0
        public static DateTimeValue Datetime(DateValue date, TimeValue time)
        {
            OffsetTime t = time.Temporal();

            return(new DateTimeValue(ZonedDateTime.of(date.Temporal(), t.toLocalTime(), t.Offset)));
        }
コード例 #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldEncodeArrays()
        public virtual void ShouldEncodeArrays()
        {
            AssertEncoding("D1.0|2.0|3.0|", new int[] { 1, 2, 3 });
            AssertEncoding("Ztrue|false|", new bool[] { true, false });
            AssertEncoding("LYWxp|YXJl|eW91|b2s=|", new string[] { "ali", "are", "you", "ok" });
            AssertEncoding("", new string[] {});
            AssertEncoding("P1:4326:1.234;2.567|1:4326:2.345;5.678|2:9157:3.0;4.0;5.0|", new Point[] { Values.pointValue(CoordinateReferenceSystem.WGS84, 1.234, 2.567), Values.pointValue(CoordinateReferenceSystem.WGS84, 2.345, 5.678), Values.pointValue(CoordinateReferenceSystem.Cartesian_3D, 3, 4, 5) });
            AssertEncoding("T1991-03-05|1992-04-06|", new LocalDate[] { DateValue.date(1991, 3, 5).asObjectCopy(), DateValue.date(1992, 4, 6).asObjectCopy() });
            AssertEncoding("T12:45:13.000008676|05:04:50.000000076|", new LocalTime[] { LocalTimeValue.localTime(12, 45, 13, 8676).asObjectCopy(), LocalTimeValue.localTime(5, 4, 50, 76).asObjectCopy() });
            AssertEncoding("T1991-03-05T12:45:13.000008676|1992-04-06T05:04:50.000000076|", new DateTime[] { LocalDateTimeValue.localDateTime(1991, 3, 5, 12, 45, 13, 8676).asObjectCopy(), LocalDateTimeValue.localDateTime(1992, 4, 6, 5, 4, 50, 76).asObjectCopy() });
            AssertEncoding("T02:45:13.000008676Z|01:05:00.0000003+01:00|05:04:50.000000076+05:00|", new OffsetTime[] { TimeValue.time(2, 45, 13, 8676, UTC).asObjectCopy(), TimeValue.time(OffsetTime.ofInstant(Instant.ofEpochSecond(300, 300), ZoneId.of("Europe/Stockholm"))).asObjectCopy(), TimeValue.time(5, 4, 50, 76, "+05:00").asObjectCopy() });
            AssertEncoding("T1991-03-05T02:45:13.000008676Z|1991-03-05T02:45:13.000008676+01:00[Europe/Stockholm]|1992-04-06T05:04:50.000000076+05:00|", new ZonedDateTime[] { DateTimeValue.datetime(1991, 3, 5, 2, 45, 13, 8676, UTC).asObjectCopy(), DateTimeValue.datetime(1991, 3, 5, 2, 45, 13, 8676, ZoneId.of("Europe/Stockholm")).asObjectCopy(), DateTimeValue.datetime(1992, 4, 6, 5, 4, 50, 76, "+05:00").asObjectCopy() });
            AssertEncoding("AP165Y11M3DT5.000000012S|P166Y4DT6.000000005S|", new TemporalAmount[] { DurationValue.duration(1991, 3, 5, 12).asObjectCopy(), DurationValue.duration(1992, 4, 6, 5).asObjectCopy() });
        }
コード例 #13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeTime(java.time.OffsetTime offsetTime) throws RuntimeException
        public override void WriteTime(OffsetTime offsetTime)
        {
            Append("{time: ");
            Append(Quote(offsetTime.ToString()));
            Append("}");
        }
コード例 #14
0
 public override void WriteTime(OffsetTime offsetTime)
 {
     throw new System.NotSupportedException("INIT message metadata should not contain time values");
 }
コード例 #15
0
 public override void writeTime(OffsetTime offsetTime)
 {
     _result.set(offsetTime);
 }
コード例 #16
0
        internal override OffsetTime GetTimePart(System.Func <ZoneId> defaultZone)
        {
            ZoneOffset currentOffset = AssertValidArgument(() => ZonedDateTime.ofInstant(Instant.now(), defaultZone())).Offset;

            return(OffsetTime.of(_value.toLocalTime(), currentOffset));
        }
コード例 #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @TestFactory Stream<org.junit.jupiter.api.DynamicTest> addGet()
        internal virtual Stream <DynamicTest> AddGet()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<org.eclipse.collections.api.tuple.Pair<String, org.neo4j.values.storable.Value[]>> inputs = asList(testInput("NoValue", System.Func.identity(), org.neo4j.values.storable.NoValue.NO_VALUE), testInput("Boolean", org.neo4j.values.storable.Values::booleanValue, true, false, true, false), testInput("BooleanArray", org.neo4j.values.storable.Values::booleanArray, new boolean[] {false, true, false}, EMPTY_BOOLEAN_ARRAY), testInput("Byte", org.neo4j.values.storable.Values::byteValue, (byte) 0, (byte) 1, (byte) -1, Byte.MIN_VALUE, Byte.MAX_VALUE), testInput("ByteArray", org.neo4j.values.storable.Values::byteArray, new byte[] {(byte) 0, (byte) 1, (byte) -1, Byte.MIN_VALUE, Byte.MAX_VALUE}, EMPTY_BYTE_ARRAY), testInput("Short", org.neo4j.values.storable.Values::shortValue, (short) 0, (short) 1, (short) -1, Short.MIN_VALUE, Short.MAX_VALUE), testInput("ShortArray", org.neo4j.values.storable.Values::shortArray, new short[] {(short) 0, (short) 1, (short) -1, Short.MIN_VALUE, Short.MAX_VALUE}, EMPTY_SHORT_ARRAY), testInput("Char", org.neo4j.values.storable.Values::charValue, 'a', '\uFFFF', '∂', '©'), testInput("CharArray", org.neo4j.values.storable.Values::charArray, new char[] {'a', '\uFFFF', '∂', '©'}, EMPTY_CHAR_ARRAY), testInput("Int", org.neo4j.values.storable.Values::intValue, 0, 1, -1, Integer.MIN_VALUE, Integer.MAX_VALUE), testInput("IntArray", org.neo4j.values.storable.Values::intArray, new int[] {0, 1, -1, Integer.MIN_VALUE, Integer.MAX_VALUE}, EMPTY_INT_ARRAY), testInput("Long", org.neo4j.values.storable.Values::longValue, 0L, 1L, -1L, Long.MIN_VALUE, Long.MAX_VALUE), testInput("LongArray", org.neo4j.values.storable.Values::longArray, new long[] {0L, 1L, -1L, Long.MIN_VALUE, Long.MAX_VALUE}, EMPTY_LONG_ARRAY), testInput("Double", org.neo4j.values.storable.Values::doubleValue, 0.0, 1.0, -1.0, Double.MIN_VALUE, Double.MAX_VALUE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), testInput("DoubleArray", org.neo4j.values.storable.Values::doubleArray, new double[] {0.0, 1.0, -1.0, Double.MIN_VALUE, Double.MAX_VALUE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY}, EMPTY_DOUBLE_ARRAY), testInput("Float", org.neo4j.values.storable.Values::floatValue, 0.0f, 1.0f, -1.0f, Float.MIN_VALUE, Float.MAX_VALUE, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY), testInput("FloatArray", org.neo4j.values.storable.Values::floatArray, new float[] {0.0f, 1.0f, -1.0f, Float.MIN_VALUE, Float.MAX_VALUE, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY}, EMPTY_FLOAT_ARRAY), testInput("String", org.neo4j.values.storable.Values::stringValue, "", "x", "foobar"), testInput("StringArray", org.neo4j.values.storable.Values::stringArray, new String[] {"", "x", "foobar"}, EMPTY_STRING_ARRAY), testInput("Point", input -> pointValue(input.getOne(), input.getTwo()), org.eclipse.collections.impl.tuple.Tuples.pair(org.neo4j.values.storable.CoordinateReferenceSystem.WGS84, new double[] {1.0, 2.0}), org.eclipse.collections.impl.tuple.Tuples.pair(org.neo4j.values.storable.CoordinateReferenceSystem.WGS84_3D, new double[] {1.0, 2.0, 3.0}), org.eclipse.collections.impl.tuple.Tuples.pair(org.neo4j.values.storable.CoordinateReferenceSystem.Cartesian, new double[] {1.0, 2.0}), org.eclipse.collections.impl.tuple.Tuples.pair(org.neo4j.values.storable.CoordinateReferenceSystem.Cartesian_3D, new double[] {1.0, 2.0, 3.0})), testInput("PointArray", org.neo4j.values.storable.Values::pointArray, new org.neo4j.graphdb.spatial.Point[] { pointValue(org.neo4j.values.storable.CoordinateReferenceSystem.WGS84, 1.0, 2.0), pointValue(org.neo4j.values.storable.CoordinateReferenceSystem.WGS84_3D, 1.0, 2.0, 3.0), pointValue(org.neo4j.values.storable.CoordinateReferenceSystem.Cartesian, 1.0, 2.0), pointValue(org.neo4j.values.storable.CoordinateReferenceSystem.Cartesian_3D, 1.0, 2.0, 3.0) }, new org.neo4j.graphdb.spatial.Point[0]), testInput("Duration", org.neo4j.values.storable.Values::durationValue, (java.time.temporal.TemporalAmount) java.time.Duration.parse("P2DT3H4M"), java.time.Period.parse("P1Y2M3W4D")), testInput("DurationArray", org.neo4j.values.storable.Values::durationArray, new java.time.temporal.TemporalAmount[] {java.time.Duration.parse("P2DT3H4M"), java.time.Period.parse("P1Y2M3W4D")}, new java.time.temporal.TemporalAmount[0]), testInput("Date", org.neo4j.values.storable.DateValue::date, java.time.LocalDate.now(), java.time.LocalDate.parse("1977-05-25")), testInput("DateArray", org.neo4j.values.storable.Values::dateArray, new java.time.LocalDate[] {java.time.LocalDate.now(), java.time.LocalDate.parse("1977-05-25")}, new java.time.LocalDate[0]), testInput("Time", org.neo4j.values.storable.TimeValue::time, java.time.OffsetTime.now(), java.time.OffsetTime.parse("19:28:34.123+02:00")), testInput("TimeArray", org.neo4j.values.storable.Values::timeArray, new java.time.OffsetTime[] {java.time.OffsetTime.now(), java.time.OffsetTime.parse("19:28:34.123+02:00")}, new java.time.OffsetTime[0]), testInput("LocalTime", org.neo4j.values.storable.LocalTimeValue::localTime, java.time.LocalTime.now(), java.time.LocalTime.parse("19:28:34.123")), testInput("LocalTimeArray", org.neo4j.values.storable.Values::localTimeArray, new java.time.LocalTime[] {java.time.LocalTime.now(), java.time.LocalTime.parse("19:28:34.123")}, new java.time.LocalTime[0]), testInput("LocalDateTime", org.neo4j.values.storable.LocalDateTimeValue::localDateTime, java.time.LocalDateTime.now(), java.time.LocalDateTime.parse("1956-10-04T19:28:34.123")), testInput("LocalDateTimeArray", org.neo4j.values.storable.Values::localDateTimeArray, new java.time.LocalDateTime[] {java.time.LocalDateTime.now(), java.time.LocalDateTime.parse("1956-10-04T19:28:34.123")}, new java.time.LocalDateTime[0]), testInput("DateTime", org.neo4j.values.storable.DateTimeValue::datetime, java.time.ZonedDateTime.now(), java.time.ZonedDateTime.parse("1956-10-04T19:28:34.123+01:00[Europe/Paris]"), java.time.ZonedDateTime.parse("1956-10-04T19:28:34.123+01:15"), java.time.ZonedDateTime.parse("2018-09-13T16:12:16.12345+14:00[Pacific/Kiritimati]"), java.time.ZonedDateTime.parse("2018-09-13T16:12:16.12345-12:00[Etc/GMT+12]"), java.time.ZonedDateTime.parse("2018-09-13T16:12:16.12345-18:00"), java.time.ZonedDateTime.parse("2018-09-13T16:12:16.12345+18:00")), testInput("DateTimeArray", org.neo4j.values.storable.Values::dateTimeArray, new java.time.ZonedDateTime[] { java.time.ZonedDateTime.parse("1956-10-04T19:28:34.123+01:00[Europe/Paris]"), java.time.ZonedDateTime.parse("1956-10-04T19:28:34.123+01:15"), java.time.ZonedDateTime.parse("2018-09-13T16:12:16.12345+14:00[Pacific/Kiritimati]"), java.time.ZonedDateTime.parse("2018-09-13T16:12:16.12345-12:00[Etc/GMT+12]"), java.time.ZonedDateTime.parse("2018-09-13T16:12:16.12345-18:00"), java.time.ZonedDateTime.parse("2018-09-13T16:12:16.12345+18:00") }, new java.time.ZonedDateTime[0]));
            IList <Pair <string, Value[]> > inputs = new IList <Pair <string, Value[]> > {
                TestInput("NoValue", System.Func.identity(), NoValue.NO_VALUE), TestInput("Boolean", Values.booleanValue, true, false, true, false), TestInput("BooleanArray", Values.booleanArray, new bool[] { false, true, false }, EMPTY_BOOLEAN_ARRAY), TestInput("Byte", Values.byteValue, (sbyte)0, (sbyte)1, (sbyte)-1, sbyte.MinValue, sbyte.MaxValue), TestInput("ByteArray", Values.byteArray, new sbyte[] { (sbyte)0, (sbyte)1, (sbyte)-1, sbyte.MinValue, sbyte.MaxValue }, EMPTY_BYTE_ARRAY), TestInput("Short", Values.shortValue, (short)0, (short)1, (short)-1, short.MinValue, short.MaxValue), TestInput("ShortArray", Values.shortArray, new short[] { (short)0, (short)1, (short)-1, short.MinValue, short.MaxValue }, EMPTY_SHORT_ARRAY), TestInput("Char", Values.charValue, 'a', '\uFFFF', '∂', '©'), TestInput("CharArray", Values.charArray, new char[] { 'a', '\uFFFF', '∂', '©' }, EMPTY_CHAR_ARRAY), TestInput("Int", Values.intValue, 0, 1, -1, int.MinValue, int.MaxValue), TestInput("IntArray", Values.intArray, new int[] { 0, 1, -1, int.MinValue, int.MaxValue }, EMPTY_INT_ARRAY), TestInput("Long", Values.longValue, 0L, 1L, -1L, long.MinValue, long.MaxValue), TestInput("LongArray", Values.longArray, new long[] { 0L, 1L, -1L, long.MinValue, long.MaxValue }, EMPTY_LONG_ARRAY), TestInput("Double", Values.doubleValue, 0.0, 1.0, -1.0, double.Epsilon, double.MaxValue, double.NegativeInfinity, double.PositiveInfinity), TestInput("DoubleArray", Values.doubleArray, new double[] { 0.0, 1.0, -1.0, double.Epsilon, double.MaxValue, double.NegativeInfinity, double.PositiveInfinity }, EMPTY_DOUBLE_ARRAY), TestInput("Float", Values.floatValue, 0.0f, 1.0f, -1.0f, float.Epsilon, float.MaxValue, float.NegativeInfinity, float.PositiveInfinity), TestInput("FloatArray", Values.floatArray, new float[] { 0.0f, 1.0f, -1.0f, float.Epsilon, float.MaxValue, float.NegativeInfinity, float.PositiveInfinity }, EMPTY_FLOAT_ARRAY), TestInput("String", Values.stringValue, "", "x", "foobar"), TestInput("StringArray", Values.stringArray, new string[] { "", "x", "foobar" }, EMPTY_STRING_ARRAY), TestInput("Point", input => pointValue(input.One, input.Two), Tuples.pair(CoordinateReferenceSystem.WGS84, new double[] { 1.0, 2.0 }), Tuples.pair(CoordinateReferenceSystem.WGS84_3D, new double[] { 1.0, 2.0, 3.0 }), Tuples.pair(CoordinateReferenceSystem.Cartesian, new double[] { 1.0, 2.0 }), Tuples.pair(CoordinateReferenceSystem.Cartesian_3D, new double[] { 1.0, 2.0, 3.0 })), TestInput("PointArray", Values.pointArray, new Point[] { pointValue(CoordinateReferenceSystem.WGS84, 1.0, 2.0), pointValue(CoordinateReferenceSystem.WGS84_3D, 1.0, 2.0, 3.0), pointValue(CoordinateReferenceSystem.Cartesian, 1.0, 2.0), pointValue(CoordinateReferenceSystem.Cartesian_3D, 1.0, 2.0, 3.0) }, new Point[0]), TestInput("Duration", Values.durationValue, (TemporalAmount)Duration.parse("P2DT3H4M"), Period.parse("P1Y2M3W4D")), TestInput("DurationArray", Values.durationArray, new TemporalAmount[] { Duration.parse("P2DT3H4M"), Period.parse("P1Y2M3W4D") }, new TemporalAmount[0]), TestInput("Date", DateValue.date, LocalDate.now(), LocalDate.parse("1977-05-25")), TestInput("DateArray", Values.dateArray, new LocalDate[] { LocalDate.now(), LocalDate.parse("1977-05-25") }, new LocalDate[0]), TestInput("Time", TimeValue.time, OffsetTime.now(), OffsetTime.parse("19:28:34.123+02:00")), TestInput("TimeArray", Values.timeArray, new OffsetTime[] { OffsetTime.now(), OffsetTime.parse("19:28:34.123+02:00") }, new OffsetTime[0]), TestInput("LocalTime", LocalTimeValue.localTime, LocalTime.now(), LocalTime.parse("19:28:34.123")), TestInput("LocalTimeArray", Values.localTimeArray, new LocalTime[] { LocalTime.now(), LocalTime.parse("19:28:34.123") }, new LocalTime[0]), TestInput("LocalDateTime", LocalDateTimeValue.localDateTime, DateTime.Now, DateTime.Parse("1956-10-04T19:28:34.123")), TestInput("LocalDateTimeArray", Values.localDateTimeArray, new DateTime[] { DateTime.Now, DateTime.Parse("1956-10-04T19:28:34.123") }, new DateTime[0]), TestInput("DateTime", DateTimeValue.datetime, ZonedDateTime.now(), ZonedDateTime.parse("1956-10-04T19:28:34.123+01:00[Europe/Paris]"), ZonedDateTime.parse("1956-10-04T19:28:34.123+01:15"), ZonedDateTime.parse("2018-09-13T16:12:16.12345+14:00[Pacific/Kiritimati]"), ZonedDateTime.parse("2018-09-13T16:12:16.12345-12:00[Etc/GMT+12]"), ZonedDateTime.parse("2018-09-13T16:12:16.12345-18:00"), ZonedDateTime.parse("2018-09-13T16:12:16.12345+18:00")), TestInput("DateTimeArray", Values.dateTimeArray, new ZonedDateTime[] { ZonedDateTime.parse("1956-10-04T19:28:34.123+01:00[Europe/Paris]"), ZonedDateTime.parse("1956-10-04T19:28:34.123+01:15"), ZonedDateTime.parse("2018-09-13T16:12:16.12345+14:00[Pacific/Kiritimati]"), ZonedDateTime.parse("2018-09-13T16:12:16.12345-12:00[Etc/GMT+12]"), ZonedDateTime.parse("2018-09-13T16:12:16.12345-18:00"), ZonedDateTime.parse("2018-09-13T16:12:16.12345+18:00") }, new ZonedDateTime[0])
            };

            return(DynamicTest.stream(inputs.GetEnumerator(), Pair.getOne, pair =>
            {
                Value[] values = pair.Two;
                long[] refs = values.Select(_container.add).ToArray();
                for (int i = 0; i < values.Length; i++)
                {
                    assertEquals(values[i], _container.get(refs[i]));
                }
            }));
        }
コード例 #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void compareGenericKeyState()
        internal virtual void CompareGenericKeyState()
        {
            IList <Value> allValues = Arrays.asList(Values.of("string1"), Values.of(42), Values.of(true), Values.of(new char[] { 'a', 'z' }), Values.of(new string[] { "arrayString1", "arraysString2" }), Values.of(new sbyte[] { ( sbyte )1, ( sbyte )12 }), Values.of(new short[] { 314, 1337 }), Values.of(new int[] { 3140, 13370 }), Values.of(new long[] { 31400, 133700 }), Values.of(new bool[] { false, true }), DateValue.epochDate(2), LocalTimeValue.localTime(100000), TimeValue.time(43_200_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_201_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_200_000_000_000L, ZoneOffset.of("+01:00")), TimeValue.time(46_800_000_000_000L, ZoneOffset.UTC), LocalDateTimeValue.localDateTime(2018, 3, 1, 13, 50, 42, 1337), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "UTC"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "Europe/Stockholm"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2015, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 4, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 26, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 13, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 46, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 14, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7475, "+05:00"), DateTimeValue.datetime(2038, 1, 18, 9, 14, 7, 0, "-18:00"), DateTimeValue.datetime(10000, 100, ZoneOffset.ofTotalSeconds(3)), DateTimeValue.datetime(10000, 101, ZoneOffset.ofTotalSeconds(-3)), DurationValue.duration(10, 20, 30, 40), DurationValue.duration(11, 20, 30, 40), DurationValue.duration(10, 21, 30, 40), DurationValue.duration(10, 20, 31, 40), DurationValue.duration(10, 20, 30, 41), Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(2018, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(2017, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }), Values.localDateTimeArray(new DateTime[] { new DateTime(2018, 10, 9, 8, 7, 6, 5), new DateTime(2018, 10, 9, 8, 7, 6, 5) }), Values.timeArray(new OffsetTime[] { OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC) }), Values.dateArray(new LocalDate[] { LocalDate.of(2018, 12, 28), LocalDate.of(2018, 12, 28) }), Values.localTimeArray(new LocalTime[] { LocalTime.of(9, 28), LocalTime.of(9, 28) }), Values.durationArray(new DurationValue[] { DurationValue.duration(12, 10, 10, 10), DurationValue.duration(12, 10, 10, 10) }));

            allValues.sort(Values.COMPARATOR);

            IList <GenericKey> states = new List <GenericKey>();

            foreach (Value value in allValues)
            {
                GenericKey state = new GenericKey(null);
                state.WriteValue(value, NativeIndexKey.Inclusion.Neutral);
                states.Add(state);
            }
            Collections.shuffle(states);
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            states.sort(GenericKey::compareValueTo);
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IList <Value> sortedStatesAsValues = states.Select(GenericKey::asValue).ToList();

            assertEquals(allValues, sortedStatesAsValues);
        }
コード例 #19
0
            public Compatibility(IndexProviderCompatibilityTestSuite testSuite, IndexDescriptor descriptor)
            {
                this.TestSuite  = testSuite;
                this.Descriptor = descriptor.WithId(17);
                this.ValueSet1  = AllValues(testSuite.SupportsSpatial(), Arrays.asList(Values.of("string1"), Values.of(42), Values.of(true), Values.of(new char[] { 'a', 'z' }), Values.of(new string[] { "arrayString1", "arraysString2" }), Values.of(new sbyte[] { (sbyte)1, (sbyte)12 }), Values.of(new short[] { 314, 1337 }), Values.of(new int[] { 3140, 13370 }), Values.of(new long[] { 31400, 133700 }), Values.of(new bool[] { true, true })), Arrays.asList(DateValue.epochDate(2), LocalTimeValue.localTime(100000), TimeValue.time(43_200_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_201_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_200_000_000_000L, ZoneOffset.of("+01:00")), TimeValue.time(46_800_000_000_000L, ZoneOffset.UTC), LocalDateTimeValue.localDateTime(2018, 3, 1, 13, 50, 42, 1337), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "UTC"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "Europe/Stockholm"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2015, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 4, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 26, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 13, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 46, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 14, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7475, "+05:00"), DateTimeValue.datetime(2038, 1, 18, 9, 14, 7, 0, "-18:00"), DateTimeValue.datetime(10000, 100, ZoneOffset.ofTotalSeconds(3)), DateTimeValue.datetime(10000, 101, ZoneOffset.ofTotalSeconds(-3)), DurationValue.duration(10, 20, 30, 40), DurationValue.duration(11, 20, 30, 40), DurationValue.duration(10, 21, 30, 40), DurationValue.duration(10, 20, 31, 40), DurationValue.duration(10, 20, 30, 41), Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(2018, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(2017, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }), Values.localDateTimeArray(new DateTime[] { new DateTime(2018, 10, 9, 8, 7, 6, 5), new DateTime(2018, 10, 9, 8, 7, 6, 5) }), Values.timeArray(new OffsetTime[] { OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC) }), Values.dateArray(new LocalDate[] { LocalDate.of(1, 12, 28), LocalDate.of(1, 12, 28) }), Values.localTimeArray(new LocalTime[] { LocalTime.of(9, 28), LocalTime.of(9, 28) }), Values.durationArray(new DurationValue[] { DurationValue.duration(12, 10, 10, 10), DurationValue.duration(12, 10, 10, 10) })), Arrays.asList(Values.pointValue(CoordinateReferenceSystem.Cartesian, 0, 0), Values.pointValue(CoordinateReferenceSystem.WGS84, 12.78, 56.7)));

                this.ValueSet2 = AllValues(testSuite.SupportsSpatial(), Arrays.asList(Values.of("string2"), Values.of(1337), Values.of(false), Values.of(new char[] { 'b', 'c' }), Values.of(new string[] { "someString1", "someString2" }), Values.of(new sbyte[] { (sbyte)9, (sbyte)9 }), Values.of(new short[] { 99, 999 }), Values.of(new int[] { 99999, 99999 }), Values.of(new long[] { 999999, 999999 }), Values.of(new bool[] { false, false })), Arrays.asList(DateValue.epochDate(42), LocalTimeValue.localTime(2000), TimeValue.time(100L, ZoneOffset.UTC), LocalDateTimeValue.localDateTime(2018, 2, 28, 11, 5, 1, 42), DateTimeValue.datetime(1999, 12, 31, 23, 59, 59, 123456789, "Europe/London"), DurationValue.duration(4, 3, 2, 1), Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(999, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(999, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }), Values.localDateTimeArray(new DateTime[] { new DateTime(999, 10, 9, 8, 7, 6, 5), new DateTime(999, 10, 9, 8, 7, 6, 5) }), Values.timeArray(new OffsetTime[] { OffsetTime.of(19, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(19, 8, 7, 6, ZoneOffset.UTC) }), Values.dateArray(new LocalDate[] { LocalDate.of(999, 12, 28), LocalDate.of(999, 12, 28) }), Values.localTimeArray(new LocalTime[] { LocalTime.of(19, 28), LocalTime.of(19, 28) }), Values.durationArray(new DurationValue[] { DurationValue.duration(99, 10, 10, 10), DurationValue.duration(99, 10, 10, 10) })), Arrays.asList(Values.pointValue(CoordinateReferenceSystem.Cartesian, 90, 90), Values.pointValue(CoordinateReferenceSystem.WGS84, 9.21, 9.65)));

                PageCacheAndDependenciesRule = (new PageCacheAndDependenciesRule()).with(new DefaultFileSystemRule()).with(testSuite.GetType());
                Random    = new RandomRule();
                RuleChain = RuleChain.outerRule(PageCacheAndDependenciesRule).around(Random);
            }
コード例 #20
0
ファイル: MessageDecoderTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCallExternalErrorOnTime() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCallExternalErrorOnTime()
        {
            assumeThat(PackerUnderTest.version(), equalTo(1L));

            TestUnpackableStructParametersWithKnownType(new Neo4jPackV2(), ValueUtils.of(OffsetTime.now()), "OffsetTime values cannot be unpacked with this version of bolt.");
        }
コード例 #21
0
 protected override LocalTime GetProperty1Value(OffsetTime value) => value.TimeOfDay;
コード例 #22
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeTime(java.time.OffsetTime offsetTime) throws E
        public override void WriteTime(OffsetTime offsetTime)
        {           // no-op
        }
コード例 #23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeTime(java.time.OffsetTime offsetTime) throws RuntimeException
        public override void WriteTime(OffsetTime offsetTime)
        {
            WriteValue(offsetTime);
        }
コード例 #24
0
 public OffsetTime Test(OffsetTime arg) => arg;
コード例 #25
0
 protected override DateTimeOffset Wrap(OffsetTime value) => value.On(new LocalDate(1900, 1, 1)).ToDateTimeOffset();
コード例 #26
0
 private static Stream <AnyValue> UnsupportedValues()
 {
     return(Stream.of(nodeValue(42, stringArray("Person"), EMPTY_MAP), NewRelationshipValue(), pointValue(CoordinateReferenceSystem.WGS84, new double[2]), byteArray(new sbyte[] { 1, 2, 3 }), Values.of(Duration.ofHours(1)), Values.of(LocalDate.now()), Values.of(LocalTime.now()), Values.of(OffsetTime.now()), Values.of(DateTime.Now), Values.of(ZonedDateTime.now())));
 }
コード例 #27
0
 public virtual void SupportsEquals(OffsetTime offsetTime)
 {
     SupportsPropertyOrMethod(x => x.Equals(offsetTime));
 }
コード例 #28
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeTime(java.time.OffsetTime offsetTime) throws E
        public override void WriteTime(OffsetTime offsetTime)
        {
            throw Exception("writeTime");
        }