Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4ddb2248
提交
4ddb2248
authored
5月 21, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Require Java 1.5 compiler
上级
c1394475
显示空白字符变更
内嵌
并排
正在显示
34 个修改的文件
包含
77 行增加
和
89 行删除
+77
-89
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+1
-1
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+3
-3
BenchA.java
h2/src/test/org/h2/test/bench/BenchA.java
+2
-2
BenchB.java
h2/src/test/org/h2/test/bench/BenchB.java
+6
-6
BenchC.java
h2/src/test/org/h2/test/bench/BenchC.java
+4
-4
BenchCThread.java
h2/src/test/org/h2/test/bench/BenchCThread.java
+3
-4
Database.java
h2/src/test/org/h2/test/bench/Database.java
+7
-9
TestPerformance.java
h2/src/test/org/h2/test/bench/TestPerformance.java
+10
-13
Coverage.java
h2/src/test/org/h2/test/coverage/Coverage.java
+1
-1
Db.java
h2/src/test/org/h2/test/db/Db.java
+8
-7
TaskProcess.java
h2/src/test/org/h2/test/db/TaskProcess.java
+1
-1
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+1
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+3
-3
TestLogFile.java
h2/src/test/org/h2/test/db/TestLogFile.java
+1
-1
TestRights.java
h2/src/test/org/h2/test/db/TestRights.java
+1
-1
TestScript.java
h2/src/test/org/h2/test/db/TestScript.java
+1
-1
TestBatchUpdates.java
h2/src/test/org/h2/test/jdbc/TestBatchUpdates.java
+2
-2
TestNativeSQL.java
h2/src/test/org/h2/test/jdbc/TestNativeSQL.java
+2
-2
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+1
-1
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+2
-2
TestConnectionPool.java
h2/src/test/org/h2/test/jdbcx/TestConnectionPool.java
+1
-1
TestAutoReconnect.java
h2/src/test/org/h2/test/server/TestAutoReconnect.java
+1
-1
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+1
-1
TestFuzzOptimizations.java
h2/src/test/org/h2/test/synth/TestFuzzOptimizations.java
+2
-4
TestHalt.java
h2/src/test/org/h2/test/synth/TestHalt.java
+1
-1
TestJoin.java
h2/src/test/org/h2/test/synth/TestJoin.java
+2
-2
TestKillProcess.java
h2/src/test/org/h2/test/synth/TestKillProcess.java
+1
-3
TestKillRestart.java
h2/src/test/org/h2/test/synth/TestKillRestart.java
+1
-3
TestKillRestartMulti.java
h2/src/test/org/h2/test/synth/TestKillRestartMulti.java
+2
-2
TestMultiNews.java
h2/src/test/org/h2/test/synth/thread/TestMultiNews.java
+1
-1
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+1
-1
TestMathUtils.java
h2/src/test/org/h2/test/unit/TestMathUtils.java
+1
-2
TestOverflow.java
h2/src/test/org/h2/test/unit/TestOverflow.java
+1
-1
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+1
-1
没有找到文件。
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
4ddb2248
...
...
@@ -596,7 +596,7 @@ kill -9 `jps -l | grep "org.h2.test.TestAll" | cut -d " " -f 1`
private
void
runTest
(
String
className
)
{
try
{
Class
clazz
=
Class
.
forName
(
className
);
Class
<
?
>
clazz
=
Class
.
forName
(
className
);
TestBase
test
=
(
TestBase
)
clazz
.
newInstance
();
test
.
runTest
(
this
);
}
catch
(
Exception
e
)
{
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
4ddb2248
...
...
@@ -1009,8 +1009,8 @@ public abstract class TestBase {
protected
void
assertEqualDatabases
(
Statement
stat1
,
Statement
stat2
)
throws
SQLException
{
ResultSet
rs1
=
stat1
.
executeQuery
(
"SCRIPT NOPASSWORDS"
);
ResultSet
rs2
=
stat2
.
executeQuery
(
"SCRIPT NOPASSWORDS"
);
ArrayList
list1
=
new
ArrayList
();
ArrayList
list2
=
new
ArrayList
();
ArrayList
<
String
>
list1
=
new
ArrayList
<
String
>
();
ArrayList
<
String
>
list2
=
new
ArrayList
<
String
>
();
while
(
rs1
.
next
())
{
String
s1
=
rs1
.
getString
(
1
);
list1
.
add
(
s1
);
...
...
@@ -1021,7 +1021,7 @@ public abstract class TestBase {
list2
.
add
(
s2
);
}
for
(
int
i
=
0
;
i
<
list1
.
size
();
i
++)
{
String
s
=
(
String
)
list1
.
get
(
i
);
String
s
=
list1
.
get
(
i
);
if
(!
list2
.
remove
(
s
))
{
fail
(
"only found in first: "
+
s
);
}
...
...
h2/src/test/org/h2/test/bench/BenchA.java
浏览文件 @
4ddb2248
...
...
@@ -52,8 +52,8 @@ public class BenchA implements Bench {
"CREATE TABLE ACCOUNTS(AID INT NOT NULL PRIMARY KEY, BID INT, ABALANCE DECIMAL(15,2), FILLER VARCHAR(84))"
,
"CREATE TABLE HISTORY(TID INT, BID INT, AID INT, DELTA DECIMAL(15,2), HTIME DATETIME, FILLER VARCHAR(40))"
};
for
(
int
i
=
0
;
i
<
create
.
length
;
i
++
)
{
db
.
update
(
create
[
i
]
);
for
(
String
sql
:
create
)
{
db
.
update
(
sql
);
}
PreparedStatement
prep
;
...
...
h2/src/test/org/h2/test/bench/BenchB.java
浏览文件 @
4ddb2248
...
...
@@ -75,8 +75,8 @@ public class BenchB implements Bench, Runnable {
"CREATE TABLE TELLERS(TID INT NOT NULL PRIMARY KEY, BID INT, TBALANCE INT, FILLER VARCHAR(84))"
,
"CREATE TABLE ACCOUNTS(AID INT NOT NULL PRIMARY KEY, BID INT, ABALANCE INT, FILLER VARCHAR(84))"
,
"CREATE TABLE HISTORY(TID INT, BID INT, AID INT, DELTA INT, TIME DATETIME, FILLER VARCHAR(22))"
};
for
(
int
i
=
0
;
i
<
create
.
length
;
i
++
)
{
db
.
update
(
create
[
i
]
);
for
(
String
sql
:
create
)
{
db
.
update
(
sql
);
}
PreparedStatement
prep
;
db
.
setAutoCommit
(
false
);
...
...
@@ -197,11 +197,11 @@ public class BenchB implements Bench, Runnable {
for
(
int
i
=
0
;
i
<
clients
;
i
++)
{
threads
[
i
]
=
new
Thread
(
new
BenchB
(
this
,
i
));
}
for
(
int
i
=
0
;
i
<
clients
;
i
++
)
{
t
hreads
[
i
]
.
start
();
for
(
Thread
t
:
threads
)
{
t
.
start
();
}
for
(
int
i
=
0
;
i
<
clients
;
i
++
)
{
t
hreads
[
i
]
.
join
();
for
(
Thread
t
:
threads
)
{
t
.
join
();
}
}
...
...
h2/src/test/org/h2/test/bench/BenchC.java
浏览文件 @
4ddb2248
...
...
@@ -129,11 +129,11 @@ public class BenchC implements Bench {
}
private
void
load
()
throws
SQLException
{
for
(
int
i
=
0
;
i
<
TABLES
.
length
;
i
++
)
{
db
.
dropTable
(
TABLES
[
i
]
);
for
(
String
sql
:
TABLES
)
{
db
.
dropTable
(
sql
);
}
for
(
int
i
=
0
;
i
<
CREATE_SQL
.
length
;
i
++
)
{
db
.
update
(
CREATE_SQL
[
i
]
);
for
(
String
sql
:
CREATE_SQL
)
{
db
.
update
(
sql
);
}
db
.
setAutoCommit
(
false
);
loadItem
();
...
...
h2/src/test/org/h2/test/bench/BenchCThread.java
浏览文件 @
4ddb2248
...
...
@@ -26,7 +26,7 @@ public class BenchCThread {
private
Database
db
;
private
int
warehouseId
;
private
int
terminalId
;
private
HashMap
prepared
=
new
HashMap
();
private
HashMap
<
String
,
PreparedStatement
>
prepared
=
new
HashMap
<
String
,
PreparedStatement
>
();
private
BenchCRandom
random
;
private
BenchC
bench
;
...
...
@@ -57,8 +57,7 @@ public class BenchCThread {
deck
[
i
]
=
deck
[
j
];
deck
[
j
]
=
temp
;
}
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
int
op
=
deck
[
i
];
for
(
int
op
:
deck
)
{
switch
(
op
)
{
case
OP_NEW_ORDER:
processNewOrder
();
...
...
@@ -726,7 +725,7 @@ public class BenchCThread {
}
private
PreparedStatement
prepare
(
String
sql
)
throws
SQLException
{
PreparedStatement
prep
=
(
PreparedStatement
)
prepared
.
get
(
sql
);
PreparedStatement
prep
=
prepared
.
get
(
sql
);
if
(
prep
==
null
)
{
prep
=
db
.
prepare
(
sql
);
prepared
.
put
(
sql
,
prep
);
...
...
h2/src/test/org/h2/test/bench/Database.java
浏览文件 @
4ddb2248
...
...
@@ -16,7 +16,6 @@ import java.sql.ResultSetMetaData;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.Properties
;
import
java.util.Random
;
import
java.util.StringTokenizer
;
...
...
@@ -34,7 +33,7 @@ class Database {
private
TestPerformance
test
;
private
int
id
;
private
String
name
,
url
,
user
,
password
;
private
ArrayList
replace
=
new
ArrayList
();
private
ArrayList
<
String
[]>
replace
=
new
ArrayList
<
String
[]>
();
private
String
action
;
private
long
startTime
;
private
Connection
conn
;
...
...
@@ -42,7 +41,7 @@ class Database {
private
boolean
trace
=
true
;
private
long
lastTrace
;
private
Random
random
=
new
Random
(
1
);
private
ArrayList
results
=
new
ArrayList
();
private
ArrayList
<
Object
[]>
results
=
new
ArrayList
<
Object
[]>
();
private
int
totalTime
;
private
int
executedStatements
;
...
...
@@ -73,7 +72,7 @@ class Database {
*
* @return the result array
*/
ArrayList
getResults
()
{
ArrayList
<
Object
[]>
getResults
()
{
return
results
;
}
...
...
@@ -102,7 +101,7 @@ class Database {
Thread
.
sleep
(
100
);
}
else
if
(
url
.
startsWith
(
"jdbc:hsqldb:hsql:"
))
{
if
(!
serverHSQLDB
)
{
Class
c
=
Class
.
forName
(
"org.hsqldb.Server"
);
Class
<
?
>
c
=
Class
.
forName
(
"org.hsqldb.Server"
);
Method
m
=
c
.
getMethod
(
"main"
,
new
Class
[]
{
String
[].
class
});
m
.
invoke
(
null
,
new
Object
[]
{
new
String
[]
{
"-database.0"
,
"data/mydb;hsqldb.default_table_type=cached"
,
"-dbname.0"
,
"xdb"
}
});
...
...
@@ -239,8 +238,8 @@ class Database {
void
setTranslations
(
Properties
prop
)
{
String
id
=
url
.
substring
(
"jdbc:"
.
length
());
id
=
id
.
substring
(
0
,
id
.
indexOf
(
':'
));
for
(
Iterator
it
=
prop
.
keySet
().
iterator
();
it
.
hasNext
();
)
{
String
key
=
(
String
)
it
.
next
()
;
for
(
Object
k
:
prop
.
keySet
()
)
{
String
key
=
(
String
)
k
;
if
(
key
.
startsWith
(
id
+
"."
))
{
String
pattern
=
key
.
substring
(
id
.
length
()
+
1
);
pattern
=
StringUtils
.
replaceAll
(
pattern
,
"_"
,
" "
);
...
...
@@ -263,8 +262,7 @@ class Database {
}
private
String
getSQL
(
String
sql
)
{
for
(
int
i
=
0
;
i
<
replace
.
size
();
i
++)
{
String
[]
pair
=
(
String
[])
replace
.
get
(
i
);
for
(
String
[]
pair
:
replace
)
{
String
pattern
=
pair
[
0
];
String
replace
=
pair
[
1
];
sql
=
StringUtils
.
replaceAll
(
sql
,
pattern
,
replace
);
...
...
h2/src/test/org/h2/test/bench/TestPerformance.java
浏览文件 @
4ddb2248
...
...
@@ -94,7 +94,7 @@ public class TestPerformance {
prop
.
load
(
in
);
in
.
close
();
int
size
=
Integer
.
parseInt
(
prop
.
getProperty
(
"size"
));
ArrayList
dbs
=
new
ArrayList
();
ArrayList
<
Database
>
dbs
=
new
ArrayList
<
Database
>
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
if
(
dbId
!=
-
1
&&
i
!=
dbId
)
{
continue
;
...
...
@@ -108,7 +108,7 @@ public class TestPerformance {
}
}
}
ArrayList
tests
=
new
ArrayList
();
ArrayList
<
Bench
>
tests
=
new
ArrayList
<
Bench
>
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
String
testString
=
prop
.
getProperty
(
"test"
+
i
);
if
(
testString
!=
null
)
{
...
...
@@ -121,7 +121,7 @@ public class TestPerformance {
if
(
dbs
.
size
()
==
0
)
{
return
;
}
ArrayList
results
=
((
Database
)
dbs
.
get
(
0
)
).
getResults
();
ArrayList
<
Object
[]>
results
=
dbs
.
get
(
0
).
getResults
();
Connection
conn
=
null
;
PreparedStatement
prep
=
null
;
Statement
stat
=
null
;
...
...
@@ -133,16 +133,14 @@ public class TestPerformance {
prep
=
conn
.
prepareStatement
(
"INSERT INTO RESULTS(TESTID, TEST, UNIT, DBID, DB, RESULT) VALUES(?, ?, ?, ?, ?, ?)"
);
for
(
int
i
=
0
;
i
<
results
.
size
();
i
++)
{
Object
[]
res
=
(
Object
[])
results
.
get
(
i
);
Object
[]
res
=
results
.
get
(
i
);
prep
.
setInt
(
1
,
i
);
prep
.
setString
(
2
,
res
[
0
].
toString
());
prep
.
setString
(
3
,
res
[
1
].
toString
());
for
(
int
j
=
0
;
j
<
dbs
.
size
();
j
++)
{
Database
db
=
(
Database
)
dbs
.
get
(
j
);
for
(
Database
db
:
dbs
)
{
prep
.
setInt
(
4
,
db
.
getId
());
prep
.
setString
(
5
,
db
.
getName
());
ArrayList
r
=
db
.
getResults
();
Object
[]
v
=
(
Object
[])
r
.
get
(
i
);
Object
[]
v
=
db
.
getResults
().
get
(
i
);
prep
.
setString
(
6
,
v
[
2
].
toString
());
prep
.
execute
();
}
...
...
@@ -215,14 +213,14 @@ public class TestPerformance {
}
}
private
void
testAll
(
ArrayList
dbs
,
ArrayList
tests
,
int
size
)
throws
Exception
{
private
void
testAll
(
ArrayList
<
Database
>
dbs
,
ArrayList
<
Bench
>
tests
,
int
size
)
throws
Exception
{
for
(
int
i
=
0
;
i
<
dbs
.
size
();
i
++)
{
if
(
i
>
0
)
{
Thread
.
sleep
(
1000
);
}
// calls garbage collection
TestBase
.
getMemoryUsed
();
Database
db
=
(
Database
)
dbs
.
get
(
i
);
Database
db
=
dbs
.
get
(
i
);
System
.
out
.
println
(
"Testing the performance of "
+
db
.
getName
());
db
.
startServer
();
Connection
conn
=
db
.
openNewConnection
();
...
...
@@ -243,9 +241,8 @@ public class TestPerformance {
}
}
private
void
runDatabase
(
Database
db
,
ArrayList
tests
,
int
size
)
throws
Exception
{
for
(
int
j
=
0
;
j
<
tests
.
size
();
j
++)
{
Bench
bench
=
(
Bench
)
tests
.
get
(
j
);
private
void
runDatabase
(
Database
db
,
ArrayList
<
Bench
>
tests
,
int
size
)
throws
Exception
{
for
(
Bench
bench
:
tests
)
{
runTest
(
db
,
bench
,
size
);
}
}
...
...
h2/src/test/org/h2/test/coverage/Coverage.java
浏览文件 @
4ddb2248
...
...
@@ -479,7 +479,7 @@ public class Coverage {
}
}
private
void
setLine
()
throws
IOException
{
private
void
setLine
()
{
add
+=
"Profile.visit("
+
index
+
");"
;
line
=
tokenizer
.
getLine
();
}
...
...
h2/src/test/org/h2/test/db/Db.java
浏览文件 @
4ddb2248
...
...
@@ -17,6 +17,7 @@ import java.sql.Statement;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.h2.util.JdbcDriverUtils
;
...
...
@@ -33,7 +34,7 @@ public class Db {
private
Connection
conn
;
private
Statement
stat
;
private
HashMap
prepared
=
new
HashMap
();
private
HashMap
<
String
,
PreparedStatement
>
prepared
=
new
HashMap
<
String
,
PreparedStatement
>
();
/**
* Create a database object using the given connection.
...
...
@@ -75,7 +76,7 @@ public class Db {
*/
public
Prepared
prepare
(
String
sql
)
{
try
{
PreparedStatement
prep
=
(
PreparedStatement
)
prepared
.
get
(
sql
);
PreparedStatement
prep
=
prepared
.
get
(
sql
);
if
(
prep
==
null
)
{
prep
=
conn
.
prepareStatement
(
sql
);
prepared
.
put
(
sql
,
prep
);
...
...
@@ -105,12 +106,12 @@ public class Db {
* @param rs the result set
* @return a list of maps
*/
static
List
query
(
ResultSet
rs
)
throws
SQLException
{
List
list
=
new
ArrayList
();
static
List
<
Map
<
String
,
Object
>>
query
(
ResultSet
rs
)
throws
SQLException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>
();
ResultSetMetaData
meta
=
rs
.
getMetaData
();
int
columnCount
=
meta
.
getColumnCount
();
while
(
rs
.
next
())
{
HashMap
map
=
new
HashMap
();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
map
.
put
(
meta
.
getColumnLabel
(
i
+
1
),
rs
.
getObject
(
i
+
1
));
}
...
...
@@ -125,7 +126,7 @@ public class Db {
* @param sql the SQL statement
* @return a list of maps
*/
public
List
query
(
String
sql
)
{
public
List
<
Map
<
String
,
Object
>>
query
(
String
sql
)
{
try
{
return
query
(
stat
.
executeQuery
(
sql
));
}
catch
(
SQLException
e
)
{
...
...
@@ -231,7 +232,7 @@ public class Db {
*
* @return the result list
*/
public
List
query
()
{
public
List
<
Map
<
String
,
Object
>>
query
()
{
try
{
return
Db
.
query
(
prep
.
executeQuery
());
}
catch
(
SQLException
e
)
{
...
...
h2/src/test/org/h2/test/db/TaskProcess.java
浏览文件 @
4ddb2248
...
...
@@ -47,7 +47,7 @@ public class TaskProcess {
public
void
start
(
String
[]
args
)
{
try
{
String
selfDestruct
=
SelfDestructor
.
getPropertyString
(
60
);
ArrayList
list
=
new
ArrayList
();
ArrayList
<
String
>
list
=
new
ArrayList
<
String
>
();
list
.
add
(
"java"
);
list
.
add
(
selfDestruct
);
list
.
add
(
"-cp"
);
...
...
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
4ddb2248
...
...
@@ -123,7 +123,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testInvalidDatabaseName
()
throws
SQLException
{
private
void
testInvalidDatabaseName
()
{
if
(
config
.
memory
)
{
return
;
}
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
4ddb2248
...
...
@@ -625,11 +625,11 @@ public class TestFunctions extends TestBase implements AggregateFunction {
}
//## Java 1.5 end ##
public
void
add
(
Object
value
)
throws
SQLException
{
public
void
add
(
Object
value
)
{
// ignore
}
public
Object
getResult
()
throws
SQLException
{
public
Object
getResult
()
{
return
new
BigDecimal
(
"1.6"
);
}
...
...
@@ -640,7 +640,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
return
Types
.
DECIMAL
;
}
public
void
init
(
Connection
conn
)
throws
SQLException
{
public
void
init
(
Connection
conn
)
{
// ignore
}
...
...
h2/src/test/org/h2/test/db/TestLogFile.java
浏览文件 @
4ddb2248
...
...
@@ -76,7 +76,7 @@ public class TestLogFile extends TestBase {
deleteDb
(
"logfile"
);
}
private
void
checkLogSize
()
throws
SQLException
{
private
void
checkLogSize
()
{
String
[]
files
=
new
File
(
"."
).
list
();
for
(
int
j
=
0
;
j
<
files
.
length
;
j
++)
{
String
name
=
files
[
j
];
...
...
h2/src/test/org/h2/test/db/TestRights.java
浏览文件 @
4ddb2248
...
...
@@ -275,7 +275,7 @@ public class TestRights extends TestBase {
executeSuccess
(
"DROP TABLE TEST"
);
}
private
void
executeError
(
String
sql
)
throws
SQLException
{
private
void
executeError
(
String
sql
)
{
try
{
stat
.
execute
(
sql
);
fail
(
"not admin"
);
...
...
h2/src/test/org/h2/test/db/TestScript.java
浏览文件 @
4ddb2248
...
...
@@ -302,7 +302,7 @@ public class TestScript extends TestBase {
writeResult
((
ordered
?
"rows (ordered): "
:
"rows: "
)
+
i
,
null
);
}
private
String
format
(
String
[]
row
,
int
[]
max
)
throws
SQLException
{
private
String
format
(
String
[]
row
,
int
[]
max
)
{
int
length
=
max
.
length
;
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
...
...
h2/src/test/org/h2/test/jdbc/TestBatchUpdates.java
浏览文件 @
4ddb2248
...
...
@@ -73,8 +73,8 @@ public class TestBatchUpdates extends TestBase {
call
.
addBatch
();
int
[]
updateCounts
=
call
.
executeBatch
();
int
total
=
0
;
for
(
int
i
=
0
;
i
<
updateCounts
.
length
;
i
++
)
{
total
+=
updateCounts
[
i
]
;
for
(
int
t
:
updateCounts
)
{
total
+=
t
;
}
assertEquals
(
4
,
total
);
conn
.
close
();
...
...
h2/src/test/org/h2/test/jdbc/TestNativeSQL.java
浏览文件 @
4ddb2248
...
...
@@ -207,7 +207,7 @@ public class TestNativeSQL extends TestBase {
}
}
private
void
testPairs
()
throws
SQLException
{
private
void
testPairs
()
{
for
(
int
i
=
0
;
i
<
PAIRS
.
length
;
i
+=
2
)
{
test
(
conn
,
PAIRS
[
i
],
PAIRS
[
i
+
1
]);
}
...
...
@@ -241,7 +241,7 @@ public class TestNativeSQL extends TestBase {
assertFalse
(
conn
.
isClosed
());
}
private
void
test
(
Connection
conn
,
String
original
,
String
expected
)
throws
SQLException
{
private
void
test
(
Connection
conn
,
String
original
,
String
expected
)
{
trace
(
"original: <"
+
original
+
">"
);
trace
(
"expected: <"
+
expected
+
">"
);
try
{
...
...
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
4ddb2248
...
...
@@ -778,7 +778,7 @@ public class TestPreparedStatement extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
int
getLength
()
throws
SQLException
{
private
int
getLength
()
{
return
getSize
(
LOB_SIZE
,
LOB_SIZE_BIG
);
}
...
...
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
4ddb2248
...
...
@@ -1019,7 +1019,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
byte
[]
readAllBytes
(
InputStream
in
)
throws
SQLException
{
private
byte
[]
readAllBytes
(
InputStream
in
)
{
if
(
in
==
null
)
{
return
null
;
}
...
...
@@ -1039,7 +1039,7 @@ public class TestResultSet extends TestBase {
}
}
private
void
checkBytes
(
byte
[]
test
,
byte
[]
good
)
throws
SQLException
{
private
void
checkBytes
(
byte
[]
test
,
byte
[]
good
)
{
if
(
test
==
null
||
good
==
null
)
{
assertTrue
(
test
==
good
);
}
else
{
...
...
h2/src/test/org/h2/test/jdbcx/TestConnectionPool.java
浏览文件 @
4ddb2248
...
...
@@ -126,7 +126,7 @@ public class TestConnectionPool extends TestBase {
man
.
dispose
();
}
private
JdbcConnectionPool
getConnectionPool
(
int
poolSize
)
throws
SQLException
{
private
JdbcConnectionPool
getConnectionPool
(
int
poolSize
)
{
JdbcDataSource
ds
=
new
JdbcDataSource
();
ds
.
setURL
(
getURL
(
"connectionPool"
,
true
));
ds
.
setUser
(
getUser
());
...
...
h2/src/test/org/h2/test/server/TestAutoReconnect.java
浏览文件 @
4ddb2248
...
...
@@ -188,7 +188,7 @@ public class TestAutoReconnect extends TestBase implements DatabaseEventListener
// ignore
}
public
void
diskSpaceIsLow
(
long
stillAvailable
)
throws
SQLException
{
public
void
diskSpaceIsLow
(
long
stillAvailable
)
{
// ignore
}
...
...
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
4ddb2248
...
...
@@ -246,7 +246,7 @@ public class TestCrashAPI extends TestBase {
" "
+
t
.
getMessage
(),
t
);
}
private
Object
callRandom
(
int
seed
,
int
id
,
int
objectId
,
Object
o
,
Method
m
)
throws
SQLException
{
private
Object
callRandom
(
int
seed
,
int
id
,
int
objectId
,
Object
o
,
Method
m
)
{
Class
[]
paramClasses
=
m
.
getParameterTypes
();
Object
[]
params
=
new
Object
[
paramClasses
.
length
];
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++)
{
...
...
h2/src/test/org/h2/test/synth/TestFuzzOptimizations.java
浏览文件 @
4ddb2248
...
...
@@ -7,10 +7,8 @@
package
org
.
h2
.
test
.
synth
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.util.List
;
import
java.util.Random
;
import
org.h2.constant.SysProperties
;
import
org.h2.test.TestBase
;
import
org.h2.test.db.Db
;
...
...
@@ -42,7 +40,7 @@ public class TestFuzzOptimizations extends TestBase {
deleteDb
(
"optimizations"
);
}
private
void
testInSelect
()
throws
SQLException
{
private
void
testInSelect
()
{
boolean
old
=
SysProperties
.
optimizeInJoin
;
Db
db
=
new
Db
(
conn
);
db
.
execute
(
"CREATE TABLE TEST(A INT, B INT)"
);
...
...
@@ -72,7 +70,7 @@ public class TestFuzzOptimizations extends TestBase {
SysProperties
.
optimizeInJoin
=
old
;
}
private
void
testGroupSorted
()
throws
SQLException
{
private
void
testGroupSorted
()
{
Db
db
=
new
Db
(
conn
);
db
.
execute
(
"CREATE TABLE TEST(A INT, B INT, C INT)"
);
Random
random
=
new
Random
();
...
...
h2/src/test/org/h2/test/synth/TestHalt.java
浏览文件 @
4ddb2248
...
...
@@ -123,7 +123,7 @@ public abstract class TestHalt extends TestBase {
*/
abstract
void
processAppRun
()
throws
SQLException
;
public
void
test
()
throws
SQLException
{
public
void
test
()
{
for
(
int
i
=
0
;;
i
++)
{
operations
=
OP_INSERT
|
i
;
flags
=
i
>>
4
;
...
...
h2/src/test/org/h2/test/synth/TestJoin.java
浏览文件 @
4ddb2248
...
...
@@ -235,11 +235,11 @@ public class TestJoin extends TestBase {
buff
.
append
(
" "
);
}
private
void
execute
(
String
sql
,
Object
[]
params
)
throws
SQLException
{
private
void
execute
(
String
sql
,
Object
[]
params
)
{
execute
(
sql
,
params
,
false
);
}
private
void
execute
(
String
sql
,
Object
[]
params
,
boolean
ignoreDifference
)
throws
SQLException
{
private
void
execute
(
String
sql
,
Object
[]
params
,
boolean
ignoreDifference
)
{
String
first
=
null
;
for
(
int
i
=
0
;
i
<
connections
.
size
();
i
++)
{
Connection
conn
=
(
Connection
)
connections
.
get
(
i
);
...
...
h2/src/test/org/h2/test/synth/TestKillProcess.java
浏览文件 @
4ddb2248
...
...
@@ -9,10 +9,8 @@ package org.h2.test.synth;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.Random
;
import
org.h2.store.FileLister
;
import
org.h2.test.TestBase
;
import
org.h2.test.unit.SelfDestructor
;
...
...
@@ -31,7 +29,7 @@ public class TestKillProcess {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
SQLException
{
public
static
void
main
(
String
[]
args
)
{
SelfDestructor
.
startCountdown
(
60
);
try
{
Class
.
forName
(
"org.h2.Driver"
);
...
...
h2/src/test/org/h2/test/synth/TestKillRestart.java
浏览文件 @
4ddb2248
...
...
@@ -11,10 +11,8 @@ import java.sql.Connection;
import
java.sql.DriverManager
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Random
;
import
org.h2.test.TestBase
;
import
org.h2.test.unit.SelfDestructor
;
...
...
@@ -72,7 +70,7 @@ public class TestKillRestart extends TestBase {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
SQLException
{
public
static
void
main
(
String
[]
args
)
{
SelfDestructor
.
startCountdown
(
60
);
String
driver
=
"org.h2.Driver"
;
String
url
=
"jdbc:h2:test"
,
user
=
"sa"
,
password
=
"sa"
;
...
...
h2/src/test/org/h2/test/synth/TestKillRestartMulti.java
浏览文件 @
4ddb2248
...
...
@@ -122,12 +122,12 @@ public class TestKillRestartMulti extends TestBase {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
SQLException
{
public
static
void
main
(
String
[]
args
)
{
SelfDestructor
.
startCountdown
(
60
);
new
TestKillRestartMulti
().
test
(
args
);
}
private
void
test
(
String
[]
args
)
throws
SQLException
{
private
void
test
(
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
"-url"
.
equals
(
args
[
i
]))
{
url
=
args
[++
i
];
...
...
h2/src/test/org/h2/test/synth/thread/TestMultiNews.java
浏览文件 @
4ddb2248
...
...
@@ -77,7 +77,7 @@ public class TestMultiNews extends TestMultiThread {
conn
.
close
();
}
void
finalTest
()
throws
SQLException
{
void
finalTest
()
{
// nothing to do
}
...
...
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
4ddb2248
...
...
@@ -115,7 +115,7 @@ public class TestFileSystem extends TestBase {
conn
.
close
();
}
private
void
testUserHome
()
throws
SQLException
{
private
void
testUserHome
()
{
FileSystem
fs
=
FileSystem
.
getInstance
(
"~/test"
);
String
fileName
=
fs
.
getAbsolutePath
(
"~/test"
);
String
userDir
=
System
.
getProperty
(
"user.home"
);
...
...
h2/src/test/org/h2/test/unit/TestMathUtils.java
浏览文件 @
4ddb2248
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
test
.
unit
;
import
java.math.BigInteger
;
import
java.sql.SQLException
;
import
org.h2.test.TestBase
;
/**
...
...
@@ -24,7 +23,7 @@ public class TestMathUtils extends TestBase {
TestBase
.
createCaller
().
init
().
test
();
}
public
void
test
()
throws
SQLException
{
public
void
test
()
{
testFactorial
();
}
...
...
h2/src/test/org/h2/test/unit/TestOverflow.java
浏览文件 @
4ddb2248
...
...
@@ -90,7 +90,7 @@ public class TestOverflow extends TestBase {
}
}
private
void
testValues
(
Value
va
,
Value
vb
)
throws
SQLException
{
private
void
testValues
(
Value
va
,
Value
vb
)
{
BigInteger
a
=
new
BigInteger
(
va
.
getString
());
BigInteger
b
=
new
BigInteger
(
vb
.
getString
());
successExpected
=
inRange
(
a
.
negate
());
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
4ddb2248
...
...
@@ -155,7 +155,7 @@ public class TestTools extends TestBase {
}
}
private
String
runServer
(
String
[]
args
,
int
exitCode
)
throws
SQLException
{
private
String
runServer
(
String
[]
args
,
int
exitCode
)
{
ByteArrayOutputStream
buff
=
new
ByteArrayOutputStream
();
PrintStream
ps
=
new
PrintStream
(
buff
);
server
=
new
Server
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论