Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c3fc6e3e
提交
c3fc6e3e
authored
16 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
throw the most specific exception
上级
8e8786dc
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
112 个修改的文件
包含
596 行增加
和
551 行删除
+596
-551
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+3
-3
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+1
-1
Bench.java
h2/src/test/org/h2/test/bench/Bench.java
+3
-1
BenchA.java
h2/src/test/org/h2/test/bench/BenchA.java
+4
-3
BenchB.java
h2/src/test/org/h2/test/bench/BenchB.java
+2
-2
BenchC.java
h2/src/test/org/h2/test/bench/BenchC.java
+12
-11
BenchCThread.java
h2/src/test/org/h2/test/bench/BenchCThread.java
+11
-10
BenchSimple.java
h2/src/test/org/h2/test/bench/BenchSimple.java
+3
-2
TestPerformance.java
h2/src/test/org/h2/test/bench/TestPerformance.java
+4
-3
Coverage.java
h2/src/test/org/h2/test/coverage/Coverage.java
+15
-14
Profile.java
h2/src/test/org/h2/test/coverage/Profile.java
+2
-2
TestAutoRecompile.java
h2/src/test/org/h2/test/db/TestAutoRecompile.java
+1
-1
TestBackup.java
h2/src/test/org/h2/test/db/TestBackup.java
+3
-2
TestBigDb.java
h2/src/test/org/h2/test/db/TestBigDb.java
+5
-4
TestBigResult.java
h2/src/test/org/h2/test/db/TestBigResult.java
+8
-6
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+24
-24
TestCheckpoint.java
h2/src/test/org/h2/test/db/TestCheckpoint.java
+2
-1
TestCluster.java
h2/src/test/org/h2/test/db/TestCluster.java
+3
-3
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+5
-5
TestCsv.java
h2/src/test/org/h2/test/db/TestCsv.java
+6
-5
TestDeadlock.java
h2/src/test/org/h2/test/db/TestDeadlock.java
+2
-2
TestEncryptedDb.java
h2/src/test/org/h2/test/db/TestEncryptedDb.java
+1
-1
TestFullText.java
h2/src/test/org/h2/test/db/TestFullText.java
+5
-4
TestFunctionOverload.java
h2/src/test/org/h2/test/db/TestFunctionOverload.java
+6
-6
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+4
-4
TestIndex.java
h2/src/test/org/h2/test/db/TestIndex.java
+14
-13
TestLinkedTable.java
h2/src/test/org/h2/test/db/TestLinkedTable.java
+17
-17
TestListener.java
h2/src/test/org/h2/test/db/TestListener.java
+1
-1
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+14
-13
TestLogFile.java
h2/src/test/org/h2/test/db/TestLogFile.java
+5
-4
TestMemoryUsage.java
h2/src/test/org/h2/test/db/TestMemoryUsage.java
+7
-6
TestMultiConn.java
h2/src/test/org/h2/test/db/TestMultiConn.java
+1
-1
TestMultiDimension.java
h2/src/test/org/h2/test/db/TestMultiDimension.java
+2
-1
TestMultiThread.java
h2/src/test/org/h2/test/db/TestMultiThread.java
+3
-2
TestOpenClose.java
h2/src/test/org/h2/test/db/TestOpenClose.java
+3
-3
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+10
-9
TestOutOfMemory.java
h2/src/test/org/h2/test/db/TestOutOfMemory.java
+1
-1
TestPowerOff.java
h2/src/test/org/h2/test/db/TestPowerOff.java
+10
-10
TestReadOnly.java
h2/src/test/org/h2/test/db/TestReadOnly.java
+1
-1
TestRights.java
h2/src/test/org/h2/test/db/TestRights.java
+8
-8
TestRunscript.java
h2/src/test/org/h2/test/db/TestRunscript.java
+2
-2
TestSQLInjection.java
h2/src/test/org/h2/test/db/TestSQLInjection.java
+3
-3
TestScript.java
h2/src/test/org/h2/test/db/TestScript.java
+2
-2
TestScriptSimple.java
h2/src/test/org/h2/test/db/TestScriptSimple.java
+1
-1
TestSequence.java
h2/src/test/org/h2/test/db/TestSequence.java
+7
-6
TestSessionsLocks.java
h2/src/test/org/h2/test/db/TestSessionsLocks.java
+1
-1
TestSpaceReuse.java
h2/src/test/org/h2/test/db/TestSpaceReuse.java
+2
-1
TestSpeed.java
h2/src/test/org/h2/test/db/TestSpeed.java
+3
-2
TestTempTables.java
h2/src/test/org/h2/test/db/TestTempTables.java
+1
-1
TestTransaction.java
h2/src/test/org/h2/test/db/TestTransaction.java
+9
-9
TestTriggersConstraints.java
h2/src/test/org/h2/test/db/TestTriggersConstraints.java
+5
-5
TestTwoPhaseCommit.java
h2/src/test/org/h2/test/db/TestTwoPhaseCommit.java
+5
-4
TestView.java
h2/src/test/org/h2/test/db/TestView.java
+4
-3
SamplesTest.java
h2/src/test/org/h2/test/jaqu/SamplesTest.java
+18
-18
TestBatchUpdates.java
h2/src/test/org/h2/test/jdbc/TestBatchUpdates.java
+17
-16
TestCallableStatement.java
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
+3
-2
TestCancel.java
h2/src/test/org/h2/test/jdbc/TestCancel.java
+5
-5
TestDatabaseEventListener.java
h2/src/test/org/h2/test/jdbc/TestDatabaseEventListener.java
+3
-3
TestManyJdbcObjects.java
h2/src/test/org/h2/test/jdbc/TestManyJdbcObjects.java
+5
-4
TestMetaData.java
h2/src/test/org/h2/test/jdbc/TestMetaData.java
+13
-12
TestNativeSQL.java
h2/src/test/org/h2/test/jdbc/TestNativeSQL.java
+6
-6
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+26
-26
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+22
-22
TestStatement.java
h2/src/test/org/h2/test/jdbc/TestStatement.java
+5
-5
TestTransactionIsolation.java
h2/src/test/org/h2/test/jdbc/TestTransactionIsolation.java
+2
-2
TestUpdatableResultSet.java
h2/src/test/org/h2/test/jdbc/TestUpdatableResultSet.java
+9
-9
TestZloty.java
h2/src/test/org/h2/test/jdbc/TestZloty.java
+3
-3
TestConnectionPool.java
h2/src/test/org/h2/test/jdbcx/TestConnectionPool.java
+3
-2
TestDataSource.java
h2/src/test/org/h2/test/jdbcx/TestDataSource.java
+3
-2
TestXASimple.java
h2/src/test/org/h2/test/jdbcx/TestXASimple.java
+3
-2
TestMvcc1.java
h2/src/test/org/h2/test/mvcc/TestMvcc1.java
+3
-3
TestMvcc2.java
h2/src/test/org/h2/test/mvcc/TestMvcc2.java
+5
-4
TestMvcc3.java
h2/src/test/org/h2/test/mvcc/TestMvcc3.java
+6
-5
Listener.java
h2/src/test/org/h2/test/poweroff/Listener.java
+3
-3
Test.java
h2/src/test/org/h2/test/poweroff/Test.java
+2
-1
TestRecover.java
h2/src/test/org/h2/test/poweroff/TestRecover.java
+1
-1
TestRowLocks.java
h2/src/test/org/h2/test/rowlock/TestRowLocks.java
+2
-2
TestNestedLoop.java
h2/src/test/org/h2/test/server/TestNestedLoop.java
+1
-1
TestPgServer.java
h2/src/test/org/h2/test/server/TestPgServer.java
+2
-2
TestBtreeIndex.java
h2/src/test/org/h2/test/synth/TestBtreeIndex.java
+4
-4
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+6
-6
TestHalt.java
h2/src/test/org/h2/test/synth/TestHalt.java
+13
-13
TestHaltApp.java
h2/src/test/org/h2/test/synth/TestHaltApp.java
+4
-4
TestJoin.java
h2/src/test/org/h2/test/synth/TestJoin.java
+3
-3
TestKill.java
h2/src/test/org/h2/test/synth/TestKill.java
+1
-1
TestKillProcess.java
h2/src/test/org/h2/test/synth/TestKillProcess.java
+2
-1
TestKillRestart.java
h2/src/test/org/h2/test/synth/TestKillRestart.java
+2
-1
TestKillRestartMulti.java
h2/src/test/org/h2/test/synth/TestKillRestartMulti.java
+4
-4
TestRandomSQL.java
h2/src/test/org/h2/test/synth/TestRandomSQL.java
+4
-4
TestSimpleIndex.java
h2/src/test/org/h2/test/synth/TestSimpleIndex.java
+5
-5
TestThreads.java
h2/src/test/org/h2/test/synth/TestThreads.java
+3
-2
TestTimer.java
h2/src/test/org/h2/test/synth/TestTimer.java
+2
-2
TestSynth.java
h2/src/test/org/h2/test/synth/sql/TestSynth.java
+1
-1
TestMulti.java
h2/src/test/org/h2/test/synth/thread/TestMulti.java
+1
-1
TestMultiNews.java
h2/src/test/org/h2/test/synth/thread/TestMultiNews.java
+1
-1
TestMultiOrder.java
h2/src/test/org/h2/test/synth/thread/TestMultiOrder.java
+1
-1
TestMultiThread.java
h2/src/test/org/h2/test/synth/thread/TestMultiThread.java
+2
-2
Player.java
h2/src/test/org/h2/test/trace/Player.java
+1
-1
TestExit.java
h2/src/test/org/h2/test/unit/TestExit.java
+4
-4
TestPattern.java
h2/src/test/org/h2/test/unit/TestPattern.java
+5
-3
TestRecovery.java
h2/src/test/org/h2/test/unit/TestRecovery.java
+3
-2
TestScriptReader.java
h2/src/test/org/h2/test/unit/TestScriptReader.java
+4
-3
TestSecurity.java
h2/src/test/org/h2/test/unit/TestSecurity.java
+18
-22
TestServlet.java
h2/src/test/org/h2/test/unit/TestServlet.java
+1
-1
TestShell.java
h2/src/test/org/h2/test/unit/TestShell.java
+3
-2
TestStreams.java
h2/src/test/org/h2/test/unit/TestStreams.java
+3
-2
TestStringCache.java
h2/src/test/org/h2/test/unit/TestStringCache.java
+15
-15
TestStringUtils.java
h2/src/test/org/h2/test/unit/TestStringUtils.java
+7
-6
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+17
-17
TestValue.java
h2/src/test/org/h2/test/unit/TestValue.java
+5
-3
TestValueHashMap.java
h2/src/test/org/h2/test/unit/TestValueHashMap.java
+1
-1
TestValueMemory.java
h2/src/test/org/h2/test/unit/TestValueMemory.java
+2
-2
没有找到文件。
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
c3fc6e3e
...
...
@@ -348,7 +348,7 @@ http://www.w3schools.com/sql/
/**
* Run all tests in all possible combinations.
*/
private
void
testEverything
()
throws
Exception
{
private
void
testEverything
()
throws
SQL
Exception
{
for
(
int
c
=
0
;
c
<
3
;
c
++)
{
if
(
c
==
0
)
{
cipher
=
null
;
...
...
@@ -377,7 +377,7 @@ http://www.w3schools.com/sql/
/**
* Run the tests with a number of different settings.
*/
private
void
runTests
()
throws
Exception
{
private
void
runTests
()
throws
SQL
Exception
{
jdk14
=
true
;
smallLog
=
big
=
networked
=
memory
=
ssl
=
textStorage
=
false
;
diskResult
=
deleteIndex
=
traceSystemOut
=
diskUndo
=
false
;
...
...
@@ -446,7 +446,7 @@ http://www.w3schools.com/sql/
/**
* Run all tests with the current settings.
*/
private
void
test
()
throws
Exception
{
private
void
test
()
throws
SQL
Exception
{
System
.
out
.
println
();
System
.
out
.
println
(
"Test "
+
toString
());
beforeTest
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
c3fc6e3e
...
...
@@ -424,7 +424,7 @@ public abstract class TestBase {
/**
* This method will be called by the test framework.
*
* @throws
AssertionError
if an exception in the test occurs
* @throws
Exception
if an exception in the test occurs
*/
public
abstract
void
test
()
throws
Exception
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/Bench.java
浏览文件 @
c3fc6e3e
...
...
@@ -6,6 +6,8 @@
*/
package
org
.
h2
.
test
.
bench
;
import
java.sql.SQLException
;
/**
* The interface for benchmark tests.
*/
...
...
@@ -17,7 +19,7 @@ public interface Bench {
* @param db the database object
* @param size the amount of data
*/
void
init
(
Database
db
,
int
size
)
throws
Exception
;
void
init
(
Database
db
,
int
size
)
throws
SQL
Exception
;
/**
* Run the test.
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/BenchA.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.bench;
import
java.math.BigDecimal
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.util.Random
;
/**
...
...
@@ -28,7 +29,7 @@ public class BenchA implements Bench {
private
int
accounts
;
private
int
size
;
public
void
init
(
Database
db
,
int
size
)
throws
Exception
{
public
void
init
(
Database
db
,
int
size
)
throws
SQL
Exception
{
this
.
db
=
db
;
this
.
size
=
size
;
...
...
@@ -97,7 +98,7 @@ public class BenchA implements Bench {
// db.end();
}
public
void
runTest
()
throws
Exception
{
public
void
runTest
()
throws
SQL
Exception
{
db
.
start
(
this
,
"Transactions"
);
db
.
openConnection
();
...
...
@@ -112,7 +113,7 @@ public class BenchA implements Bench {
}
private
void
processTransactions
()
throws
Exception
{
private
void
processTransactions
()
throws
SQL
Exception
{
Random
random
=
db
.
getRandom
();
int
branch
=
random
.
nextInt
(
branches
);
int
teller
=
random
.
nextInt
(
tellers
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/BenchB.java
浏览文件 @
c3fc6e3e
...
...
@@ -44,7 +44,7 @@ public class BenchB implements Bench, Runnable {
// nothing to do
}
private
BenchB
(
BenchB
master
,
int
seed
)
throws
Exception
{
private
BenchB
(
BenchB
master
,
int
seed
)
throws
SQL
Exception
{
this
.
master
=
master
;
random
=
new
Random
(
seed
);
conn
=
master
.
db
.
openNewConnection
();
...
...
@@ -61,7 +61,7 @@ public class BenchB implements Bench, Runnable {
"INSERT INTO HISTORY(TID, BID, AID, DELTA) VALUES(?, ?, ?, ?)"
);
}
public
void
init
(
Database
db
,
int
size
)
throws
Exception
{
public
void
init
(
Database
db
,
int
size
)
throws
SQL
Exception
{
this
.
db
=
db
;
this
.
transactionPerClient
=
size
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/BenchC.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.bench;
import
java.math.BigDecimal
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.sql.Timestamp
;
import
java.sql.Types
;
...
...
@@ -102,7 +103,7 @@ public class BenchC implements Bench {
private
int
commitEvery
=
1000
;
public
void
init
(
Database
db
,
int
size
)
throws
Exception
{
public
void
init
(
Database
db
,
int
size
)
throws
SQL
Exception
{
this
.
db
=
db
;
random
=
new
BenchCRandom
();
...
...
@@ -127,7 +128,7 @@ public class BenchC implements Bench {
}
private
void
load
()
throws
Exception
{
private
void
load
()
throws
SQL
Exception
{
for
(
int
i
=
0
;
i
<
TABLES
.
length
;
i
++)
{
db
.
dropTable
(
TABLES
[
i
]);
}
...
...
@@ -151,7 +152,7 @@ public class BenchC implements Bench {
db
.
trace
(
action
,
i
,
max
);
}
private
void
loadItem
()
throws
Exception
{
private
void
loadItem
()
throws
SQL
Exception
{
trace
(
"Loading item table"
);
boolean
[]
original
=
random
.
getBoolean
(
items
,
items
/
10
);
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO ITEM(I_ID, I_IM_ID, I_NAME, I_PRICE, I_DATA) "
...
...
@@ -176,7 +177,7 @@ public class BenchC implements Bench {
}
}
private
void
loadWarehouse
()
throws
Exception
{
private
void
loadWarehouse
()
throws
SQL
Exception
{
trace
(
"Loading warehouse table"
);
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO WAREHOUSE(W_ID, W_NAME, W_STREET_1, "
+
"W_STREET_2, W_CITY, W_STATE, W_ZIP, W_TAX, W_YTD) "
+
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"
);
...
...
@@ -208,7 +209,7 @@ public class BenchC implements Bench {
}
}
private
void
loadCustomer
()
throws
Exception
{
private
void
loadCustomer
()
throws
SQL
Exception
{
trace
(
"Load customer table"
);
int
max
=
warehouses
*
districtsPerWarehouse
;
int
i
=
0
;
...
...
@@ -223,7 +224,7 @@ public class BenchC implements Bench {
}
}
private
void
loadCustomerSub
(
int
dId
,
int
wId
)
throws
Exception
{
private
void
loadCustomerSub
(
int
dId
,
int
wId
)
throws
SQL
Exception
{
Timestamp
timestamp
=
new
Timestamp
(
System
.
currentTimeMillis
());
PreparedStatement
prepCustomer
=
db
.
prepare
(
"INSERT INTO CUSTOMER(C_ID, C_D_ID, C_W_ID, "
+
"C_FIRST, C_MIDDLE, C_LAST, "
+
"C_STREET_1, C_STREET_2, C_CITY, C_STATE, C_ZIP, "
...
...
@@ -297,7 +298,7 @@ public class BenchC implements Bench {
}
}
private
void
loadOrder
()
throws
Exception
{
private
void
loadOrder
()
throws
SQL
Exception
{
trace
(
"Loading order table"
);
int
max
=
warehouses
*
districtsPerWarehouse
;
int
i
=
0
;
...
...
@@ -309,7 +310,7 @@ public class BenchC implements Bench {
}
}
private
void
loadOrderSub
(
int
dId
,
int
wId
)
throws
Exception
{
private
void
loadOrderSub
(
int
dId
,
int
wId
)
throws
SQL
Exception
{
Timestamp
timestamp
=
new
Timestamp
(
System
.
currentTimeMillis
());
int
[]
orderid
=
random
.
getPermutation
(
ordersPerDistrict
);
PreparedStatement
prepOrder
=
db
.
prepare
(
"INSERT INTO ORDERS(O_ID, O_C_ID, O_D_ID, O_W_ID, "
...
...
@@ -368,7 +369,7 @@ public class BenchC implements Bench {
}
}
private
void
loadStock
(
int
wId
)
throws
Exception
{
private
void
loadStock
(
int
wId
)
throws
SQL
Exception
{
trace
(
"Loading stock table (warehouse "
+
wId
+
")"
);
boolean
[]
original
=
random
.
getBoolean
(
items
,
items
/
10
);
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO STOCK(S_I_ID, S_W_ID, S_QUANTITY, "
...
...
@@ -417,7 +418,7 @@ public class BenchC implements Bench {
}
}
private
void
loadDistrict
(
int
wId
)
throws
Exception
{
private
void
loadDistrict
(
int
wId
)
throws
SQL
Exception
{
BigDecimal
ytd
=
new
BigDecimal
(
"300000.00"
);
int
nextId
=
3001
;
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO DISTRICT(D_ID, D_W_ID, D_NAME, "
...
...
@@ -448,7 +449,7 @@ public class BenchC implements Bench {
}
}
public
void
runTest
()
throws
Exception
{
public
void
runTest
()
throws
SQL
Exception
{
db
.
start
(
this
,
"Transactions"
);
db
.
openConnection
();
for
(
int
i
=
0
;
i
<
70
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/BenchCThread.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.bench;
import
java.math.BigDecimal
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
...
...
@@ -30,7 +31,7 @@ public class BenchCThread {
private
BenchC
bench
;
BenchCThread
(
Database
db
,
BenchC
bench
,
BenchCRandom
random
,
int
terminal
)
throws
Exception
{
throws
SQL
Exception
{
this
.
db
=
db
;
this
.
bench
=
bench
;
this
.
terminalId
=
terminal
;
...
...
@@ -42,7 +43,7 @@ public class BenchCThread {
/**
* Process the list of operations (a 'deck') in random order.
*/
void
process
()
throws
Exception
{
void
process
()
throws
SQL
Exception
{
int
[]
deck
=
new
int
[]
{
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_NEW_ORDER
,
OP_PAYMENT
,
...
...
@@ -80,7 +81,7 @@ public class BenchCThread {
}
}
private
void
processNewOrder
()
throws
Exception
{
private
void
processNewOrder
()
throws
SQL
Exception
{
int
dId
=
random
.
getInt
(
1
,
bench
.
districtsPerWarehouse
);
int
cId
=
random
.
getNonUniform
(
1023
,
1
,
bench
.
customersPerDistrict
);
int
olCnt
=
random
.
getInt
(
5
,
15
);
...
...
@@ -166,7 +167,7 @@ public class BenchCThread {
db
.
rollback
();
return
;
}
throw
new
Exception
(
"item not found: "
+
olId
+
" "
throw
new
SQL
Exception
(
"item not found: "
+
olId
+
" "
+
olSupplyId
);
}
BigDecimal
price
=
rs
.
getBigDecimal
(
1
);
...
...
@@ -187,7 +188,7 @@ public class BenchCThread {
db
.
rollback
();
return
;
}
throw
new
Exception
(
"item not found: "
+
olId
+
" "
throw
new
SQL
Exception
(
"item not found: "
+
olId
+
" "
+
olSupplyId
);
}
int
sQuantity
=
rs
.
getInt
(
1
);
...
...
@@ -257,7 +258,7 @@ public class BenchCThread {
db
.
commit
();
}
private
void
processPayment
()
throws
Exception
{
private
void
processPayment
()
throws
SQL
Exception
{
int
dId
=
random
.
getInt
(
1
,
bench
.
districtsPerWarehouse
);
int
wId
,
cdId
;
if
(
bench
.
warehouses
>
1
&&
random
.
getInt
(
1
,
100
)
<=
15
)
{
...
...
@@ -482,7 +483,7 @@ public class BenchCThread {
db
.
commit
();
}
private
void
processOrderStatus
()
throws
Exception
{
private
void
processOrderStatus
()
throws
SQL
Exception
{
int
dId
=
random
.
getInt
(
1
,
bench
.
districtsPerWarehouse
);
boolean
byName
;
String
last
=
null
;
...
...
@@ -604,7 +605,7 @@ public class BenchCThread {
db
.
commit
();
}
private
void
processDelivery
()
throws
Exception
{
private
void
processDelivery
()
throws
SQL
Exception
{
int
carrierId
=
random
.
getInt
(
1
,
10
);
Timestamp
datetime
=
new
Timestamp
(
System
.
currentTimeMillis
());
PreparedStatement
prep
;
...
...
@@ -678,7 +679,7 @@ public class BenchCThread {
db
.
commit
();
}
private
void
processStockLevel
()
throws
Exception
{
private
void
processStockLevel
()
throws
SQL
Exception
{
int
dId
=
(
terminalId
%
bench
.
districtsPerWarehouse
)
+
1
;
int
threshold
=
random
.
getInt
(
10
,
20
);
PreparedStatement
prep
;
...
...
@@ -724,7 +725,7 @@ public class BenchCThread {
db
.
commit
();
}
private
PreparedStatement
prepare
(
String
sql
)
throws
Exception
{
private
PreparedStatement
prepare
(
String
sql
)
throws
SQL
Exception
{
PreparedStatement
prep
=
(
PreparedStatement
)
prepared
.
get
(
sql
);
if
(
prep
==
null
)
{
prep
=
db
.
prepare
(
sql
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/BenchSimple.java
浏览文件 @
c3fc6e3e
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
test
.
bench
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.util.Random
;
/**
...
...
@@ -19,7 +20,7 @@ public class BenchSimple implements Bench {
Database
db
;
int
records
;
public
void
init
(
Database
db
,
int
size
)
throws
Exception
{
public
void
init
(
Database
db
,
int
size
)
throws
SQL
Exception
{
this
.
db
=
db
;
this
.
records
=
size
*
60
;
...
...
@@ -50,7 +51,7 @@ public class BenchSimple implements Bench {
}
public
void
runTest
()
throws
Exception
{
public
void
runTest
()
throws
SQL
Exception
{
PreparedStatement
prep
;
Random
random
=
db
.
getRandom
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/TestPerformance.java
浏览文件 @
c3fc6e3e
...
...
@@ -13,6 +13,7 @@ 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.ArrayList
;
import
java.util.Properties
;
...
...
@@ -46,12 +47,12 @@ public class TestPerformance {
new
TestPerformance
().
test
(
args
);
}
private
Connection
getResultConnection
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
private
Connection
getResultConnection
()
throws
SQL
Exception
{
org
.
h2
.
Driver
.
load
(
);
return
DriverManager
.
getConnection
(
"jdbc:h2:data/results"
);
}
private
void
openResults
(
boolean
init
)
throws
Exception
{
private
void
openResults
(
boolean
init
)
throws
SQL
Exception
{
Connection
conn
=
null
;
Statement
stat
=
null
;
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/coverage/Coverage.java
浏览文件 @
c3fc6e3e
...
...
@@ -11,6 +11,7 @@ import java.io.BufferedWriter;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.Reader
;
import
java.io.Writer
;
import
java.util.ArrayList
;
...
...
@@ -183,7 +184,7 @@ public class Coverage {
}
}
private
void
read
()
throws
Exception
{
private
void
read
()
throws
IO
Exception
{
last
=
token
;
String
write
=
token
;
token
=
null
;
...
...
@@ -225,14 +226,14 @@ public class Coverage {
}
}
private
void
readThis
(
String
s
)
throws
Exception
{
private
void
readThis
(
String
s
)
throws
IO
Exception
{
if
(!
token
.
equals
(
s
))
{
throw
new
Exception
(
"Expected: "
+
s
+
" got:"
+
token
);
throw
new
IO
Exception
(
"Expected: "
+
s
+
" got:"
+
token
);
}
read
();
}
private
void
process
()
throws
Exception
{
private
void
process
()
throws
IO
Exception
{
boolean
imp
=
false
;
read
();
do
{
...
...
@@ -251,7 +252,7 @@ public class Coverage {
}
while
(
token
!=
null
);
}
private
void
processInit
()
throws
Exception
{
private
void
processInit
()
throws
IO
Exception
{
do
{
if
(
token
.
equals
(
"{"
))
{
read
();
...
...
@@ -265,7 +266,7 @@ public class Coverage {
}
while
(
true
);
}
private
void
processClass
()
throws
Exception
{
private
void
processClass
()
throws
IO
Exception
{
int
type
=
0
;
while
(
true
)
{
if
(
token
==
null
)
{
...
...
@@ -317,7 +318,7 @@ public class Coverage {
}
}
private
void
processBracket
()
throws
Exception
{
private
void
processBracket
()
throws
IO
Exception
{
do
{
if
(
token
.
equals
(
"("
))
{
read
();
...
...
@@ -331,7 +332,7 @@ public class Coverage {
}
while
(
true
);
}
private
void
processFunction
()
throws
Exception
{
private
void
processFunction
()
throws
IO
Exception
{
function
=
word
;
writeLine
();
do
{
...
...
@@ -341,7 +342,7 @@ public class Coverage {
writeLine
();
}
private
void
processBlockOrStatement
()
throws
Exception
{
private
void
processBlockOrStatement
()
throws
IO
Exception
{
if
(!
token
.
equals
(
"{"
))
{
write
(
"{ //++"
);
writeLine
();
...
...
@@ -356,7 +357,7 @@ public class Coverage {
}
}
private
void
processStatement
()
throws
Exception
{
private
void
processStatement
()
throws
IO
Exception
{
while
(
true
)
{
if
(
token
.
equals
(
"while"
)
||
token
.
equals
(
"for"
)
||
token
.
equals
(
"synchronized"
))
{
read
();
...
...
@@ -478,12 +479,12 @@ public class Coverage {
}
}
private
void
setLine
()
throws
Exception
{
private
void
setLine
()
throws
IO
Exception
{
add
+=
"Profile.visit("
+
index
+
");"
;
line
=
tokenizer
.
getLine
();
}
private
void
nextDebug
()
throws
Exception
{
private
void
nextDebug
()
throws
IO
Exception
{
if
(
perFunction
)
{
int
i
=
function
.
indexOf
(
"("
);
String
func
=
i
<
0
?
function
:
function
.
substring
(
0
,
i
);
...
...
@@ -498,14 +499,14 @@ public class Coverage {
index
++;
}
private
void
writeLine
()
throws
Exception
{
private
void
writeLine
()
throws
IO
Exception
{
write
(
"\r\n"
);
for
(
int
i
=
0
;
i
<
indent
;
i
++)
{
writer
.
write
(
' '
);
}
}
private
void
write
(
String
s
)
throws
Exception
{
private
void
write
(
String
s
)
throws
IO
Exception
{
writer
.
write
(
s
);
// System.out.print(s);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/coverage/Profile.java
浏览文件 @
c3fc6e3e
...
...
@@ -148,7 +148,7 @@ public class Profile extends Thread {
lastIndex
=
i
;
}
private
void
listUnvisited
()
throws
Exception
{
private
void
listUnvisited
()
throws
IO
Exception
{
printLine
(
'='
);
print
(
"NOT COVERED"
);
printLine
(
'-'
);
...
...
@@ -184,7 +184,7 @@ public class Profile extends Thread {
}
}
private
void
listTop
(
String
title
,
int
[]
list
,
int
max
)
throws
Exception
{
private
void
listTop
(
String
title
,
int
[]
list
,
int
max
)
throws
IO
Exception
{
printLine
(
'-'
);
int
total
=
0
;
int
totalLines
=
0
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestAutoRecompile.java
浏览文件 @
c3fc6e3e
...
...
@@ -18,7 +18,7 @@ import org.h2.test.TestBase;
*/
public
class
TestAutoRecompile
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"autoRecompile"
);
Connection
conn
=
getConnection
(
"autoRecompile"
);
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestBackup.java
浏览文件 @
c3fc6e3e
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
test
.
db
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -17,14 +18,14 @@ import org.h2.tools.Restore;
*/
public
class
TestBackup
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
||
config
.
logMode
==
0
)
{
return
;
}
testBackup
();
}
private
void
testBackup
()
throws
Exception
{
private
void
testBackup
()
throws
SQL
Exception
{
deleteDb
(
"backup"
);
Connection
conn1
,
conn2
,
conn3
;
Statement
stat1
,
stat2
,
stat3
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestBigDb.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -19,7 +20,7 @@ import org.h2.util.MemoryUtils;
*/
public
class
TestBigDb
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -31,7 +32,7 @@ public class TestBigDb extends TestBase {
testLeftSummary
();
}
private
void
testLargeTable
()
throws
Exception
{
private
void
testLargeTable
()
throws
SQL
Exception
{
deleteDb
(
"bigDb"
);
Connection
conn
=
getConnection
(
"bigDb"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -88,7 +89,7 @@ public class TestBigDb extends TestBase {
conn
.
close
();
}
private
void
testLeftSummary
()
throws
Exception
{
private
void
testLeftSummary
()
throws
SQL
Exception
{
deleteDb
(
"bigDb"
);
Connection
conn
=
getConnection
(
"bigDb"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -113,7 +114,7 @@ public class TestBigDb extends TestBase {
conn
.
close
();
}
private
void
testInsert
()
throws
Exception
{
private
void
testInsert
()
throws
SQL
Exception
{
deleteDb
(
"bigDb"
);
Connection
conn
=
getConnection
(
"bigDb"
);
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestBigResult.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
...
...
@@ -19,7 +20,8 @@ import org.h2.test.TestBase;
* Test for big result sets.
*/
public
class
TestBigResult
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQLException
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -30,7 +32,7 @@ public class TestBigResult extends TestBase {
testLimitBufferedResult
();
}
private
void
testLargeSubquery
()
throws
Exception
{
private
void
testLargeSubquery
()
throws
SQL
Exception
{
deleteDb
(
"bigResult"
);
Connection
conn
=
getConnection
(
"bigResult"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -53,7 +55,7 @@ public class TestBigResult extends TestBase {
conn
.
close
();
}
private
void
testLargeUpdateDelete
()
throws
Exception
{
private
void
testLargeUpdateDelete
()
throws
SQL
Exception
{
deleteDb
(
"bigResult"
);
Connection
conn
=
getConnection
(
"bigResult"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -65,7 +67,7 @@ public class TestBigResult extends TestBase {
conn
.
close
();
}
private
void
testCloseConnectionDelete
()
throws
Exception
{
private
void
testCloseConnectionDelete
()
throws
SQL
Exception
{
deleteDb
(
"bigResult"
);
Connection
conn
=
getConnection
(
"bigResult"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -83,7 +85,7 @@ public class TestBigResult extends TestBase {
}
}
private
void
testLimitBufferedResult
()
throws
Exception
{
private
void
testLimitBufferedResult
()
throws
SQL
Exception
{
deleteDb
(
"bigResult"
);
Connection
conn
=
getConnection
(
"bigResult"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -109,7 +111,7 @@ public class TestBigResult extends TestBase {
conn
.
close
();
}
private
void
testOrderGroup
()
throws
Exception
{
private
void
testOrderGroup
()
throws
SQL
Exception
{
deleteDb
(
"bigResult"
);
Connection
conn
=
getConnection
(
"bigResult"
);
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
c3fc6e3e
...
...
@@ -57,7 +57,7 @@ public class TestCases extends TestBase {
testCollation
();
}
private
void
testInvalidDatabaseName
()
throws
Exception
{
private
void
testInvalidDatabaseName
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -75,7 +75,7 @@ public class TestCases extends TestBase {
}
}
private
void
testReuseSpace
()
throws
Exception
{
private
void
testReuseSpace
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -99,7 +99,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testDeleteGroup
()
throws
Exception
{
private
void
testDeleteGroup
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -110,7 +110,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testSpecialSQL
()
throws
Exception
{
private
void
testSpecialSQL
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -138,7 +138,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testUpperCaseLowerCaseDatabase
()
throws
Exception
{
private
void
testUpperCaseLowerCaseDatabase
()
throws
SQL
Exception
{
if
(
File
.
separatorChar
!=
'\\'
)
{
return
;
}
...
...
@@ -175,7 +175,7 @@ public class TestCases extends TestBase {
}
private
void
testManualCommitSet
()
throws
Exception
{
private
void
testManualCommitSet
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Connection
conn2
=
getConnection
(
"cases"
);
...
...
@@ -187,7 +187,7 @@ public class TestCases extends TestBase {
conn2
.
close
();
}
private
void
testSchemaIdentityReconnect
()
throws
Exception
{
private
void
testSchemaIdentityReconnect
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -246,7 +246,7 @@ public class TestCases extends TestBase {
deleteDb
(
"cases"
);
}
private
void
testExecuteTrace
()
throws
Exception
{
private
void
testExecuteTrace
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -265,7 +265,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testAlterTableReconnect
()
throws
Exception
{
private
void
testAlterTableReconnect
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -313,7 +313,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testCollation
()
throws
Exception
{
private
void
testCollation
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -339,7 +339,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testPersistentSettings
()
throws
Exception
{
private
void
testPersistentSettings
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -360,7 +360,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testInsertSelectUnion
()
throws
Exception
{
private
void
testInsertSelectUnion
()
throws
SQL
Exception
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -387,7 +387,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testViewReconnect
()
throws
Exception
{
private
void
testViewReconnect
()
throws
SQL
Exception
{
trace
(
"testViewReconnect"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
@@ -407,7 +407,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testDefaultQueryReconnect
()
throws
Exception
{
private
void
testDefaultQueryReconnect
()
throws
SQL
Exception
{
trace
(
"testDefaultQueryReconnect"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
@@ -429,7 +429,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testBigString
()
throws
Exception
{
private
void
testBigString
()
throws
SQL
Exception
{
trace
(
"testBigString"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
@@ -481,7 +481,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testConstraintReconnect
()
throws
Exception
{
private
void
testConstraintReconnect
()
throws
SQL
Exception
{
trace
(
"testConstraintReconnect"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
@@ -500,7 +500,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testDoubleRecovery
()
throws
Exception
{
private
void
testDoubleRecovery
()
throws
SQL
Exception
{
if
(
config
.
networked
)
{
return
;
}
...
...
@@ -535,7 +535,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testRenameReconnect
()
throws
Exception
{
private
void
testRenameReconnect
()
throws
SQL
Exception
{
trace
(
"testRenameReconnect"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
@@ -562,7 +562,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testAllSizes
()
throws
Exception
{
private
void
testAllSizes
()
throws
SQL
Exception
{
trace
(
"testAllSizes"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
@@ -594,7 +594,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testSelectForUpdate
()
throws
Exception
{
private
void
testSelectForUpdate
()
throws
SQL
Exception
{
trace
(
"testSelectForUpdate"
);
deleteDb
(
"cases"
);
Connection
conn1
=
getConnection
(
"cases"
);
...
...
@@ -617,7 +617,7 @@ public class TestCases extends TestBase {
conn2
.
close
();
}
private
void
testMutableObjects
()
throws
Exception
{
private
void
testMutableObjects
()
throws
SQL
Exception
{
trace
(
"testMutableObjects"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
@@ -644,7 +644,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testCreateDrop
()
throws
Exception
{
private
void
testCreateDrop
()
throws
SQL
Exception
{
trace
(
"testCreateDrop"
);
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
@@ -658,7 +658,7 @@ public class TestCases extends TestBase {
conn
.
close
();
}
private
void
testPolePos
()
throws
Exception
{
private
void
testPolePos
()
throws
SQL
Exception
{
trace
(
"testPolePos"
);
// poleposition-0.20
...
...
@@ -732,7 +732,7 @@ public class TestCases extends TestBase {
c0
.
close
();
}
private
void
testQuick
()
throws
Exception
{
private
void
testQuick
()
throws
SQL
Exception
{
trace
(
"testQuick"
);
deleteDb
(
"cases"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCheckpoint.java
浏览文件 @
c3fc6e3e
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
test
.
db
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -16,7 +17,7 @@ import org.h2.test.TestBase;
*/
public
class
TestCheckpoint
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
// TODO test checkpoint with rollback, not only just run the command
deleteDb
(
"checkpoint"
);
Connection
c0
=
getConnection
(
"checkpoint"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCluster.java
浏览文件 @
c3fc6e3e
...
...
@@ -23,7 +23,7 @@ import org.h2.tools.Server;
*/
public
class
TestCluster
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
||
config
.
networked
)
{
return
;
}
...
...
@@ -33,7 +33,7 @@ public class TestCluster extends TestBase {
// create the master database
Connection
conn
;
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:file:"
+
baseDir
+
"/node1/test"
,
"sa"
,
""
);
Statement
stat
;
stat
=
conn
.
createStatement
();
...
...
@@ -124,7 +124,7 @@ public class TestCluster extends TestBase {
n2
.
stop
();
}
private
void
check
(
Connection
conn
,
int
len
)
throws
Exception
{
private
void
check
(
Connection
conn
,
int
len
)
throws
SQL
Exception
{
PreparedStatement
prep
=
conn
.
prepareStatement
(
"SELECT * FROM TEST WHERE ID=?"
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
prep
.
setInt
(
1
,
i
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
c3fc6e3e
...
...
@@ -20,7 +20,7 @@ public class TestCompatibility extends TestBase {
private
Connection
conn
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"compatibility"
);
conn
=
getConnection
(
"compatibility"
);
...
...
@@ -33,7 +33,7 @@ public class TestCompatibility extends TestBase {
}
private
void
testUniqueIndexSingleNull
()
throws
Exception
{
private
void
testUniqueIndexSingleNull
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
String
[]
modes
=
new
String
[]
{
"PostgreSQL"
,
"MySQL"
,
"HSQLDB"
,
"MSSQLServer"
,
"Derby"
,
"Oracle"
,
"Regular"
};
String
multiNull
=
"PostgreSQL,MySQL,Oracle,Regular"
;
...
...
@@ -52,7 +52,7 @@ public class TestCompatibility extends TestBase {
}
}
private
void
testUniqueIndexOracle
()
throws
Exception
{
private
void
testUniqueIndexOracle
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SET MODE ORACLE"
);
stat
.
execute
(
"create table t2(c1 int, c2 int)"
);
...
...
@@ -76,7 +76,7 @@ public class TestCompatibility extends TestBase {
stat
.
execute
(
"DROP TABLE T2"
);
}
private
void
testHsqlDb
()
throws
Exception
{
private
void
testHsqlDb
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"DROP TABLE TEST IF EXISTS; CREATE TABLE TEST(ID INT PRIMARY KEY); "
);
stat
.
execute
(
"CALL CURRENT_TIME"
);
...
...
@@ -95,7 +95,7 @@ public class TestCompatibility extends TestBase {
}
private
void
testMySQL
()
throws
Exception
{
private
void
testMySQL
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SELECT 1"
);
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCsv.java
浏览文件 @
c3fc6e3e
...
...
@@ -13,6 +13,7 @@ import java.sql.Connection;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.Random
;
...
...
@@ -44,7 +45,7 @@ public class TestCsv extends TestBase {
testPipe
();
}
private
void
testSpaceSeparated
()
throws
Exception
{
private
void
testSpaceSeparated
()
throws
SQL
Exception
{
deleteDb
(
"csv"
);
File
f
=
new
File
(
baseDir
+
"/testSpace.csv"
);
FileUtils
.
delete
(
f
.
getAbsolutePath
());
...
...
@@ -107,7 +108,7 @@ public class TestCsv extends TestBase {
FileUtils
.
delete
(
f
.
getAbsolutePath
());
}
private
void
testRandomData
()
throws
Exception
{
private
void
testRandomData
()
throws
SQL
Exception
{
deleteDb
(
"csv"
);
Connection
conn
=
getConnection
(
"csv"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -204,7 +205,7 @@ public class TestCsv extends TestBase {
conn
.
close
();
}
private
void
testPipe
()
throws
Exception
{
private
void
testPipe
()
throws
SQL
Exception
{
deleteDb
(
"csv"
);
Connection
conn
=
getConnection
(
"csv"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -226,7 +227,7 @@ public class TestCsv extends TestBase {
conn
.
close
();
}
private
void
testAsTable
()
throws
Exception
{
private
void
testAsTable
()
throws
SQL
Exception
{
deleteDb
(
"csv"
);
Connection
conn
=
getConnection
(
"csv"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -288,7 +289,7 @@ public class TestCsv extends TestBase {
// 201,2,0,18
}
private
void
testWriteRead
()
throws
Exception
{
private
void
testWriteRead
()
throws
SQL
Exception
{
deleteDb
(
"csv"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestDeadlock.java
浏览文件 @
c3fc6e3e
...
...
@@ -42,7 +42,7 @@ public class TestDeadlock extends TestBase {
testNoDeadlock
();
}
private
void
initTest
()
throws
Exception
{
private
void
initTest
()
throws
SQL
Exception
{
c1
=
getConnection
(
"deadlock"
);
c2
=
getConnection
(
"deadlock"
);
c3
=
getConnection
(
"deadlock"
);
...
...
@@ -239,7 +239,7 @@ public class TestDeadlock extends TestBase {
end
();
}
private
void
checkDeadlock
()
throws
Exception
{
private
void
checkDeadlock
()
throws
SQL
Exception
{
assertTrue
(
lastException
!=
null
);
assertKnownException
(
lastException
);
assertEquals
(
ErrorCode
.
DEADLOCK_1
,
lastException
.
getErrorCode
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestEncryptedDb.java
浏览文件 @
c3fc6e3e
...
...
@@ -18,7 +18,7 @@ import org.h2.test.TestBase;
*/
public
class
TestEncryptedDb
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
||
config
.
cipher
!=
null
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFullText.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.StringTokenizer
;
...
...
@@ -20,7 +21,7 @@ import org.h2.test.TestBase;
*/
public
class
TestFullText
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -45,7 +46,7 @@ public class TestFullText extends TestBase {
}
private
void
testReopen
(
boolean
lucene
)
throws
Exception
{
private
void
testReopen
(
boolean
lucene
)
throws
SQL
Exception
{
String
prefix
=
lucene
?
"FTL"
:
"FT"
;
deleteDb
(
"fullTextReopen"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullTextReopen"
);
...
...
@@ -66,7 +67,7 @@ public class TestFullText extends TestBase {
conn
.
close
();
}
private
void
testPerformance
(
boolean
lucene
)
throws
Exception
{
private
void
testPerformance
(
boolean
lucene
)
throws
SQL
Exception
{
deleteDb
(
"fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
);
Connection
conn
=
getConnection
(
"fullText"
);
...
...
@@ -107,7 +108,7 @@ public class TestFullText extends TestBase {
conn
.
close
();
}
private
void
test
(
boolean
lucene
,
String
dataType
)
throws
Exception
{
private
void
test
(
boolean
lucene
,
String
dataType
)
throws
SQL
Exception
{
deleteDb
(
"fullText"
);
Connection
conn
=
getConnection
(
"fullText"
);
String
prefix
=
lucene
?
"FTL_"
:
"FT_"
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctionOverload.java
浏览文件 @
c3fc6e3e
...
...
@@ -25,7 +25,7 @@ public class TestFunctionOverload extends TestBase {
private
Connection
conn
;
private
DatabaseMetaData
meta
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
this
.
deleteDb
(
"functionOverload"
);
conn
=
getConnection
(
"functionOverload"
);
meta
=
conn
.
getMetaData
();
...
...
@@ -37,7 +37,7 @@ public class TestFunctionOverload extends TestBase {
conn
.
close
();
}
private
void
testOverloadError
()
throws
Exception
{
private
void
testOverloadError
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
try
{
stat
.
execute
(
"create alias overloadError for \""
+
ME
+
".overloadError\""
);
...
...
@@ -47,7 +47,7 @@ public class TestFunctionOverload extends TestBase {
}
}
private
void
testControl
()
throws
Exception
{
private
void
testControl
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create alias overload0 for \""
+
ME
+
".overload0\""
);
ResultSet
rs
=
stat
.
executeQuery
(
"select overload0() from dual"
);
...
...
@@ -59,7 +59,7 @@ public class TestFunctionOverload extends TestBase {
assertFalse
(
rs
.
next
());
}
private
void
testOverload
()
throws
Exception
{
private
void
testOverload
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create alias overload1or2 for \""
+
ME
+
".overload1or2\""
);
ResultSet
rs
=
stat
.
executeQuery
(
"select overload1or2(1) from dual"
);
...
...
@@ -78,7 +78,7 @@ public class TestFunctionOverload extends TestBase {
assertFalse
(
rs
.
next
());
}
private
void
testOverloadNamedArgs
()
throws
Exception
{
private
void
testOverloadNamedArgs
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create alias overload1or2Named for \""
+
ME
+
".overload1or2(int)\""
);
...
...
@@ -100,7 +100,7 @@ public class TestFunctionOverload extends TestBase {
stat
.
close
();
}
private
void
testOverloadWithConnection
()
throws
Exception
{
private
void
testOverloadWithConnection
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create alias overload1or2WithConn for \""
+
ME
+
".overload1or2WithConn\""
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
c3fc6e3e
...
...
@@ -39,7 +39,7 @@ public class TestFunctions extends TestBase {
testFileRead
();
}
private
void
testVarArgs
()
throws
Exception
{
private
void
testVarArgs
()
throws
SQL
Exception
{
//## Java 1.5 begin ##
Connection
conn
=
getConnection
(
"functions"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -127,7 +127,7 @@ public class TestFunctions extends TestBase {
}
private
void
testAggregate
()
throws
Exception
{
private
void
testAggregate
()
throws
SQL
Exception
{
deleteDb
(
"functions"
);
Connection
conn
=
getConnection
(
"functions"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -163,7 +163,7 @@ public class TestFunctions extends TestBase {
conn
.
close
();
}
private
void
testFunctions
()
throws
Exception
{
private
void
testFunctions
()
throws
SQL
Exception
{
deleteDb
(
"functions"
);
Connection
conn
=
getConnection
(
"functions"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -298,7 +298,7 @@ public class TestFunctions extends TestBase {
conn
.
close
();
}
private
void
test
(
Statement
stat
,
String
sql
,
String
value
)
throws
Exception
{
private
void
test
(
Statement
stat
,
String
sql
,
String
value
)
throws
SQL
Exception
{
ResultSet
rs
=
stat
.
executeQuery
(
"CALL "
+
sql
);
rs
.
next
();
String
s
=
rs
.
getString
(
1
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestIndex.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Random
;
...
...
@@ -24,7 +25,7 @@ public class TestIndex extends TestBase {
private
Statement
stat
;
private
Random
random
=
new
Random
();
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testDescIndex
();
testHashIndex
();
...
...
@@ -70,7 +71,7 @@ public class TestIndex extends TestBase {
conn
.
close
();
}
private
void
testHashIndex
()
throws
Exception
{
private
void
testHashIndex
()
throws
SQL
Exception
{
reconnect
();
stat
.
execute
(
"create table testA(id int primary key, name varchar)"
);
stat
.
execute
(
"create table testB(id int primary key hash, name varchar)"
);
...
...
@@ -110,7 +111,7 @@ public class TestIndex extends TestBase {
conn
.
close
();
}
private
void
reconnect
()
throws
Exception
{
private
void
reconnect
()
throws
SQL
Exception
{
if
(
conn
!=
null
)
{
conn
.
close
();
conn
=
null
;
...
...
@@ -119,7 +120,7 @@ public class TestIndex extends TestBase {
stat
=
conn
.
createStatement
();
}
private
void
testDescIndex
()
throws
Exception
{
private
void
testDescIndex
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -155,7 +156,7 @@ public class TestIndex extends TestBase {
return
buff
.
toString
();
}
private
void
testWideIndex
(
int
length
)
throws
Exception
{
private
void
testWideIndex
(
int
length
)
throws
SQL
Exception
{
reconnect
();
stat
.
execute
(
"CREATE TABLE TEST(ID INT, NAME VARCHAR)"
);
stat
.
execute
(
"CREATE INDEX IDXNAME ON TEST(NAME)"
);
...
...
@@ -180,7 +181,7 @@ public class TestIndex extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testLike
()
throws
Exception
{
private
void
testLike
()
throws
SQL
Exception
{
reconnect
();
stat
.
execute
(
"CREATE TABLE ABC(ID INT, NAME VARCHAR)"
);
stat
.
execute
(
"INSERT INTO ABC VALUES(1, 'Hello')"
);
...
...
@@ -190,7 +191,7 @@ public class TestIndex extends TestBase {
stat
.
execute
(
"DROP TABLE ABC"
);
}
private
void
testConstraint
()
throws
Exception
{
private
void
testConstraint
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -201,7 +202,7 @@ public class TestIndex extends TestBase {
stat
.
execute
(
"DROP TABLE CHILD"
);
}
private
void
testLargeIndex
()
throws
Exception
{
private
void
testLargeIndex
()
throws
SQL
Exception
{
random
.
setSeed
(
10
);
for
(
int
i
=
1
;
i
<
100
;
i
+=
getSize
(
1000
,
3
))
{
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
...
...
@@ -226,7 +227,7 @@ public class TestIndex extends TestBase {
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
}
private
void
testHashIndex
(
boolean
primaryKey
,
boolean
hash
)
throws
Exception
{
private
void
testHashIndex
(
boolean
primaryKey
,
boolean
hash
)
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -264,7 +265,7 @@ public class TestIndex extends TestBase {
assertEquals
(
0
,
getValue
(
stat
,
"SELECT COUNT(*) FROM TEST"
));
}
private
void
testMultiColumnIndex
()
throws
Exception
{
private
void
testMultiColumnIndex
()
throws
SQL
Exception
{
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
stat
.
execute
(
"CREATE TABLE TEST(A INT, B INT)"
);
PreparedStatement
prep
;
...
...
@@ -288,7 +289,7 @@ public class TestIndex extends TestBase {
assertEquals
(
0
,
getValue
(
stat
,
"SELECT COUNT(*) FROM TEST"
));
}
private
void
testMultiColumnHashIndex
()
throws
Exception
{
private
void
testMultiColumnHashIndex
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -329,13 +330,13 @@ public class TestIndex extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
int
getValue
(
Statement
stat
,
String
sql
)
throws
Exception
{
private
int
getValue
(
Statement
stat
,
String
sql
)
throws
SQL
Exception
{
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
rs
.
next
();
return
rs
.
getInt
(
1
);
}
private
void
log
(
Statement
stat
,
String
sql
)
throws
Exception
{
private
void
log
(
Statement
stat
,
String
sql
)
throws
SQL
Exception
{
trace
(
sql
);
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
int
cols
=
rs
.
getMetaData
().
getColumnCount
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLinkedTable.java
浏览文件 @
c3fc6e3e
...
...
@@ -22,7 +22,7 @@ import org.h2.test.TestBase;
*/
public
class
TestLinkedTable
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
// testLinkAutoAdd();
testReadOnlyLinkedTable
();
testLinkOtherSchema
();
...
...
@@ -34,7 +34,7 @@ public class TestLinkedTable extends TestBase {
}
// this is not a bug, it is the documented behavior
// private void testLinkAutoAdd() throws Exception {
// private void testLinkAutoAdd() throws
SQL
Exception {
// Class.forName("org.h2.Driver");
// Connection ca =
// DriverManager.getConnection("jdbc:h2:mem:one", "sa", "sa");
...
...
@@ -53,8 +53,8 @@ public class TestLinkedTable extends TestBase {
// cb.close();
// }
private
void
testReadOnlyLinkedTable
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
private
void
testReadOnlyLinkedTable
()
throws
SQL
Exception
{
org
.
h2
.
Driver
.
load
(
);
Connection
ca
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:one"
,
"sa"
,
"sa"
);
Connection
cb
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:two"
,
"sa"
,
"sa"
);
Statement
sa
=
ca
.
createStatement
();
...
...
@@ -87,8 +87,8 @@ public class TestLinkedTable extends TestBase {
cb
.
close
();
}
private
void
testLinkOtherSchema
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
private
void
testLinkOtherSchema
()
throws
SQL
Exception
{
org
.
h2
.
Driver
.
load
(
);
Connection
ca
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:one"
,
"sa"
,
"sa"
);
Connection
cb
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:two"
,
"sa"
,
"sa"
);
Statement
sa
=
ca
.
createStatement
();
...
...
@@ -106,8 +106,8 @@ public class TestLinkedTable extends TestBase {
cb
.
close
();
}
private
void
testLinkTwoTables
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
private
void
testLinkTwoTables
()
throws
SQL
Exception
{
org
.
h2
.
Driver
.
load
(
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:one"
,
"sa"
,
"sa"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE SCHEMA Y"
);
...
...
@@ -129,8 +129,8 @@ public class TestLinkedTable extends TestBase {
conn2
.
close
();
}
private
void
testLinkDrop
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
private
void
testLinkDrop
()
throws
SQL
Exception
{
org
.
h2
.
Driver
.
load
(
);
Connection
connA
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:a"
);
Statement
statA
=
connA
.
createStatement
();
statA
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
...
...
@@ -150,10 +150,10 @@ public class TestLinkedTable extends TestBase {
connB
.
close
();
}
private
void
testLinkEmitUpdates
()
throws
Exception
{
private
void
testLinkEmitUpdates
()
throws
SQL
Exception
{
deleteDb
(
"linked1"
);
deleteDb
(
"linked2"
);
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:"
+
baseDir
+
"/linked1"
,
"sa1"
,
"abc"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -209,10 +209,10 @@ public class TestLinkedTable extends TestBase {
conn2
.
close
();
}
private
void
testLinkSchema
()
throws
Exception
{
private
void
testLinkSchema
()
throws
SQL
Exception
{
deleteDb
(
"linked1"
);
deleteDb
(
"linked2"
);
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:"
+
baseDir
+
"/linked1"
,
"sa1"
,
"abc"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -233,10 +233,10 @@ public class TestLinkedTable extends TestBase {
conn2
.
close
();
}
private
void
testLinkTable
()
throws
Exception
{
private
void
testLinkTable
()
throws
SQL
Exception
{
deleteDb
(
"linked1"
);
deleteDb
(
"linked2"
);
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:"
+
baseDir
+
"/linked1"
,
"sa1"
,
"abc"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -338,7 +338,7 @@ public class TestLinkedTable extends TestBase {
deleteDb
(
"linked2"
);
}
private
void
testRow
(
Statement
stat
,
String
name
)
throws
Exception
{
private
void
testRow
(
Statement
stat
,
String
name
)
throws
SQL
Exception
{
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM "
+
name
+
" WHERE ID=1"
);
rs
.
next
();
assertEquals
(
rs
.
getString
(
"NAME"
),
"Hello"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestListener.java
浏览文件 @
c3fc6e3e
...
...
@@ -29,7 +29,7 @@ public class TestListener extends TestBase implements DatabaseEventListener {
start
=
last
=
System
.
currentTimeMillis
();
}
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
networked
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.db;
import
java.io.ByteArrayInputStream
;
import
java.io.CharArrayReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.Reader
;
import
java.io.StringReader
;
...
...
@@ -61,7 +62,7 @@ public class TestLob extends TestBase {
testJavaObject
();
}
private
void
testLobServerMemory
()
throws
Exception
{
private
void
testLobServerMemory
()
throws
SQL
Exception
{
deleteDb
(
"lob"
);
Connection
conn
=
getConnection
(
"lob"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -73,7 +74,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
void
testLobDelete
()
throws
Exception
{
private
void
testLobDelete
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -104,7 +105,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
void
testLobVariable
()
throws
Exception
{
private
void
testLobVariable
()
throws
SQL
Exception
{
deleteDb
(
"lob"
);
Connection
conn
=
reconnect
(
null
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -121,7 +122,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
void
testLobDrop
()
throws
Exception
{
private
void
testLobDrop
()
throws
SQL
Exception
{
if
(
config
.
logMode
==
0
||
config
.
networked
)
{
return
;
}
...
...
@@ -193,7 +194,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
void
testLobTransactions
(
int
spaceLen
)
throws
Exception
{
private
void
testLobTransactions
(
int
spaceLen
)
throws
SQL
Exception
{
if
(
config
.
logMode
==
0
)
{
return
;
}
...
...
@@ -277,7 +278,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
void
testLobRollbackStop
()
throws
Exception
{
private
void
testLobRollbackStop
()
throws
SQL
Exception
{
if
(
config
.
logMode
==
0
)
{
return
;
}
...
...
@@ -297,7 +298,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
void
testLobCopy
()
throws
Exception
{
private
void
testLobCopy
()
throws
SQL
Exception
{
deleteDb
(
"lob"
);
Connection
conn
=
reconnect
(
null
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -403,7 +404,7 @@ public class TestLob extends TestBase {
conn0
.
close
();
}
private
void
testLobCopy
(
boolean
compress
)
throws
Exception
{
private
void
testLobCopy
(
boolean
compress
)
throws
SQL
Exception
{
deleteDb
(
"lob"
);
Connection
conn
;
conn
=
reconnect
(
null
);
...
...
@@ -582,7 +583,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
Connection
reconnect
(
Connection
conn
)
throws
Exception
{
private
Connection
reconnect
(
Connection
conn
)
throws
SQL
Exception
{
long
time
=
System
.
currentTimeMillis
();
if
(
conn
!=
null
)
{
conn
.
close
();
...
...
@@ -592,7 +593,7 @@ public class TestLob extends TestBase {
return
conn
;
}
private
void
testUpdateLob
()
throws
Exception
{
private
void
testUpdateLob
()
throws
SQL
Exception
{
deleteDb
(
"lob"
);
Connection
conn
;
conn
=
reconnect
(
null
);
...
...
@@ -757,7 +758,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
void
testJavaObject
()
throws
Exception
{
private
void
testJavaObject
()
throws
SQL
Exception
{
deleteDb
(
"lob"
);
Connection
conn
=
getConnection
(
"lob"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, DATA OTHER)"
);
...
...
@@ -776,7 +777,7 @@ public class TestLob extends TestBase {
conn
.
close
();
}
private
void
checkStream
(
InputStream
a
,
InputStream
b
,
int
len
)
throws
Exception
{
private
void
checkStream
(
InputStream
a
,
InputStream
b
,
int
len
)
throws
IO
Exception
{
// this doesn't actually read anything - just tests reading 0 bytes
a
.
read
(
new
byte
[
0
]);
b
.
read
(
new
byte
[
0
]);
...
...
@@ -800,7 +801,7 @@ public class TestLob extends TestBase {
b
.
close
();
}
private
void
checkReader
(
Reader
a
,
Reader
b
,
int
len
)
throws
Exception
{
private
void
checkReader
(
Reader
a
,
Reader
b
,
int
len
)
throws
IO
Exception
{
for
(
int
i
=
0
;
len
<
0
||
i
<
len
;
i
++)
{
int
ca
=
a
.
read
();
int
cb
=
b
.
read
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLogFile.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.io.File
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
...
...
@@ -24,7 +25,7 @@ public class TestLogFile extends TestBase {
private
static
final
int
MAX_LOG_SIZE
=
1
;
private
Connection
conn
;
private
long
reconnect
(
int
maxFiles
)
throws
Exception
{
private
long
reconnect
(
int
maxFiles
)
throws
SQL
Exception
{
if
(
conn
!=
null
)
{
conn
.
close
();
}
...
...
@@ -40,7 +41,7 @@ public class TestLogFile extends TestBase {
return
length
;
}
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -65,7 +66,7 @@ public class TestLogFile extends TestBase {
}
}
private
void
checkLogSize
()
throws
Exception
{
private
void
checkLogSize
()
throws
SQL
Exception
{
String
[]
files
=
new
File
(
"."
).
list
();
for
(
int
j
=
0
;
j
<
files
.
length
;
j
++)
{
String
name
=
files
[
j
];
...
...
@@ -76,7 +77,7 @@ public class TestLogFile extends TestBase {
}
}
private
void
insert
()
throws
Exception
{
private
void
insert
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SET LOGSIZE 200"
);
stat
.
execute
(
"SET MAX_LOG_SIZE "
+
MAX_LOG_SIZE
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestMemoryUsage.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Random
;
...
...
@@ -22,7 +23,7 @@ public class TestMemoryUsage extends TestBase {
private
Connection
conn
;
private
void
reconnect
()
throws
Exception
{
private
void
reconnect
()
throws
SQL
Exception
{
if
(
conn
!=
null
)
{
conn
.
close
();
}
...
...
@@ -31,7 +32,7 @@ public class TestMemoryUsage extends TestBase {
conn
=
getConnection
(
"memoryUsage"
);
}
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"memoryUsage"
);
testCreateIndex
();
testClob
();
...
...
@@ -45,7 +46,7 @@ public class TestMemoryUsage extends TestBase {
conn
.
close
();
}
private
void
testClob
()
throws
Exception
{
private
void
testClob
()
throws
SQL
Exception
{
if
(
config
.
memory
||
!
config
.
big
)
{
return
;
}
...
...
@@ -69,7 +70,7 @@ public class TestMemoryUsage extends TestBase {
conn
.
close
();
}
private
void
testCreateIndex
()
throws
Exception
{
private
void
testCreateIndex
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -95,7 +96,7 @@ public class TestMemoryUsage extends TestBase {
conn
.
close
();
}
private
void
testReconnectOften
()
throws
Exception
{
private
void
testReconnectOften
()
throws
SQL
Exception
{
int
len
=
getSize
(
1
,
2000
);
Connection
conn1
=
getConnection
(
"memoryUsage"
);
printTimeMemory
(
"start"
,
0
);
...
...
@@ -111,7 +112,7 @@ public class TestMemoryUsage extends TestBase {
conn1
.
close
();
}
private
void
insertUpdateSelectDelete
()
throws
Exception
{
private
void
insertUpdateSelectDelete
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
long
time
;
int
len
=
getSize
(
1
,
2000
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestMultiConn.java
浏览文件 @
c3fc6e3e
...
...
@@ -166,7 +166,7 @@ public class TestMultiConn extends TestBase implements DatabaseEventListener {
// do nothing
}
private
void
testCommitRollback
()
throws
Exception
{
private
void
testCommitRollback
()
throws
SQL
Exception
{
deleteDb
(
"multiConn"
);
Connection
c1
=
getConnection
(
"multiConn"
);
Connection
c2
=
getConnection
(
"multiConn"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestMultiDimension.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Random
;
...
...
@@ -20,7 +21,7 @@ import org.h2.tools.MultiDimension;
*/
public
class
TestMultiDimension
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
Random
rand
=
new
Random
(
10
);
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
int
x
=
rand
.
nextInt
(
1000
),
y
=
rand
.
nextInt
(
1000
),
z
=
rand
.
nextInt
(
1000
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestMultiThread.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Random
;
...
...
@@ -30,7 +31,7 @@ public class TestMultiThread extends TestBase implements Runnable {
// nothing to do
}
private
TestMultiThread
(
TestAll
config
,
TestMultiThread
parent
)
throws
Exception
{
private
TestMultiThread
(
TestAll
config
,
TestMultiThread
parent
)
throws
SQL
Exception
{
this
.
config
=
config
;
this
.
parent
=
parent
;
random
=
new
Random
();
...
...
@@ -63,7 +64,7 @@ public class TestMultiThread extends TestBase implements Runnable {
conn
.
close
();
}
private
Connection
getConnection
()
throws
Exception
{
private
Connection
getConnection
()
throws
SQL
Exception
{
return
getConnection
(
"jdbc:h2:mem:multiThread"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestOpenClose.java
浏览文件 @
c3fc6e3e
...
...
@@ -48,7 +48,7 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener {
conn
.
close
();
}
private
void
testBackup
(
boolean
encrypt
)
throws
Exception
{
private
void
testBackup
(
boolean
encrypt
)
throws
SQL
Exception
{
deleteDb
(
baseDir
,
"openClose"
);
String
url
;
if
(
encrypt
)
{
...
...
@@ -74,7 +74,7 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener {
conn
.
close
();
}
private
void
testReconnectFast
()
throws
Exception
{
private
void
testReconnectFast
()
throws
SQL
Exception
{
deleteDb
(
baseDir
,
"openClose"
);
String
url
=
"jdbc:h2:"
+
baseDir
+
"/openClose;DATABASE_EVENT_LISTENER='"
+
TestOpenClose
.
class
.
getName
()
+
"'"
;
...
...
@@ -108,7 +108,7 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener {
}
private
void
testCase
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
deleteDb
(
baseDir
,
"openClose"
);
final
String
url
=
"jdbc:h2:"
+
baseDir
+
"/openClose;FILE_LOCK=NO"
;
Connection
conn
=
DriverManager
.
getConnection
(
url
,
"sa"
,
""
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -41,7 +42,7 @@ public class TestOptimizations extends TestBase {
testMinMaxCountOptimization
(
false
);
}
private
void
testOptimizeInJoin
()
throws
Exception
{
private
void
testOptimizeInJoin
()
throws
SQL
Exception
{
boolean
old
=
SysProperties
.
optimizeInJoin
;
SysProperties
.
optimizeInJoin
=
true
;
...
...
@@ -62,7 +63,7 @@ public class TestOptimizations extends TestBase {
SysProperties
.
optimizeInJoin
=
old
;
}
private
void
testMinMaxNullOptimization
()
throws
Exception
{
private
void
testMinMaxNullOptimization
()
throws
SQL
Exception
{
deleteDb
(
"optimizations"
);
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -119,7 +120,7 @@ public class TestOptimizations extends TestBase {
conn
.
close
();
}
private
void
testMultiColumnRangeQuery
()
throws
Exception
{
private
void
testMultiColumnRangeQuery
()
throws
SQL
Exception
{
deleteDb
(
"optimizations"
);
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -135,7 +136,7 @@ public class TestOptimizations extends TestBase {
conn
.
close
();
}
private
void
testDistinctOptimization
()
throws
Exception
{
private
void
testDistinctOptimization
()
throws
SQL
Exception
{
deleteDb
(
"optimizations"
);
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -206,7 +207,7 @@ public class TestOptimizations extends TestBase {
conn
.
close
();
}
private
void
testQueryCacheSpeed
()
throws
Exception
{
private
void
testQueryCacheSpeed
()
throws
SQL
Exception
{
deleteDb
(
"optimizations"
);
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -220,7 +221,7 @@ public class TestOptimizations extends TestBase {
conn
.
close
();
}
private
void
testQuerySpeed
(
Statement
stat
,
String
sql
)
throws
Exception
{
private
void
testQuerySpeed
(
Statement
stat
,
String
sql
)
throws
SQL
Exception
{
stat
.
execute
(
"set OPTIMIZE_REUSE_RESULTS 0"
);
stat
.
execute
(
sql
);
long
time
=
System
.
currentTimeMillis
();
...
...
@@ -236,7 +237,7 @@ public class TestOptimizations extends TestBase {
}
}
private
void
testQueryCache
(
boolean
optimize
)
throws
Exception
{
private
void
testQueryCache
(
boolean
optimize
)
throws
SQL
Exception
{
deleteDb
(
"optimizations"
);
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -265,7 +266,7 @@ public class TestOptimizations extends TestBase {
conn
.
close
();
}
private
void
testMinMaxCountOptimization
(
boolean
memory
)
throws
Exception
{
private
void
testMinMaxCountOptimization
(
boolean
memory
)
throws
SQL
Exception
{
deleteDb
(
"optimizations"
);
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -340,7 +341,7 @@ public class TestOptimizations extends TestBase {
conn
.
close
();
}
private
void
testIn
()
throws
Exception
{
private
void
testIn
()
throws
SQL
Exception
{
deleteDb
(
"optimizations"
);
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestOutOfMemory.java
浏览文件 @
c3fc6e3e
...
...
@@ -24,7 +24,7 @@ public class TestOutOfMemory extends TestBase {
private
LinkedList
list
=
new
LinkedList
();
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestPowerOff.java
浏览文件 @
c3fc6e3e
...
...
@@ -33,7 +33,7 @@ public class TestPowerOff extends TestBase {
private
int
maxPowerOffCount
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
||
config
.
logMode
==
0
)
{
return
;
}
...
...
@@ -51,7 +51,7 @@ public class TestPowerOff extends TestBase {
testPersistentTables
();
}
private
void
testSummaryCrash
()
throws
Exception
{
private
void
testSummaryCrash
()
throws
SQL
Exception
{
if
(
config
.
networked
)
{
return
;
}
...
...
@@ -95,7 +95,7 @@ public class TestPowerOff extends TestBase {
conn
.
close
();
}
private
void
testCrash
()
throws
Exception
{
private
void
testCrash
()
throws
SQL
Exception
{
if
(
config
.
networked
)
{
return
;
}
...
...
@@ -135,7 +135,7 @@ public class TestPowerOff extends TestBase {
}
}
private
void
testShutdown
()
throws
Exception
{
private
void
testShutdown
()
throws
SQL
Exception
{
deleteDb
(
dir
,
dbName
);
Connection
conn
=
getConnection
(
url
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -152,7 +152,7 @@ public class TestPowerOff extends TestBase {
conn
.
close
();
}
private
void
testNoIndexFile
()
throws
Exception
{
private
void
testNoIndexFile
()
throws
SQL
Exception
{
if
(
config
.
networked
)
{
return
;
}
...
...
@@ -183,7 +183,7 @@ public class TestPowerOff extends TestBase {
conn
.
close
();
}
private
void
testMemoryTables
()
throws
Exception
{
private
void
testMemoryTables
()
throws
SQL
Exception
{
if
(
config
.
networked
)
{
return
;
}
...
...
@@ -213,7 +213,7 @@ public class TestPowerOff extends TestBase {
conn
.
close
();
}
private
void
testPersistentTables
()
throws
Exception
{
private
void
testPersistentTables
()
throws
SQL
Exception
{
if
(
config
.
networked
)
{
return
;
}
...
...
@@ -234,7 +234,7 @@ public class TestPowerOff extends TestBase {
recoverAndCheckConsistency
();
}
private
void
runTest
(
int
min
,
int
max
,
boolean
withConsistencyCheck
)
throws
Exception
{
private
void
runTest
(
int
min
,
int
max
,
boolean
withConsistencyCheck
)
throws
SQL
Exception
{
for
(
int
i
=
min
;
i
<
max
;
i
++)
{
deleteDb
(
dir
,
dbName
);
Database
.
setInitialPowerOffCount
(
i
);
...
...
@@ -249,7 +249,7 @@ public class TestPowerOff extends TestBase {
Database
.
setInitialPowerOffCount
(
0
);
}
private
int
testRun
(
boolean
init
)
throws
Exception
{
private
int
testRun
(
boolean
init
)
throws
SQL
Exception
{
if
(
init
)
{
Database
.
setInitialPowerOffCount
(
Integer
.
MAX_VALUE
);
}
...
...
@@ -289,7 +289,7 @@ public class TestPowerOff extends TestBase {
return
state
;
}
private
int
recoverAndCheckConsistency
()
throws
Exception
{
private
int
recoverAndCheckConsistency
()
throws
SQL
Exception
{
int
state
;
Database
.
setInitialPowerOffCount
(
0
);
Connection
conn
=
getConnection
(
url
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestReadOnly.java
浏览文件 @
c3fc6e3e
...
...
@@ -34,7 +34,7 @@ public class TestReadOnly extends TestBase {
}
}
private
void
testReadOnlyDbCreate
()
throws
Exception
{
private
void
testReadOnlyDbCreate
()
throws
SQL
Exception
{
if
(
config
.
deleteIndex
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestRights.java
浏览文件 @
c3fc6e3e
...
...
@@ -21,14 +21,14 @@ public class TestRights extends TestBase {
private
Statement
stat
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testDropTempTables
();
// testLowerCaseUser();
testSchemaRenameUser
();
testAccessRights
();
}
// public void testLowerCaseUser() throws Exception {
// public void testLowerCaseUser() throws
SQL
Exception {
// Documentation: For compatibility,
// only unquoted or uppercase user names are allowed.
// deleteDb("rights");
...
...
@@ -43,7 +43,7 @@ public class TestRights extends TestBase {
// conn.close();
// }
private
void
testDropTempTables
()
throws
Exception
{
private
void
testDropTempTables
()
throws
SQL
Exception
{
deleteDb
(
"rights"
);
Connection
conn
=
getConnection
(
"rights"
);
stat
=
conn
.
createStatement
();
...
...
@@ -65,7 +65,7 @@ public class TestRights extends TestBase {
conn
.
close
();
}
private
void
testSchemaRenameUser
()
throws
Exception
{
private
void
testSchemaRenameUser
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -98,7 +98,7 @@ public class TestRights extends TestBase {
conn
.
close
();
}
private
void
testAccessRights
()
throws
Exception
{
private
void
testAccessRights
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -236,7 +236,7 @@ public class TestRights extends TestBase {
conn
.
close
();
}
private
void
testTableType
(
Connection
conn
,
String
type
)
throws
Exception
{
private
void
testTableType
(
Connection
conn
,
String
type
)
throws
SQL
Exception
{
executeSuccess
(
"SET DEFAULT_TABLE_TYPE "
+
type
);
executeSuccess
(
"CREATE TABLE TEST(ID INT)"
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
...
...
@@ -246,7 +246,7 @@ public class TestRights extends TestBase {
executeSuccess
(
"DROP TABLE TEST"
);
}
private
void
executeError
(
String
sql
)
throws
Exception
{
private
void
executeError
(
String
sql
)
throws
SQL
Exception
{
try
{
stat
.
execute
(
sql
);
fail
(
"not admin"
);
...
...
@@ -255,7 +255,7 @@ public class TestRights extends TestBase {
}
}
private
void
executeSuccess
(
String
sql
)
throws
Exception
{
private
void
executeSuccess
(
String
sql
)
throws
SQL
Exception
{
if
(
stat
.
execute
(
sql
))
{
ResultSet
rs
=
stat
.
getResultSet
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestRunscript.java
浏览文件 @
c3fc6e3e
...
...
@@ -18,7 +18,7 @@ import org.h2.test.TestBase;
*/
public
class
TestRunscript
extends
TestBase
implements
Trigger
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
test
(
false
);
test
(
true
);
}
...
...
@@ -33,7 +33,7 @@ public class TestRunscript extends TestBase implements Trigger {
return
Math
.
abs
(
a
);
}
private
void
test
(
boolean
password
)
throws
Exception
{
private
void
test
(
boolean
password
)
throws
SQL
Exception
{
deleteDb
(
"runscript"
);
Connection
conn1
,
conn2
;
Statement
stat1
,
stat2
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSQLInjection.java
浏览文件 @
c3fc6e3e
...
...
@@ -22,7 +22,7 @@ public class TestSQLInjection extends TestBase {
private
Connection
conn
;
private
Statement
stat
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"sqlInjection"
);
reconnect
(
"sqlInjection"
);
stat
.
execute
(
"DROP TABLE IF EXISTS USERS"
);
...
...
@@ -89,7 +89,7 @@ public class TestSQLInjection extends TestBase {
return
rs
.
next
();
}
private
boolean
checkPasswordSecure
(
String
pwd
)
throws
Exception
{
private
boolean
checkPasswordSecure
(
String
pwd
)
throws
SQL
Exception
{
String
sql
=
"SELECT * FROM USERS WHERE PASSWORD=?"
;
PreparedStatement
prep
=
conn
.
prepareStatement
(
sql
);
prep
.
setString
(
1
,
pwd
);
...
...
@@ -97,7 +97,7 @@ public class TestSQLInjection extends TestBase {
return
rs
.
next
();
}
private
void
reconnect
(
String
name
)
throws
Exception
{
private
void
reconnect
(
String
name
)
throws
SQL
Exception
{
if
(!
config
.
memory
)
{
if
(
conn
!=
null
)
{
conn
.
close
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestScript.java
浏览文件 @
c3fc6e3e
...
...
@@ -294,7 +294,7 @@ public class TestScript extends TestBase {
writeResult
((
ordered
?
"rows (ordered): "
:
"rows: "
)
+
i
,
null
);
}
private
String
format
(
String
[]
row
,
int
[]
max
)
throws
Exception
{
private
String
format
(
String
[]
row
,
int
[]
max
)
throws
SQL
Exception
{
int
length
=
max
.
length
;
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
...
...
@@ -351,7 +351,7 @@ public class TestScript extends TestBase {
}
private
void
write
(
String
s
)
throws
Exception
{
private
void
write
(
String
s
)
{
line
++;
out
.
println
(
s
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestScriptSimple.java
浏览文件 @
c3fc6e3e
...
...
@@ -64,7 +64,7 @@ public class TestScriptSimple extends TestBase {
conn
.
close
();
}
private
void
reconnect
()
throws
Exception
{
private
void
reconnect
()
throws
SQL
Exception
{
if
(
conn
!=
null
)
{
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSequence.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -17,14 +18,14 @@ import org.h2.test.TestBase;
*/
public
class
TestSequence
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testAlterSequenceColumn
();
testAlterSequence
();
testCache
();
testTwo
();
}
private
void
testAlterSequenceColumn
()
throws
Exception
{
private
void
testAlterSequenceColumn
()
throws
SQL
Exception
{
deleteDb
(
"sequence"
);
Connection
conn
=
getConnection
(
"sequence"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -36,7 +37,7 @@ public class TestSequence extends TestBase {
conn
.
close
();
}
private
void
testAlterSequence
()
throws
Exception
{
private
void
testAlterSequence
()
throws
SQL
Exception
{
deleteDb
(
"sequence"
);
Connection
conn
=
getConnection
(
"sequence"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -49,7 +50,7 @@ public class TestSequence extends TestBase {
conn
.
close
();
}
private
void
testCache
()
throws
Exception
{
private
void
testCache
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -74,7 +75,7 @@ public class TestSequence extends TestBase {
conn
.
close
();
}
private
void
testTwo
()
throws
Exception
{
private
void
testTwo
()
throws
SQL
Exception
{
deleteDb
(
"sequence"
);
Connection
conn
=
getConnection
(
"sequence"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -101,7 +102,7 @@ public class TestSequence extends TestBase {
conn
.
close
();
}
private
long
getNext
(
Statement
stat
)
throws
Exception
{
private
long
getNext
(
Statement
stat
)
throws
SQL
Exception
{
ResultSet
rs
=
stat
.
executeQuery
(
"call next value for testSequence"
);
rs
.
next
();
long
value
=
rs
.
getLong
(
1
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSessionsLocks.java
浏览文件 @
c3fc6e3e
...
...
@@ -26,7 +26,7 @@ public class TestSessionsLocks extends TestBase {
testLocks
();
}
private
void
testLocks
()
throws
Exception
{
private
void
testLocks
()
throws
SQL
Exception
{
deleteDb
(
"sessionsLocks"
);
Connection
conn
=
getConnection
(
"sessionsLocks;MULTI_THREADED=1"
);
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSpaceReuse.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.db;
import
java.io.File
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -17,7 +18,7 @@ import org.h2.test.TestBase;
*/
public
class
TestSpaceReuse
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSpeed.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -23,7 +24,7 @@ public class TestSpeed extends TestBase {
// TODO test: here is more code, currently untested!
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"speed"
);
Connection
conn
;
...
...
@@ -157,7 +158,7 @@ public class TestSpeed extends TestBase {
trace
(
time
+
" close"
);
}
// private void testOuterJoin() throws Exception {
// private void testOuterJoin() throws
SQL
Exception {
// Class.forName("org.h2.jdbc.jdbcDriver");
// Connection conn = DriverManager.getConnection("jdbc:h2:test");
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestTempTables.java
浏览文件 @
c3fc6e3e
...
...
@@ -18,7 +18,7 @@ import org.h2.test.TestBase;
*/
public
class
TestTempTables
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"tempTables"
);
Connection
c1
=
getConnection
(
"tempTables"
);
Connection
c2
=
getConnection
(
"tempTables"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestTransaction.java
浏览文件 @
c3fc6e3e
...
...
@@ -23,14 +23,14 @@ import org.h2.test.TestBase;
*/
public
class
TestTransaction
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testSetTransaction
();
testReferential
();
testSavepoint
();
testIsolation
();
}
private
void
testSetTransaction
()
throws
Exception
{
private
void
testSetTransaction
()
throws
SQL
Exception
{
deleteDb
(
"transaction"
);
Connection
conn
=
getConnection
(
"transaction"
);
conn
.
setAutoCommit
(
false
);
...
...
@@ -51,7 +51,7 @@ public class TestTransaction extends TestBase {
conn
.
close
();
}
private
void
testReferential
()
throws
Exception
{
private
void
testReferential
()
throws
SQL
Exception
{
deleteDb
(
"transaction"
);
Connection
c1
=
getConnection
(
"transaction"
);
c1
.
setAutoCommit
(
false
);
...
...
@@ -76,7 +76,7 @@ public class TestTransaction extends TestBase {
c2
.
close
();
}
private
void
testSavepoint
()
throws
Exception
{
private
void
testSavepoint
()
throws
SQL
Exception
{
deleteDb
(
"transaction"
);
Connection
conn
=
getConnection
(
"transaction"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -136,14 +136,14 @@ public class TestTransaction extends TestBase {
conn
.
close
();
}
private
void
checkTableCount
(
Statement
stat
,
String
tableName
,
int
count
)
throws
Exception
{
private
void
checkTableCount
(
Statement
stat
,
String
tableName
,
int
count
)
throws
SQL
Exception
{
ResultSet
rs
;
rs
=
stat
.
executeQuery
(
"SELECT COUNT(*) FROM "
+
tableName
);
rs
.
next
();
assertEquals
(
count
,
rs
.
getInt
(
1
));
}
private
void
testIsolation
()
throws
Exception
{
private
void
testIsolation
()
throws
SQL
Exception
{
Connection
conn
=
getConnection
(
"transaction"
);
trace
(
"default TransactionIsolation="
+
conn
.
getTransactionIsolation
());
conn
.
setTransactionIsolation
(
Connection
.
TRANSACTION_READ_COMMITTED
);
...
...
@@ -174,7 +174,7 @@ public class TestTransaction extends TestBase {
conn
.
close
();
}
private
void
testNestedResultSets
(
Connection
conn
)
throws
Exception
{
private
void
testNestedResultSets
(
Connection
conn
)
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
test
(
stat
,
"CREATE TABLE NEST1(ID INT PRIMARY KEY,VALUE VARCHAR(255))"
);
test
(
stat
,
"CREATE TABLE NEST2(ID INT PRIMARY KEY,VALUE VARCHAR(255))"
);
...
...
@@ -236,7 +236,7 @@ public class TestTransaction extends TestBase {
test
(
stat
,
"DROP TABLE NEST2"
);
}
private
void
testValue
(
Statement
stat
,
String
sql
,
String
data
)
throws
Exception
{
private
void
testValue
(
Statement
stat
,
String
sql
,
String
data
)
throws
SQL
Exception
{
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
rs
.
next
();
String
s
=
rs
.
getString
(
1
);
...
...
@@ -245,7 +245,7 @@ public class TestTransaction extends TestBase {
}
}
private
void
test
(
Statement
stat
,
String
sql
)
throws
Exception
{
private
void
test
(
Statement
stat
,
String
sql
)
throws
SQL
Exception
{
trace
(
sql
);
stat
.
execute
(
sql
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestTriggersConstraints.java
浏览文件 @
c3fc6e3e
...
...
@@ -25,7 +25,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
private
String
triggerName
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"trigger"
);
testTriggerAlterTable
();
testTriggers
();
...
...
@@ -47,7 +47,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
}
}
private
void
testTriggerAlterTable
()
throws
Exception
{
private
void
testTriggerAlterTable
()
throws
SQL
Exception
{
Connection
conn
=
getConnection
(
"trigger"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
...
...
@@ -65,7 +65,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
conn
.
close
();
}
private
void
testConstraints
()
throws
Exception
{
private
void
testConstraints
()
throws
SQL
Exception
{
Connection
conn
=
getConnection
(
"trigger"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
...
...
@@ -78,7 +78,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
conn
.
close
();
}
private
void
testTriggers
()
throws
Exception
{
private
void
testTriggers
()
throws
SQL
Exception
{
mustNotCallTrigger
=
false
;
Connection
conn
=
getConnection
(
"trigger"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -142,7 +142,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
conn
.
close
();
}
private
void
checkRows
(
ResultSet
rs
,
String
[]
expected
)
throws
Exception
{
private
void
checkRows
(
ResultSet
rs
,
String
[]
expected
)
throws
SQL
Exception
{
HashSet
set
=
new
HashSet
(
Arrays
.
asList
(
expected
));
while
(
rs
.
next
())
{
set
.
remove
(
rs
.
getString
(
1
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestTwoPhaseCommit.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
...
...
@@ -17,7 +18,7 @@ import org.h2.test.TestBase;
* Tests for the two-phase-commit feature.
*/
public
class
TestTwoPhaseCommit
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
memory
||
config
.
networked
||
config
.
logMode
==
0
)
{
return
;
}
...
...
@@ -33,7 +34,7 @@ public class TestTwoPhaseCommit extends TestBase {
test
(
false
);
}
private
void
test
(
boolean
rolledBack
)
throws
Exception
{
private
void
test
(
boolean
rolledBack
)
throws
SQL
Exception
{
Connection
conn
=
getConnection
(
"twoPhaseCommit"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SET WRITE_DELAY 0"
);
...
...
@@ -50,7 +51,7 @@ public class TestTwoPhaseCommit extends TestBase {
conn
.
close
();
}
private
void
openWith
(
boolean
rollback
)
throws
Exception
{
private
void
openWith
(
boolean
rollback
)
throws
SQL
Exception
{
Connection
conn
=
getConnection
(
"twoPhaseCommit"
);
Statement
stat
=
conn
.
createStatement
();
ArrayList
list
=
new
ArrayList
();
...
...
@@ -69,7 +70,7 @@ public class TestTwoPhaseCommit extends TestBase {
conn
.
close
();
}
private
void
prepare
()
throws
Exception
{
private
void
prepare
()
throws
SQL
Exception
{
deleteDb
(
"twoPhaseCommit"
);
Connection
conn
=
getConnection
(
"twoPhaseCommit"
);
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestView.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -17,12 +18,12 @@ import org.h2.test.TestBase;
*/
public
class
TestView
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testUnionReconnect
();
testManyViews
();
}
private
void
testUnionReconnect
()
throws
Exception
{
private
void
testUnionReconnect
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -47,7 +48,7 @@ public class TestView extends TestBase {
deleteDb
(
"view"
);
}
private
void
testManyViews
()
throws
Exception
{
private
void
testManyViews
()
throws
SQL
Exception
{
deleteDb
(
"view"
);
Connection
conn
=
getConnection
(
"view"
);
Statement
s
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jaqu/SamplesTest.java
浏览文件 @
c3fc6e3e
...
...
@@ -39,11 +39,11 @@ public class SamplesTest extends TestBase {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
{
new
SamplesTest
().
test
();
}
public
void
test
()
throws
Exception
{
public
void
test
()
{
//## Java 1.5 begin ##
db
=
Db
.
open
(
"jdbc:h2:mem:"
,
"sa"
,
"sa"
);
db
.
insertAll
(
Product
.
getList
());
...
...
@@ -80,7 +80,7 @@ public class SamplesTest extends TestBase {
}
//## Java 1.5 begin ##
private
void
testWhereSimple2
()
throws
Exception
{
private
void
testWhereSimple2
()
{
// var soldOutProducts =
// from p in products
...
...
@@ -96,7 +96,7 @@ public class SamplesTest extends TestBase {
assertEquals
(
"[Chef Anton's Gumbo Mix: 0]"
,
soldOutProducts
.
toString
());
}
private
void
testWhereSimple3
()
throws
Exception
{
private
void
testWhereSimple3
()
{
// var expensiveInStockProducts =
// from p in products
...
...
@@ -116,7 +116,7 @@ public class SamplesTest extends TestBase {
}
private
void
testWhereSimple4
()
throws
Exception
{
private
void
testWhereSimple4
()
{
// var waCustomers =
// from c in customers
...
...
@@ -132,7 +132,7 @@ public class SamplesTest extends TestBase {
assertEquals
(
"[ALFKI, ANATR]"
,
waCustomers
.
toString
());
}
private
void
testSelectSimple2
()
throws
Exception
{
private
void
testSelectSimple2
()
{
// var productNames =
// from p in products
...
...
@@ -160,7 +160,7 @@ public class SamplesTest extends TestBase {
}
//## Java 1.5 begin ##
private
void
testAnonymousTypes3
()
throws
Exception
{
private
void
testAnonymousTypes3
()
{
// var productInfos =
// from p in products
...
...
@@ -204,7 +204,7 @@ public class SamplesTest extends TestBase {
}
//## Java 1.5 begin ##
private
void
testSelectManyCompoundFrom2
()
throws
Exception
{
private
void
testSelectManyCompoundFrom2
()
{
// var orders =
// from c in customers,
...
...
@@ -232,13 +232,13 @@ public class SamplesTest extends TestBase {
assertEquals
(
"[ANATR:10308:88.80]"
,
orders
.
toString
());
}
private
void
testIsNull
()
throws
Exception
{
private
void
testIsNull
()
{
Product
p
=
new
Product
();
String
sql
=
db
.
from
(
p
).
whereTrue
(
isNull
(
p
.
productName
)).
getSQL
();
assertEquals
(
"SELECT * FROM Product WHERE (productName IS NULL)"
,
sql
);
}
private
void
testDelete
()
throws
Exception
{
private
void
testDelete
()
{
Product
p
=
new
Product
();
int
deleted
=
db
.
from
(
p
).
where
(
p
.
productName
).
like
(
"A%"
).
delete
();
assertEquals
(
1
,
deleted
);
...
...
@@ -247,7 +247,7 @@ public class SamplesTest extends TestBase {
db
.
insertAll
(
Product
.
getList
());
}
private
void
testOrAndNot
()
throws
Exception
{
private
void
testOrAndNot
()
{
Product
p
=
new
Product
();
String
sql
=
db
.
from
(
p
).
whereTrue
(
not
(
isNull
(
p
.
productName
))).
getSQL
();
assertEquals
(
"SELECT * FROM Product WHERE (NOT productName IS NULL)"
,
sql
);
...
...
@@ -257,7 +257,7 @@ public class SamplesTest extends TestBase {
assertEquals
(
"SELECT * FROM Product WHERE ((productId = ?))"
,
sql
);
}
private
void
testLength
()
throws
Exception
{
private
void
testLength
()
{
Product
p
=
new
Product
();
List
<
Integer
>
lengths
=
db
.
from
(
p
).
where
(
length
(
p
.
productName
)).
smaller
(
10
).
...
...
@@ -266,7 +266,7 @@ public class SamplesTest extends TestBase {
assertEquals
(
"[4, 5]"
,
lengths
.
toString
());
}
private
void
testSum
()
throws
Exception
{
private
void
testSum
()
{
Product
p
=
new
Product
();
Integer
sum
=
db
.
from
(
p
).
selectFirst
(
sum
(
p
.
unitsInStock
));
assertEquals
(
323
,
sum
.
intValue
());
...
...
@@ -274,7 +274,7 @@ public class SamplesTest extends TestBase {
assertEquals
(
313.35
,
sumPrice
.
doubleValue
());
}
private
void
testMinMax
()
throws
Exception
{
private
void
testMinMax
()
{
Product
p
=
new
Product
();
Integer
min
=
db
.
from
(
p
).
selectFirst
(
min
(
p
.
unitsInStock
));
assertEquals
(
0
,
min
.
intValue
());
...
...
@@ -284,7 +284,7 @@ public class SamplesTest extends TestBase {
assertEquals
(
97.0
,
max
.
doubleValue
());
}
private
void
testLike
()
throws
Exception
{
private
void
testLike
()
{
Product
p
=
new
Product
();
List
<
Product
>
aList
=
db
.
from
(
p
).
where
(
p
.
productName
).
like
(
"Cha%"
).
...
...
@@ -292,12 +292,12 @@ public class SamplesTest extends TestBase {
assertEquals
(
"[Chai: 39, Chang: 17]"
,
aList
.
toString
());
}
private
void
testCount
()
throws
Exception
{
private
void
testCount
()
{
long
count
=
db
.
from
(
new
Product
()).
selectCount
();
assertEquals
(
10
,
count
);
}
private
void
testComplexObject
()
throws
Exception
{
private
void
testComplexObject
()
{
ComplexObject
co
=
new
ComplexObject
();
long
count
=
db
.
from
(
co
).
where
(
co
.
id
).
is
(
1
).
...
...
@@ -325,7 +325,7 @@ public class SamplesTest extends TestBase {
}
//## Java 1.5 begin ##
private
void
testGroup
()
throws
Exception
{
private
void
testGroup
()
{
// var orderGroups =
// from p in products
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestBatchUpdates.java
浏览文件 @
c3fc6e3e
...
...
@@ -14,6 +14,7 @@ import java.sql.Connection;
import
java.sql.DatabaseMetaData
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -42,13 +43,13 @@ public class TestBatchUpdates extends TestBase {
private
Statement
stat
;
private
PreparedStatement
prep
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testExecuteCall
();
testException
();
testCoffee
();
}
private
void
testExecuteCall
()
throws
Exception
{
private
void
testExecuteCall
()
throws
SQL
Exception
{
deleteDb
(
"batchUpdates"
);
Connection
conn
=
getConnection
(
"batchUpdates"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -80,7 +81,7 @@ public class TestBatchUpdates extends TestBase {
return
(
int
)
f
;
}
private
void
testException
()
throws
Exception
{
private
void
testException
()
throws
SQL
Exception
{
deleteDb
(
"batchUpdates"
);
Connection
conn
=
getConnection
(
"batchUpdates"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -106,7 +107,7 @@ public class TestBatchUpdates extends TestBase {
conn
.
close
();
}
private
void
testCoffee
()
throws
Exception
{
private
void
testCoffee
()
throws
SQL
Exception
{
deleteDb
(
"batchUpdates"
);
this
.
conn
=
getConnection
(
"batchUpdates"
);
stat
=
conn
.
createStatement
();
...
...
@@ -151,7 +152,7 @@ public class TestBatchUpdates extends TestBase {
conn
.
close
();
}
private
void
testAddBatch01
()
throws
Exception
{
private
void
testAddBatch01
()
throws
SQL
Exception
{
trace
(
"testAddBatch01"
);
int
i
=
0
;
int
[]
retValue
=
{
0
,
0
,
0
};
...
...
@@ -200,7 +201,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testAddBatch02
()
throws
Exception
{
private
void
testAddBatch02
()
throws
SQL
Exception
{
trace
(
"testAddBatch02"
);
int
i
=
0
;
int
[]
retValue
=
{
0
,
0
,
0
};
...
...
@@ -237,7 +238,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testClearBatch01
()
throws
Exception
{
private
void
testClearBatch01
()
throws
SQL
Exception
{
trace
(
"testClearBatch01"
);
String
sPrepStmt
=
COFFEE_UPDATE
;
trace
(
"Prepared Statement String:"
+
sPrepStmt
);
...
...
@@ -258,7 +259,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testClearBatch02
()
throws
Exception
{
private
void
testClearBatch02
()
throws
SQL
Exception
{
trace
(
"testClearBatch02"
);
int
updCountLength
=
0
;
String
sUpdCoffee
=
COFFEE_UPDATE1
;
...
...
@@ -278,7 +279,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testExecuteBatch01
()
throws
Exception
{
private
void
testExecuteBatch01
()
throws
SQL
Exception
{
trace
(
"testExecuteBatch01"
);
int
i
=
0
;
int
[]
retValue
=
{
0
,
0
,
0
};
...
...
@@ -327,7 +328,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testExecuteBatch02
()
throws
Exception
{
private
void
testExecuteBatch02
()
throws
SQL
Exception
{
trace
(
"testExecuteBatch02"
);
String
sPrepStmt
=
COFFEE_UPDATE
;
trace
(
"Prepared Statement String:"
+
sPrepStmt
);
...
...
@@ -345,7 +346,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testExecuteBatch03
()
throws
Exception
{
private
void
testExecuteBatch03
()
throws
SQL
Exception
{
trace
(
"testExecuteBatch03"
);
boolean
batchExceptionFlag
=
false
;
String
sPrepStmt
=
COFFEE_SELECT
;
...
...
@@ -366,7 +367,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testExecuteBatch04
()
throws
Exception
{
private
void
testExecuteBatch04
()
throws
SQL
Exception
{
trace
(
"testExecuteBatch04"
);
int
i
=
0
;
int
[]
retValue
=
{
0
,
0
,
0
};
...
...
@@ -402,7 +403,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testExecuteBatch05
()
throws
Exception
{
private
void
testExecuteBatch05
()
throws
SQL
Exception
{
trace
(
"testExecuteBatch05"
);
int
updCountLength
=
0
;
int
[]
updateCount
=
stat
.
executeBatch
();
...
...
@@ -415,7 +416,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testExecuteBatch06
()
throws
Exception
{
private
void
testExecuteBatch06
()
throws
SQL
Exception
{
trace
(
"testExecuteBatch06"
);
boolean
batchExceptionFlag
=
false
;
// Insert a row which is already Present
...
...
@@ -440,7 +441,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testExecuteBatch07
()
throws
Exception
{
private
void
testExecuteBatch07
()
throws
SQL
Exception
{
trace
(
"testExecuteBatch07"
);
boolean
batchExceptionFlag
=
false
;
String
selectCoffee
=
COFFEE_SELECT1
;
...
...
@@ -460,7 +461,7 @@ public class TestBatchUpdates extends TestBase {
}
}
private
void
testContinueBatch01
()
throws
Exception
{
private
void
testContinueBatch01
()
throws
SQL
Exception
{
trace
(
"testContinueBatch01"
);
int
[]
batchUpdates
=
{
0
,
0
,
0
};
int
buCountLen
=
0
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.jdbc;
import
java.sql.CallableStatement
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -18,14 +19,14 @@ import org.h2.test.TestBase;
*/
public
class
TestCallableStatement
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"callableStatement"
);
Connection
conn
=
getConnection
(
"preparedStatement"
);
testPrepare
(
conn
);
conn
.
close
();
}
private
void
testPrepare
(
Connection
conn
)
throws
Exception
{
private
void
testPrepare
(
Connection
conn
)
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
CallableStatement
call
;
ResultSet
rs
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestCancel.java
浏览文件 @
c3fc6e3e
...
...
@@ -68,7 +68,7 @@ public class TestCancel extends TestBase {
testCancelStatement
();
}
private
void
testReset
()
throws
Exception
{
private
void
testReset
()
throws
SQL
Exception
{
deleteDb
(
"cancel"
);
Connection
conn
=
getConnection
(
"cancel"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -84,7 +84,7 @@ public class TestCancel extends TestBase {
conn
.
close
();
}
private
void
testQueryTimeoutInTransaction
()
throws
Exception
{
private
void
testQueryTimeoutInTransaction
()
throws
SQL
Exception
{
deleteDb
(
"cancel"
);
Connection
conn
=
getConnection
(
"cancel"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -99,7 +99,7 @@ public class TestCancel extends TestBase {
conn
.
close
();
}
private
void
testJdbcQueryTimeout
()
throws
Exception
{
private
void
testJdbcQueryTimeout
()
throws
SQL
Exception
{
deleteDb
(
"cancel"
);
Connection
conn
=
getConnection
(
"cancel"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -123,7 +123,7 @@ public class TestCancel extends TestBase {
conn
.
close
();
}
private
void
testQueryTimeout
()
throws
Exception
{
private
void
testQueryTimeout
()
throws
SQL
Exception
{
deleteDb
(
"cancel"
);
Connection
conn
=
getConnection
(
"cancel"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -137,7 +137,7 @@ public class TestCancel extends TestBase {
conn
.
close
();
}
private
void
testMaxQueryTimeout
()
throws
Exception
{
private
void
testMaxQueryTimeout
()
throws
SQL
Exception
{
deleteDb
(
"cancel"
);
int
oldMax
=
SysProperties
.
getMaxQueryTimeout
();
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestDatabaseEventListener.java
浏览文件 @
c3fc6e3e
...
...
@@ -22,13 +22,13 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent
private
boolean
calledOpened
,
calledClosingDatabase
,
calledScan
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testCalled
();
testCloseLog0
(
false
);
testCloseLog0
(
true
);
}
private
void
testCloseLog0
(
boolean
shutdown
)
throws
Exception
{
private
void
testCloseLog0
(
boolean
shutdown
)
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
@@ -57,7 +57,7 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent
}
}
private
void
testCalled
()
throws
Exception
{
private
void
testCalled
()
throws
SQL
Exception
{
Properties
p
=
new
Properties
();
p
.
setProperty
(
"user"
,
"sa"
);
p
.
setProperty
(
"password"
,
"sa"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestManyJdbcObjects.java
浏览文件 @
c3fc6e3e
...
...
@@ -10,6 +10,7 @@ import java.sql.Connection;
import
java.sql.DatabaseMetaData
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.constant.SysProperties
;
...
...
@@ -20,13 +21,13 @@ import org.h2.test.TestBase;
*/
public
class
TestManyJdbcObjects
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testNestedResultSets
();
testManyConnections
();
testOneConnectionPrepare
();
}
private
void
testNestedResultSets
()
throws
Exception
{
private
void
testNestedResultSets
()
throws
SQL
Exception
{
if
(!
config
.
networked
)
{
return
;
}
...
...
@@ -41,7 +42,7 @@ public class TestManyJdbcObjects extends TestBase {
conn
.
close
();
}
private
void
testManyConnections
()
throws
Exception
{
private
void
testManyConnections
()
throws
SQL
Exception
{
if
(!
config
.
networked
||
config
.
memory
)
{
return
;
}
...
...
@@ -70,7 +71,7 @@ public class TestManyJdbcObjects extends TestBase {
SysProperties
.
runFinalize
=
true
;
}
private
void
testOneConnectionPrepare
()
throws
Exception
{
private
void
testOneConnectionPrepare
()
throws
SQL
Exception
{
deleteDb
(
"manyObjects"
);
SysProperties
.
runFinalize
=
false
;
Connection
conn
=
getConnection
(
"manyObjects"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestMetaData.java
浏览文件 @
c3fc6e3e
...
...
@@ -11,6 +11,7 @@ import java.sql.DatabaseMetaData;
import
java.sql.Driver
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Types
;
...
...
@@ -28,7 +29,7 @@ public class TestMetaData extends TestBase {
private
Statement
stat
;
private
String
catalog
=
"METADATA"
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"metaData"
);
conn
=
getConnection
(
"metaData"
);
...
...
@@ -197,7 +198,7 @@ public class TestMetaData extends TestBase {
}
private
void
testColumnLobMeta
()
throws
Exception
{
private
void
testColumnLobMeta
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
executeUpdate
(
"CREATE TABLE t (blob BLOB, clob CLOB)"
);
stat
.
execute
(
"INSERT INTO t VALUES('', '')"
);
...
...
@@ -211,7 +212,7 @@ public class TestMetaData extends TestBase {
stat
.
executeUpdate
(
"DROP TABLE t"
);
}
private
void
testColumnMetaData
()
throws
Exception
{
private
void
testColumnMetaData
()
throws
SQL
Exception
{
String
statement
=
"select substring('Hello',0,1)"
;
ResultSet
rs
=
conn
.
prepareStatement
(
statement
).
executeQuery
();
rs
.
next
();
...
...
@@ -219,7 +220,7 @@ public class TestMetaData extends TestBase {
assertEquals
(
Types
.
VARCHAR
,
type
);
}
private
void
testColumnPrecision
()
throws
Exception
{
private
void
testColumnPrecision
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE ONE(X NUMBER(12,2), Y FLOAT)"
);
stat
.
execute
(
"CREATE TABLE TWO AS SELECT * FROM ONE"
);
...
...
@@ -240,7 +241,7 @@ public class TestMetaData extends TestBase {
stat
.
execute
(
"DROP TABLE ONE, TWO"
);
}
private
void
testColumnDefault
()
throws
Exception
{
private
void
testColumnDefault
()
throws
SQL
Exception
{
DatabaseMetaData
meta
=
conn
.
getMetaData
();
ResultSet
rs
;
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -256,7 +257,7 @@ public class TestMetaData extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testProcedureColumns
()
throws
Exception
{
private
void
testProcedureColumns
()
throws
SQL
Exception
{
DatabaseMetaData
meta
=
conn
.
getMetaData
();
ResultSet
rs
;
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -286,7 +287,7 @@ public class TestMetaData extends TestBase {
stat
.
execute
(
"DROP ALIAS PROP"
);
}
private
void
testCrossReferences
()
throws
Exception
{
private
void
testCrossReferences
()
throws
SQL
Exception
{
DatabaseMetaData
meta
=
conn
.
getMetaData
();
ResultSet
rs
;
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -303,7 +304,7 @@ public class TestMetaData extends TestBase {
stat
.
execute
(
"DROP TABLE CHILD"
);
}
private
void
checkCrossRef
(
ResultSet
rs
)
throws
Exception
{
private
void
checkCrossRef
(
ResultSet
rs
)
throws
SQL
Exception
{
assertResultSetMeta
(
rs
,
14
,
new
String
[]
{
"PKTABLE_CAT"
,
"PKTABLE_SCHEM"
,
"PKTABLE_NAME"
,
"PKCOLUMN_NAME"
,
"FKTABLE_CAT"
,
"FKTABLE_SCHEM"
,
"FKTABLE_NAME"
,
"FKCOLUMN_NAME"
,
"KEY_SEQ"
,
"UPDATE_RULE"
,
"DELETE_RULE"
,
"FK_NAME"
,
"PK_NAME"
,
"DEFERRABILITY"
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
,
...
...
@@ -319,7 +320,7 @@ public class TestMetaData extends TestBase {
null
,
""
+
DatabaseMetaData
.
importedKeyNotDeferrable
}
});
}
private
void
testTempTable
()
throws
Exception
{
private
void
testTempTable
()
throws
SQL
Exception
{
Connection
conn
=
getConnection
(
"metaData"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"DROP TABLE IF EXISTS TEST_TEMP"
);
...
...
@@ -339,8 +340,8 @@ public class TestMetaData extends TestBase {
conn
.
close
();
}
private
void
testStatic
()
throws
Exception
{
Driver
dr
=
(
Driver
)
Class
.
forName
(
"org.h2.Driver"
).
newInstance
();
private
void
testStatic
()
throws
SQL
Exception
{
Driver
dr
=
org
.
h2
.
Driver
.
load
();
assertEquals
(
dr
.
getMajorVersion
(),
meta
.
getDriverMajorVersion
());
assertEquals
(
dr
.
getMinorVersion
(),
meta
.
getDriverMinorVersion
());
...
...
@@ -536,7 +537,7 @@ public class TestMetaData extends TestBase {
assertTrue
(
meta
.
usesLocalFiles
());
}
private
void
test
(
Connection
conn
)
throws
Exception
{
private
void
test
(
Connection
conn
)
throws
SQL
Exception
{
DatabaseMetaData
meta
=
conn
.
getMetaData
();
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestNativeSQL.java
浏览文件 @
c3fc6e3e
...
...
@@ -55,7 +55,7 @@ public class TestNativeSQL extends TestBase {
private
Connection
conn
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"nativeSql"
);
conn
=
getConnection
(
"nativeSql"
);
testPairs
();
...
...
@@ -66,7 +66,7 @@ public class TestNativeSQL extends TestBase {
assertTrue
(
conn
.
isClosed
());
}
private
void
testQuotes
()
throws
Exception
{
private
void
testQuotes
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
Random
random
=
new
Random
(
1
);
String
s
=
"'\"$/-* \n"
;
...
...
@@ -105,7 +105,7 @@ public class TestNativeSQL extends TestBase {
}
}
private
void
testRandom
()
throws
Exception
{
private
void
testRandom
()
throws
SQL
Exception
{
Random
random
=
new
Random
(
1
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
StringBuffer
buff
=
new
StringBuffer
(
"{oj }"
);
...
...
@@ -197,13 +197,13 @@ public class TestNativeSQL extends TestBase {
}
}
private
void
testPairs
()
throws
Exception
{
private
void
testPairs
()
throws
SQL
Exception
{
for
(
int
i
=
0
;
i
<
PAIRS
.
length
;
i
+=
2
)
{
test
(
conn
,
PAIRS
[
i
],
PAIRS
[
i
+
1
]);
}
}
private
void
testCases
()
throws
Exception
{
private
void
testCases
()
throws
SQL
Exception
{
conn
.
nativeSQL
(
"TEST"
);
conn
.
nativeSQL
(
"TEST--testing"
);
conn
.
nativeSQL
(
"TEST--testing{oj }"
);
...
...
@@ -231,7 +231,7 @@ public class TestNativeSQL extends TestBase {
assertFalse
(
conn
.
isClosed
());
}
private
void
test
(
Connection
conn
,
String
original
,
String
expected
)
throws
Exception
{
private
void
test
(
Connection
conn
,
String
original
,
String
expected
)
throws
SQL
Exception
{
trace
(
"original: <"
+
original
+
">"
);
trace
(
"expected: <"
+
expected
+
">"
);
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
c3fc6e3e
...
...
@@ -36,7 +36,7 @@ public class TestResultSet extends TestBase {
private
Connection
conn
;
private
Statement
stat
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"resultSet"
);
conn
=
getConnection
(
"resultSet"
);
...
...
@@ -70,7 +70,7 @@ public class TestResultSet extends TestBase {
}
private
void
testAbsolute
()
throws
Exception
{
private
void
testAbsolute
()
throws
SQL
Exception
{
// stat.execute("SET MAX_MEMORY_ROWS 90");
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY)"
);
// there was a problem when more than MAX_MEMORY_ROWS where in the result set
...
...
@@ -84,7 +84,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testFetchSize
()
throws
Exception
{
private
void
testFetchSize
()
throws
SQL
Exception
{
if
(!
config
.
networked
||
config
.
memory
)
{
return
;
}
...
...
@@ -97,7 +97,7 @@ public class TestResultSet extends TestBase {
assertEquals
(
a
+
1
,
b
);
}
private
void
testOwnUpdates
()
throws
Exception
{
private
void
testOwnUpdates
()
throws
SQL
Exception
{
DatabaseMetaData
meta
=
conn
.
getMetaData
();
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
int
type
=
i
==
0
?
ResultSet
.
TYPE_FORWARD_ONLY
:
i
==
1
?
ResultSet
.
TYPE_SCROLL_INSENSITIVE
:
ResultSet
.
TYPE_SCROLL_SENSITIVE
;
...
...
@@ -120,12 +120,12 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
checkPrecision
(
int
expected
,
String
sql
)
throws
Exception
{
private
void
checkPrecision
(
int
expected
,
String
sql
)
throws
SQL
Exception
{
ResultSetMetaData
meta
=
stat
.
executeQuery
(
sql
).
getMetaData
();
assertEquals
(
expected
,
meta
.
getPrecision
(
1
));
}
private
void
testSubstringPrecision
()
throws
Exception
{
private
void
testSubstringPrecision
()
throws
SQL
Exception
{
trace
(
"testSubstringPrecision"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT, NAME VARCHAR(10))"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1, 'Hello'), (2, 'WorldPeace')"
);
...
...
@@ -139,7 +139,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testFindColumn
()
throws
Exception
{
private
void
testFindColumn
()
throws
SQL
Exception
{
trace
(
"testFindColumn"
);
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE TEST(ID INT, NAME VARCHAR)"
);
...
...
@@ -177,7 +177,7 @@ public class TestResultSet extends TestBase {
}
private
void
testColumnLength
()
throws
Exception
{
private
void
testColumnLength
()
throws
SQL
Exception
{
trace
(
"testColumnDisplayLength"
);
ResultSet
rs
;
ResultSetMetaData
meta
;
...
...
@@ -214,7 +214,7 @@ public class TestResultSet extends TestBase {
}
private
void
testLimitMaxRows
()
throws
Exception
{
private
void
testLimitMaxRows
()
throws
SQL
Exception
{
trace
(
"Test LimitMaxRows"
);
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE one (C CHARACTER(10))"
);
...
...
@@ -234,7 +234,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE one"
);
}
private
void
testAutoIncrement
()
throws
Exception
{
private
void
testAutoIncrement
()
throws
SQL
Exception
{
trace
(
"Test AutoIncrement"
);
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
ResultSet
rs
;
...
...
@@ -264,7 +264,7 @@ public class TestResultSet extends TestBase {
}
private
void
testInt
()
throws
Exception
{
private
void
testInt
()
throws
SQL
Exception
{
trace
(
"Test INT"
);
ResultSet
rs
;
Object
o
;
...
...
@@ -420,7 +420,7 @@ public class TestResultSet extends TestBase {
stat
.
setMaxRows
(
0
);
}
private
void
testVarchar
()
throws
Exception
{
private
void
testVarchar
()
throws
SQL
Exception
{
trace
(
"Test VARCHAR"
);
ResultSet
rs
;
Object
o
;
...
...
@@ -504,7 +504,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testDecimal
()
throws
Exception
{
private
void
testDecimal
()
throws
SQL
Exception
{
trace
(
"Test DECIMAL"
);
ResultSet
rs
;
Object
o
;
...
...
@@ -555,7 +555,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testDoubleFloat
()
throws
Exception
{
private
void
testDoubleFloat
()
throws
SQL
Exception
{
trace
(
"Test DOUBLE - FLOAT"
);
ResultSet
rs
;
Object
o
;
...
...
@@ -621,7 +621,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testDatetime
()
throws
Exception
{
private
void
testDatetime
()
throws
SQL
Exception
{
trace
(
"Test DATETIME"
);
ResultSet
rs
;
Object
o
;
...
...
@@ -702,7 +702,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testDatetimeWithCalendar
()
throws
Exception
{
private
void
testDatetimeWithCalendar
()
throws
SQL
Exception
{
trace
(
"Test DATETIME with Calendar"
);
ResultSet
rs
;
...
...
@@ -795,7 +795,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testBlob
()
throws
Exception
{
private
void
testBlob
()
throws
SQL
Exception
{
trace
(
"Test BLOB"
);
ResultSet
rs
;
...
...
@@ -833,7 +833,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testClob
()
throws
Exception
{
private
void
testClob
()
throws
SQL
Exception
{
trace
(
"Test CLOB"
);
ResultSet
rs
;
String
string
;
...
...
@@ -900,7 +900,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testArray
()
throws
Exception
{
private
void
testArray
()
throws
SQL
Exception
{
trace
(
"Test ARRAY"
);
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, VALUE ARRAY)"
);
...
...
@@ -938,7 +938,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
byte
[]
readAllBytes
(
InputStream
in
)
throws
Exception
{
private
byte
[]
readAllBytes
(
InputStream
in
)
throws
SQL
Exception
{
if
(
in
==
null
)
{
return
null
;
}
...
...
@@ -958,7 +958,7 @@ public class TestResultSet extends TestBase {
}
}
private
void
checkBytes
(
byte
[]
test
,
byte
[]
good
)
throws
Exception
{
private
void
checkBytes
(
byte
[]
test
,
byte
[]
good
)
throws
SQL
Exception
{
if
(
test
==
null
||
good
==
null
)
{
assertTrue
(
test
==
good
);
}
else
{
...
...
@@ -966,7 +966,7 @@ public class TestResultSet extends TestBase {
}
}
private
void
checkColumnBigDecimal
(
ResultSet
rs
,
int
column
,
int
i
,
String
bd
)
throws
Exception
{
private
void
checkColumnBigDecimal
(
ResultSet
rs
,
int
column
,
int
i
,
String
bd
)
throws
SQL
Exception
{
BigDecimal
bd1
=
rs
.
getBigDecimal
(
column
);
int
i1
=
rs
.
getInt
(
column
);
if
(
bd
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestStatement.java
浏览文件 @
c3fc6e3e
...
...
@@ -23,7 +23,7 @@ public class TestStatement extends TestBase {
private
Connection
conn
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"statement"
);
conn
=
getConnection
(
"statement"
);
if
(
config
.
jdk14
)
{
...
...
@@ -37,7 +37,7 @@ public class TestStatement extends TestBase {
conn
.
close
();
}
private
void
testConnectionRollback
()
throws
Exception
{
private
void
testConnectionRollback
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
conn
.
setAutoCommit
(
false
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"
);
...
...
@@ -49,7 +49,7 @@ public class TestStatement extends TestBase {
conn
.
setAutoCommit
(
true
);
}
private
void
testSavepoint
()
throws
Exception
{
private
void
testSavepoint
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"
);
conn
.
setAutoCommit
(
false
);
...
...
@@ -103,7 +103,7 @@ public class TestStatement extends TestBase {
conn
.
setAutoCommit
(
true
);
}
private
void
testStatement
()
throws
Exception
{
private
void
testStatement
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -278,7 +278,7 @@ public class TestStatement extends TestBase {
stat
.
close
();
}
private
void
testIdentity
()
throws
Exception
{
private
void
testIdentity
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE SEQUENCE SEQ"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestTransactionIsolation.java
浏览文件 @
c3fc6e3e
...
...
@@ -18,7 +18,7 @@ public class TestTransactionIsolation extends TestBase {
private
Connection
conn1
,
conn2
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
mvcc
)
{
// no tests yet
}
else
{
...
...
@@ -26,7 +26,7 @@ public class TestTransactionIsolation extends TestBase {
}
}
private
void
testTableLevelLocking
()
throws
Exception
{
private
void
testTableLevelLocking
()
throws
SQL
Exception
{
deleteDb
(
"transactionIsolation"
);
conn1
=
getConnection
(
"transactionIsolation"
);
assertEquals
(
conn1
.
getTransactionIsolation
(),
Connection
.
TRANSACTION_READ_COMMITTED
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestUpdatableResultSet.java
浏览文件 @
c3fc6e3e
...
...
@@ -27,7 +27,7 @@ import org.h2.test.TestBase;
*/
public
class
TestUpdatableResultSet
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testUpdateLob
();
testScroll
();
testUpdateDeleteInsert
();
...
...
@@ -35,7 +35,7 @@ public class TestUpdatableResultSet extends TestBase {
testUpdateResetRead
();
}
private
void
testUpdateLob
()
throws
Exception
{
private
void
testUpdateLob
()
throws
SQL
Exception
{
deleteDb
(
"updatableResultSet"
);
Connection
conn
=
getConnection
(
"updatableResultSet"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -62,7 +62,7 @@ public class TestUpdatableResultSet extends TestBase {
conn
.
close
();
}
private
void
testUpdateResetRead
()
throws
Exception
{
private
void
testUpdateResetRead
()
throws
SQL
Exception
{
deleteDb
(
"updatableResultSet"
);
Connection
conn
=
getConnection
(
"updatableResultSet"
);
Statement
stat
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_READ_ONLY
);
...
...
@@ -86,7 +86,7 @@ public class TestUpdatableResultSet extends TestBase {
conn
.
close
();
}
private
void
testScroll
()
throws
Exception
{
private
void
testScroll
()
throws
SQL
Exception
{
deleteDb
(
"updatableResultSet"
);
Connection
conn
=
getConnection
(
"updatableResultSet"
);
Statement
stat
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_READ_ONLY
);
...
...
@@ -194,7 +194,7 @@ public class TestUpdatableResultSet extends TestBase {
conn
.
close
();
}
private
void
testUpdateDataType
()
throws
Exception
{
private
void
testUpdateDataType
()
throws
SQL
Exception
{
deleteDb
(
"updatableResultSet"
);
Connection
conn
=
getConnection
(
"updatableResultSet"
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -328,7 +328,7 @@ public class TestUpdatableResultSet extends TestBase {
conn
.
close
();
}
private
void
testUpdateDeleteInsert
()
throws
Exception
{
private
void
testUpdateDeleteInsert
()
throws
SQL
Exception
{
deleteDb
(
"updatableResultSet"
);
Connection
c1
=
getConnection
(
"updatableResultSet"
);
Connection
c2
=
getConnection
(
"updatableResultSet"
);
...
...
@@ -387,7 +387,7 @@ public class TestUpdatableResultSet extends TestBase {
conn
.
close
();
}
private
void
testScrollable
(
Connection
conn
,
int
rows
)
throws
Exception
{
private
void
testScrollable
(
Connection
conn
,
int
rows
)
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE IF NOT EXISTS TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"
);
stat
.
execute
(
"DELETE FROM TEST"
);
...
...
@@ -403,7 +403,7 @@ public class TestUpdatableResultSet extends TestBase {
testScrollResultSet
(
scroll
,
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
rows
);
}
private
void
testScrollResultSet
(
Statement
stat
,
int
type
,
int
rows
)
throws
Exception
{
private
void
testScrollResultSet
(
Statement
stat
,
int
type
,
int
rows
)
throws
SQL
Exception
{
boolean
error
=
false
;
if
(
type
==
ResultSet
.
TYPE_FORWARD_ONLY
)
{
error
=
true
;
...
...
@@ -456,7 +456,7 @@ public class TestUpdatableResultSet extends TestBase {
}
}
private
void
checkState
(
ResultSet
rs
,
boolean
beforeFirst
,
boolean
first
,
boolean
last
,
boolean
afterLast
)
throws
Exception
{
private
void
checkState
(
ResultSet
rs
,
boolean
beforeFirst
,
boolean
first
,
boolean
last
,
boolean
afterLast
)
throws
SQL
Exception
{
assertEquals
(
rs
.
isBeforeFirst
(),
beforeFirst
);
assertEquals
(
rs
.
isFirst
(),
first
);
assertEquals
(
rs
.
isLast
(),
last
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestZloty.java
浏览文件 @
c3fc6e3e
...
...
@@ -20,7 +20,7 @@ import org.h2.test.TestBase;
*/
public
class
TestZloty
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testZloty
();
testModifyBytes
();
}
...
...
@@ -42,7 +42,7 @@ public class TestZloty extends TestBase {
}
private
void
testModifyBytes
()
throws
Exception
{
private
void
testModifyBytes
()
throws
SQL
Exception
{
deleteDb
(
"zloty"
);
Connection
conn
=
getConnection
(
"zloty"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT, DATA BINARY)"
);
...
...
@@ -73,7 +73,7 @@ public class TestZloty extends TestBase {
*
* @author Maciej Wegorkiewicz
*/
private
void
testZloty
()
throws
Exception
{
private
void
testZloty
()
throws
SQL
Exception
{
deleteDb
(
"zloty"
);
Connection
conn
=
getConnection
(
"zloty"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT, AMOUNT DECIMAL)"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbcx/TestConnectionPool.java
浏览文件 @
c3fc6e3e
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
test
.
jdbcx
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.jdbcx.JdbcConnectionPool
;
...
...
@@ -64,7 +65,7 @@ public class TestConnectionPool extends TestBase {
man
.
dispose
();
}
private
JdbcConnectionPool
getConnectionPool
(
int
poolSize
)
throws
Exception
{
private
JdbcConnectionPool
getConnectionPool
(
int
poolSize
)
throws
SQL
Exception
{
JdbcDataSource
ds
=
new
JdbcDataSource
();
ds
.
setURL
(
getURL
(
"connectionPool"
,
true
));
ds
.
setUser
(
getUser
());
...
...
@@ -74,7 +75,7 @@ public class TestConnectionPool extends TestBase {
return
pool
;
}
private
void
testConnect
()
throws
Exception
{
private
void
testConnect
()
throws
SQL
Exception
{
JdbcConnectionPool
man
=
getConnectionPool
(
3
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
Connection
conn
=
man
.
getConnection
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbcx/TestDataSource.java
浏览文件 @
c3fc6e3e
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
test
.
jdbcx
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
javax.sql.ConnectionEvent
;
...
...
@@ -23,7 +24,7 @@ import org.h2.test.TestBase;
*/
public
class
TestDataSource
extends
TestBase
{
// public static void main(String[] args) throws Exception {
// public static void main(String[] args) throws
SQL
Exception {
//
// // first, need to start on the command line:
// // rmiregistry 1099
...
...
@@ -76,7 +77,7 @@ public class TestDataSource extends TestBase {
xaConn
.
close
();
}
private
void
testDataSource
()
throws
Exception
{
private
void
testDataSource
()
throws
SQL
Exception
{
deleteDb
(
baseDir
,
"dataSource"
);
JdbcDataSource
ds
=
new
JdbcDataSource
();
ds
.
setURL
(
"jdbc:h2:"
+
baseDir
+
"/dataSource"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbcx/TestXASimple.java
浏览文件 @
c3fc6e3e
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
test
.
jdbcx
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
javax.sql.XAConnection
;
...
...
@@ -18,11 +19,11 @@ import org.h2.test.TestBase;
*/
public
class
TestXASimple
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"xaSimple1"
);
deleteDb
(
"xaSimple2"
);
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
// InitialContext context = new InitialContext();
// context.rebind(USER_TRANSACTION_JNDI_NAME, j.getUserTransaction());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/mvcc/TestMvcc1.java
浏览文件 @
c3fc6e3e
...
...
@@ -23,12 +23,12 @@ public class TestMvcc1 extends TestBase {
private
Connection
c1
,
c2
;
private
Statement
s1
,
s2
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testSetMode
();
testCases
();
}
private
void
testSetMode
()
throws
Exception
{
private
void
testSetMode
()
throws
SQL
Exception
{
deleteDb
(
"mvcc1"
);
c1
=
getConnection
(
"mvcc1;MVCC=FALSE"
);
Statement
stat
=
c1
.
createStatement
();
...
...
@@ -47,7 +47,7 @@ public class TestMvcc1 extends TestBase {
c1
.
close
();
}
private
void
testCases
()
throws
Exception
{
private
void
testCases
()
throws
SQL
Exception
{
if
(!
config
.
mvcc
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/mvcc/TestMvcc2.java
浏览文件 @
c3fc6e3e
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
test
.
mvcc
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -21,7 +22,7 @@ public class TestMvcc2 extends TestBase {
private
static
final
String
INSERT
=
"INSERT INTO EMPLOYEE (id, version, NAME) VALUES (1, 1, 'Jones')"
;
private
static
final
String
UPDATE
=
"UPDATE EMPLOYEE SET NAME = 'Miller' WHERE version = 1"
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(!
config
.
mvcc
)
{
return
;
}
...
...
@@ -30,11 +31,11 @@ public class TestMvcc2 extends TestBase {
testInsertRollback
();
}
private
Connection
getConnection
()
throws
Exception
{
private
Connection
getConnection
()
throws
SQL
Exception
{
return
getConnection
(
"mvcc2"
);
}
private
void
testInsertUpdateRollback
()
throws
Exception
{
private
void
testInsertUpdateRollback
()
throws
SQL
Exception
{
Connection
conn
=
getConnection
();
conn
.
setAutoCommit
(
false
);
Statement
stmt
=
conn
.
createStatement
();
...
...
@@ -47,7 +48,7 @@ public class TestMvcc2 extends TestBase {
conn
.
close
();
}
private
void
testInsertRollback
()
throws
Exception
{
private
void
testInsertRollback
()
throws
SQL
Exception
{
Connection
conn
=
getConnection
();
conn
.
setAutoCommit
(
false
);
Statement
stmt
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/mvcc/TestMvcc3.java
浏览文件 @
c3fc6e3e
...
...
@@ -8,6 +8,7 @@ package org.h2.test.mvcc;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
...
...
@@ -17,14 +18,14 @@ import org.h2.test.TestBase;
*/
public
class
TestMvcc3
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
testCreateTableAsSelect
();
testSequence
();
testDisableAutoCommit
();
testRollback
();
}
private
void
testCreateTableAsSelect
()
throws
Exception
{
private
void
testCreateTableAsSelect
()
throws
SQL
Exception
{
if
(!
config
.
mvcc
)
{
return
;
}
...
...
@@ -41,7 +42,7 @@ public class TestMvcc3 extends TestBase {
c2
.
close
();
}
private
void
testRollback
()
throws
Exception
{
private
void
testRollback
()
throws
SQL
Exception
{
if
(!
config
.
mvcc
)
{
return
;
}
...
...
@@ -89,7 +90,7 @@ public class TestMvcc3 extends TestBase {
conn2
.
close
();
}
private
void
testDisableAutoCommit
()
throws
Exception
{
private
void
testDisableAutoCommit
()
throws
SQL
Exception
{
if
(!
config
.
mvcc
)
{
return
;
}
...
...
@@ -108,7 +109,7 @@ public class TestMvcc3 extends TestBase {
conn
.
close
();
}
private
void
testSequence
()
throws
Exception
{
private
void
testSequence
()
throws
SQL
Exception
{
if
(
config
.
memory
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/poweroff/Listener.java
浏览文件 @
c3fc6e3e
...
...
@@ -25,11 +25,11 @@ public class Listener implements Runnable {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
IO
Exception
{
new
Listener
().
test
(
args
);
}
private
void
test
(
String
[]
args
)
throws
Exception
{
private
void
test
(
String
[]
args
)
throws
IO
Exception
{
int
port
=
9099
;
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
args
[
i
].
equals
(
"-port"
))
{
...
...
@@ -50,7 +50,7 @@ public class Listener implements Runnable {
}
}
private
void
listen
(
int
port
)
throws
Exception
{
private
void
listen
(
int
port
)
throws
IO
Exception
{
new
Thread
(
this
).
start
();
ServerSocket
serverSocket
=
new
ServerSocket
(
port
);
System
.
out
.
println
(
"Listening on "
+
serverSocket
.
toString
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/poweroff/Test.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.poweroff;
import
java.io.DataOutputStream
;
import
java.io.File
;
import
java.io.FileDescriptor
;
import
java.io.IOException
;
import
java.io.RandomAccessFile
;
import
java.net.Socket
;
import
java.sql.Connection
;
...
...
@@ -116,7 +117,7 @@ public class Test {
}
}
private
void
testFile
(
DataOutputStream
out
)
throws
Exception
{
private
void
testFile
(
DataOutputStream
out
)
throws
IO
Exception
{
File
file
=
new
File
(
"test.txt"
);
if
(
file
.
exists
())
{
file
.
delete
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/poweroff/TestRecover.java
浏览文件 @
c3fc6e3e
...
...
@@ -81,7 +81,7 @@ public class TestRecover {
testLoop
();
}
private
static
File
backup
(
String
sourcePath
,
String
targetPath
,
String
basePath
,
int
max
,
String
node
)
throws
Exception
{
private
static
File
backup
(
String
sourcePath
,
String
targetPath
,
String
basePath
,
int
max
,
String
node
)
throws
IO
Exception
{
File
root
=
new
File
(
targetPath
);
if
(!
root
.
exists
())
{
root
.
mkdirs
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/rowlock/TestRowLocks.java
浏览文件 @
c3fc6e3e
...
...
@@ -39,7 +39,7 @@ public class TestRowLocks extends TestBase {
testCases
();
}
private
void
testSetMode
()
throws
Exception
{
private
void
testSetMode
()
throws
SQL
Exception
{
deleteDb
(
"rowLocks"
);
c1
=
getConnection
(
"rowLocks"
);
Statement
stat
=
c1
.
createStatement
();
...
...
@@ -102,7 +102,7 @@ public class TestRowLocks extends TestBase {
c2
.
close
();
}
private
String
getSingleValue
(
Statement
stat
,
String
sql
)
throws
Exception
{
private
String
getSingleValue
(
Statement
stat
,
String
sql
)
throws
SQL
Exception
{
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
return
rs
.
next
()
?
rs
.
getString
(
1
)
:
null
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/server/TestNestedLoop.java
浏览文件 @
c3fc6e3e
...
...
@@ -19,7 +19,7 @@ import org.h2.test.TestBase;
*/
public
class
TestNestedLoop
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"nestedLoop"
);
Connection
conn
=
getConnection
(
"nestedLoop"
);
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/server/TestPgServer.java
浏览文件 @
c3fc6e3e
...
...
@@ -23,7 +23,7 @@ import org.h2.tools.Server;
*/
public
class
TestPgServer
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"test"
);
Server
server
=
Server
.
createPgServer
(
new
String
[]{
"-baseDir"
,
baseDir
,
"-pgPort"
,
"5535"
});
server
.
start
();
...
...
@@ -37,7 +37,7 @@ public class TestPgServer extends TestBase {
}
}
private
void
testPgClient
()
throws
Exception
{
private
void
testPgClient
()
throws
SQL
Exception
{
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:postgresql://localhost:5535/test"
,
"sa"
,
"sa"
);
Statement
stat
=
conn
.
createStatement
();
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestBtreeIndex.java
浏览文件 @
c3fc6e3e
...
...
@@ -22,7 +22,7 @@ import org.h2.tools.DeleteDbFiles;
*/
public
class
TestBtreeIndex
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
Random
random
=
new
Random
();
while
(
true
)
{
int
seed
=
random
.
nextInt
();
...
...
@@ -30,15 +30,15 @@ public class TestBtreeIndex extends TestBase {
}
}
public
void
testCase
(
int
seed
)
throws
Exception
{
public
void
testCase
(
int
seed
)
throws
SQL
Exception
{
String
old
=
baseDir
;
baseDir
=
TestBase
.
getTestDir
(
"index"
);
testOne
(
seed
);
baseDir
=
old
;
}
private
void
testOne
(
int
seed
)
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
private
void
testOne
(
int
seed
)
throws
SQL
Exception
{
org
.
h2
.
Driver
.
load
(
);
printTime
(
"testIndex "
+
seed
);
Random
random
=
new
Random
(
seed
);
int
distinct
,
prefixLength
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
c3fc6e3e
...
...
@@ -65,7 +65,7 @@ public class TestCrashAPI extends TestBase {
}
}
private
Connection
getConnection
(
int
seed
,
boolean
delete
)
throws
Exception
{
private
Connection
getConnection
(
int
seed
,
boolean
delete
)
throws
SQL
Exception
{
openCount
++;
if
(
delete
)
{
deleteDb
();
...
...
@@ -148,7 +148,7 @@ public class TestCrashAPI extends TestBase {
return
conn
;
}
private
void
testOne
(
int
seed
)
throws
Exception
{
private
void
testOne
(
int
seed
)
throws
SQL
Exception
{
printTime
(
"seed: "
+
seed
);
callCount
=
0
;
openCount
=
0
;
...
...
@@ -239,7 +239,7 @@ public class TestCrashAPI extends TestBase {
" "
+
t
.
getMessage
(),
t
);
}
private
Object
callRandom
(
int
seed
,
int
id
,
int
objectId
,
Object
o
,
Method
m
)
throws
Exception
{
private
Object
callRandom
(
int
seed
,
int
id
,
int
objectId
,
Object
o
,
Method
m
)
throws
SQL
Exception
{
Class
[]
paramClasses
=
m
.
getParameterTypes
();
Object
[]
params
=
new
Object
[
paramClasses
.
length
];
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++)
{
...
...
@@ -399,12 +399,12 @@ public class TestCrashAPI extends TestBase {
TestScript
script
=
new
TestScript
();
ArrayList
add
=
script
.
getAllStatements
(
config
,
"org/h2/test/test.in.txt"
);
initMethods
();
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
statements
.
addAll
(
add
);
return
this
;
}
public
void
testCase
(
int
i
)
throws
Exception
{
public
void
testCase
(
int
i
)
throws
SQL
Exception
{
int
old
=
SysProperties
.
getMaxQueryTimeout
();
String
oldBaseDir
=
baseDir
;
try
{
...
...
@@ -417,7 +417,7 @@ public class TestCrashAPI extends TestBase {
}
}
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
mvcc
||
config
.
networked
||
config
.
logMode
==
0
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestHalt.java
浏览文件 @
c3fc6e3e
...
...
@@ -13,6 +13,7 @@ import java.io.InputStream;
import
java.io.PrintWriter
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Random
;
...
...
@@ -99,12 +100,12 @@ public abstract class TestHalt extends TestBase {
/**
* Initialize the test.
*/
abstract
void
testInit
()
throws
Exception
;
abstract
void
testInit
()
throws
SQL
Exception
;
/**
* Check if the database is consistent after a simulated database crash.
*/
abstract
void
testCheckAfterCrash
()
throws
Exception
;
abstract
void
testCheckAfterCrash
()
throws
SQL
Exception
;
/**
* Wait for some time after the application has been started.
...
...
@@ -114,15 +115,14 @@ public abstract class TestHalt extends TestBase {
/**
* Start the application.
*/
abstract
void
appStart
()
throws
Exception
;
abstract
void
appStart
()
throws
SQL
Exception
;
/**
* Run the application.
* @throws Exception
*/
abstract
void
appRun
()
throws
Exception
;
abstract
void
appRun
()
throws
SQL
Exception
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
for
(
int
i
=
0
;;
i
++)
{
operations
=
OP_INSERT
|
i
;
flags
=
i
>>
4
;
...
...
@@ -136,8 +136,8 @@ public abstract class TestHalt extends TestBase {
}
}
Connection
getConnection
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
Connection
getConnection
()
throws
SQL
Exception
{
org
.
h2
.
Driver
.
load
(
);
return
DriverManager
.
getConnection
(
"jdbc:h2:"
+
baseDir
+
"/halt"
,
"sa"
,
"sa"
);
}
...
...
@@ -157,7 +157,7 @@ public abstract class TestHalt extends TestBase {
}
}
private
void
runRandom
()
throws
Exception
{
private
void
runRandom
()
throws
SQL
Exception
{
connect
();
try
{
traceOperation
(
"connected, operations:"
+
operations
+
" flags:"
+
flags
+
" value:"
+
value
);
...
...
@@ -173,11 +173,11 @@ public abstract class TestHalt extends TestBase {
disconnect
();
}
private
void
connect
()
throws
Exception
{
private
void
connect
()
throws
SQL
Exception
{
try
{
traceOperation
(
"connecting"
);
conn
=
getConnection
();
}
catch
(
Exception
e
)
{
}
catch
(
SQL
Exception
e
)
{
trace
(
"connect"
,
e
);
e
.
printStackTrace
();
throw
e
;
...
...
@@ -287,7 +287,7 @@ public abstract class TestHalt extends TestBase {
}
}
// public Connection getConnectionHSQLDB() throws Exception {
// public Connection getConnectionHSQLDB() throws
SQL
Exception {
// File lock = new File("test.lck");
// while (lock.exists()) {
// lock.delete();
...
...
@@ -297,7 +297,7 @@ public abstract class TestHalt extends TestBase {
// return DriverManager.getConnection("jdbc:hsqldb:test", "sa", "");
// }
// public Connection getConnectionDerby() throws Exception {
// public Connection getConnectionDerby() throws
SQL
Exception {
// File lock = new File("test3/db.lck");
// while (lock.exists()) {
// lock.delete();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestHaltApp.java
浏览文件 @
c3fc6e3e
...
...
@@ -69,9 +69,9 @@ public class TestHaltApp extends TestHalt {
* This method is called after a simulated crash. The method should check if
* the data is transactionally consistent and throw an exception if not.
*
* @throws
Exception
if the data is not consistent.
* @throws
SQLException
if the data is not consistent.
*/
protected
void
testCheckAfterCrash
()
throws
Exception
{
protected
void
testCheckAfterCrash
()
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT COUNT(*) FROM TEST"
);
rs
.
next
();
...
...
@@ -79,7 +79,7 @@ public class TestHaltApp extends TestHalt {
System
.
out
.
println
(
"count: "
+
count
);
if
(
count
%
2
==
1
)
{
traceOperation
(
"row count: "
+
count
);
throw
new
Exception
(
"Unexpected odd row count"
);
throw
new
SQL
Exception
(
"Unexpected odd row count"
);
}
}
...
...
@@ -101,7 +101,7 @@ public class TestHaltApp extends TestHalt {
/**
* Run the application code.
*/
protected
void
appRun
()
throws
Exception
{
protected
void
appRun
()
throws
SQL
Exception
{
conn
.
setAutoCommit
(
false
);
traceOperation
(
"setAutoCommit false"
);
int
rows
=
10000
+
value
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestJoin.java
浏览文件 @
c3fc6e3e
...
...
@@ -226,11 +226,11 @@ public class TestJoin extends TestBase {
buff
.
append
(
" "
);
}
private
void
execute
(
String
sql
,
Object
[]
params
)
throws
Exception
{
private
void
execute
(
String
sql
,
Object
[]
params
)
throws
SQL
Exception
{
execute
(
sql
,
params
,
false
);
}
private
void
execute
(
String
sql
,
Object
[]
params
,
boolean
ignoreDifference
)
throws
Exception
{
private
void
execute
(
String
sql
,
Object
[]
params
,
boolean
ignoreDifference
)
throws
SQL
Exception
{
String
first
=
null
;
for
(
int
i
=
0
;
i
<
connections
.
size
();
i
++)
{
Connection
conn
=
(
Connection
)
connections
.
get
(
i
);
...
...
@@ -262,7 +262,7 @@ public class TestJoin extends TestBase {
first
=
s
;
}
else
{
if
(!
ignoreDifference
&&
!
s
.
equals
(
first
))
{
throw
new
Exception
(
"FAIL s:"
+
s
+
" first:"
+
first
+
" sql:"
+
sql
);
fail
(
"FAIL s:"
+
s
+
" first:"
+
first
+
" sql:"
+
sql
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestKill.java
浏览文件 @
c3fc6e3e
...
...
@@ -102,7 +102,7 @@ public class TestKill extends TestBase {
}
}
private
void
checkData
()
throws
Exception
{
private
void
checkData
()
throws
SQL
Exception
{
trace
(
"checkData..."
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM ACCOUNT ORDER BY ID"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"SELECT SUM(AMOUNT) FROM LOG WHERE ACCOUNTID=?"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestKillProcess.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ 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
;
...
...
@@ -30,7 +31,7 @@ public class TestKillProcess {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
SQL
Exception
{
SelfDestructor
.
startCountdown
(
60
);
try
{
Class
.
forName
(
"org.h2.Driver"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestKillRestart.java
浏览文件 @
c3fc6e3e
...
...
@@ -11,6 +11,7 @@ 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
;
...
...
@@ -68,7 +69,7 @@ public class TestKillRestart extends TestBase {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
SQL
Exception
{
SelfDestructor
.
startCountdown
(
60
);
String
driver
=
"org.h2.Driver"
;
String
url
=
"jdbc:h2:test"
,
user
=
"sa"
,
password
=
"sa"
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestKillRestartMulti.java
浏览文件 @
c3fc6e3e
...
...
@@ -119,12 +119,12 @@ public class TestKillRestartMulti extends TestBase {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
SQL
Exception
{
SelfDestructor
.
startCountdown
(
60
);
new
TestKillRestartMulti
().
test
(
args
);
}
private
void
test
(
String
[]
args
)
throws
Exception
{
private
void
test
(
String
[]
args
)
throws
SQL
Exception
{
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
"-url"
.
equals
(
args
[
i
]))
{
url
=
args
[++
i
];
...
...
@@ -235,7 +235,7 @@ public class TestKillRestartMulti extends TestBase {
return
conn
;
}
private
void
createTable
(
Random
random
)
throws
Exception
{
private
void
createTable
(
Random
random
)
throws
SQL
Exception
{
Connection
conn
=
(
Connection
)
connections
.
get
(
random
.
nextInt
(
connections
.
size
()));
Statement
stat
=
conn
.
createStatement
();
String
table
=
"TEST"
+
random
.
nextInt
(
10
);
...
...
@@ -256,7 +256,7 @@ public class TestKillRestartMulti extends TestBase {
}
}
private
void
testConsistent
(
Connection
conn
)
throws
Exception
{
private
void
testConsistent
(
Connection
conn
)
throws
SQL
Exception
{
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
Statement
stat
=
conn
.
createStatement
();
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestRandomSQL.java
浏览文件 @
c3fc6e3e
...
...
@@ -50,7 +50,7 @@ public class TestRandomSQL extends TestBase {
// return "dataRandomSQL/randomSql" + dbId+";TRACE_LEVEL_FILE=3";
}
private
Connection
connect
()
throws
Exception
{
private
Connection
connect
()
throws
SQL
Exception
{
while
(
true
)
{
try
{
return
getConnection
(
getDatabaseName
());
...
...
@@ -122,7 +122,7 @@ public class TestRandomSQL extends TestBase {
return
this
;
}
private
void
testWithSeed
(
Bnf
config
)
throws
Exception
{
private
void
testWithSeed
(
Bnf
config
)
throws
SQL
Exception
{
config
.
getRandom
().
setSeed
(
seed
);
Connection
conn
=
null
;
try
{
...
...
@@ -164,7 +164,7 @@ public class TestRandomSQL extends TestBase {
}
}
public
void
testCase
(
int
i
)
throws
Exception
{
public
void
testCase
(
int
i
)
throws
SQL
Exception
{
String
old
=
SysProperties
.
scriptDirectory
;
SysProperties
.
scriptDirectory
=
"dataScript/"
;
seed
=
i
;
...
...
@@ -178,7 +178,7 @@ public class TestRandomSQL extends TestBase {
SysProperties
.
scriptDirectory
=
old
;
}
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
if
(
config
.
networked
)
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestSimpleIndex.java
浏览文件 @
c3fc6e3e
...
...
@@ -24,7 +24,7 @@ public class TestSimpleIndex extends TestBase {
private
Statement
stat
;
private
RandomGen
random
;
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
deleteDb
(
"simpleIndex"
);
conn
=
getConnection
(
"simpleIndex"
);
random
=
new
RandomGen
();
...
...
@@ -34,7 +34,7 @@ public class TestSimpleIndex extends TestBase {
}
}
private
void
testIndex
(
int
seed
)
throws
Exception
{
private
void
testIndex
(
int
seed
)
throws
SQL
Exception
{
random
.
setSeed
(
seed
);
String
unique
=
random
.
nextBoolean
()
?
"UNIQUE "
:
""
;
int
len
=
random
.
getInt
(
2
)
+
1
;
...
...
@@ -64,7 +64,7 @@ public class TestSimpleIndex extends TestBase {
execute
(
"DROP TABLE TEST_DI"
);
}
private
void
testRows
()
throws
Exception
{
private
void
testRows
()
throws
SQL
Exception
{
String
a
=
randomValue
(),
b
=
randomValue
(),
c
=
randomValue
();
String
data
=
a
+
"/"
+
b
+
"/"
+
c
;
String
sql
=
"VALUES("
+
a
+
", "
+
b
+
", "
+
c
+
", '"
+
data
+
"')"
;
...
...
@@ -138,7 +138,7 @@ public class TestSimpleIndex extends TestBase {
assertEquals
(
r1
,
r4
);
}
private
String
getResult
(
String
sql
)
throws
Exception
{
private
String
getResult
(
String
sql
)
throws
SQL
Exception
{
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
StringBuffer
buff
=
new
StringBuffer
();
while
(
rs
.
next
())
{
...
...
@@ -153,7 +153,7 @@ public class TestSimpleIndex extends TestBase {
return
random
.
getInt
(
10
)
==
0
?
"NULL"
:
""
+
(
random
.
getInt
(
100
)
-
50
);
}
private
void
execute
(
String
sql
)
throws
Exception
{
private
void
execute
(
String
sql
)
throws
SQL
Exception
{
try
{
println
(
sql
+
";"
);
stat
.
execute
(
sql
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestThreads.java
浏览文件 @
c3fc6e3e
...
...
@@ -9,6 +9,7 @@ package org.h2.test.synth;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Random
;
...
...
@@ -78,7 +79,7 @@ public class TestThreads extends TestBase implements Runnable {
conn
.
close
();
}
private
void
insertRows
(
Connection
conn
,
String
tableName
,
int
len
)
throws
Exception
{
private
void
insertRows
(
Connection
conn
,
String
tableName
,
int
len
)
throws
SQL
Exception
{
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO "
+
tableName
+
" VALUES(?, 'Hi')"
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
prep
.
setInt
(
1
,
i
);
...
...
@@ -86,7 +87,7 @@ public class TestThreads extends TestBase implements Runnable {
}
}
private
void
checkTable
(
Connection
conn
,
String
tableName
)
throws
Exception
{
private
void
checkTable
(
Connection
conn
,
String
tableName
)
throws
SQL
Exception
{
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM "
+
tableName
+
" ORDER BY ID"
);
while
(
rs
.
next
())
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestTimer.java
浏览文件 @
c3fc6e3e
...
...
@@ -24,13 +24,13 @@ import org.h2.tools.DeleteDbFiles;
*/
public
class
TestTimer
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
validateOld
();
DeleteDbFiles
.
execute
(
baseDir
,
"timer"
,
true
);
loop
();
}
private
void
loop
()
throws
Exception
{
private
void
loop
()
throws
SQL
Exception
{
println
(
"loop"
);
Connection
conn
=
getConnection
(
"timer"
);
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/sql/TestSynth.java
浏览文件 @
c3fc6e3e
...
...
@@ -280,7 +280,7 @@ public class TestSynth extends TestBase {
// "");
mode
=
H2_MEM
;
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
addDatabase
(
"org.h2.Driver"
,
"jdbc:h2:mem:synth"
,
"sa"
,
""
,
true
);
addDatabase
(
"org.h2.Driver"
,
"jdbc:h2:"
+
baseDir
+
"/"
+
DIR
+
"/synth"
,
"sa"
,
""
,
false
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/thread/TestMulti.java
浏览文件 @
c3fc6e3e
...
...
@@ -23,7 +23,7 @@ public class TestMulti extends TestBase {
public
volatile
boolean
stop
;
public
void
test
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
org
.
h2
.
Driver
.
load
(
);
deleteDb
(
baseDir
,
"openClose"
);
// int len = getSize(5, 100);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/thread/TestMultiNews.java
浏览文件 @
c3fc6e3e
...
...
@@ -77,7 +77,7 @@ public class TestMultiNews extends TestMultiThread {
conn
.
close
();
}
void
finalTest
()
throws
Exception
{
void
finalTest
()
throws
SQL
Exception
{
// nothing to do
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/thread/TestMultiOrder.java
浏览文件 @
c3fc6e3e
...
...
@@ -132,7 +132,7 @@ public class TestMultiOrder extends TestMultiThread {
conn
.
close
();
}
void
finalTest
()
throws
Exception
{
void
finalTest
()
throws
SQL
Exception
{
conn
=
base
.
getConnection
();
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"select count(*) from customer"
);
rs
.
next
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/thread/TestMultiThread.java
浏览文件 @
c3fc6e3e
...
...
@@ -54,9 +54,9 @@ abstract class TestMultiThread extends Thread {
/**
* This method is called once after all threads have been stopped.
* @throws
Exception
* @throws
SQLException
*/
abstract
void
finalTest
()
throws
Exception
;
abstract
void
finalTest
()
throws
SQL
Exception
;
public
void
run
()
{
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/trace/Player.java
浏览文件 @
c3fc6e3e
...
...
@@ -62,7 +62,7 @@ public class Player {
*
* @param args the arguments of the application
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
IO
Exception
{
new
Player
().
run
(
args
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestExit.java
浏览文件 @
c3fc6e3e
...
...
@@ -70,7 +70,7 @@ public class TestExit extends TestBase implements DatabaseEventListener {
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
SQL
Exception
{
SelfDestructor
.
startCountdown
(
60
);
if
(
args
.
length
==
0
)
{
System
.
exit
(
1
);
...
...
@@ -80,8 +80,8 @@ public class TestExit extends TestBase implements DatabaseEventListener {
app
.
execute
(
action
);
}
private
void
execute
(
int
action
)
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
private
void
execute
(
int
action
)
throws
SQL
Exception
{
org
.
h2
.
Driver
.
load
(
);
String
url
=
""
;
switch
(
action
)
{
case
OPEN_WITH_CLOSE_ON_EXIT:
...
...
@@ -99,7 +99,7 @@ public class TestExit extends TestBase implements DatabaseEventListener {
conn2
.
close
();
}
private
static
Connection
open
(
String
url
)
throws
Exception
{
private
static
Connection
open
(
String
url
)
throws
SQL
Exception
{
getClosedFile
().
delete
();
return
DriverManager
.
getConnection
(
url
,
"sa"
,
""
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestPattern.java
浏览文件 @
c3fc6e3e
...
...
@@ -6,6 +6,8 @@
*/
package
org
.
h2
.
test
.
unit
;
import
java.sql.SQLException
;
import
org.h2.expression.CompareLike
;
import
org.h2.test.TestBase
;
import
org.h2.value.CompareMode
;
...
...
@@ -15,7 +17,7 @@ import org.h2.value.CompareMode;
*/
public
class
TestPattern
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
SQL
Exception
{
CompareMode
mode
=
new
CompareMode
(
null
,
null
,
100
);
CompareLike
comp
=
new
CompareLike
(
mode
,
null
,
null
,
null
,
false
);
test
(
comp
,
"B"
,
"%_"
);
...
...
@@ -30,7 +32,7 @@ public class TestPattern extends TestBase {
}
}
private
void
test
(
CompareLike
comp
,
String
value
,
String
pattern
)
throws
Exception
{
private
void
test
(
CompareLike
comp
,
String
value
,
String
pattern
)
throws
SQL
Exception
{
String
regexp
=
initPatternRegexp
(
pattern
,
'\\'
);
boolean
resultRegexp
=
value
.
matches
(
regexp
);
boolean
result
=
comp
.
test
(
pattern
,
value
,
'\\'
);
...
...
@@ -65,7 +67,7 @@ public class TestPattern extends TestBase {
return
buff
.
toString
();
}
private
String
initPatternRegexp
(
String
pattern
,
char
escape
)
throws
Exception
{
private
String
initPatternRegexp
(
String
pattern
,
char
escape
)
{
int
len
=
pattern
.
length
();
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestRecovery.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestScriptReader.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestSecurity.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestServlet.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestShell.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestStreams.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestStringCache.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestStringUtils.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestValue.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestValueHashMap.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
h2/src/test/org/h2/test/unit/TestValueMemory.java
浏览文件 @
c3fc6e3e
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论