//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void failToCreateDateOnOldDatabase() internal virtual void FailToCreateDateOnOldDatabase() { File storeDir = _testDirectory.storeDir(); GraphDatabaseService nonUpgradedStore = startNonUpgradableDatabaseWithFormat(storeDir, StandardV3_2.NAME); TransactionFailureException failureException = assertThrows(typeof(TransactionFailureException), () => { using (Transaction transaction = nonUpgradedStore.BeginTx()) { Node node = nonUpgradedStore.CreateNode(); node.setProperty("a", DateValue.date(1991, 5, 3).asObjectCopy()); transaction.success(); } }); assertEquals("Current record format does not support TEMPORAL_PROPERTIES. Please upgrade your store to the format that support requested capability.", Exceptions.rootCause(failureException).Message); nonUpgradedStore.Shutdown(); GraphDatabaseService restartedOldFormatDatabase = startNonUpgradableDatabaseWithFormat(storeDir, StandardV3_2.NAME); using (Transaction transaction = restartedOldFormatDatabase.BeginTx()) { Node node = restartedOldFormatDatabase.CreateNode(); node.SetProperty("c", "d"); transaction.success(); } restartedOldFormatDatabase.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void createDateArrayOnLatestDatabase() internal virtual void CreateDateArrayOnLatestDatabase() { File storeDir = _testDirectory.storeDir(); Label label = Label.label("DateNode"); string propertyKey = "a"; LocalDate date = DateValue.date(1991, 5, 3).asObjectCopy(); GraphDatabaseService database = startDatabaseWithFormat(storeDir, Standard.LATEST_NAME); using (Transaction transaction = database.BeginTx()) { Node node = database.CreateNode(label); node.SetProperty(propertyKey, new LocalDate[] { date, date }); transaction.Success(); } database.Shutdown(); GraphDatabaseService restartedDatabase = startDatabaseWithFormat(storeDir, Standard.LATEST_NAME); using (Transaction ignored = restartedDatabase.BeginTx()) { using (ResourceIterator <Node> nodes = restartedDatabase.FindNodes(label)) { //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: Node node = nodes.next(); LocalDate[] points = ( LocalDate[] )node.GetProperty(propertyKey); assertThat(points, arrayWithSize(2)); } } restartedDatabase.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void createDatePropertyOnLatestDatabase() internal virtual void CreateDatePropertyOnLatestDatabase() { File storeDir = _testDirectory.storeDir(); Label label = Label.label("DateNode"); string propertyKey = "a"; LocalDate date = DateValue.date(1991, 5, 3).asObjectCopy(); GraphDatabaseService database = startDatabaseWithFormat(storeDir, Standard.LATEST_NAME); using (Transaction transaction = database.BeginTx()) { Node node = database.CreateNode(label); node.SetProperty(propertyKey, date); transaction.Success(); } database.Shutdown(); GraphDatabaseService restartedDatabase = startDatabaseWithFormat(storeDir, Standard.LATEST_NAME); using (Transaction ignored = restartedDatabase.BeginTx()) { assertNotNull(restartedDatabase.FindNode(label, propertyKey, date)); } restartedDatabase.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDateTypeSmallEpochDay() public virtual void TestDateTypeSmallEpochDay() { LocalDate date = DateValue.date(2018, 1, 31).asObjectCopy(); string key = "dt"; _node1.setProperty(key, date); NewTransaction(); object property = _node1.getProperty(key); assertEquals(date, property); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleDate() public virtual void ShouldHandleDate() { // Given DateValue dvalue = DateValue.date(1, 2, 3); // When dvalue.WriteTo(_converter); // Then object value = _converter.value(); assertThat(value, instanceOf(typeof(LocalDate))); assertThat(value, equalTo(dvalue.AsObjectCopy())); }
//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() }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void failToOpenStoreWithDatePropertyUsingOldFormat() internal virtual void FailToOpenStoreWithDatePropertyUsingOldFormat() { File storeDir = _testDirectory.storeDir(); GraphDatabaseService database = startDatabaseWithFormat(storeDir, StandardV3_4.NAME); using (Transaction transaction = database.BeginTx()) { Node node = database.CreateNode(); node.SetProperty("a", DateValue.date(1991, 5, 3)); transaction.Success(); } database.Shutdown(); Exception throwable = assertThrows(typeof(Exception), () => startDatabaseWithFormat(storeDir, StandardV3_2.NAME)); assertSame(typeof(StoreUpgrader.AttemptedDowngradeException), Exceptions.rootCause(throwable).GetType()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDateArray() public virtual void TestDateArray() { LocalDate[] array = new LocalDate[] { DateValue.date(2018, 1, 31).asObjectCopy(), DateValue.epochDate(2147483648L).asObjectCopy() }; string key = "testarray"; _node1.setProperty(key, array); NewTransaction(); LocalDate[] propertyValue = ( LocalDate[] )_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)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void writeDate(java.time.LocalDate localDate) throws RuntimeException public override void WriteDate(LocalDate localDate) { Builder.Append(DateValue.date(localDate).prettyPrint()); Builder.Append('|'); }