提交 a34085c3 authored 作者: Noel Grandin's avatar Noel Grandin

remove related unused testMoveDatabaseToAnotherTimezone

上级 18602ef4
......@@ -42,7 +42,6 @@ public class TestDateStorage extends TestDb {
public void test() throws SQLException {
deleteDb(getTestName());
testDateTimeTimestampWithCalendar();
testMoveDatabaseToAnotherTimezone();
testAllTimeZones();
testCurrentTimeZone();
}
......@@ -150,91 +149,6 @@ public class TestDateStorage extends TestDb {
conn.close();
}
private void testMoveDatabaseToAnotherTimezone() throws SQLException {
if (config.memory) {
return;
}
if (config.mvStore) {
return;
}
/**
* Disabled this test for now, explanation from Evgenij Ryazanov:<br>
* This test is executed only in PageStore mode because there is no
* reason to test it with MVStore that stores date-time values in local
* time.<br>
* There is a hard-coded configuration option for PageStore,
* org.h2.store.Data::STORE_LOCAL_TIME. <br>
* This test completes normally if this constant is changed to true.
* Probably this test was designed for this mode. But with
* STORE_LOCAL_TIME = false this test is useless. On Java 10 only 57% of
* conversions tested by this test are successful, the remaining 43%
* have different offsets due to differences in DST transitions between
* timezones.
*/
if (!config.mvStore) {
return;
}
String db = getTestName() + ";LOG=0;FILE_LOCK=NO";
Connection conn = getConnection(db);
Statement stat;
stat = conn.createStatement();
stat.execute("create table date_list(tz varchar, t varchar, ts timestamp)");
conn.close();
TimeZone defaultTimeZone = TimeZone.getDefault();
ArrayList<TimeZone> distinct = TestDate.getDistinctTimeZones();
try {
for (TimeZone tz : distinct) {
// println("insert using " + tz.getID());
TimeZone.setDefault(tz);
DateTimeUtils.resetCalendar();
conn = getConnection(db);
PreparedStatement prep = conn.prepareStatement(
"insert into date_list values(?, ?, ?)");
prep.setString(1, tz.getID());
for (int m = 1; m < 10; m++) {
String s = "2000-0" + m + "-01 15:00:00";
prep.setString(2, s);
prep.setTimestamp(3, Timestamp.valueOf(s));
prep.execute();
}
conn.close();
}
// printTime("inserted");
for (TimeZone target : distinct) {
// println("select from " + target.getID());
if ("Pacific/Kiritimati".equals(target.getID())) {
// there is a problem with this time zone, but it seems
// unrelated to this database (possibly wrong timezone
// information?)
continue;
}
TimeZone.setDefault(target);
DateTimeUtils.resetCalendar();
conn = getConnection(db);
stat = conn.createStatement();
ResultSet rs = stat.executeQuery("select * from date_list order by t");
while (rs.next()) {
String source = rs.getString(1);
String a = rs.getString(2);
String b = rs.getString(3);
b = b.substring(0, a.length());
if (!a.equals(b)) {
assertEquals(source + ">" + target, a, b);
}
}
conn.close();
}
} finally {
TimeZone.setDefault(defaultTimeZone);
DateTimeUtils.resetCalendar();
}
// printTime("done");
conn = getConnection(db);
stat = conn.createStatement();
stat.execute("drop table date_list");
conn.close();
}
private static void testCurrentTimeZone() {
for (int year = 1890; year < 2050; year += 3) {
for (int month = 1; month <= 12; month++) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论