Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4ca5c7bd
提交
4ca5c7bd
authored
1月 04, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More tests
上级
a3086043
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
48 行增加
和
39 行删除
+48
-39
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+48
-39
没有找到文件。
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
4ca5c7bd
...
...
@@ -34,6 +34,8 @@ import org.h2.value.ValueGeometry;
*/
public
class
TestSpatial
extends
TestBase
{
String
url
=
"spatial"
;
/**
* Run just this test.
*
...
...
@@ -50,6 +52,15 @@ public class TestSpatial extends TestBase {
}
if
(
DataType
.
GEOMETRY_CLASS
!=
null
)
{
deleteDb
(
"spatial"
);
url
=
"spatial"
;
testSpatial
();
url
=
"spatial;MV_STORE=false"
;
testSpatial
();
deleteDb
(
"spatial"
);
}
}
private
void
testSpatial
()
throws
SQLException
{
testSpatialValues
();
testOverlap
();
testNotOverlap
();
...
...
@@ -65,8 +76,6 @@ public class TestSpatial extends TestBase {
testEquals
();
testTableFunctionGeometry
();
testHashCode
();
deleteDb
(
"spatial"
);
}
}
private
void
testHashCode
()
{
...
...
@@ -82,7 +91,7 @@ public class TestSpatial extends TestBase {
private
void
testSpatialValues
()
throws
SQLException
{
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create memory table test(id int primary key, polygon geometry)"
);
...
...
@@ -142,7 +151,7 @@ public class TestSpatial extends TestBase {
private
void
testOverlap
()
throws
SQLException
{
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create memory table test(id int primary key, poly geometry)"
);
...
...
@@ -162,8 +171,8 @@ public class TestSpatial extends TestBase {
}
}
private
void
testPersistentSpatialIndex
()
throws
SQLException
{
deleteDb
(
"spatial
Persistent
"
);
Connection
conn
=
getConnection
(
"spatialPersistent"
);
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key, poly geometry)"
);
...
...
@@ -198,7 +207,7 @@ public class TestSpatial extends TestBase {
return
;
}
conn
=
getConnection
(
"spatialPersistent"
);
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
...
...
@@ -215,7 +224,7 @@ public class TestSpatial extends TestBase {
}
private
void
testNotOverlap
()
throws
SQLException
{
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create memory table test(id int primary key, poly geometry)"
);
...
...
@@ -272,7 +281,7 @@ public class TestSpatial extends TestBase {
private
void
testSpatialIndexQueryMultipleTable
()
throws
SQLException
{
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
createTestTable
(
stat
);
...
...
@@ -312,8 +321,8 @@ public class TestSpatial extends TestBase {
}
private
void
testIndexTransaction
()
throws
SQLException
{
// Check session management in index
deleteDb
(
"spatial
Index
"
);
Connection
conn
=
getConnection
(
"spatialIndex"
);
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
conn
.
setAutoCommit
(
false
);
try
{
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -360,8 +369,8 @@ public class TestSpatial extends TestBase {
* Test the in the in-memory spatial index
*/
private
void
testMemorySpatialIndex
()
throws
SQLException
{
deleteDb
(
"spatial
Index
"
);
Connection
conn
=
getConnection
(
"spatialIndex"
);
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create memory table test(id int primary key, polygon geometry)"
);
...
...
@@ -409,15 +418,15 @@ public class TestSpatial extends TestBase {
stat
.
execute
(
"drop table test"
);
conn
.
close
();
deleteDb
(
"spatial
Index
"
);
deleteDb
(
"spatial"
);
}
/**
* Test java alias with Geometry type.
*/
private
void
testJavaAlias
()
throws
SQLException
{
deleteDb
(
"spatial
Index
"
);
Connection
conn
=
getConnection
(
"spatialIndex"
);
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE ALIAS T_GEOM_FROM_TEXT FOR \""
+
TestSpatial
.
class
.
getName
()
+
".geomFromText\""
);
...
...
@@ -431,15 +440,15 @@ public class TestSpatial extends TestBase {
}
finally
{
conn
.
close
();
}
deleteDb
(
"spatial
Index
"
);
deleteDb
(
"spatial"
);
}
/**
* Test java alias with Geometry type.
*/
private
void
testJavaAliasTableFunction
()
throws
SQLException
{
deleteDb
(
"spatial
Index
"
);
Connection
conn
=
getConnection
(
"spatialIndex"
);
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE ALIAS T_RANDOM_GEOM_TABLE FOR \""
+
...
...
@@ -454,7 +463,7 @@ public class TestSpatial extends TestBase {
}
finally
{
conn
.
close
();
}
deleteDb
(
"spatial
Index
"
);
deleteDb
(
"spatial"
);
}
/**
...
...
@@ -547,8 +556,8 @@ public class TestSpatial extends TestBase {
* Test conversion of Geometry object into Object
*/
private
void
testValueConversion
()
throws
SQLException
{
deleteDb
(
"spatial
Index
"
);
Connection
conn
=
getConnection
(
"spatialIndex"
);
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE ALIAS OBJ_STRING FOR \""
+
TestSpatial
.
class
.
getName
()
+
".getObjectString\""
);
...
...
@@ -556,7 +565,7 @@ public class TestSpatial extends TestBase {
assertTrue
(
rs
.
next
());
assertEquals
(
"POINT (15 25)"
,
rs
.
getString
(
1
));
conn
.
close
();
deleteDb
(
"spatial
Index
"
);
deleteDb
(
"spatial"
);
}
/**
...
...
@@ -599,8 +608,8 @@ public class TestSpatial extends TestBase {
* Check that geometry column type is kept with a table function
*/
private
void
testTableFunctionGeometry
()
throws
SQLException
{
deleteDb
(
"spatial
Index
"
);
Connection
conn
=
getConnection
(
"spatialIndex"
);
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE ALIAS POINT_TABLE FOR \""
+
...
...
@@ -614,7 +623,7 @@ public class TestSpatial extends TestBase {
}
finally
{
conn
.
close
();
}
deleteDb
(
"spatial
Index
"
);
deleteDb
(
"spatial"
);
}
public
static
ResultSet
pointTable
(
double
x
,
double
y
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论