//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void checkLogRecordTimeZone(ConsistencyCheckService service, String[] args, int hoursShift, String timeZoneSuffix) throws org.neo4j.consistency.ConsistencyCheckTool.ToolFailureException, java.io.IOException private static void CheckLogRecordTimeZone(ConsistencyCheckService service, string[] args, int hoursShift, string timeZoneSuffix) { TimeZone.Default = TimeZone.getTimeZone(ZoneOffset.ofHours(hoursShift)); MemoryStream outputStream = new MemoryStream(); PrintStream printStream = new PrintStream(outputStream); RunConsistencyCheckToolWith(service, printStream, args); string logLine = ReadLogLine(outputStream); assertTrue(logLine, logLine.Contains(timeZoneSuffix)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldGetNanosOfDayUTC() internal virtual void ShouldGetNanosOfDayUTC() { LocalTime localTime = LocalTime.of(14, 19, 18, 123999); ZoneOffset offset = ZoneOffset.ofHours(-12); OffsetTime time = OffsetTime.of(localTime, offset); long nanosOfDayUTC = TemporalUtil.GetNanosOfDayUTC(time); long expectedNanosOfDayUTC = Duration.ofSeconds(localTime.toSecondOfDay()).minus(offset.TotalSeconds, SECONDS).toNanos(); assertEquals(expectedNanosOfDayUTC + localTime.Nano, nanosOfDayUTC); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void checkStartLogLine(int hoursShift, String timeZoneSuffix) throws java.io.IOException private void CheckStartLogLine(int hoursShift, string timeZoneSuffix) { TimeZone.Default = TimeZone.getTimeZone(ZoneOffset.ofHours(hoursShift)); File storeDir = TestDirectory.storeDir(hoursShift.ToString()); File databaseDirectory = TestDirectory.databaseLayout(storeDir).databaseDirectory(); GraphDatabaseService database = (new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(databaseDirectory).setConfig(GraphDatabaseSettings.db_timezone, LogTimeZone.SYSTEM.name()).newGraphDatabase(); database.Shutdown(); Path databasePath = storeDir.toPath(); Path debugLog = Paths.get("logs", "debug.log"); string debugLogLine = GetLogLine(databasePath, debugLog); assertTrue(debugLogLine, debugLogLine.Contains(timeZoneSuffix)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void checkLogTimeZone(int hoursShift, String timeZoneSuffix) throws Exception private void CheckLogTimeZone(int hoursShift, string timeZoneSuffix) { TimeZone.Default = TimeZone.getTimeZone(ZoneOffset.ofHours(hoursShift)); Config timeZoneConfig = Config.defaults(GraphDatabaseSettings.db_timezone, LogTimeZone.SYSTEM.name()); SecurityLog securityLog = new SecurityLog(timeZoneConfig, FileSystemRule.get(), ThreadStart.run); securityLog.Info("line 1"); FileSystemAbstraction fs = FileSystemRule.get(); File activeLogFile = timeZoneConfig.Get(SecuritySettings.security_log_filename); string[] activeLines = ReadLogFile(fs, activeLogFile); assertThat(activeLines, array(containsString(timeZoneSuffix))); FileSystemRule.clear(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void logQueriesWithSystemTimeZoneIsConfigured() public virtual void LogQueriesWithSystemTimeZoneIsConfigured() { TimeZone defaultTimeZone = TimeZone.Default; try { TimeZone.Default = TimeZone.getTimeZone(ZoneOffset.ofHours(5)); ExecuteSingleQueryWithTimeZoneLog(); TimeZone.Default = TimeZone.getTimeZone(ZoneOffset.ofHours(-5)); ExecuteSingleQueryWithTimeZoneLog(); IList <string> allQueries = ReadAllLinesSilent(_logFilename); assertTrue(allQueries[0].Contains("+0500")); assertTrue(allQueries[1].Contains("-0500")); } finally { TimeZone.Default = defaultTimeZone; } }
// ====================================================== // 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); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSendAndReceiveTime() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSendAndReceiveTime() { TestSendingAndReceivingOfBoltV2Value(time(19, 22, 44, 100, ZoneOffset.ofHours(-5))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReceiveTime() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReceiveTime() { TestReceivingOfBoltV2Value("RETURN time('14:30+0100')", time(14, 30, 0, 0, ZoneOffset.ofHours(1))); }
private static Stream <AnyValue> Parameters() { NodeValue node1 = nodeValue(1, stringArray(), emptyMap()); NodeValue node2 = nodeValue(2, stringArray(), emptyMap()); NodeValue node3 = nodeValue(3, stringArray(), emptyMap()); RelationshipValue relationship1 = relationshipValue(100, node1, node2, stringValue("ONE"), emptyMap()); RelationshipValue relationship2 = relationshipValue(200, node2, node2, stringValue("TWO"), emptyMap()); return(Stream.of(node1, relationship1, path(new NodeValue[] { node1, node2, node3 }, new RelationshipValue[] { relationship1, relationship2 }), map(new string[] { "alpha", "beta" }, new AnyValue[] { stringValue("one"), numberValue(2) }), NO_VALUE, list(numberValue(1), stringValue("fine"), node2), stringValue("hello world"), stringArray("hello", "brave", "new", "world"), booleanValue(false), booleanArray(new bool[] { true, false, true }), charValue('\n'), charArray(new char[] { 'h', 'e', 'l', 'l', 'o' }), byteValue(( sbyte )3), byteArray(new sbyte[] { 0x00, unchecked (( sbyte )0x99), unchecked (( sbyte )0xcc) }), shortValue(( short )42), shortArray(new short[] { 1337, unchecked (( short )0xcafe), unchecked (( short )0xbabe) }), intValue(987654321), intArray(new int[] { 42, 11 }), longValue(9876543210L), longArray(new long[] { 0xcafebabe, 0x1ee7 }), floatValue(float.MaxValue), floatArray(new float[] { float.NegativeInfinity, float.Epsilon }), doubleValue(Double.MIN_NORMAL), doubleArray(new double[] { double.PositiveInfinity, double.MaxValue }), datetime(2018, 1, 16, 10, 36, 43, 123456788, ZoneId.of("Europe/Stockholm")), localDateTime(2018, 1, 16, 10, 36, 43, 123456788), date(2018, 1, 16), time(10, 36, 43, 123456788, ZoneOffset.ofHours(1)), localTime(10, 36, 43, 123456788), duration(399, 4, 48424, 133701337), pointValue(Cartesian, 11, 32), pointArray(new Point[] { pointValue(Cartesian, 11, 32), pointValue(WGS84, 13, 56) }))); }