Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
79304ac8
提交
79304ac8
authored
14 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make methods static if possible.
上级
c5e2da62
显示空白字符变更
内嵌
并排
正在显示
57 个修改的文件
包含
118 行增加
和
146 行删除
+118
-146
Set.java
h2/src/main/org/h2/command/dml/Set.java
+1
-1
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+1
-1
FileStoreInputStream.java
h2/src/main/org/h2/store/FileStoreInputStream.java
+1
-1
CompressTool.java
h2/src/main/org/h2/tools/CompressTool.java
+4
-9
CreateScriptFile.java
h2/src/test/org/h2/samples/CreateScriptFile.java
+2
-2
InitDatabaseFromJar.java
h2/src/test/org/h2/samples/InitDatabaseFromJar.java
+2
-2
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+3
-3
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+5
-17
TestPerformance.java
h2/src/test/org/h2/test/bench/TestPerformance.java
+4
-4
Profile.java
h2/src/test/org/h2/test/coverage/Profile.java
+4
-4
TaskProcess.java
h2/src/test/org/h2/test/db/TaskProcess.java
+1
-1
TestCsv.java
h2/src/test/org/h2/test/db/TestCsv.java
+1
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+1
-1
TestLinkedTable.java
h2/src/test/org/h2/test/db/TestLinkedTable.java
+2
-2
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+5
-5
TestScript.java
h2/src/test/org/h2/test/db/TestScript.java
+4
-4
TestSequence.java
h2/src/test/org/h2/test/db/TestSequence.java
+1
-1
TestTempTables.java
h2/src/test/org/h2/test/db/TestTempTables.java
+2
-2
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+2
-3
TestConnectionPool.java
h2/src/test/org/h2/test/jdbcx/TestConnectionPool.java
+1
-1
TestXASimple.java
h2/src/test/org/h2/test/jdbcx/TestXASimple.java
+1
-1
Test.java
h2/src/test/org/h2/test/poweroff/Test.java
+3
-7
TestRecover.java
h2/src/test/org/h2/test/poweroff/TestRecover.java
+6
-10
TestRowLocks.java
h2/src/test/org/h2/test/rowlock/TestRowLocks.java
+1
-1
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+1
-1
TestJoin.java
h2/src/test/org/h2/test/synth/TestJoin.java
+1
-1
TestKillRestartMulti.java
h2/src/test/org/h2/test/synth/TestKillRestartMulti.java
+1
-1
TestNestedJoins.java
h2/src/test/org/h2/test/synth/TestNestedJoins.java
+2
-2
TestOuterJoins.java
h2/src/test/org/h2/test/synth/TestOuterJoins.java
+4
-4
TestPowerOffFs2.java
h2/src/test/org/h2/test/synth/TestPowerOffFs2.java
+1
-1
TestRandomCompare.java
h2/src/test/org/h2/test/synth/TestRandomCompare.java
+2
-2
TestThreads.java
h2/src/test/org/h2/test/synth/TestThreads.java
+2
-2
Expression.java
h2/src/test/org/h2/test/synth/sql/Expression.java
+1
-1
TestMultiOrder.java
h2/src/test/org/h2/test/synth/thread/TestMultiOrder.java
+5
-5
TestTempTableCrash.java
h2/src/test/org/h2/test/todo/TestTempTableCrash.java
+1
-1
TestUndoLogLarge.java
h2/src/test/org/h2/test/todo/TestUndoLogLarge.java
+2
-1
TestUndoLogMemory.java
h2/src/test/org/h2/test/todo/TestUndoLogMemory.java
+2
-1
Arg.java
h2/src/test/org/h2/test/trace/Arg.java
+1
-1
TestCache.java
h2/src/test/org/h2/test/unit/TestCache.java
+1
-1
TestCompress.java
h2/src/test/org/h2/test/unit/TestCompress.java
+1
-1
TestDataPage.java
h2/src/test/org/h2/test/unit/TestDataPage.java
+1
-1
TestDate.java
h2/src/test/org/h2/test/unit/TestDate.java
+2
-2
TestIntArray.java
h2/src/test/org/h2/test/unit/TestIntArray.java
+5
-5
TestOldVersion.java
h2/src/test/org/h2/test/unit/TestOldVersion.java
+2
-2
TestPageStore.java
h2/src/test/org/h2/test/unit/TestPageStore.java
+1
-1
TestScriptReader.java
h2/src/test/org/h2/test/unit/TestScriptReader.java
+1
-1
TestSecurity.java
h2/src/test/org/h2/test/unit/TestSecurity.java
+10
-13
TestStreams.java
h2/src/test/org/h2/test/unit/TestStreams.java
+1
-1
TestTraceSystem.java
h2/src/test/org/h2/test/unit/TestTraceSystem.java
+1
-1
TestValueMemory.java
h2/src/test/org/h2/test/unit/TestValueMemory.java
+1
-1
MemoryFootprint.java
h2/src/test/org/h2/test/utils/MemoryFootprint.java
+1
-2
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+1
-1
PgTcpRedirect.java
h2/src/tools/org/h2/dev/net/PgTcpRedirect.java
+1
-1
SQLStatement.java
h2/src/tools/org/h2/jaqu/SQLStatement.java
+1
-1
TableDefinition.java
h2/src/tools/org/h2/jaqu/TableDefinition.java
+1
-1
ClassReader.java
h2/src/tools/org/h2/jaqu/bytecode/ClassReader.java
+1
-1
JavaParser.java
h2/src/tools/org/h2/java/JavaParser.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
79304ac8
...
@@ -132,7 +132,7 @@ public class Set extends Prepared {
...
@@ -132,7 +132,7 @@ public class Set extends Prepared {
}
}
case
SetTypes
.
COMPRESS_LOB
:
{
case
SetTypes
.
COMPRESS_LOB
:
{
session
.
getUser
().
checkAdmin
();
session
.
getUser
().
checkAdmin
();
int
algo
=
CompressTool
.
get
Instance
().
get
CompressAlgorithm
(
stringValue
);
int
algo
=
CompressTool
.
getCompressAlgorithm
(
stringValue
);
database
.
setLobCompressionAlgorithm
(
algo
==
Compressor
.
NO
?
null
:
stringValue
);
database
.
setLobCompressionAlgorithm
(
algo
==
Compressor
.
NO
?
null
:
stringValue
);
addOrUpdateSetting
(
name
,
stringValue
,
0
);
addOrUpdateSetting
(
name
,
stringValue
,
0
);
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
79304ac8
...
@@ -59,7 +59,7 @@ implements XAConnection, XAResource
...
@@ -59,7 +59,7 @@ implements XAConnection, XAResource
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
}
}
JdbcXAConnection
(
JdbcDataSourceFactory
factory
,
int
id
,
JdbcConnection
physicalConn
)
throws
SQLException
{
JdbcXAConnection
(
JdbcDataSourceFactory
factory
,
int
id
,
JdbcConnection
physicalConn
)
{
this
.
factory
=
factory
;
this
.
factory
=
factory
;
setTrace
(
factory
.
getTrace
(),
TraceObject
.
XA_DATA_SOURCE
,
id
);
setTrace
(
factory
.
getTrace
(),
TraceObject
.
XA_DATA_SOURCE
,
id
);
this
.
physicalConn
=
physicalConn
;
this
.
physicalConn
=
physicalConn
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/FileStoreInputStream.java
浏览文件 @
79304ac8
...
@@ -117,7 +117,7 @@ public class FileStoreInputStream extends InputStream {
...
@@ -117,7 +117,7 @@ public class FileStoreInputStream extends InputStream {
page
.
read
(
buff
,
0
,
remainingInBuffer
);
page
.
read
(
buff
,
0
,
remainingInBuffer
);
page
.
reset
();
page
.
reset
();
page
.
checkCapacity
(
uncompressed
);
page
.
checkCapacity
(
uncompressed
);
compress
.
expand
(
buff
,
page
.
getBytes
(),
0
);
CompressTool
.
expand
(
buff
,
page
.
getBytes
(),
0
);
remainingInBuffer
=
uncompressed
;
remainingInBuffer
=
uncompressed
;
}
}
if
(
alwaysClose
)
{
if
(
alwaysClose
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/CompressTool.java
浏览文件 @
79304ac8
...
@@ -69,7 +69,6 @@ public class CompressTool {
...
@@ -69,7 +69,6 @@ public class CompressTool {
* @param in the byte array with the original data
* @param in the byte array with the original data
* @param algorithm the algorithm (LZF, DEFLATE)
* @param algorithm the algorithm (LZF, DEFLATE)
* @return the compressed data
* @return the compressed data
* @throws SQLException if a error occurs
*/
*/
public
byte
[]
compress
(
byte
[]
in
,
String
algorithm
)
{
public
byte
[]
compress
(
byte
[]
in
,
String
algorithm
)
{
int
len
=
in
.
length
;
int
len
=
in
.
length
;
...
@@ -84,10 +83,7 @@ public class CompressTool {
...
@@ -84,10 +83,7 @@ public class CompressTool {
return
out
;
return
out
;
}
}
/**
private
static
int
compress
(
byte
[]
in
,
int
len
,
Compressor
compress
,
byte
[]
out
)
{
* INTERNAL
*/
public
int
compress
(
byte
[]
in
,
int
len
,
Compressor
compress
,
byte
[]
out
)
{
int
newLen
=
0
;
int
newLen
=
0
;
out
[
0
]
=
(
byte
)
compress
.
getAlgorithm
();
out
[
0
]
=
(
byte
)
compress
.
getAlgorithm
();
int
start
=
1
+
writeVariableInt
(
out
,
1
,
len
);
int
start
=
1
+
writeVariableInt
(
out
,
1
,
len
);
...
@@ -105,7 +101,6 @@ public class CompressTool {
...
@@ -105,7 +101,6 @@ public class CompressTool {
*
*
* @param in the byte array with the compressed data
* @param in the byte array with the compressed data
* @return the uncompressed data
* @return the uncompressed data
* @throws SQLException if a error occurs
*/
*/
public
byte
[]
expand
(
byte
[]
in
)
{
public
byte
[]
expand
(
byte
[]
in
)
{
int
algorithm
=
in
[
0
];
int
algorithm
=
in
[
0
];
...
@@ -124,7 +119,7 @@ public class CompressTool {
...
@@ -124,7 +119,7 @@ public class CompressTool {
/**
/**
* INTERNAL
* INTERNAL
*/
*/
public
void
expand
(
byte
[]
in
,
byte
[]
out
,
int
outPos
)
{
public
static
void
expand
(
byte
[]
in
,
byte
[]
out
,
int
outPos
)
{
int
algorithm
=
in
[
0
];
int
algorithm
=
in
[
0
];
Compressor
compress
=
getCompressor
(
algorithm
);
Compressor
compress
=
getCompressor
(
algorithm
);
try
{
try
{
...
@@ -230,7 +225,7 @@ public class CompressTool {
...
@@ -230,7 +225,7 @@ public class CompressTool {
}
}
}
}
private
Compressor
getCompressor
(
String
algorithm
)
{
private
static
Compressor
getCompressor
(
String
algorithm
)
{
if
(
algorithm
==
null
)
{
if
(
algorithm
==
null
)
{
algorithm
=
"LZF"
;
algorithm
=
"LZF"
;
}
}
...
@@ -249,7 +244,7 @@ public class CompressTool {
...
@@ -249,7 +244,7 @@ public class CompressTool {
/**
/**
* INTERNAL
* INTERNAL
*/
*/
public
int
getCompressAlgorithm
(
String
algorithm
)
{
public
static
int
getCompressAlgorithm
(
String
algorithm
)
{
algorithm
=
StringUtils
.
toUpperEnglish
(
algorithm
);
algorithm
=
StringUtils
.
toUpperEnglish
(
algorithm
);
if
(
"NO"
.
equals
(
algorithm
))
{
if
(
"NO"
.
equals
(
algorithm
))
{
return
Compressor
.
NO
;
return
Compressor
.
NO
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/CreateScriptFile.java
浏览文件 @
79304ac8
...
@@ -108,7 +108,7 @@ public class CreateScriptFile {
...
@@ -108,7 +108,7 @@ public class CreateScriptFile {
try
{
try
{
OutputStream
out
;
OutputStream
out
;
if
(
cipher
!=
null
)
{
if
(
cipher
!=
null
)
{
byte
[]
key
=
new
SHA256
()
.
getKeyPasswordHash
(
"script"
,
password
.
toCharArray
());
byte
[]
key
=
SHA256
.
getKeyPasswordHash
(
"script"
,
password
.
toCharArray
());
IOUtils
.
delete
(
fileName
);
IOUtils
.
delete
(
fileName
);
FileStore
store
=
FileStore
.
open
(
null
,
fileName
,
"rw"
,
cipher
,
key
);
FileStore
store
=
FileStore
.
open
(
null
,
fileName
,
"rw"
,
cipher
,
key
);
store
.
init
();
store
.
init
();
...
@@ -142,7 +142,7 @@ public class CreateScriptFile {
...
@@ -142,7 +142,7 @@ public class CreateScriptFile {
try
{
try
{
InputStream
in
;
InputStream
in
;
if
(
cipher
!=
null
)
{
if
(
cipher
!=
null
)
{
byte
[]
key
=
new
SHA256
()
.
getKeyPasswordHash
(
"script"
,
password
.
toCharArray
());
byte
[]
key
=
SHA256
.
getKeyPasswordHash
(
"script"
,
password
.
toCharArray
());
FileStore
store
=
FileStore
.
open
(
null
,
fileName
,
"rw"
,
cipher
,
key
);
FileStore
store
=
FileStore
.
open
(
null
,
fileName
,
"rw"
,
cipher
,
key
);
store
.
init
();
store
.
init
();
in
=
new
FileStoreInputStream
(
store
,
null
,
compressionAlgorithm
!=
null
,
false
);
in
=
new
FileStoreInputStream
(
store
,
null
,
compressionAlgorithm
!=
null
,
false
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/InitDatabaseFromJar.java
浏览文件 @
79304ac8
...
@@ -28,14 +28,14 @@ public class InitDatabaseFromJar {
...
@@ -28,14 +28,14 @@ public class InitDatabaseFromJar {
* @param args the command line parameters
* @param args the command line parameters
*/
*/
public
static
void
main
(
String
...
args
)
throws
Exception
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
new
InitDatabaseFromJar
().
createScript
();
createScript
();
new
InitDatabaseFromJar
().
initDb
();
new
InitDatabaseFromJar
().
initDb
();
}
}
/**
/**
* Create a script from a new database.
* Create a script from a new database.
*/
*/
private
void
createScript
()
throws
Exception
{
private
static
void
createScript
()
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
Class
.
forName
(
"org.h2.Driver"
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:test"
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:test"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
79304ac8
...
@@ -322,8 +322,7 @@ java org.h2.test.TestAll timer
...
@@ -322,8 +322,7 @@ java org.h2.test.TestAll timer
private
static
void
run
(
String
...
args
)
throws
Exception
{
private
static
void
run
(
String
...
args
)
throws
Exception
{
SelfDestructor
.
startCountdown
(
3
*
60
);
SelfDestructor
.
startCountdown
(
3
*
60
);
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
TestAll
test
=
new
TestAll
();
printSystemInfo
();
test
.
printSystemInfo
();
System
.
setProperty
(
"h2.maxMemoryRowsDistinct"
,
"128"
);
System
.
setProperty
(
"h2.maxMemoryRowsDistinct"
,
"128"
);
System
.
setProperty
(
"h2.check2"
,
"true"
);
System
.
setProperty
(
"h2.check2"
,
"true"
);
...
@@ -366,6 +365,7 @@ kill a test:
...
@@ -366,6 +365,7 @@ kill a test:
kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
*/
*/
TestAll
test
=
new
TestAll
();
if
(
args
.
length
>
0
)
{
if
(
args
.
length
>
0
)
{
if
(
"reopen"
.
equals
(
args
[
0
]))
{
if
(
"reopen"
.
equals
(
args
[
0
]))
{
System
.
setProperty
(
"h2.delayWrongPasswordMin"
,
"0"
);
System
.
setProperty
(
"h2.delayWrongPasswordMin"
,
"0"
);
...
@@ -775,7 +775,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -775,7 +775,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
return
buff
.
toString
();
return
buff
.
toString
();
}
}
private
void
appendIf
(
StringBuilder
buff
,
boolean
flag
,
String
text
)
{
private
static
void
appendIf
(
StringBuilder
buff
,
boolean
flag
,
String
text
)
{
if
(
flag
)
{
if
(
flag
)
{
buff
.
append
(
text
);
buff
.
append
(
text
);
buff
.
append
(
' '
);
buff
.
append
(
' '
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
79304ac8
...
@@ -304,14 +304,14 @@ public abstract class TestBase {
...
@@ -304,14 +304,14 @@ public abstract class TestBase {
return
"jdbc:h2:"
+
url
;
return
"jdbc:h2:"
+
url
;
}
}
private
String
addOption
(
String
url
,
String
option
,
String
value
)
{
private
static
String
addOption
(
String
url
,
String
option
,
String
value
)
{
if
(
url
.
indexOf
(
";"
+
option
+
"="
)
<
0
)
{
if
(
url
.
indexOf
(
";"
+
option
+
"="
)
<
0
)
{
url
+=
";"
+
option
+
"="
+
value
;
url
+=
";"
+
option
+
"="
+
value
;
}
}
return
url
;
return
url
;
}
}
private
Connection
getConnectionInternal
(
String
url
,
String
user
,
String
password
)
throws
SQLException
{
private
static
Connection
getConnectionInternal
(
String
url
,
String
user
,
String
password
)
throws
SQLException
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
// url += ";DEFAULT_TABLE_TYPE=1";
// url += ";DEFAULT_TABLE_TYPE=1";
// Class.forName("org.hsqldb.jdbcDriver");
// Class.forName("org.hsqldb.jdbcDriver");
...
@@ -974,18 +974,6 @@ public abstract class TestBase {
...
@@ -974,18 +974,6 @@ public abstract class TestBase {
assertResultSet
(
true
,
rs
,
data
);
assertResultSet
(
true
,
rs
,
data
);
}
}
/**
* Check if a result set contains the expected data.
* The sort order is not significant
*
* @param rs the result set
* @param data the expected data
* @throws AssertionError if there is a mismatch
*/
// void assertResultSetUnordered(ResultSet rs, String[][] data) {
// assertResultSet(false, rs, data);
// }
/**
/**
* Check if a result set contains the expected data.
* Check if a result set contains the expected data.
*
*
...
@@ -1037,7 +1025,7 @@ public abstract class TestBase {
...
@@ -1037,7 +1025,7 @@ public abstract class TestBase {
}
}
}
}
private
boolean
testRow
(
String
[]
a
,
String
[]
b
,
int
len
)
{
private
static
boolean
testRow
(
String
[]
a
,
String
[]
b
,
int
len
)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
String
sa
=
a
[
i
];
String
sa
=
a
[
i
];
String
sb
=
b
[
i
];
String
sb
=
b
[
i
];
...
@@ -1054,7 +1042,7 @@ public abstract class TestBase {
...
@@ -1054,7 +1042,7 @@ public abstract class TestBase {
return
true
;
return
true
;
}
}
private
String
[]
getData
(
ResultSet
rs
,
int
len
)
throws
SQLException
{
private
static
String
[]
getData
(
ResultSet
rs
,
int
len
)
throws
SQLException
{
String
[]
data
=
new
String
[
len
];
String
[]
data
=
new
String
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
data
[
i
]
=
rs
.
getString
(
i
+
1
);
data
[
i
]
=
rs
.
getString
(
i
+
1
);
...
@@ -1064,7 +1052,7 @@ public abstract class TestBase {
...
@@ -1064,7 +1052,7 @@ public abstract class TestBase {
return
data
;
return
data
;
}
}
private
String
formatRow
(
String
[]
row
)
{
private
static
String
formatRow
(
String
[]
row
)
{
String
sb
=
""
;
String
sb
=
""
;
for
(
String
r
:
row
)
{
for
(
String
r
:
row
)
{
sb
+=
"{"
+
r
+
"}"
;
sb
+=
"{"
+
r
+
"}"
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/TestPerformance.java
浏览文件 @
79304ac8
...
@@ -47,12 +47,12 @@ public class TestPerformance {
...
@@ -47,12 +47,12 @@ public class TestPerformance {
new
TestPerformance
().
test
(
args
);
new
TestPerformance
().
test
(
args
);
}
}
private
Connection
getResultConnection
()
throws
SQLException
{
private
static
Connection
getResultConnection
()
throws
SQLException
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
return
DriverManager
.
getConnection
(
"jdbc:h2:data/results"
);
return
DriverManager
.
getConnection
(
"jdbc:h2:data/results"
);
}
}
private
void
openResults
()
throws
SQLException
{
private
static
void
openResults
()
throws
SQLException
{
Connection
conn
=
null
;
Connection
conn
=
null
;
Statement
stat
=
null
;
Statement
stat
=
null
;
try
{
try
{
...
@@ -236,13 +236,13 @@ public class TestPerformance {
...
@@ -236,13 +236,13 @@ public class TestPerformance {
}
}
}
}
private
void
runDatabase
(
Database
db
,
ArrayList
<
Bench
>
tests
,
int
size
)
throws
Exception
{
private
static
void
runDatabase
(
Database
db
,
ArrayList
<
Bench
>
tests
,
int
size
)
throws
Exception
{
for
(
Bench
bench
:
tests
)
{
for
(
Bench
bench
:
tests
)
{
runTest
(
db
,
bench
,
size
);
runTest
(
db
,
bench
,
size
);
}
}
}
}
private
void
runTest
(
Database
db
,
Bench
bench
,
int
size
)
throws
Exception
{
private
static
void
runTest
(
Database
db
,
Bench
bench
,
int
size
)
throws
Exception
{
bench
.
init
(
db
,
size
);
bench
.
init
(
db
,
size
);
bench
.
runTest
();
bench
.
runTest
();
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/coverage/Profile.java
浏览文件 @
79304ac8
...
@@ -108,7 +108,7 @@ public class Profile extends Thread {
...
@@ -108,7 +108,7 @@ public class Profile extends Thread {
}
}
}
}
private
void
closeSilently
(
Reader
reader
)
{
private
static
void
closeSilently
(
Reader
reader
)
{
if
(
reader
!=
null
)
{
if
(
reader
!=
null
)
{
try
{
try
{
reader
.
close
();
reader
.
close
();
...
@@ -118,7 +118,7 @@ public class Profile extends Thread {
...
@@ -118,7 +118,7 @@ public class Profile extends Thread {
}
}
}
}
private
void
closeSilently
(
Writer
writer
)
{
private
static
void
closeSilently
(
Writer
writer
)
{
if
(
writer
!=
null
)
{
if
(
writer
!=
null
)
{
try
{
try
{
writer
.
close
();
writer
.
close
();
...
@@ -244,11 +244,11 @@ public class Profile extends Thread {
...
@@ -244,11 +244,11 @@ public class Profile extends Thread {
}
}
}
}
private
void
print
(
String
s
)
{
private
static
void
print
(
String
s
)
{
System
.
out
.
println
(
s
);
System
.
out
.
println
(
s
);
}
}
private
void
printLine
(
char
c
)
{
private
static
void
printLine
(
char
c
)
{
for
(
int
i
=
0
;
i
<
60
;
i
++)
{
for
(
int
i
=
0
;
i
<
60
;
i
++)
{
System
.
out
.
print
(
c
);
System
.
out
.
print
(
c
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TaskProcess.java
浏览文件 @
79304ac8
...
@@ -78,7 +78,7 @@ public class TaskProcess {
...
@@ -78,7 +78,7 @@ public class TaskProcess {
}
}
}
}
private
void
copyInThread
(
final
InputStream
in
,
final
OutputStream
out
)
{
private
static
void
copyInThread
(
final
InputStream
in
,
final
OutputStream
out
)
{
new
Task
()
{
new
Task
()
{
public
void
call
()
throws
IOException
{
public
void
call
()
throws
IOException
{
while
(
true
)
{
while
(
true
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCsv.java
浏览文件 @
79304ac8
...
@@ -247,7 +247,7 @@ public class TestCsv extends TestBase {
...
@@ -247,7 +247,7 @@ public class TestCsv extends TestBase {
IOUtils
.
delete
(
getBaseDir
()
+
"/test.csv"
);
IOUtils
.
delete
(
getBaseDir
()
+
"/test.csv"
);
}
}
private
String
randomData
(
Random
random
)
{
private
static
String
randomData
(
Random
random
)
{
if
(
random
.
nextInt
(
10
)
==
1
)
{
if
(
random
.
nextInt
(
10
)
==
1
)
{
return
null
;
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
79304ac8
...
@@ -650,7 +650,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -650,7 +650,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
* @param conn the connection
* @param conn the connection
* @return the result set
* @return the result set
*/
*/
public
static
ResultSet
nullResultSet
(
Connection
conn
)
throws
SQLException
{
public
static
ResultSet
nullResultSet
(
Connection
conn
)
{
return
null
;
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLinkedTable.java
浏览文件 @
79304ac8
...
@@ -247,7 +247,7 @@ public class TestLinkedTable extends TestBase {
...
@@ -247,7 +247,7 @@ public class TestLinkedTable extends TestBase {
cb
.
close
();
cb
.
close
();
}
}
private
void
testLinkOtherSchema
()
throws
SQLException
{
private
static
void
testLinkOtherSchema
()
throws
SQLException
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
Connection
ca
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:one"
,
"sa"
,
"sa"
);
Connection
ca
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:one"
,
"sa"
,
"sa"
);
Connection
cb
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:two"
,
"sa"
,
"sa"
);
Connection
cb
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:two"
,
"sa"
,
"sa"
);
...
@@ -289,7 +289,7 @@ public class TestLinkedTable extends TestBase {
...
@@ -289,7 +289,7 @@ public class TestLinkedTable extends TestBase {
conn2
.
close
();
conn2
.
close
();
}
}
private
void
testLinkDrop
()
throws
SQLException
{
private
static
void
testLinkDrop
()
throws
SQLException
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
Connection
connA
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:a"
);
Connection
connA
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:a"
);
Statement
statA
=
connA
.
createStatement
();
Statement
statA
=
connA
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
79304ac8
...
@@ -235,7 +235,7 @@ public class TestLob extends TestBase {
...
@@ -235,7 +235,7 @@ public class TestLob extends TestBase {
}
}
}
}
private
void
testAddLobRestart
()
throws
SQLException
{
private
static
void
testAddLobRestart
()
throws
SQLException
{
DeleteDbFiles
.
execute
(
"memFS:"
,
"lob"
,
true
);
DeleteDbFiles
.
execute
(
"memFS:"
,
"lob"
,
true
);
Connection
conn
=
org
.
h2
.
Driver
.
load
().
connect
(
"jdbc:h2:memFS:lob"
,
null
);
Connection
conn
=
org
.
h2
.
Driver
.
load
().
connect
(
"jdbc:h2:memFS:lob"
,
null
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
...
@@ -320,7 +320,7 @@ public class TestLob extends TestBase {
...
@@ -320,7 +320,7 @@ public class TestLob extends TestBase {
conn
.
close
();
conn
.
close
();
}
}
private
void
collectAndWait
()
{
private
static
void
collectAndWait
()
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
System
.
gc
();
System
.
gc
();
}
}
...
@@ -1020,11 +1020,11 @@ public class TestLob extends TestBase {
...
@@ -1020,11 +1020,11 @@ public class TestLob extends TestBase {
conn
.
close
();
conn
.
close
();
}
}
private
Reader
getRandomReader
(
int
len
,
int
seed
)
{
private
static
Reader
getRandomReader
(
int
len
,
int
seed
)
{
return
new
CharArrayReader
(
getRandomChars
(
len
,
seed
));
return
new
CharArrayReader
(
getRandomChars
(
len
,
seed
));
}
}
private
char
[]
getRandomChars
(
int
len
,
int
seed
)
{
private
static
char
[]
getRandomChars
(
int
len
,
int
seed
)
{
Random
random
=
new
Random
(
seed
);
Random
random
=
new
Random
(
seed
);
char
[]
buff
=
new
char
[
len
];
char
[]
buff
=
new
char
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
@@ -1039,7 +1039,7 @@ public class TestLob extends TestBase {
...
@@ -1039,7 +1039,7 @@ public class TestLob extends TestBase {
return
buff
;
return
buff
;
}
}
private
InputStream
getRandomStream
(
int
len
,
int
seed
)
{
private
static
InputStream
getRandomStream
(
int
len
,
int
seed
)
{
Random
random
=
new
Random
(
seed
);
Random
random
=
new
Random
(
seed
);
byte
[]
buff
=
new
byte
[
len
];
byte
[]
buff
=
new
byte
[
len
];
random
.
nextBytes
(
buff
);
random
.
nextBytes
(
buff
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestScript.java
浏览文件 @
79304ac8
...
@@ -199,7 +199,7 @@ public class TestScript extends TestBase {
...
@@ -199,7 +199,7 @@ public class TestScript extends TestBase {
write
(
""
);
write
(
""
);
}
}
private
void
setParameter
(
PreparedStatement
prep
,
int
i
,
String
param
)
throws
SQLException
{
private
static
void
setParameter
(
PreparedStatement
prep
,
int
i
,
String
param
)
throws
SQLException
{
if
(
param
.
equalsIgnoreCase
(
"null"
))
{
if
(
param
.
equalsIgnoreCase
(
"null"
))
{
param
=
null
;
param
=
null
;
}
}
...
@@ -255,7 +255,7 @@ public class TestScript extends TestBase {
...
@@ -255,7 +255,7 @@ public class TestScript extends TestBase {
return
0
;
return
0
;
}
}
private
String
formatString
(
String
s
)
{
private
static
String
formatString
(
String
s
)
{
if
(
s
==
null
)
{
if
(
s
==
null
)
{
return
"null"
;
return
"null"
;
}
}
...
@@ -311,7 +311,7 @@ public class TestScript extends TestBase {
...
@@ -311,7 +311,7 @@ public class TestScript extends TestBase {
writeResult
(
sql
,
(
ordered
?
"rows (ordered): "
:
"rows: "
)
+
i
,
null
);
writeResult
(
sql
,
(
ordered
?
"rows (ordered): "
:
"rows: "
)
+
i
,
null
);
}
}
private
String
format
(
String
[]
row
,
int
[]
max
)
{
private
static
String
format
(
String
[]
row
,
int
[]
max
)
{
int
length
=
max
.
length
;
int
length
=
max
.
length
;
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buff
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
...
@@ -376,7 +376,7 @@ public class TestScript extends TestBase {
...
@@ -376,7 +376,7 @@ public class TestScript extends TestBase {
out
.
println
(
s
);
out
.
println
(
s
);
}
}
private
void
sort
(
String
[]
a
)
{
private
static
void
sort
(
String
[]
a
)
{
for
(
int
i
=
1
,
j
,
len
=
a
.
length
;
i
<
len
;
i
++)
{
for
(
int
i
=
1
,
j
,
len
=
a
.
length
;
i
<
len
;
i
++)
{
String
t
=
a
[
i
];
String
t
=
a
[
i
];
for
(
j
=
i
-
1
;
j
>=
0
&&
t
.
compareTo
(
a
[
j
])
<
0
;
j
--)
{
for
(
j
=
i
-
1
;
j
>=
0
&&
t
.
compareTo
(
a
[
j
])
<
0
;
j
--)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSequence.java
浏览文件 @
79304ac8
...
@@ -125,7 +125,7 @@ public class TestSequence extends TestBase {
...
@@ -125,7 +125,7 @@ public class TestSequence extends TestBase {
conn
.
close
();
conn
.
close
();
}
}
private
long
getNext
(
Statement
stat
)
throws
SQLException
{
private
static
long
getNext
(
Statement
stat
)
throws
SQLException
{
ResultSet
rs
=
stat
.
executeQuery
(
"call next value for testSequence"
);
ResultSet
rs
=
stat
.
executeQuery
(
"call next value for testSequence"
);
rs
.
next
();
rs
.
next
();
long
value
=
rs
.
getLong
(
1
);
long
value
=
rs
.
getLong
(
1
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestTempTables.java
浏览文件 @
79304ac8
...
@@ -194,7 +194,7 @@ public class TestTempTables extends TestBase {
...
@@ -194,7 +194,7 @@ public class TestTempTables extends TestBase {
stat
.
execute
(
"drop table test"
);
stat
.
execute
(
"drop table test"
);
}
}
private
void
testConstraints
(
Connection
conn1
,
Connection
conn2
)
throws
SQLException
{
private
static
void
testConstraints
(
Connection
conn1
,
Connection
conn2
)
throws
SQLException
{
Statement
s1
=
conn1
.
createStatement
(),
s2
=
conn2
.
createStatement
();
Statement
s1
=
conn1
.
createStatement
(),
s2
=
conn2
.
createStatement
();
s1
.
execute
(
"create local temporary table test(id int unique)"
);
s1
.
execute
(
"create local temporary table test(id int unique)"
);
s2
.
execute
(
"create local temporary table test(id int unique)"
);
s2
.
execute
(
"create local temporary table test(id int unique)"
);
...
@@ -204,7 +204,7 @@ public class TestTempTables extends TestBase {
...
@@ -204,7 +204,7 @@ public class TestTempTables extends TestBase {
s2
.
execute
(
"drop table test"
);
s2
.
execute
(
"drop table test"
);
}
}
private
void
testIndexes
(
Connection
conn1
,
Connection
conn2
)
throws
SQLException
{
private
static
void
testIndexes
(
Connection
conn1
,
Connection
conn2
)
throws
SQLException
{
conn1
.
createStatement
().
executeUpdate
(
"create local temporary table test(id int)"
);
conn1
.
createStatement
().
executeUpdate
(
"create local temporary table test(id int)"
);
conn1
.
createStatement
().
executeUpdate
(
"create index idx_id on test(id)"
);
conn1
.
createStatement
().
executeUpdate
(
"create index idx_id on test(id)"
);
conn2
.
createStatement
().
executeUpdate
(
"create local temporary table test(id int)"
);
conn2
.
createStatement
().
executeUpdate
(
"create local temporary table test(id int)"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
79304ac8
...
@@ -143,11 +143,10 @@ public class TestPreparedStatement extends TestBase {
...
@@ -143,11 +143,10 @@ public class TestPreparedStatement extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
stat
.
execute
(
"DROP TABLE TEST"
);
}
}
private
String
getString
(
int
i
)
{
private
static
String
getString
(
int
i
)
{
return
new
String
(
new
char
[
100000
]).
replace
(
'\0'
,
(
char
)
(
'0'
+
i
));
return
new
String
(
new
char
[
100000
]).
replace
(
'\0'
,
(
char
)
(
'0'
+
i
));
}
}
private
void
testExecuteErrorTwice
(
Connection
conn
)
throws
SQLException
{
private
void
testExecuteErrorTwice
(
Connection
conn
)
throws
SQLException
{
PreparedStatement
prep
=
conn
.
prepareStatement
(
"CREATE TABLE BAD AS SELECT A"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"CREATE TABLE BAD AS SELECT A"
);
try
{
try
{
...
@@ -301,7 +300,7 @@ public class TestPreparedStatement extends TestBase {
...
@@ -301,7 +300,7 @@ public class TestPreparedStatement extends TestBase {
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
}
}
private
void
testCoalesce
(
Connection
conn
)
throws
SQLException
{
private
static
void
testCoalesce
(
Connection
conn
)
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
executeUpdate
(
"create table test(tm timestamp)"
);
stat
.
executeUpdate
(
"create table test(tm timestamp)"
);
stat
.
executeUpdate
(
"insert into test values(current_timestamp)"
);
stat
.
executeUpdate
(
"insert into test values(current_timestamp)"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbcx/TestConnectionPool.java
浏览文件 @
79304ac8
...
@@ -60,7 +60,7 @@ public class TestConnectionPool extends TestBase {
...
@@ -60,7 +60,7 @@ public class TestConnectionPool extends TestBase {
cp
.
dispose
();
cp
.
dispose
();
}
}
private
void
testWrongUrl
()
throws
SQLException
{
private
void
testWrongUrl
()
{
JdbcConnectionPool
cp
=
JdbcConnectionPool
.
create
(
"jdbc:wrong:url"
,
""
,
""
);
JdbcConnectionPool
cp
=
JdbcConnectionPool
.
create
(
"jdbc:wrong:url"
,
""
,
""
);
try
{
try
{
cp
.
getConnection
();
cp
.
getConnection
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbcx/TestXASimple.java
浏览文件 @
79304ac8
...
@@ -100,7 +100,7 @@ public class TestXASimple extends TestBase {
...
@@ -100,7 +100,7 @@ public class TestXASimple extends TestBase {
JdbcUtils
.
closeSilently
(
xa
);
JdbcUtils
.
closeSilently
(
xa
);
}
}
private
void
shutdown
(
JdbcDataSource
ds
)
throws
SQLException
{
private
static
void
shutdown
(
JdbcDataSource
ds
)
throws
SQLException
{
Connection
conn
=
ds
.
getConnection
();
Connection
conn
=
ds
.
getConnection
();
conn
.
createStatement
().
execute
(
"shutdown immediately"
);
conn
.
createStatement
().
execute
(
"shutdown immediately"
);
JdbcUtils
.
closeSilently
(
conn
);
JdbcUtils
.
closeSilently
(
conn
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/poweroff/Test.java
浏览文件 @
79304ac8
...
@@ -87,10 +87,6 @@ public class Test {
...
@@ -87,10 +87,6 @@ public class Test {
* @param args the command line parameters
* @param args the command line parameters
*/
*/
public
static
void
main
(
String
...
args
)
throws
Exception
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
new
Test
().
test
(
args
);
}
private
void
test
(
String
...
args
)
throws
Exception
{
int
port
=
9099
;
int
port
=
9099
;
String
connect
=
"192.168.0.3"
;
String
connect
=
"192.168.0.3"
;
boolean
file
=
false
;
boolean
file
=
false
;
...
@@ -106,7 +102,7 @@ public class Test {
...
@@ -106,7 +102,7 @@ public class Test {
test
(
connect
,
port
,
file
);
test
(
connect
,
port
,
file
);
}
}
private
void
test
(
String
connect
,
int
port
,
boolean
file
)
throws
Exception
{
private
static
void
test
(
String
connect
,
int
port
,
boolean
file
)
throws
Exception
{
Socket
socket
=
new
Socket
(
connect
,
port
);
Socket
socket
=
new
Socket
(
connect
,
port
);
DataOutputStream
out
=
new
DataOutputStream
(
socket
.
getOutputStream
());
DataOutputStream
out
=
new
DataOutputStream
(
socket
.
getOutputStream
());
System
.
out
.
println
(
"Connected to "
+
socket
.
toString
());
System
.
out
.
println
(
"Connected to "
+
socket
.
toString
());
...
@@ -117,7 +113,7 @@ public class Test {
...
@@ -117,7 +113,7 @@ public class Test {
}
}
}
}
private
void
testFile
(
DataOutputStream
out
)
throws
IOException
{
private
static
void
testFile
(
DataOutputStream
out
)
throws
IOException
{
File
file
=
new
File
(
"test.txt"
);
File
file
=
new
File
(
"test.txt"
);
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
file
.
delete
();
file
.
delete
();
...
@@ -142,7 +138,7 @@ public class Test {
...
@@ -142,7 +138,7 @@ public class Test {
write
.
close
();
write
.
close
();
}
}
private
void
testDatabases
(
DataOutputStream
out
)
throws
Exception
{
private
static
void
testDatabases
(
DataOutputStream
out
)
throws
Exception
{
Test
[]
dbs
=
{
Test
[]
dbs
=
{
new
Test
(
"org.h2.Driver"
,
"jdbc:h2:test1"
,
"sa"
,
""
,
true
),
new
Test
(
"org.h2.Driver"
,
"jdbc:h2:test1"
,
"sa"
,
""
,
true
),
new
Test
(
"org.h2.Driver"
,
"jdbc:h2:test2"
,
"sa"
,
""
,
false
),
new
Test
(
"org.h2.Driver"
,
"jdbc:h2:test2"
,
"sa"
,
""
,
false
),
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/poweroff/TestRecover.java
浏览文件 @
79304ac8
...
@@ -63,10 +63,6 @@ public class TestRecover {
...
@@ -63,10 +63,6 @@ public class TestRecover {
* @param args the command line parameters
* @param args the command line parameters
*/
*/
public
static
void
main
(
String
...
args
)
throws
Exception
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
new
TestRecover
().
runTest
();
}
private
void
runTest
()
throws
Exception
{
System
.
out
.
println
(
"URL="
+
URL
);
System
.
out
.
println
(
"URL="
+
URL
);
System
.
out
.
println
(
"backup..."
);
System
.
out
.
println
(
"backup..."
);
new
File
(
TEST_DIRECTORY
).
mkdirs
();
new
File
(
TEST_DIRECTORY
).
mkdirs
();
...
@@ -174,14 +170,14 @@ public class TestRecover {
...
@@ -174,14 +170,14 @@ public class TestRecover {
}
}
}
}
private
void
testLoop
()
throws
Exception
{
private
static
void
testLoop
()
throws
Exception
{
Random
random
=
new
SecureRandom
();
Random
random
=
new
SecureRandom
();
while
(
true
)
{
while
(
true
)
{
runOneTest
(
random
.
nextInt
());
runOneTest
(
random
.
nextInt
());
}
}
}
}
private
Connection
openConnection
()
throws
Exception
{
private
static
Connection
openConnection
()
throws
Exception
{
Class
.
forName
(
DRIVER
);
Class
.
forName
(
DRIVER
);
Connection
conn
=
DriverManager
.
getConnection
(
URL
,
"sa"
,
"sa"
);
Connection
conn
=
DriverManager
.
getConnection
(
URL
,
"sa"
,
"sa"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
...
@@ -194,7 +190,7 @@ public class TestRecover {
...
@@ -194,7 +190,7 @@ public class TestRecover {
return
conn
;
return
conn
;
}
}
private
void
closeConnection
(
Connection
conn
)
{
private
static
void
closeConnection
(
Connection
conn
)
{
try
{
try
{
conn
.
close
();
conn
.
close
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
...
@@ -215,7 +211,7 @@ public class TestRecover {
...
@@ -215,7 +211,7 @@ public class TestRecover {
}
}
}
}
private
void
runOneTest
(
int
i
)
throws
Exception
{
private
static
void
runOneTest
(
int
i
)
throws
Exception
{
Random
random
=
new
Random
(
i
);
Random
random
=
new
Random
(
i
);
Connection
conn
=
openConnection
();
Connection
conn
=
openConnection
();
PreparedStatement
prepInsert
=
null
;
PreparedStatement
prepInsert
=
null
;
...
@@ -309,7 +305,7 @@ public class TestRecover {
...
@@ -309,7 +305,7 @@ public class TestRecover {
}
}
}
}
private
boolean
testConsistency
()
{
private
static
boolean
testConsistency
()
{
FileOutputStream
out
=
null
;
FileOutputStream
out
=
null
;
PrintWriter
p
=
null
;
PrintWriter
p
=
null
;
try
{
try
{
...
@@ -347,7 +343,7 @@ public class TestRecover {
...
@@ -347,7 +343,7 @@ public class TestRecover {
}
}
}
}
private
void
test
(
Connection
conn
,
String
order
)
throws
Exception
{
private
static
void
test
(
Connection
conn
,
String
order
)
throws
Exception
{
ResultSet
rs
;
ResultSet
rs
;
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST "
+
order
);
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST "
+
order
);
int
max
=
0
;
int
max
=
0
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/rowlock/TestRowLocks.java
浏览文件 @
79304ac8
...
@@ -100,7 +100,7 @@ public class TestRowLocks extends TestBase {
...
@@ -100,7 +100,7 @@ public class TestRowLocks extends TestBase {
c2
.
close
();
c2
.
close
();
}
}
private
String
getSingleValue
(
Statement
stat
,
String
sql
)
throws
SQLException
{
private
static
String
getSingleValue
(
Statement
stat
,
String
sql
)
throws
SQLException
{
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
return
rs
.
next
()
?
rs
.
getString
(
1
)
:
null
;
return
rs
.
next
()
?
rs
.
getString
(
1
)
:
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
79304ac8
...
@@ -99,7 +99,7 @@ public class TestCrashAPI extends TestBase implements Runnable {
...
@@ -99,7 +99,7 @@ public class TestCrashAPI extends TestBase implements Runnable {
}
}
}
}
private
void
recoverAll
()
throws
SQLException
{
private
static
void
recoverAll
()
throws
SQLException
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
File
[]
files
=
new
File
(
"temp/backup"
).
listFiles
();
File
[]
files
=
new
File
(
"temp/backup"
).
listFiles
();
Arrays
.
sort
(
files
,
new
Comparator
<
File
>()
{
Arrays
.
sort
(
files
,
new
Comparator
<
File
>()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestJoin.java
浏览文件 @
79304ac8
...
@@ -275,7 +275,7 @@ public class TestJoin extends TestBase {
...
@@ -275,7 +275,7 @@ public class TestJoin extends TestBase {
}
}
}
}
private
String
readResult
(
ResultSet
rs
)
throws
SQLException
{
private
static
String
readResult
(
ResultSet
rs
)
throws
SQLException
{
StringBuilder
b
=
new
StringBuilder
();
StringBuilder
b
=
new
StringBuilder
();
ResultSetMetaData
meta
=
rs
.
getMetaData
();
ResultSetMetaData
meta
=
rs
.
getMetaData
();
int
columnCount
=
meta
.
getColumnCount
();
int
columnCount
=
meta
.
getColumnCount
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestKillRestartMulti.java
浏览文件 @
79304ac8
...
@@ -264,7 +264,7 @@ public class TestKillRestartMulti extends TestBase {
...
@@ -264,7 +264,7 @@ public class TestKillRestartMulti extends TestBase {
}
}
}
}
private
void
testConsistent
(
Connection
conn
)
throws
SQLException
{
private
static
void
testConsistent
(
Connection
conn
)
throws
SQLException
{
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
try
{
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestNestedJoins.java
浏览文件 @
79304ac8
...
@@ -217,7 +217,7 @@ public class TestNestedJoins extends TestBase {
...
@@ -217,7 +217,7 @@ public class TestNestedJoins extends TestBase {
}
}
}
}
private
String
getResult
(
ResultSet
rs
)
throws
SQLException
{
private
static
String
getResult
(
ResultSet
rs
)
throws
SQLException
{
ArrayList
<
String
>
list
=
New
.
arrayList
();
ArrayList
<
String
>
list
=
New
.
arrayList
();
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buff
=
new
StringBuilder
();
...
@@ -569,7 +569,7 @@ public class TestNestedJoins extends TestBase {
...
@@ -569,7 +569,7 @@ public class TestNestedJoins extends TestBase {
deleteDb
(
"nestedJoins"
);
deleteDb
(
"nestedJoins"
);
}
}
private
String
cleanRemarks
(
String
sql
)
throws
SQLException
{
private
static
String
cleanRemarks
(
String
sql
)
{
ScriptReader
r
=
new
ScriptReader
(
new
StringReader
(
sql
));
ScriptReader
r
=
new
ScriptReader
(
new
StringReader
(
sql
));
r
.
setSkipRemarks
(
true
);
r
.
setSkipRemarks
(
true
);
sql
=
r
.
readStatement
();
sql
=
r
.
readStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestOuterJoins.java
浏览文件 @
79304ac8
...
@@ -184,7 +184,7 @@ public class TestOuterJoins extends TestBase {
...
@@ -184,7 +184,7 @@ public class TestOuterJoins extends TestBase {
buff
.
append
(
")"
);
buff
.
append
(
")"
);
}
}
private
void
appendRandomCondition
(
Random
random
,
StringBuilder
buff
,
int
max
)
{
private
static
void
appendRandomCondition
(
Random
random
,
StringBuilder
buff
,
int
max
)
{
if
(
max
>
0
&&
random
.
nextInt
(
4
)
==
0
)
{
if
(
max
>
0
&&
random
.
nextInt
(
4
)
==
0
)
{
return
;
return
;
}
}
...
@@ -230,7 +230,7 @@ public class TestOuterJoins extends TestBase {
...
@@ -230,7 +230,7 @@ public class TestOuterJoins extends TestBase {
}
}
}
}
private
void
appendRandomValueOrColumn
(
Random
random
,
StringBuilder
buff
,
int
max
)
{
private
static
void
appendRandomValueOrColumn
(
Random
random
,
StringBuilder
buff
,
int
max
)
{
if
(
random
.
nextBoolean
())
{
if
(
random
.
nextBoolean
())
{
buff
.
append
(
random
.
nextInt
(
8
)
-
2
);
buff
.
append
(
random
.
nextInt
(
8
)
-
2
);
}
else
{
}
else
{
...
@@ -269,7 +269,7 @@ public class TestOuterJoins extends TestBase {
...
@@ -269,7 +269,7 @@ public class TestOuterJoins extends TestBase {
}
}
}
}
private
String
getResult
(
ResultSet
rs
)
throws
SQLException
{
private
static
String
getResult
(
ResultSet
rs
)
throws
SQLException
{
ArrayList
<
String
>
list
=
New
.
arrayList
();
ArrayList
<
String
>
list
=
New
.
arrayList
();
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buff
=
new
StringBuilder
();
...
@@ -561,7 +561,7 @@ public class TestOuterJoins extends TestBase {
...
@@ -561,7 +561,7 @@ public class TestOuterJoins extends TestBase {
deleteDb
(
"nestedJoins"
);
deleteDb
(
"nestedJoins"
);
}
}
private
String
cleanRemarks
(
String
sql
)
throws
SQLException
{
private
static
String
cleanRemarks
(
String
sql
)
{
ScriptReader
r
=
new
ScriptReader
(
new
StringReader
(
sql
));
ScriptReader
r
=
new
ScriptReader
(
new
StringReader
(
sql
));
r
.
setSkipRemarks
(
true
);
r
.
setSkipRemarks
(
true
);
sql
=
r
.
readStatement
();
sql
=
r
.
readStatement
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestPowerOffFs2.java
浏览文件 @
79304ac8
...
@@ -195,7 +195,7 @@ public class TestPowerOffFs2 extends TestBase {
...
@@ -195,7 +195,7 @@ public class TestPowerOffFs2 extends TestBase {
}
}
}
}
private
void
testConsistent
(
Connection
conn
)
throws
SQLException
{
private
static
void
testConsistent
(
Connection
conn
)
throws
SQLException
{
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
try
{
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestRandomCompare.java
浏览文件 @
79304ac8
...
@@ -188,7 +188,7 @@ public class TestRandomCompare extends TestBase {
...
@@ -188,7 +188,7 @@ public class TestRandomCompare extends TestBase {
}
}
}
}
private
void
appendRandomValue
(
Random
random
,
StringBuilder
buff
)
{
private
static
void
appendRandomValue
(
Random
random
,
StringBuilder
buff
)
{
switch
(
random
.
nextInt
(
7
))
{
switch
(
random
.
nextInt
(
7
))
{
case
0
:
case
0
:
buff
.
append
(
"null"
);
buff
.
append
(
"null"
);
...
@@ -238,7 +238,7 @@ public class TestRandomCompare extends TestBase {
...
@@ -238,7 +238,7 @@ public class TestRandomCompare extends TestBase {
}
}
}
}
private
String
getResult
(
ResultSet
rs
)
throws
SQLException
{
private
static
String
getResult
(
ResultSet
rs
)
throws
SQLException
{
ArrayList
<
String
>
list
=
New
.
arrayList
();
ArrayList
<
String
>
list
=
New
.
arrayList
();
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buff
=
new
StringBuilder
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestThreads.java
浏览文件 @
79304ac8
...
@@ -88,7 +88,7 @@ public class TestThreads extends TestBase implements Runnable {
...
@@ -88,7 +88,7 @@ public class TestThreads extends TestBase implements Runnable {
conn
.
close
();
conn
.
close
();
}
}
private
void
insertRows
(
Connection
conn
,
String
tableName
,
int
len
)
throws
SQLException
{
private
static
void
insertRows
(
Connection
conn
,
String
tableName
,
int
len
)
throws
SQLException
{
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO "
+
tableName
+
" VALUES(?, 'Hi')"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO "
+
tableName
+
" VALUES(?, 'Hi')"
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
prep
.
setInt
(
1
,
i
);
prep
.
setInt
(
1
,
i
);
...
@@ -96,7 +96,7 @@ public class TestThreads extends TestBase implements Runnable {
...
@@ -96,7 +96,7 @@ public class TestThreads extends TestBase implements Runnable {
}
}
}
}
private
void
checkTable
(
Connection
conn
,
String
tableName
)
throws
SQLException
{
private
static
void
checkTable
(
Connection
conn
,
String
tableName
)
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM "
+
tableName
+
" ORDER BY ID"
);
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM "
+
tableName
+
" ORDER BY ID"
);
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/sql/Expression.java
浏览文件 @
79304ac8
...
@@ -154,7 +154,7 @@ public class Expression {
...
@@ -154,7 +154,7 @@ public class Expression {
return
list
[
i
];
return
list
[
i
];
}
}
private
String
getColumnName
(
String
alias
,
Column
column
)
{
private
static
String
getColumnName
(
String
alias
,
Column
column
)
{
if
(
alias
==
null
)
{
if
(
alias
==
null
)
{
return
column
.
getName
();
return
column
.
getName
();
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/thread/TestMultiOrder.java
浏览文件 @
79304ac8
...
@@ -86,7 +86,7 @@ public class TestMultiOrder extends TestMultiThread {
...
@@ -86,7 +86,7 @@ public class TestMultiOrder extends TestMultiThread {
prep
.
execute
();
prep
.
execute
();
}
}
private
String
getString
(
int
id
)
{
private
static
String
getString
(
int
id
)
{
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buff
=
new
StringBuilder
();
Random
rnd
=
new
Random
(
id
);
Random
rnd
=
new
Random
(
id
);
int
len
=
rnd
.
nextInt
(
40
);
int
len
=
rnd
.
nextInt
(
40
);
...
@@ -101,19 +101,19 @@ public class TestMultiOrder extends TestMultiThread {
...
@@ -101,19 +101,19 @@ public class TestMultiOrder extends TestMultiThread {
return
buff
.
toString
();
return
buff
.
toString
();
}
}
private
synchronized
int
getNextCustomerId
()
{
private
s
tatic
s
ynchronized
int
getNextCustomerId
()
{
return
customerCount
++;
return
customerCount
++;
}
}
private
synchronized
int
increaseOrders
()
{
private
s
tatic
s
ynchronized
int
increaseOrders
()
{
return
orderCount
++;
return
orderCount
++;
}
}
private
synchronized
int
increaseOrderLines
(
int
count
)
{
private
s
tatic
s
ynchronized
int
increaseOrderLines
(
int
count
)
{
return
orderLineCount
+=
count
;
return
orderLineCount
+=
count
;
}
}
private
int
getCustomerCount
()
{
private
static
int
getCustomerCount
()
{
return
customerCount
;
return
customerCount
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/todo/TestTempTableCrash.java
浏览文件 @
79304ac8
...
@@ -28,7 +28,7 @@ public class TestTempTableCrash {
...
@@ -28,7 +28,7 @@ public class TestTempTableCrash {
new
TestTempTableCrash
().
test
();
new
TestTempTableCrash
().
test
();
}
}
p
rivate
void
test
()
throws
Exception
{
p
ublic
void
test
()
throws
Exception
{
Connection
conn
;
Connection
conn
;
Statement
stat
;
Statement
stat
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/todo/TestUndoLogLarge.java
浏览文件 @
79304ac8
...
@@ -28,7 +28,7 @@ public class TestUndoLogLarge {
...
@@ -28,7 +28,7 @@ public class TestUndoLogLarge {
new
TestUndoLogLarge
().
test
();
new
TestUndoLogLarge
().
test
();
}
}
p
rivate
void
test
()
throws
SQLException
{
p
ublic
void
test
()
throws
SQLException
{
DeleteDbFiles
.
execute
(
"data"
,
"test"
,
true
);
DeleteDbFiles
.
execute
(
"data"
,
"test"
,
true
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:data/test"
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:data/test"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
...
@@ -50,4 +50,5 @@ public class TestUndoLogLarge {
...
@@ -50,4 +50,5 @@ public class TestUndoLogLarge {
conn
.
rollback
();
conn
.
rollback
();
conn
.
close
();
conn
.
close
();
}
}
}
}
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/todo/TestUndoLogMemory.java
浏览文件 @
79304ac8
...
@@ -30,7 +30,7 @@ public class TestUndoLogMemory {
...
@@ -30,7 +30,7 @@ public class TestUndoLogMemory {
// new TestUndoLogMemory().test(1000, "space(100000)");
// new TestUndoLogMemory().test(1000, "space(100000)");
}
}
p
rivate
void
test
(
int
count
,
String
defaultValue
)
throws
SQLException
{
p
ublic
void
test
(
int
count
,
String
defaultValue
)
throws
SQLException
{
// -Xmx1m -XX:+HeapDumpOnOutOfMemoryError
// -Xmx1m -XX:+HeapDumpOnOutOfMemoryError
DeleteDbFiles
.
execute
(
"data"
,
"test"
,
true
);
DeleteDbFiles
.
execute
(
"data"
,
"test"
,
true
);
...
@@ -74,4 +74,5 @@ public class TestUndoLogMemory {
...
@@ -74,4 +74,5 @@ public class TestUndoLogMemory {
System
.
out
.
println
(
"close---"
);
System
.
out
.
println
(
"close---"
);
conn
.
close
();
conn
.
close
();
}
}
}
}
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/trace/Arg.java
浏览文件 @
79304ac8
...
@@ -68,7 +68,7 @@ class Arg {
...
@@ -68,7 +68,7 @@ class Arg {
return
obj
;
return
obj
;
}
}
private
String
quote
(
Class
<?>
valueClass
,
Object
value
)
{
private
static
String
quote
(
Class
<?>
valueClass
,
Object
value
)
{
if
(
value
==
null
)
{
if
(
value
==
null
)
{
return
null
;
return
null
;
}
else
if
(
valueClass
==
String
.
class
)
{
}
else
if
(
valueClass
==
String
.
class
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestCache.java
浏览文件 @
79304ac8
...
@@ -118,7 +118,7 @@ public class TestCache extends TestBase implements CacheWriter {
...
@@ -118,7 +118,7 @@ public class TestCache extends TestBase implements CacheWriter {
conn
.
close
();
conn
.
close
();
}
}
private
int
getReadCount
(
Statement
stat
)
throws
Exception
{
private
static
int
getReadCount
(
Statement
stat
)
throws
Exception
{
ResultSet
rs
;
ResultSet
rs
;
rs
=
stat
.
executeQuery
(
"select value from information_schema.settings where name = 'info.FILE_READ'"
);
rs
=
stat
.
executeQuery
(
"select value from information_schema.settings where name = 'info.FILE_READ'"
);
rs
.
next
();
rs
.
next
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestCompress.java
浏览文件 @
79304ac8
...
@@ -243,7 +243,7 @@ public class TestCompress extends TestBase {
...
@@ -243,7 +243,7 @@ public class TestCompress extends TestBase {
assertEquals
(
buff
.
length
,
test
.
length
);
assertEquals
(
buff
.
length
,
test
.
length
);
assertEquals
(
buff
,
test
);
assertEquals
(
buff
,
test
);
Arrays
.
fill
(
test
,
(
byte
)
0
);
Arrays
.
fill
(
test
,
(
byte
)
0
);
utils
.
expand
(
out
,
test
,
0
);
CompressTool
.
expand
(
out
,
test
,
0
);
assertEquals
(
buff
,
test
);
assertEquals
(
buff
,
test
);
}
}
for
(
String
a
:
new
String
[]
{
null
,
"LZF"
,
"DEFLATE"
,
"ZIP"
,
"GZIP"
})
{
for
(
String
a
:
new
String
[]
{
null
,
"LZF"
,
"DEFLATE"
,
"ZIP"
,
"GZIP"
})
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestDataPage.java
浏览文件 @
79304ac8
...
@@ -67,7 +67,7 @@ public class TestDataPage extends TestBase implements DataHandler {
...
@@ -67,7 +67,7 @@ public class TestDataPage extends TestBase implements DataHandler {
testAll
();
testAll
();
}
}
private
void
testPerformance
()
{
private
static
void
testPerformance
()
{
Data
data
=
Data
.
create
(
null
,
1024
);
Data
data
=
Data
.
create
(
null
,
1024
);
for
(
int
j
=
0
;
j
<
4
;
j
++)
{
for
(
int
j
=
0
;
j
<
4
;
j
++)
{
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestDate.java
浏览文件 @
79304ac8
...
@@ -39,7 +39,7 @@ public class TestDate extends TestBase {
...
@@ -39,7 +39,7 @@ public class TestDate extends TestBase {
testCurrentTimeZone
();
testCurrentTimeZone
();
}
}
private
void
testCurrentTimeZone
()
{
private
static
void
testCurrentTimeZone
()
{
for
(
int
year
=
1970
;
year
<
2050
;
year
+=
3
)
{
for
(
int
year
=
1970
;
year
<
2050
;
year
+=
3
)
{
for
(
int
month
=
1
;
month
<=
12
;
month
++)
{
for
(
int
month
=
1
;
month
<=
12
;
month
++)
{
for
(
int
day
=
1
;
day
<
29
;
day
++)
{
for
(
int
day
=
1
;
day
<
29
;
day
++)
{
...
@@ -51,7 +51,7 @@ public class TestDate extends TestBase {
...
@@ -51,7 +51,7 @@ public class TestDate extends TestBase {
}
}
}
}
private
void
test
(
int
year
,
int
month
,
int
day
,
int
hour
)
{
private
static
void
test
(
int
year
,
int
month
,
int
day
,
int
hour
)
{
DateTimeUtils
.
parseDateTime
(
year
+
"-"
+
month
+
"-"
+
day
+
" "
+
hour
+
":00:00"
,
Value
.
TIMESTAMP
,
ErrorCode
.
TIMESTAMP_CONSTANT_2
);
DateTimeUtils
.
parseDateTime
(
year
+
"-"
+
month
+
"-"
+
day
+
" "
+
hour
+
":00:00"
,
Value
.
TIMESTAMP
,
ErrorCode
.
TIMESTAMP_CONSTANT_2
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestIntArray.java
浏览文件 @
79304ac8
...
@@ -39,7 +39,7 @@ public class TestIntArray extends TestBase {
...
@@ -39,7 +39,7 @@ public class TestIntArray extends TestBase {
assertEquals
(
5
,
array
.
get
(
2
));
assertEquals
(
5
,
array
.
get
(
2
));
}
}
private
void
testInit
()
{
private
static
void
testInit
()
{
IntArray
array
=
new
IntArray
(
new
int
[
0
]);
IntArray
array
=
new
IntArray
(
new
int
[
0
]);
array
.
add
(
10
);
array
.
add
(
10
);
}
}
...
@@ -81,7 +81,7 @@ public class TestIntArray extends TestBase {
...
@@ -81,7 +81,7 @@ public class TestIntArray extends TestBase {
}
}
}
}
private
int
[]
add
(
int
[]
array
,
int
i
,
int
value
)
{
private
static
int
[]
add
(
int
[]
array
,
int
i
,
int
value
)
{
int
[]
a2
=
new
int
[
array
.
length
+
1
];
int
[]
a2
=
new
int
[
array
.
length
+
1
];
System
.
arraycopy
(
array
,
0
,
a2
,
0
,
array
.
length
);
System
.
arraycopy
(
array
,
0
,
a2
,
0
,
array
.
length
);
if
(
i
<
array
.
length
)
{
if
(
i
<
array
.
length
)
{
...
@@ -92,15 +92,15 @@ public class TestIntArray extends TestBase {
...
@@ -92,15 +92,15 @@ public class TestIntArray extends TestBase {
return
array
;
return
array
;
}
}
private
int
[]
add
(
int
[]
array
,
int
value
)
{
private
static
int
[]
add
(
int
[]
array
,
int
value
)
{
return
add
(
array
,
array
.
length
,
value
);
return
add
(
array
,
array
.
length
,
value
);
}
}
private
int
get
(
int
[]
array
,
int
i
)
{
private
static
int
get
(
int
[]
array
,
int
i
)
{
return
array
[
i
];
return
array
[
i
];
}
}
private
int
[]
remove
(
int
[]
array
,
int
i
)
{
private
static
int
[]
remove
(
int
[]
array
,
int
i
)
{
int
[]
a2
=
new
int
[
array
.
length
-
1
];
int
[]
a2
=
new
int
[
array
.
length
-
1
];
System
.
arraycopy
(
array
,
0
,
a2
,
0
,
i
);
System
.
arraycopy
(
array
,
0
,
a2
,
0
,
i
);
if
(
i
<
a2
.
length
)
{
if
(
i
<
a2
.
length
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestOldVersion.java
浏览文件 @
79304ac8
...
@@ -132,12 +132,12 @@ public class TestOldVersion extends TestBase {
...
@@ -132,12 +132,12 @@ public class TestOldVersion extends TestBase {
m
.
invoke
(
serverOld
);
m
.
invoke
(
serverOld
);
}
}
private
ClassLoader
getClassLoader
(
String
jarFile
)
throws
Exception
{
private
static
ClassLoader
getClassLoader
(
String
jarFile
)
throws
Exception
{
URL
[]
urls
=
{
new
URL
(
jarFile
)
};
URL
[]
urls
=
{
new
URL
(
jarFile
)
};
return
new
URLClassLoader
(
urls
,
null
);
return
new
URLClassLoader
(
urls
,
null
);
}
}
private
Driver
getDriver
(
ClassLoader
cl
)
throws
Exception
{
private
static
Driver
getDriver
(
ClassLoader
cl
)
throws
Exception
{
Class
<?>
driverClass
;
Class
<?>
driverClass
;
try
{
try
{
driverClass
=
cl
.
loadClass
(
"org.h2.Driver"
);
driverClass
=
cl
.
loadClass
(
"org.h2.Driver"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestPageStore.java
浏览文件 @
79304ac8
...
@@ -794,7 +794,7 @@ public class TestPageStore extends TestBase implements DatabaseEventListener {
...
@@ -794,7 +794,7 @@ public class TestPageStore extends TestBase implements DatabaseEventListener {
event
(
"setProgress "
+
state
+
" "
+
name
+
" "
+
x
+
" "
+
max
);
event
(
"setProgress "
+
state
+
" "
+
name
+
" "
+
x
+
" "
+
max
);
}
}
private
void
event
(
String
s
)
{
private
static
void
event
(
String
s
)
{
eventBuffer
.
append
(
s
).
append
(
';'
);
eventBuffer
.
append
(
s
).
append
(
';'
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestScriptReader.java
浏览文件 @
79304ac8
...
@@ -59,7 +59,7 @@ public class TestScriptReader extends TestBase {
...
@@ -59,7 +59,7 @@ public class TestScriptReader extends TestBase {
}
}
}
}
private
String
randomStatement
(
Random
random
)
{
private
static
String
randomStatement
(
Random
random
)
{
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buff
=
new
StringBuilder
();
int
len
=
random
.
nextInt
(
5
);
int
len
=
random
.
nextInt
(
5
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestSecurity.java
浏览文件 @
79304ac8
...
@@ -37,35 +37,33 @@ public class TestSecurity extends TestBase {
...
@@ -37,35 +37,33 @@ public class TestSecurity extends TestBase {
testXTEA
();
testXTEA
();
}
}
private
void
testConnectWithHash
()
throws
SQLException
{
private
static
void
testConnectWithHash
()
throws
SQLException
{
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:test"
,
"sa"
,
"sa"
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:test"
,
"sa"
,
"sa"
);
String
pwd
=
StringUtils
.
convertBytesToString
(
new
SHA256
()
.
getKeyPasswordHash
(
"SA"
,
"sa"
.
toCharArray
()));
String
pwd
=
StringUtils
.
convertBytesToString
(
SHA256
.
getKeyPasswordHash
(
"SA"
,
"sa"
.
toCharArray
()));
Connection
conn2
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:test;PASSWORD_HASH=TRUE"
,
"sa"
,
pwd
);
Connection
conn2
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:test;PASSWORD_HASH=TRUE"
,
"sa"
,
pwd
);
conn
.
close
();
conn
.
close
();
conn2
.
close
();
conn2
.
close
();
}
}
private
void
testSHA
()
{
private
void
testSHA
()
{
SHA256
sha
=
new
SHA256
();
testOneSHA
();
testOneSHA
(
sha
);
}
}
private
String
getHashString
(
SHA256
sha
,
byte
[]
data
)
{
private
String
getHashString
(
byte
[]
data
)
{
byte
[]
result
=
sha
.
getHash
(
data
,
true
);
byte
[]
result
=
SHA256
.
getHash
(
data
,
true
);
if
(
data
.
length
>
0
)
{
if
(
data
.
length
>
0
)
{
assertEquals
(
0
,
data
[
0
]);
assertEquals
(
0
,
data
[
0
]);
}
}
return
StringUtils
.
convertBytesToString
(
result
);
return
StringUtils
.
convertBytesToString
(
result
);
}
}
private
void
testOneSHA
(
SHA256
sha
)
{
private
void
testOneSHA
()
{
assertEquals
(
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
,
assertEquals
(
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
,
getHashString
(
sha
,
new
byte
[]
{}));
getHashString
(
new
byte
[]
{}));
assertEquals
(
"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4"
,
assertEquals
(
"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4"
,
getHashString
(
sha
,
new
byte
[]
{
0x19
}));
getHashString
(
new
byte
[]
{
0x19
}));
assertEquals
(
"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8"
,
assertEquals
(
"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8"
,
getHashString
(
getHashString
(
sha
,
new
byte
[]
{
(
byte
)
0xe3
,
(
byte
)
0xd7
,
0x25
,
0x70
,
(
byte
)
0xdc
,
(
byte
)
0xdd
,
0x78
,
0x7c
,
(
byte
)
0xe3
,
new
byte
[]
{
(
byte
)
0xe3
,
(
byte
)
0xd7
,
0x25
,
0x70
,
(
byte
)
0xdc
,
(
byte
)
0xdd
,
0x78
,
0x7c
,
(
byte
)
0xe3
,
(
byte
)
0x88
,
0x7a
,
(
byte
)
0xb2
,
(
byte
)
0xcd
,
0x68
,
0x46
,
0x52
}));
(
byte
)
0x88
,
0x7a
,
(
byte
)
0xb2
,
(
byte
)
0xcd
,
0x68
,
0x46
,
0x52
}));
checkSHA256
(
""
,
"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
);
checkSHA256
(
""
,
"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
);
...
@@ -81,12 +79,11 @@ public class TestSecurity extends TestBase {
...
@@ -81,12 +79,11 @@ public class TestSecurity extends TestBase {
}
}
private
void
checkSHA256
(
String
message
,
String
expected
)
{
private
void
checkSHA256
(
String
message
,
String
expected
)
{
SHA256
sha
=
new
SHA256
();
String
hash
=
StringUtils
.
convertBytesToString
(
SHA256
.
getHash
(
message
.
getBytes
(),
true
)).
toUpperCase
();
String
hash
=
StringUtils
.
convertBytesToString
(
sha
.
getHash
(
message
.
getBytes
(),
true
)).
toUpperCase
();
assertEquals
(
expected
,
hash
);
assertEquals
(
expected
,
hash
);
}
}
private
void
testXTEA
()
{
private
static
void
testXTEA
()
{
byte
[]
test
=
new
byte
[
4096
];
byte
[]
test
=
new
byte
[
4096
];
BlockCipher
xtea
=
CipherFactory
.
getBlockCipher
(
"XTEA"
);
BlockCipher
xtea
=
CipherFactory
.
getBlockCipher
(
"XTEA"
);
xtea
.
setKey
(
"abcdefghijklmnop"
.
getBytes
());
xtea
.
setKey
(
"abcdefghijklmnop"
.
getBytes
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestStreams.java
浏览文件 @
79304ac8
...
@@ -36,7 +36,7 @@ public class TestStreams extends TestBase {
...
@@ -36,7 +36,7 @@ public class TestStreams extends TestBase {
testLZFStreamClose
();
testLZFStreamClose
();
}
}
private
byte
[]
getRandomBytes
(
Random
random
)
{
private
static
byte
[]
getRandomBytes
(
Random
random
)
{
int
[]
sizes
=
{
0
,
1
,
random
.
nextInt
(
1000
),
random
.
nextInt
(
100000
),
random
.
nextInt
(
1000000
)
};
int
[]
sizes
=
{
0
,
1
,
random
.
nextInt
(
1000
),
random
.
nextInt
(
100000
),
random
.
nextInt
(
1000000
)
};
int
size
=
sizes
[
random
.
nextInt
(
sizes
.
length
)];
int
size
=
sizes
[
random
.
nextInt
(
sizes
.
length
)];
byte
[]
buffer
=
new
byte
[
size
];
byte
[]
buffer
=
new
byte
[
size
];
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestTraceSystem.java
浏览文件 @
79304ac8
...
@@ -33,7 +33,7 @@ public class TestTraceSystem extends TestBase {
...
@@ -33,7 +33,7 @@ public class TestTraceSystem extends TestBase {
testAdapter
();
testAdapter
();
}
}
private
void
testAdapter
()
{
private
static
void
testAdapter
()
{
TraceSystem
ts
=
new
TraceSystem
(
null
);
TraceSystem
ts
=
new
TraceSystem
(
null
);
ts
.
setLevelFile
(
TraceSystem
.
ADAPTER
);
ts
.
setLevelFile
(
TraceSystem
.
ADAPTER
);
ts
.
getTrace
(
"test"
).
info
(
"test"
);
ts
.
getTrace
(
"test"
).
info
(
"test"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestValueMemory.java
浏览文件 @
79304ac8
...
@@ -94,7 +94,7 @@ public class TestValueMemory extends TestBase implements DataHandler {
...
@@ -94,7 +94,7 @@ public class TestValueMemory extends TestBase implements DataHandler {
long
first
=
Utils
.
getMemoryUsed
();
long
first
=
Utils
.
getMemoryUsed
();
ArrayList
<
Value
>
list
=
new
ArrayList
<
Value
>();
ArrayList
<
Value
>
list
=
new
ArrayList
<
Value
>();
long
memory
=
0
;
long
memory
=
0
;
for
(
int
i
=
0
;
memory
<
1000000
;
i
++
)
{
while
(
memory
<
1000000
)
{
Value
v
=
create
(
type
);
Value
v
=
create
(
type
);
memory
+=
v
.
getMemory
()
+
Constants
.
MEMORY_POINTER
;
memory
+=
v
.
getMemory
()
+
Constants
.
MEMORY_POINTER
;
list
.
add
(
v
);
list
.
add
(
v
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/utils/MemoryFootprint.java
浏览文件 @
79304ac8
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
*/
*/
package
org
.
h2
.
test
.
utils
;
package
org
.
h2
.
test
.
utils
;
import
java.io.IOException
;
import
java.lang.instrument.Instrumentation
;
import
java.lang.instrument.Instrumentation
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
...
@@ -26,7 +25,7 @@ public class MemoryFootprint {
...
@@ -26,7 +25,7 @@ public class MemoryFootprint {
*
*
* @param a ignored
* @param a ignored
*/
*/
public
static
void
main
(
String
...
a
)
throws
IOException
{
public
static
void
main
(
String
...
a
)
{
// System.getProperties().store(System.out, "");
// System.getProperties().store(System.out, "");
print
(
"Object"
,
new
Object
());
print
(
"Object"
,
new
Object
());
print
(
"Timestamp"
,
new
java
.
sql
.
Timestamp
(
0
));
print
(
"Timestamp"
,
new
java
.
sql
.
Timestamp
(
0
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
79304ac8
...
@@ -548,7 +548,7 @@ public class BuildBase {
...
@@ -548,7 +548,7 @@ public class BuildBase {
}
}
in
.
close
();
in
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"Error downloading
"
,
e
);
throw
new
RuntimeException
(
"Error downloading
"
+
fileURL
+
" to "
+
target
,
e
);
}
}
byte
[]
data
=
buff
.
toByteArray
();
byte
[]
data
=
buff
.
toByteArray
();
String
got
=
getSHA1
(
data
);
String
got
=
getSHA1
(
data
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/net/PgTcpRedirect.java
浏览文件 @
79304ac8
...
@@ -537,7 +537,7 @@ public class PgTcpRedirect {
...
@@ -537,7 +537,7 @@ public class PgTcpRedirect {
* @param buffer the byte array
* @param buffer the byte array
* @param len the length
* @param len the length
*/
*/
s
ynchronized
static
void
printData
(
byte
[]
buffer
,
int
len
)
{
s
tatic
synchronized
void
printData
(
byte
[]
buffer
,
int
len
)
{
if
(
DEBUG
)
{
if
(
DEBUG
)
{
System
.
out
.
print
(
" "
);
System
.
out
.
print
(
" "
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/SQLStatement.java
浏览文件 @
79304ac8
...
@@ -66,7 +66,7 @@ public class SQLStatement {
...
@@ -66,7 +66,7 @@ public class SQLStatement {
}
}
}
}
private
void
setValue
(
PreparedStatement
prep
,
int
parameterIndex
,
Object
x
)
{
private
static
void
setValue
(
PreparedStatement
prep
,
int
parameterIndex
,
Object
x
)
{
try
{
try
{
prep
.
setObject
(
parameterIndex
,
x
);
prep
.
setObject
(
parameterIndex
,
x
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/TableDefinition.java
浏览文件 @
79304ac8
...
@@ -152,7 +152,7 @@ class TableDefinition<T> {
...
@@ -152,7 +152,7 @@ class TableDefinition<T> {
}
}
}
}
private
String
getDataType
(
Field
field
)
{
private
static
String
getDataType
(
Field
field
)
{
Class
<?>
fieldClass
=
field
.
getType
();
Class
<?>
fieldClass
=
field
.
getType
();
if
(
fieldClass
==
Integer
.
class
)
{
if
(
fieldClass
==
Integer
.
class
)
{
return
"INT"
;
return
"INT"
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/bytecode/ClassReader.java
浏览文件 @
79304ac8
...
@@ -38,7 +38,7 @@ public class ClassReader {
...
@@ -38,7 +38,7 @@ public class ClassReader {
private
int
nextPc
;
private
int
nextPc
;
private
Map
<
String
,
Object
>
fieldMap
=
new
HashMap
<
String
,
Object
>();
private
Map
<
String
,
Object
>
fieldMap
=
new
HashMap
<
String
,
Object
>();
private
void
debug
(
String
s
)
{
private
static
void
debug
(
String
s
)
{
if
(
DEBUG
)
{
if
(
DEBUG
)
{
System
.
out
.
println
(
s
);
System
.
out
.
println
(
s
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/java/JavaParser.java
浏览文件 @
79304ac8
...
@@ -157,7 +157,7 @@ public class JavaParser {
...
@@ -157,7 +157,7 @@ public class JavaParser {
}
}
}
}
private
String
cleanPackageName
(
String
name
)
{
private
static
String
cleanPackageName
(
String
name
)
{
if
(
name
.
startsWith
(
"org.h2.java.lang"
)
||
name
.
startsWith
(
"org.h2.java.io"
))
{
if
(
name
.
startsWith
(
"org.h2.java.lang"
)
||
name
.
startsWith
(
"org.h2.java.io"
))
{
return
name
.
substring
(
"org.h2."
.
length
());
return
name
.
substring
(
"org.h2."
.
length
());
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论