예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testTimeArray()
        public virtual void TestTimeArray()
        {
            string key = "testarray";

            // array sizes 1 through 4
            foreach (OffsetTime[] array in new OffsetTime[][]
            {
                new OffsetTime[] { TimeValue.time(23, 11, 8, 0, "+17:59").asObjectCopy() },
                new OffsetTime[] { TimeValue.time(23, 11, 8, 0, "+17:59").asObjectCopy(), TimeValue.time(14, 34, 55, 3478, "+02:00").asObjectCopy() },
                new OffsetTime[] { TimeValue.time(23, 11, 8, 0, "+17:59").asObjectCopy(), TimeValue.time(14, 34, 55, 3478, "+02:00").asObjectCopy(), TimeValue.time(0, 17, 20, 783478, "-03:00").asObjectCopy() },
                new OffsetTime[] { TimeValue.time(23, 11, 8, 0, "+17:59").asObjectCopy(), TimeValue.time(14, 34, 55, 3478, "+02:00").asObjectCopy(), TimeValue.time(0, 17, 20, 783478, "-03:00").asObjectCopy(), TimeValue.time(1, 1, 1, 1, "-01:00").asObjectCopy() }
            })
            {
                _node1.setProperty(key, array);
                NewTransaction();

                OffsetTime[] propertyValue = ( OffsetTime[] )_node1.getProperty(key);
                assertEquals(array.Length, propertyValue.Length);
                for (int i = 0; i < array.Length; i++)
                {
                    assertEquals(array[i], propertyValue[i]);
                }
            }

            _node1.removeProperty(key);
            NewTransaction();

            assertTrue(!_node1.hasProperty(key));
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testTimeType()
        public virtual void TestTimeType()
        {
            OffsetTime time = TimeValue.time(23, 11, 8, 0, "+17:59").asObjectCopy();
            string     key  = "dt";

            _node1.setProperty(key, time);
            NewTransaction();

            object property = _node1.getProperty(key);

            assertEquals(time, property);
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleTimeWithOffset()
        public virtual void ShouldHandleTimeWithOffset()
        {
            // Given
            TimeValue time = TimeValue.time(1, 2, 3, 4, "+01:00");

            // When
            time.WriteTo(_converter);

            // Then
            object value = _converter.value();

            assertThat(value, instanceOf(typeof(OffsetTime)));
            assertThat(value, equalTo(time.AsObjectCopy()));
        }
예제 #4
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);
            }
예제 #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 RuntimeException
            public override void WriteTime(OffsetTime offsetTime)
            {
                Builder.Append(TimeValue.time(offsetTime).prettyPrint());
                Builder.Append('|');
            }
예제 #6
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() });
        }