Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldCompareDerivedValue()
        internal virtual void ShouldCompareDerivedValue()
        {
            TimeValue value1 = time(4242, ZoneOffset.of("-12:00"));
            TimeValue value2 = time(value1.Temporal());

            assertEquals(0, value1.UnsafeCompareTo(value2));
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldWriteDerivedValueThatIsEqual()
        internal virtual void ShouldWriteDerivedValueThatIsEqual()
        {
            TimeValue value1 = time(42, ZoneOffset.of("-18:00"));
            TimeValue value2 = time(value1.Temporal());

            OffsetTime offsetTime1 = Write(value1);
            OffsetTime offsetTime2 = Write(value2);

            assertEquals(offsetTime1, offsetTime2);
        }
Esempio n. 3
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[] { TimeValue.time(9999, ZoneOffset.of("+18:00")), TimeValue.time(10000, ZoneOffset.of("-18:00")), TimeValue.time(10000, ZoneOffset.of("-00:00")), TimeValue.time(10000, ZoneOffset.of("+01:00")), TimeValue.time(10000, ZoneOffset.of("+03:00")), TimeValue.time(10000, ZoneOffset.of("-18:00")) };

            ZonedTimeIndexKey keyI = new ZonedTimeIndexKey();
            ZonedTimeIndexKey keyJ = new ZonedTimeIndexKey();

            foreach (Value vi in values)
            {
                foreach (Value vj in values)
                {
                    vi.WriteTo(keyI);
                    vj.WriteTo(keyJ);

                    int expected = Values.COMPARATOR.Compare(vi, vj);
                    assertEquals(format("comparing %s and %s", vi, vj), expected, keyI.CompareValueTo(keyJ));
                }
            }
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotEqualSameInstantButDifferentTimezone()
        public virtual void ShouldNotEqualSameInstantButDifferentTimezone()
        {
            assertNotEqual(datetime(10000, 100, UTC), datetime(10000, 100, ZoneOffset.of("+01:00")));
        }
Esempio n. 5
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);
            }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldNotEqualSameInstantButDifferentTimezone()
        internal virtual void ShouldNotEqualSameInstantButDifferentTimezone()
        {
            assertNotEqual(time(10000, UTC), time(10000, ZoneOffset.of("+01:00")));
        }
Esempio n. 7
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)));
                }
            }
        }
Esempio n. 8
0
 internal static OffsetTime DefaultTime(ZoneId zoneId)
 {
     return(OffsetTime.of(TemporalFields.Hour.defaultValue, TemporalFields.Minute.defaultValue, TemporalFields.Second.defaultValue, TemporalFields.Nanosecond.defaultValue, AssertValidZone(() => ZoneOffset.of(zoneId.ToString()))));
 }
Esempio n. 9
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);
        }
Esempio n. 10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSendTime() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSendTime()
        {
            TestSendingOfBoltV2Value(time(424242, ZoneOffset.of("+08:30")));
        }
Esempio n. 11
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());
            }
        }