korlov42 commented on code in PR #5784: URL: https://github.com/apache/ignite-3/pull/5784#discussion_r2086715367
########## modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/ItJdbcClientTimeZoneTest.java: ########## @@ -176,25 +180,98 @@ public void dynamicParamRespectsTimeZone() throws SQLException { // Client time zone is "GMT". Review Comment: considering the very first lines of this method, "session" time zone refers to time zone of the connection, while "client" tz refers to time zone of the JVM. Let's change all comments accordingly, because after your changes they are no longer correct in certain places. ########## modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/ItJdbcClientTimeZoneTest.java: ########## @@ -176,25 +180,98 @@ public void dynamicParamRespectsTimeZone() throws SQLException { // Client time zone is "GMT". { assertEquals(timestamp("1970-01-01T00:00:00"), rs.getTimestamp(1)); - // Since client time zone is GMT, timestamp will contain original UTC value from store. + assertEquals(LocalTime.of(0, 0, 0), rs.getTime(1).toLocalTime()); + assertEquals(LocalDate.of(1970, 1, 1), rs.getDate(1).toLocalDate()); + assertEquals(timestamp("1969-12-31T23:00:00"), rs.getTimestamp(2)); + assertEquals(LocalTime.of(23, 0, 0), rs.getTime(2).toLocalTime()); + assertEquals(LocalDate.of(1969, 12, 31), rs.getDate(2).toLocalDate()); } + } + } + } + + TimeZone.setDefault(TimeZone.getTimeZone("GMT+1")); + + try (Connection conn = DriverManager.getConnection(URL)) { + try (Statement stmt = conn.createStatement()) { + try (ResultSet rs = stmt.executeQuery("SELECT ts, ts_tz FROM test where id=1")) { + assertTrue(rs.next()); // Session and client time zone are same ("GMT+1"). { - TimeZone.setDefault(TimeZone.getTimeZone("GMT+1")); + assertEquals(timestamp("1970-01-01T00:00:00"), rs.getTimestamp(1)); + assertEquals(LocalTime.of(0, 0, 0), rs.getTime(1).toLocalTime()); + assertEquals(LocalDate.of(1970, 1, 1), rs.getDate(1).toLocalDate()); + assertEquals(timestamp("1970-01-01T00:00:00"), rs.getTimestamp(2)); + assertEquals(LocalTime.of(0, 0, 0), rs.getTime(2).toLocalTime()); + assertEquals(LocalDate.of(1970, 1, 1), rs.getDate(2).toLocalDate()); + } + } + } + } + + TimeZone.setDefault(TimeZone.getTimeZone(origin)); + + try (Connection conn = DriverManager.getConnection(URL + "?connectionTimeZone=GMT+1")) { + try (Statement stmt = conn.createStatement()) { + try (ResultSet rs = stmt.executeQuery("SELECT ts, ts_tz FROM test where id=1")) { + assertTrue(rs.next()); + + // Session and client time zone are same ("GMT+1"). Review Comment: you've changed time zone of the JVM to "origin", which is differs from environment to environment. It's better to avoid tests whose results may be affected by environment -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org