Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a34085c3
提交
a34085c3
authored
6月 24, 2018
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove related unused testMoveDatabaseToAnotherTimezone
上级
18602ef4
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
0 行增加
和
86 行删除
+0
-86
TestDateStorage.java
h2/src/test/org/h2/test/db/TestDateStorage.java
+0
-86
没有找到文件。
h2/src/test/org/h2/test/db/TestDateStorage.java
浏览文件 @
a34085c3
...
...
@@ -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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论