Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2e98e3f4
提交
2e98e3f4
authored
12月 16, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More / fixed test cases.
上级
8e7003d9
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
59 行增加
和
11 行删除
+59
-11
TestMemoryUsage.java
h2/src/test/org/h2/test/db/TestMemoryUsage.java
+22
-5
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+1
-1
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+29
-0
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+5
-4
TestDiskFull.java
h2/src/test/org/h2/test/synth/TestDiskFull.java
+2
-1
没有找到文件。
h2/src/test/org/h2/test/db/TestMemoryUsage.java
浏览文件 @
2e98e3f4
...
...
@@ -42,12 +42,14 @@ public class TestMemoryUsage extends TestBase {
testCreateIndex
();
testClob
();
testReconnectOften
();
deleteDb
(
"memoryUsage"
);
reconnect
();
insertUpdateSelectDelete
();
reconnect
();
insertUpdateSelectDelete
();
conn
.
close
();
deleteDb
(
"memoryUsage"
);
}
...
...
@@ -68,21 +70,36 @@ public class TestMemoryUsage extends TestBase {
}
private
void
testCreateDropLoop
()
throws
SQLException
{
deleteDb
(
"memoryUsage"
);
conn
=
getConnection
(
"memoryUsage"
);
deleteDb
(
"memoryUsage
CreateDropLoop
"
);
conn
=
getConnection
(
"memoryUsage
CreateDropLoop
"
);
Statement
stat
=
conn
.
createStatement
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
stat
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
stat
.
execute
(
"DROP TABLE TEST"
);
}
stat
.
execute
(
"checkpoint"
);
int
used
=
Utils
.
getMemoryUsed
();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY)"
);
stat
.
execute
(
"DROP TABLE TEST"
);
}
stat
.
execute
(
"checkpoint"
);
int
usedNow
=
Utils
.
getMemoryUsed
();
if
(
usedNow
>
used
*
1.3
)
{
assertEquals
(
used
,
usedNow
);
// try to lower memory usage (because it might be wrong)
// by forcing OOME
for
(
int
i
=
1024
;;
i
*=
2
)
{
try
{
byte
[]
oome
=
new
byte
[
1024
*
1024
*
256
];
oome
[
0
]
=
(
byte
)
i
;
}
catch
(
OutOfMemoryError
e
)
{
break
;
}
}
usedNow
=
Utils
.
getMemoryUsed
();
if
(
usedNow
>
used
*
1.3
)
{
assertEquals
(
used
,
usedNow
);
}
}
conn
.
close
();
}
...
...
@@ -101,8 +118,8 @@ public class TestMemoryUsage extends TestBase {
if
(
config
.
memory
||
!
config
.
big
)
{
return
;
}
deleteDb
(
"memoryUsage"
);
conn
=
getConnection
(
"memoryUsage"
);
deleteDb
(
"memoryUsage
Clob
"
);
conn
=
getConnection
(
"memoryUsage
Clob
"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SET MAX_LENGTH_INPLACE_LOB 8192"
);
stat
.
execute
(
"SET CACHE_SIZE 8000"
);
...
...
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
2e98e3f4
...
...
@@ -80,7 +80,7 @@ public class TestOptimizations extends TestBase {
testConvertOrToIn
();
deleteDb
(
"optimizations"
);
}
private
void
testIdentityIndexUsage
()
throws
Exception
{
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
...
...
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
2e98e3f4
...
...
@@ -88,6 +88,7 @@ public class TestSpatial extends TestBase {
testInPlaceUpdate
();
testScanIndexOnNonSpatialQuery
();
testStoreCorruption
();
testExplainSpatialIndexWithPk
();
}
private
void
testHashCode
()
{
...
...
@@ -881,4 +882,32 @@ public class TestSpatial extends TestBase {
}
deleteDb
(
"spatial"
);
}
private
void
testExplainSpatialIndexWithPk
()
throws
SQLException
{
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"drop table if exists pt_cloud;"
);
stat
.
execute
(
"CREATE TABLE PT_CLOUD(id serial, the_geom geometry) AS"
+
" SELECT null, CONCAT('POINT(',A.X,' ',B.X,')')::geometry the_geom "
+
"from system_range(0,120) A,system_range(0,10) B;"
);
stat
.
execute
(
"create spatial index on pt_cloud(the_geom);"
);
ResultSet
rs
=
stat
.
executeQuery
(
"explain select * from PT_CLOUD "
+
"where the_geom && 'POINT(1 1)'"
);
try
{
assertTrue
(
rs
.
next
());
assertFalse
(
"H2 should use spatial index got this explain:\n"
+
rs
.
getString
(
1
),
rs
.
getString
(
1
).
contains
(
"tableScan"
));
}
finally
{
rs
.
close
();
}
}
finally
{
// Close the database
conn
.
close
();
}
deleteDb
(
"spatial"
);
}
}
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
2e98e3f4
...
...
@@ -431,7 +431,7 @@ public class TestMVStore extends TestBase {
header
.
put
(
"format"
,
"2"
);
MVMap
<
Integer
,
String
>
m
=
s
.
openMap
(
"data"
);
// this is to ensure the file header is overwritten
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
10
0
;
i
++)
{
m
.
put
(
0
,
"Hello World "
+
i
);
s
.
commit
();
if
(
i
>
5
)
{
...
...
@@ -445,7 +445,8 @@ public class TestMVStore extends TestBase {
encryptionKey
(
"007"
.
toCharArray
()).
fileName
(
fileName
).
open
();
fail
();
header
=
s
.
getStoreHeader
();
fail
(
header
.
toString
());
}
catch
(
IllegalStateException
e
)
{
assertEquals
(
DataUtils
.
ERROR_UNSUPPORTED_FORMAT
,
DataUtils
.
getErrorCode
(
e
.
getMessage
()));
...
...
@@ -480,12 +481,12 @@ public class TestMVStore extends TestBase {
autoCommitDisabled
().
open
();
MVMap
<
Integer
,
String
>
m
;
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
10
0
;
i
++)
{
m
=
s
.
openMap
(
"data"
+
i
);
m
.
put
(
0
,
"Hello World"
);
s
.
commit
();
}
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
for
(
int
i
=
0
;
i
<
10
0
;
i
+=
2
)
{
m
=
s
.
openMap
(
"data"
+
i
);
s
.
removeMap
(
m
);
s
.
commit
();
...
...
h2/src/test/org/h2/test/synth/TestDiskFull.java
浏览文件 @
2e98e3f4
...
...
@@ -93,7 +93,8 @@ public class TestDiskFull extends TestBase {
}
catch
(
SQLException
e2
)
{
if
(
e2
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_1
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_2
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
DATABASE_IS_CLOSED
)
{
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
DATABASE_IS_CLOSED
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
OBJECT_CLOSED
)
{
throw
e2
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论