Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5f105925
Unverified
提交
5f105925
authored
3月 19, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
3月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #993 from katzyn/misc
Fix some compiler warnings and improve assert*() methods
上级
f622267f
25cbca39
隐藏空白字符变更
内嵌
并排
正在显示
37 个修改的文件
包含
184 行增加
和
160 行删除
+184
-160
Comparison.java
h2/src/main/org/h2/expression/Comparison.java
+2
-2
Function.java
h2/src/main/org/h2/expression/Function.java
+3
-3
MVStoreTool.java
h2/src/main/org/h2/mvstore/MVStoreTool.java
+1
-2
JdbcUtils.java
h2/src/main/org/h2/util/JdbcUtils.java
+1
-1
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+32
-7
AbstractBaseForCommonTableExpressions.java
...org/h2/test/db/AbstractBaseForCommonTableExpressions.java
+1
-1
TestDeadlock.java
h2/src/test/org/h2/test/db/TestDeadlock.java
+1
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+1
-1
TestReadOnly.java
h2/src/test/org/h2/test/db/TestReadOnly.java
+3
-3
TestRunscript.java
h2/src/test/org/h2/test/db/TestRunscript.java
+2
-2
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+2
-2
TestSynonymForTable.java
h2/src/test/org/h2/test/db/TestSynonymForTable.java
+1
-1
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+1
-1
UpdateTest.java
h2/src/test/org/h2/test/jaqu/UpdateTest.java
+2
-2
TestBatchUpdates.java
h2/src/test/org/h2/test/jdbc/TestBatchUpdates.java
+7
-7
TestDatabaseEventListener.java
h2/src/test/org/h2/test/jdbc/TestDatabaseEventListener.java
+3
-3
TestGetGeneratedKeys.java
h2/src/test/org/h2/test/jdbc/TestGetGeneratedKeys.java
+4
-4
TestMetaData.java
h2/src/test/org/h2/test/jdbc/TestMetaData.java
+5
-5
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+6
-6
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+60
-60
TestStatement.java
h2/src/test/org/h2/test/jdbc/TestStatement.java
+9
-9
TestXA.java
h2/src/test/org/h2/test/jdbcx/TestXA.java
+3
-3
RecoverLobTest.java
h2/src/test/org/h2/test/recover/RecoverLobTest.java
+1
-1
TestCacheLIRS.java
h2/src/test/org/h2/test/store/TestCacheLIRS.java
+3
-3
TestCacheLongKeyLIRS.java
h2/src/test/org/h2/test/store/TestCacheLongKeyLIRS.java
+3
-3
TestDataUtils.java
h2/src/test/org/h2/test/store/TestDataUtils.java
+1
-1
TestMVRTree.java
h2/src/test/org/h2/test/store/TestMVRTree.java
+4
-4
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+4
-4
TestMVStoreBenchmark.java
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
+1
-1
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+1
-1
TestTransactionStore.java
h2/src/test/org/h2/test/store/TestTransactionStore.java
+1
-1
TestClassLoaderLeak.java
h2/src/test/org/h2/test/unit/TestClassLoaderLeak.java
+1
-1
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+7
-7
TestNetUtils.java
h2/src/test/org/h2/test/unit/TestNetUtils.java
+1
-1
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+4
-4
TestValue.java
h2/src/test/org/h2/test/unit/TestValue.java
+1
-1
TestColumnNamer.java
h2/src/test/org/h2/test/utils/TestColumnNamer.java
+1
-1
没有找到文件。
h2/src/main/org/h2/expression/Comparison.java
浏览文件 @
5f105925
...
...
@@ -244,7 +244,7 @@ public class Comparison extends Condition {
result
=
l
==
ValueNull
.
INSTANCE
;
break
;
case
IS_NOT_NULL:
result
=
!(
l
==
ValueNull
.
INSTANCE
)
;
result
=
l
!=
ValueNull
.
INSTANCE
;
break
;
default
:
throw
DbException
.
throwInternalError
(
"type="
+
compareType
);
...
...
@@ -275,7 +275,7 @@ public class Comparison extends Condition {
return
ValueBoolean
.
get
(
result
);
}
private
String
[]
getEnumerators
(
Value
left
,
Value
right
)
{
private
static
String
[]
getEnumerators
(
Value
left
,
Value
right
)
{
if
(
left
.
getType
()
==
Value
.
ENUM
)
{
return
((
ValueEnum
)
left
).
getEnumerators
();
}
else
if
(
right
.
getType
()
==
Value
.
ENUM
)
{
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
5f105925
...
...
@@ -956,7 +956,7 @@ public class Function extends Expression implements FunctionCall {
result
=
v0
;
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
Value
v
=
getNullOrValue
(
session
,
args
,
values
,
i
);
if
(
!(
v
==
ValueNull
.
INSTANCE
)
)
{
if
(
v
!=
ValueNull
.
INSTANCE
)
{
result
=
v
.
convertTo
(
dataType
);
break
;
}
...
...
@@ -968,7 +968,7 @@ public class Function extends Expression implements FunctionCall {
result
=
ValueNull
.
INSTANCE
;
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
Value
v
=
getNullOrValue
(
session
,
args
,
values
,
i
);
if
(
!(
v
==
ValueNull
.
INSTANCE
)
)
{
if
(
v
!=
ValueNull
.
INSTANCE
)
{
v
=
v
.
convertTo
(
dataType
);
if
(
result
==
ValueNull
.
INSTANCE
)
{
result
=
v
;
...
...
@@ -1005,7 +1005,7 @@ public class Function extends Expression implements FunctionCall {
// (expr, when, then, else)
// (expr, when, then, when, then)
// (expr, when, then, when, then, else)
if
(
!(
v0
==
ValueNull
.
INSTANCE
)
)
{
if
(
v0
!=
ValueNull
.
INSTANCE
)
{
for
(
int
i
=
1
,
len
=
args
.
length
-
1
;
i
<
len
;
i
+=
2
)
{
Value
when
=
args
[
i
].
getValue
(
session
);
if
(
database
.
areEqual
(
v0
,
when
))
{
...
...
h2/src/main/org/h2/mvstore/MVStoreTool.java
浏览文件 @
5f105925
...
...
@@ -222,8 +222,7 @@ public class MVStoreTool {
if
(
mapId
==
0
&&
details
)
{
ByteBuffer
data
;
if
(
compressed
)
{
boolean
fast
=
!((
type
&
DataUtils
.
PAGE_COMPRESSED_HIGH
)
==
DataUtils
.
PAGE_COMPRESSED_HIGH
);
boolean
fast
=
(
type
&
DataUtils
.
PAGE_COMPRESSED_HIGH
)
!=
DataUtils
.
PAGE_COMPRESSED_HIGH
;
Compressor
compressor
=
getCompressor
(
fast
);
int
lenAdd
=
DataUtils
.
readVarInt
(
chunk
);
int
compLen
=
pageSize
+
start
-
chunk
.
position
();
...
...
h2/src/main/org/h2/util/JdbcUtils.java
浏览文件 @
5f105925
...
...
@@ -177,7 +177,7 @@ public class JdbcUtils {
if
(
classFactory
.
match
(
className
))
{
try
{
Class
<?>
userClass
=
classFactory
.
loadClass
(
className
);
if
(
!(
userClass
==
null
)
)
{
if
(
userClass
!=
null
)
{
return
(
Class
<
Z
>)
userClass
;
}
}
catch
(
Exception
e
)
{
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
5f105925
...
...
@@ -716,11 +716,7 @@ public abstract class TestBase {
* @throws AssertionError if the values are not equal
*/
public
void
assertEquals
(
Object
expected
,
Object
actual
)
{
if
(
expected
==
null
||
actual
==
null
)
{
assertTrue
(
expected
==
actual
);
return
;
}
if
(!
expected
.
equals
(
actual
))
{
if
(!
Objects
.
equals
(
expected
,
actual
))
{
fail
(
" expected: "
+
expected
+
" actual: "
+
actual
);
}
}
...
...
@@ -961,7 +957,9 @@ public abstract class TestBase {
* @throws AssertionError if the condition is false
*/
public
void
assertTrue
(
boolean
condition
)
{
assertTrue
(
"Expected: true got: false"
,
condition
);
if
(!
condition
)
{
fail
(
"Expected: true got: false"
);
}
}
/**
...
...
@@ -976,6 +974,31 @@ public abstract class TestBase {
}
}
/**
* Check that the passed object is not null.
*
* @param obj the object
* @throws AssertionError if the condition is false
*/
public
void
assertNotNull
(
Object
obj
)
{
if
(
obj
==
null
)
{
fail
(
"Expected: not null got: null"
);
}
}
/**
* Check that the passed object is not null.
*
* @param message the message to print if the condition is false
* @param obj the object
* @throws AssertionError if the condition is false
*/
public
void
assertNotNull
(
String
message
,
Object
obj
)
{
if
(
obj
==
null
)
{
fail
(
message
);
}
}
/**
* Check that the passed boolean is true.
*
...
...
@@ -996,7 +1019,9 @@ public abstract class TestBase {
* @throws AssertionError if the condition is true
*/
protected
void
assertFalse
(
boolean
value
)
{
assertFalse
(
"Expected: false got: true"
,
value
);
if
(
value
)
{
fail
(
"Expected: false got: true"
);
}
}
/**
...
...
h2/src/test/org/h2/test/db/AbstractBaseForCommonTableExpressions.java
浏览文件 @
5f105925
...
...
@@ -57,7 +57,7 @@ public abstract class AbstractBaseForCommonTableExpressions extends TestBase {
rs
=
prep
.
executeQuery
();
for
(
int
columnIndex
=
1
;
columnIndex
<=
rs
.
getMetaData
().
getColumnCount
();
columnIndex
++)
{
assert
True
(
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
)
!=
null
);
assert
NotNull
(
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
)
);
assertEquals
(
expectedColumnNames
[
columnIndex
-
1
],
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
));
assertEquals
(
"wrong type of column "
+
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
)
+
" on iteration #"
...
...
h2/src/test/org/h2/test/db/TestDeadlock.java
浏览文件 @
5f105925
...
...
@@ -390,7 +390,7 @@ public class TestDeadlock extends TestBase {
}
private
void
checkDeadlock
()
throws
SQLException
{
assert
True
(
lastException
!=
null
);
assert
NotNull
(
lastException
);
assertKnownException
(
lastException
);
assertEquals
(
ErrorCode
.
DEADLOCK_1
,
lastException
.
getErrorCode
());
SQLException
e2
=
lastException
.
getNextException
();
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
5f105925
...
...
@@ -520,7 +520,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
stat
.
execute
(
"delete from test"
);
rs
=
stat
.
executeQuery
(
"call transaction_id()"
);
rs
.
next
();
assert
True
(
rs
.
getString
(
1
)
!=
null
);
assert
NotNull
(
rs
.
getString
(
1
)
);
stat
.
execute
(
"drop table test"
);
conn
.
close
();
}
...
...
h2/src/test/org/h2/test/db/TestReadOnly.java
浏览文件 @
5f105925
...
...
@@ -130,7 +130,7 @@ public class TestReadOnly extends TestBase {
File
f
=
File
.
createTempFile
(
"test"
,
"temp"
);
assertTrue
(
f
.
canWrite
());
f
.
setReadOnly
();
assert
True
(!
f
.
canWrite
());
assert
False
(
f
.
canWrite
());
f
.
delete
();
f
=
File
.
createTempFile
(
"test"
,
"temp"
);
...
...
@@ -138,7 +138,7 @@ public class TestReadOnly extends TestBase {
r
.
write
(
1
);
f
.
setReadOnly
();
r
.
close
();
assert
True
(!
f
.
canWrite
());
assert
False
(
f
.
canWrite
());
f
.
delete
();
deleteDb
(
"readonlyFiles"
);
...
...
@@ -147,7 +147,7 @@ public class TestReadOnly extends TestBase {
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1, 'Hello')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(2, 'World')"
);
assert
True
(!
conn
.
isReadOnly
());
assert
False
(
conn
.
isReadOnly
());
conn
.
close
();
if
(
setReadOnly
)
{
...
...
h2/src/test/org/h2/test/db/TestRunscript.java
浏览文件 @
5f105925
...
...
@@ -350,7 +350,7 @@ public class TestRunscript extends TestBase implements Trigger {
Thread
.
sleep
(
200
);
stat
.
cancel
();
SQLException
e
=
(
SQLException
)
task
.
getException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
stat
.
execute
(
"set throttle 1000"
);
...
...
@@ -367,7 +367,7 @@ public class TestRunscript extends TestBase implements Trigger {
Thread
.
sleep
(
200
);
stat
.
cancel
();
e
=
(
SQLException
)
task
.
getException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
conn
.
close
();
...
...
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
5f105925
...
...
@@ -914,7 +914,7 @@ public class TestSpatial extends TestBase {
count
++;
int
id
=
rs
.
getInt
(
1
);
if
(
id
==
3
||
id
==
6
)
{
assert
True
(
rs
.
getObject
(
2
)
!=
null
);
assert
NotNull
(
rs
.
getObject
(
2
)
);
}
else
{
assertNull
(
rs
.
getObject
(
2
));
}
...
...
@@ -933,7 +933,7 @@ public class TestSpatial extends TestBase {
count
=
0
;
while
(
rs
.
next
())
{
count
++;
assert
True
(
rs
.
getObject
(
2
)
!=
null
);
assert
NotNull
(
rs
.
getObject
(
2
)
);
}
assertEquals
(
2
,
count
);
...
...
h2/src/test/org/h2/test/db/TestSynonymForTable.java
浏览文件 @
5f105925
...
...
@@ -184,7 +184,7 @@ public class TestSynonymForTable extends TestBase {
assertEquals
(
"BACKINGTABLE"
,
synonyms
.
getString
(
"SYNONYM_FOR"
));
assertEquals
(
"VALID"
,
synonyms
.
getString
(
"STATUS"
));
assertEquals
(
""
,
synonyms
.
getString
(
"REMARKS"
));
assert
True
(
synonyms
.
getString
(
"ID"
)
!=
null
);
assert
NotNull
(
synonyms
.
getString
(
"ID"
)
);
assertFalse
(
synonyms
.
next
());
conn
.
close
();
}
...
...
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
5f105925
...
...
@@ -507,7 +507,7 @@ public class TestTableEngines extends TestBase {
stat
.
executeUpdate
(
"CREATE TABLE T(ID INT AFFINITY PRIMARY KEY, NAME VARCHAR, AGE INT)"
+
" ENGINE \""
+
AffinityTableEngine
.
class
.
getName
()
+
"\""
);
Table
tbl
=
AffinityTableEngine
.
createdTbl
;
assert
True
(
tbl
!=
nul
l
);
assert
NotNull
(
tb
l
);
assertEquals
(
3
,
tbl
.
getIndexes
().
size
());
Index
aff
=
tbl
.
getIndexes
().
get
(
2
);
assertTrue
(
aff
.
getIndexType
().
isAffinity
());
...
...
h2/src/test/org/h2/test/jaqu/UpdateTest.java
浏览文件 @
5f105925
...
...
@@ -75,7 +75,7 @@ public class UpdateTest extends TestBase {
Order
ourUpdatedOrder
=
db
.
from
(
o
).
where
(
o
.
orderDate
)
.
is
(
valueOf
(
"2007-01-03"
)).
selectFirst
();
assert
True
(
"updated order not found"
,
ourUpdatedOrder
!=
null
);
assert
NotNull
(
"updated order not found"
,
ourUpdatedOrder
);
// undo update
ourOrder
.
orderDate
=
valueOf
(
"2007-01-02"
);
...
...
@@ -113,7 +113,7 @@ public class UpdateTest extends TestBase {
Order
ourUpdatedOrder
=
db
.
from
(
o
).
where
(
o
.
orderDate
)
.
is
(
valueOf
(
"2007-01-03"
)).
selectFirst
();
assert
True
(
"updated order not found"
,
ourUpdatedOrder
!=
null
);
assert
NotNull
(
"updated order not found"
,
ourUpdatedOrder
);
// undo update
ourOrder
.
orderDate
=
valueOf
(
"2007-01-02"
);
...
...
h2/src/test/org/h2/test/jdbc/TestBatchUpdates.java
浏览文件 @
5f105925
...
...
@@ -79,13 +79,13 @@ public class TestBatchUpdates extends TestBase {
}
catch
(
SQLException
e
)
{
assertContains
(
e
.
toString
(),
"TEST_Y"
);
e
=
e
.
getNextException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertContains
(
e
.
toString
(),
"TEST_Y"
);
e
=
e
.
getNextException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertContains
(
e
.
toString
(),
"TEST_X"
);
e
=
e
.
getNextException
();
assert
True
(
e
==
null
);
assert
Null
(
e
);
}
stat
.
execute
(
"create table test(id int)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"insert into test values(?)"
);
...
...
@@ -98,13 +98,13 @@ public class TestBatchUpdates extends TestBase {
}
catch
(
SQLException
e
)
{
assertContains
(
e
.
toString
(),
"TEST_Y"
);
e
=
e
.
getNextException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertContains
(
e
.
toString
(),
"TEST_Y"
);
e
=
e
.
getNextException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertContains
(
e
.
toString
(),
"TEST_X"
);
e
=
e
.
getNextException
();
assert
True
(
e
==
null
);
assert
Null
(
e
);
}
stat
.
execute
(
"drop table test"
);
conn
.
close
();
...
...
@@ -542,7 +542,7 @@ public class TestBatchUpdates extends TestBase {
trace
(
"Count val is: "
+
count
);
// make sure that we have the correct error code for
// the failed update.
if
(
!(
batchUpdates
[
1
]
==
-
3
&&
count
==
1
)
)
{
if
(
batchUpdates
[
1
]
!=
-
3
||
count
!=
1
)
{
fail
(
"insert failed"
);
}
}
...
...
h2/src/test/org/h2/test/jdbc/TestDatabaseEventListener.java
浏览文件 @
5f105925
...
...
@@ -143,7 +143,7 @@ public class TestDatabaseEventListener extends TestBase {
MyDatabaseEventListener
.
class
.
getName
());
conn
=
org
.
h2
.
Driver
.
load
().
connect
(
url
,
p
);
conn
.
close
();
assert
True
(!
calledCreateIndex
);
assert
False
(
calledCreateIndex
);
}
private
void
testIndexNotRebuilt
()
throws
SQLException
{
...
...
@@ -176,7 +176,7 @@ public class TestDatabaseEventListener extends TestBase {
MyDatabaseEventListener
.
class
.
getName
());
conn
=
org
.
h2
.
Driver
.
load
().
connect
(
url
,
p
);
conn
.
close
();
assert
True
(!
calledCreateIndex
);
assert
False
(
calledCreateIndex
);
}
private
void
testCloseLog0
(
boolean
shutdown
)
throws
SQLException
{
...
...
@@ -205,7 +205,7 @@ public class TestDatabaseEventListener extends TestBase {
conn
=
org
.
h2
.
Driver
.
load
().
connect
(
url
,
p
);
conn
.
close
();
if
(
calledOpened
)
{
assert
True
(!
calledScan
);
assert
False
(
calledScan
);
}
}
...
...
h2/src/test/org/h2/test/jdbc/TestGetGeneratedKeys.java
浏览文件 @
5f105925
...
...
@@ -130,19 +130,19 @@ public class TestGetGeneratedKeys extends TestBase {
rs
.
next
();
assertEquals
(
1L
,
rs
.
getLong
(
1
));
UUID
u1
=
(
UUID
)
rs
.
getObject
(
2
);
assert
True
(
u1
!=
null
);
assert
NotNull
(
u1
);
rs
.
next
();
assertEquals
(
2L
,
rs
.
getLong
(
1
));
UUID
u2
=
(
UUID
)
rs
.
getObject
(
2
);
assert
True
(
u2
!=
null
);
assert
NotNull
(
u2
);
rs
.
next
();
assertEquals
(
3L
,
rs
.
getLong
(
1
));
UUID
u3
=
(
UUID
)
rs
.
getObject
(
2
);
assert
True
(
u3
!=
null
);
assert
NotNull
(
u3
);
rs
.
next
();
assertEquals
(
4L
,
rs
.
getLong
(
1
));
UUID
u4
=
(
UUID
)
rs
.
getObject
(
2
);
assert
True
(
u4
!=
null
);
assert
NotNull
(
u4
);
assertFalse
(
rs
.
next
());
assertFalse
(
u1
.
equals
(
u2
));
assertFalse
(
u2
.
equals
(
u3
));
...
...
h2/src/test/org/h2/test/jdbc/TestMetaData.java
浏览文件 @
5f105925
...
...
@@ -127,7 +127,7 @@ public class TestMetaData extends TestBase {
rs
=
stat
.
executeQuery
(
"select 1 from dual"
);
rs
.
next
();
rsMeta
=
rs
.
getMetaData
();
assert
True
(
rsMeta
.
getCatalogName
(
1
)
!=
null
);
assert
NotNull
(
rsMeta
.
getCatalogName
(
1
)
);
assertEquals
(
"1"
,
rsMeta
.
getColumnLabel
(
1
));
assertEquals
(
"1"
,
rsMeta
.
getColumnName
(
1
));
assertEquals
(
""
,
rsMeta
.
getSchemaName
(
1
));
...
...
@@ -367,7 +367,7 @@ public class TestMetaData extends TestBase {
assertTrue
(
dr
.
jdbcCompliant
());
assertEquals
(
0
,
dr
.
getPropertyInfo
(
null
,
null
).
length
);
assert
True
(
dr
.
connect
(
"jdbc:test:false"
,
null
)
==
null
);
assert
Null
(
dr
.
connect
(
"jdbc:test:false"
,
null
)
);
assertTrue
(
meta
.
getNumericFunctions
().
length
()
>
0
);
assertTrue
(
meta
.
getStringFunctions
().
length
()
>
0
);
...
...
@@ -994,9 +994,9 @@ public class TestMetaData extends TestBase {
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
},
null
,
null
);
assert
True
(
conn
.
getWarnings
()
==
null
);
assert
Null
(
conn
.
getWarnings
()
);
conn
.
clearWarnings
();
assert
True
(
conn
.
getWarnings
()
==
null
);
assert
Null
(
conn
.
getWarnings
()
);
conn
.
close
();
}
...
...
@@ -1050,7 +1050,7 @@ public class TestMetaData extends TestBase {
rs
=
meta
.
getTables
(
null
,
Constants
.
SCHEMA_MAIN
,
null
,
new
String
[]
{
"TABLE"
});
assert
True
(
rs
.
getStatement
()
==
null
);
assert
Null
(
rs
.
getStatement
()
);
rs
.
next
();
assertEquals
(
"TEST"
,
rs
.
getString
(
"TABLE_NAME"
));
assertFalse
(
rs
.
next
());
...
...
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
5f105925
...
...
@@ -404,7 +404,7 @@ public class TestPreparedStatement extends TestBase {
Thread
.
sleep
(
100
);
prep
.
cancel
();
SQLException
e
=
(
SQLException
)
t
.
getException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
prep
.
setInt
(
1
,
1
);
prep
.
setInt
(
2
,
1
);
...
...
@@ -618,7 +618,7 @@ public class TestPreparedStatement extends TestBase {
rs
.
next
();
Object
o
=
rs
.
getObject
(
2
);
assertTrue
(
o
instanceof
byte
[]);
assert
True
(
rs
.
getObject
(
3
)
==
null
);
assert
Null
(
rs
.
getObject
(
3
)
);
rs
.
next
();
o
=
rs
.
getObject
(
2
);
assertTrue
(
o
instanceof
byte
[]);
...
...
@@ -1446,9 +1446,9 @@ public class TestPreparedStatement extends TestBase {
assertEquals
(
ascii2
,
rs
.
getString
(
3
));
assertFalse
(
rs
.
next
());
assert
True
(
prep
.
getWarnings
()
==
null
);
assert
Null
(
prep
.
getWarnings
()
);
prep
.
clearWarnings
();
assert
True
(
prep
.
getWarnings
()
==
null
);
assert
Null
(
prep
.
getWarnings
()
);
assertTrue
(
conn
==
prep
.
getConnection
());
}
...
...
@@ -1534,12 +1534,12 @@ public class TestPreparedStatement extends TestBase {
java
.
math
.
BigDecimal
x
=
rs
.
getBigDecimal
(
1
);
trace
(
"v="
+
v
+
" x="
+
x
);
if
(
v
==
null
)
{
assert
True
(
x
==
null
);
assert
Null
(
x
);
}
else
{
assertTrue
(
x
.
compareTo
(
new
java
.
math
.
BigDecimal
(
v
))
==
0
);
}
}
assert
True
(!
rs
.
next
());
assert
False
(
rs
.
next
());
}
private
void
testColumnMetaDataWithEquals
(
Connection
conn
)
...
...
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
5f105925
...
...
@@ -632,7 +632,7 @@ public class TestResultSet extends TestBase {
assertTrue
(
"TEST"
.
equals
(
meta
.
getTableName
(
1
)));
assertTrue
(
"ID"
.
equals
(
meta
.
getColumnName
(
1
)));
assertTrue
(
"VALUE"
.
equals
(
meta
.
getColumnName
(
2
)));
assert
True
(!
meta
.
isAutoIncrement
(
1
));
assert
False
(
meta
.
isAutoIncrement
(
1
));
assertTrue
(
meta
.
isCaseSensitive
(
1
));
assertTrue
(
meta
.
isSearchable
(
1
));
assertFalse
(
meta
.
isCurrency
(
1
));
...
...
@@ -709,7 +709,7 @@ public class TestResultSet extends TestBase {
rs
.
next
();
assertTrue
(
rs
.
getRow
()
==
2
);
assertTrue
(
rs
.
getInt
(
2
)
==
0
&&
!
rs
.
wasNull
());
assert
True
(!
rs
.
getBoolean
(
2
));
assert
False
(
rs
.
getBoolean
(
2
));
assertTrue
(
rs
.
getByte
(
2
)
==
0
);
assertTrue
(
rs
.
getShort
(
2
)
==
0
);
assertTrue
(
rs
.
getLong
(
2
)
==
0
);
...
...
@@ -739,10 +739,10 @@ public class TestResultSet extends TestBase {
assertTrue
(
rs
.
getString
(
1
).
equals
(
"6"
)
&&
!
rs
.
wasNull
());
assertTrue
(
rs
.
getString
(
2
)
==
null
&&
rs
.
wasNull
());
o
=
rs
.
getObject
(
2
);
assert
True
(
o
==
null
);
assert
Null
(
o
);
assertTrue
(
rs
.
wasNull
());
o
=
rs
.
getObject
(
2
,
Integer
.
class
);
assert
True
(
o
==
null
);
assert
Null
(
o
);
assertTrue
(
rs
.
wasNull
());
assertFalse
(
rs
.
next
());
assertEquals
(
0
,
rs
.
getRow
());
...
...
@@ -829,7 +829,7 @@ public class TestResultSet extends TestBase {
assertTrue
(
rs
.
getRow
()
==
2
);
assertTrue
(
rs
.
getShort
(
2
)
==
0
&&
!
rs
.
wasNull
());
assert
True
(!
rs
.
getBoolean
(
2
));
assert
False
(
rs
.
getBoolean
(
2
));
assertTrue
(
rs
.
getByte
(
2
)
==
0
);
assertTrue
(
rs
.
getInt
(
2
)
==
0
);
assertTrue
(
rs
.
getLong
(
2
)
==
0
);
...
...
@@ -863,10 +863,10 @@ public class TestResultSet extends TestBase {
assertTrue
(
rs
.
getString
(
1
).
equals
(
"6"
)
&&
!
rs
.
wasNull
());
assertTrue
(
rs
.
getString
(
2
)
==
null
&&
rs
.
wasNull
());
o
=
rs
.
getObject
(
2
);
assert
True
(
o
==
null
);
assert
Null
(
o
);
assertTrue
(
rs
.
wasNull
());
o
=
rs
.
getObject
(
2
,
Short
.
class
);
assert
True
(
o
==
null
);
assert
Null
(
o
);
assertTrue
(
rs
.
wasNull
());
assertFalse
(
rs
.
next
());
assertEquals
(
0
,
rs
.
getRow
());
...
...
@@ -960,7 +960,7 @@ public class TestResultSet extends TestBase {
assertTrue
(
rs
.
getRow
()
==
2
);
assertTrue
(
rs
.
getLong
(
2
)
==
0
&&
!
rs
.
wasNull
());
assert
True
(!
rs
.
getBoolean
(
2
));
assert
False
(
rs
.
getBoolean
(
2
));
assertTrue
(
rs
.
getByte
(
2
)
==
0
);
assertTrue
(
rs
.
getShort
(
2
)
==
0
);
assertTrue
(
rs
.
getInt
(
2
)
==
0
);
...
...
@@ -994,10 +994,10 @@ public class TestResultSet extends TestBase {
assertTrue
(
rs
.
getString
(
1
).
equals
(
"6"
)
&&
!
rs
.
wasNull
());
assertTrue
(
rs
.
getString
(
2
)
==
null
&&
rs
.
wasNull
());
o
=
rs
.
getObject
(
2
);
assert
True
(
o
==
null
);
assert
Null
(
o
);
assertTrue
(
rs
.
wasNull
());
o
=
rs
.
getObject
(
2
,
Long
.
class
);
assert
True
(
o
==
null
);
assert
Null
(
o
);
assertTrue
(
rs
.
wasNull
());
assertFalse
(
rs
.
next
());
assertEquals
(
0
,
rs
.
getRow
());
...
...
@@ -1091,7 +1091,7 @@ public class TestResultSet extends TestBase {
trace
(
"Value: <"
+
value
+
"> (should be: <\\%>)"
);
assertTrue
(
rs
.
getInt
(
1
)
==
11
&&
!
rs
.
wasNull
());
assertTrue
(
rs
.
getString
(
2
).
equals
(
"\\%"
)
&&
!
rs
.
wasNull
());
assert
True
(!
rs
.
next
());
assert
False
(
rs
.
next
());
stat
.
execute
(
"DROP TABLE TEST"
);
}
...
...
@@ -1122,12 +1122,12 @@ public class TestResultSet extends TestBase {
rs
.
next
();
assertTrue
(
rs
.
getInt
(
1
)
==
1
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertTrue
(
rs
.
getInt
(
2
)
==
-
1
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
bd
=
rs
.
getBigDecimal
(
2
);
assertTrue
(
bd
.
compareTo
(
new
BigDecimal
(
"-1.00"
))
==
0
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
o
=
rs
.
getObject
(
2
);
trace
(
o
.
getClass
().
getName
());
assertTrue
(
o
instanceof
BigDecimal
);
...
...
@@ -1139,12 +1139,12 @@ public class TestResultSet extends TestBase {
rs
.
next
();
assertTrue
(
rs
.
getInt
(
1
)
==
2
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertTrue
(
rs
.
getInt
(
2
)
==
0
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
bd
=
rs
.
getBigDecimal
(
2
);
assertTrue
(
bd
.
compareTo
(
new
BigDecimal
(
"0.00"
))
==
0
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
rs
.
next
();
checkColumnBigDecimal
(
rs
,
2
,
1
,
"1.00"
);
...
...
@@ -1161,7 +1161,7 @@ public class TestResultSet extends TestBase {
rs
.
next
();
checkColumnBigDecimal
(
rs
,
2
,
0
,
null
);
assert
True
(!
rs
.
next
());
assert
False
(
rs
.
next
());
stat
.
execute
(
"DROP TABLE TEST"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE DECIMAL(22,2))"
);
...
...
@@ -1197,13 +1197,13 @@ public class TestResultSet extends TestBase {
BigDecimal
bd
;
rs
.
next
();
assertTrue
(
rs
.
getInt
(
1
)
==
1
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertTrue
(
rs
.
getInt
(
2
)
==
-
1
);
assertTrue
(
rs
.
getInt
(
3
)
==
-
1
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
bd
=
rs
.
getBigDecimal
(
2
);
assertTrue
(
bd
.
compareTo
(
new
BigDecimal
(
"-1.00"
))
==
0
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
o
=
rs
.
getObject
(
2
);
trace
(
o
.
getClass
().
getName
());
assertTrue
(
o
instanceof
Double
);
...
...
@@ -1222,17 +1222,17 @@ public class TestResultSet extends TestBase {
assertTrue
(((
Float
)
o
).
compareTo
(-
1
f
)
==
0
);
rs
.
next
();
assertTrue
(
rs
.
getInt
(
1
)
==
2
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertTrue
(
rs
.
getInt
(
2
)
==
0
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertTrue
(
rs
.
getInt
(
3
)
==
0
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
bd
=
rs
.
getBigDecimal
(
2
);
assertTrue
(
bd
.
compareTo
(
new
BigDecimal
(
"0.00"
))
==
0
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
bd
=
rs
.
getBigDecimal
(
3
);
assertTrue
(
bd
.
compareTo
(
new
BigDecimal
(
"0.00"
))
==
0
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
rs
.
next
();
assertEquals
(
1.0
,
rs
.
getDouble
(
2
));
assertEquals
(
1.0f
,
rs
.
getFloat
(
3
));
...
...
@@ -1248,7 +1248,7 @@ public class TestResultSet extends TestBase {
rs
.
next
();
checkColumnBigDecimal
(
rs
,
2
,
0
,
null
);
checkColumnBigDecimal
(
rs
,
3
,
0
,
null
);
assert
True
(!
rs
.
next
());
assert
False
(
rs
.
next
());
stat
.
execute
(
"DROP TABLE TEST"
);
}
...
...
@@ -1290,11 +1290,11 @@ public class TestResultSet extends TestBase {
java
.
sql
.
Time
time
;
java
.
sql
.
Timestamp
ts
;
date
=
rs
.
getDate
(
2
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
time
=
rs
.
getTime
(
2
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
ts
=
rs
.
getTimestamp
(
2
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
trace
(
"Date: "
+
date
.
toString
()
+
" Time:"
+
time
.
toString
()
+
" Timestamp:"
+
ts
.
toString
());
trace
(
"Date ms: "
+
date
.
getTime
()
+
" Time ms:"
+
time
.
getTime
()
+
...
...
@@ -1337,11 +1337,11 @@ public class TestResultSet extends TestBase {
rs
.
next
();
date
=
rs
.
getDate
(
"VALUE"
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
time
=
rs
.
getTime
(
"VALUE"
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
ts
=
rs
.
getTimestamp
(
"VALUE"
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
trace
(
"Date: "
+
date
.
toString
()
+
" Time:"
+
time
.
toString
()
+
" Timestamp:"
+
ts
.
toString
());
assertEquals
(
"2002-02-02"
,
date
.
toString
());
...
...
@@ -1390,7 +1390,7 @@ public class TestResultSet extends TestBase {
assertTrue
(
rs
.
getObject
(
2
,
LocalDateTimeUtils
.
LOCAL_DATE_TIME
)
==
null
&&
rs
.
wasNull
());
}
assert
True
(!
rs
.
next
());
assert
False
(
rs
.
next
());
rs
=
stat
.
executeQuery
(
"SELECT DATE '2001-02-03' D, "
+
"TIME '14:15:16', "
+
...
...
@@ -1565,31 +1565,31 @@ public class TestResultSet extends TestBase {
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x01
,
(
byte
)
0x01
,
(
byte
)
0x01
,
(
byte
)
0x01
},
rs
.
getBytes
(
2
));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x01
,
(
byte
)
0x01
,
(
byte
)
0x01
,
(
byte
)
0x01
},
rs
.
getObject
(
2
,
byte
[].
class
));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
rs
.
next
();
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x02
,
(
byte
)
0x02
,
(
byte
)
0x02
,
(
byte
)
0x02
},
rs
.
getBytes
(
"value"
));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x02
,
(
byte
)
0x02
,
(
byte
)
0x02
,
(
byte
)
0x02
},
rs
.
getObject
(
"value"
,
byte
[].
class
));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
rs
.
next
();
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x00
},
readAllBytes
(
rs
.
getBinaryStream
(
2
)));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
rs
.
next
();
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0xff
,
(
byte
)
0xff
,
(
byte
)
0xff
},
readAllBytes
(
rs
.
getBinaryStream
(
"VaLuE"
)));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
rs
.
next
();
InputStream
in
=
rs
.
getBinaryStream
(
"value"
);
...
...
@@ -1597,26 +1597,26 @@ public class TestResultSet extends TestBase {
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x0b
,
(
byte
)
0xce
,
(
byte
)
0xc1
},
b
);
Blob
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
try
{
assert
True
(
blob
!=
null
);
assert
NotNull
(
blob
);
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x0b
,
(
byte
)
0xce
,
(
byte
)
0xc1
},
readAllBytes
(
blob
.
getBinaryStream
()));
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0xce
,
(
byte
)
0xc1
},
readAllBytes
(
blob
.
getBinaryStream
(
2
,
2
)));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
}
finally
{
blob
.
free
();
}
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
rs
.
next
();
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
try
{
assert
True
(
blob
!=
null
);
assert
NotNull
(
blob
);
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x03
,
(
byte
)
0x03
,
(
byte
)
0x03
,
(
byte
)
0x03
},
readAllBytes
(
blob
.
getBinaryStream
()));
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x03
,
(
byte
)
0x03
},
readAllBytes
(
blob
.
getBinaryStream
(
2
,
2
)));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
blob
).
getBinaryStream
(
5
,
1
);
}
finally
{
blob
.
free
();
...
...
@@ -1629,19 +1629,19 @@ public class TestResultSet extends TestBase {
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
try
{
assert
True
(
blob
!=
null
);
assert
NotNull
(
blob
);
assertEqualsWithNull
(
random
,
readAllBytes
(
blob
.
getBinaryStream
()));
byte
[]
expected
=
Arrays
.
copyOfRange
(
random
,
100
,
50102
);
byte
[]
got
=
readAllBytes
(
blob
.
getBinaryStream
(
101
,
50002
));
assertEqualsWithNull
(
expected
,
got
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
blob
).
getBinaryStream
(
0x10001
,
1
);
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
blob
).
getBinaryStream
(
0x10002
,
0
);
}
finally
{
blob
.
free
();
}
assert
True
(!
rs
.
next
());
assert
False
(
rs
.
next
());
stat
.
execute
(
"DROP TABLE TEST"
);
}
...
...
@@ -1669,7 +1669,7 @@ public class TestResultSet extends TestBase {
assertTrue
(
obj
instanceof
java
.
sql
.
Clob
);
string
=
rs
.
getString
(
2
);
assertTrue
(
string
!=
null
&&
string
.
equals
(
"Test"
));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
rs
.
next
();
InputStreamReader
reader
=
null
;
try
{
...
...
@@ -1678,7 +1678,7 @@ public class TestResultSet extends TestBase {
assertTrue
(
false
);
}
string
=
readString
(
reader
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
trace
(
string
);
assertTrue
(
string
!=
null
&&
string
.
equals
(
"Hello"
));
rs
.
next
();
...
...
@@ -1688,13 +1688,13 @@ public class TestResultSet extends TestBase {
assertTrue
(
false
);
}
string
=
readString
(
reader
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
trace
(
string
);
assertTrue
(
string
!=
null
&&
string
.
equals
(
"World!"
));
rs
.
next
();
string
=
readString
(
rs
.
getCharacterStream
(
2
));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
trace
(
string
);
assertTrue
(
string
!=
null
&&
string
.
equals
(
"Hallo"
));
Clob
clob
=
rs
.
getClob
(
2
);
...
...
@@ -1708,33 +1708,33 @@ public class TestResultSet extends TestBase {
rs
.
next
();
string
=
readString
(
rs
.
getCharacterStream
(
"value"
));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
trace
(
string
);
assertTrue
(
string
!=
null
&&
string
.
equals
(
"Welt!"
));
rs
.
next
();
clob
=
rs
.
getObject
(
"value"
,
Clob
.
class
);
try
{
assert
True
(
clob
!=
null
);
assert
NotNull
(
clob
);
string
=
readString
(
clob
.
getCharacterStream
());
assertTrue
(
string
!=
null
&&
string
.
equals
(
"Test2"
));
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
}
finally
{
clob
.
free
();
}
rs
.
next
();
assert
True
(
rs
.
getCharacterStream
(
2
)
==
null
);
assert
Null
(
rs
.
getCharacterStream
(
2
)
);
assertTrue
(
rs
.
wasNull
());
rs
.
next
();
assert
True
(
rs
.
getAsciiStream
(
"Value"
)
==
null
);
assert
Null
(
rs
.
getAsciiStream
(
"Value"
)
);
assertTrue
(
rs
.
wasNull
());
assertTrue
(
rs
.
getStatement
()
==
stat
);
assert
True
(
rs
.
getWarnings
()
==
null
);
assert
Null
(
rs
.
getWarnings
()
);
rs
.
clearWarnings
();
assert
True
(
rs
.
getWarnings
()
==
null
);
assert
Null
(
rs
.
getWarnings
()
);
assertEquals
(
ResultSet
.
FETCH_FORWARD
,
rs
.
getFetchDirection
());
assertEquals
(
ResultSet
.
CONCUR_UPDATABLE
,
rs
.
getConcurrency
());
rs
.
next
();
...
...
@@ -1835,7 +1835,7 @@ public class TestResultSet extends TestBase {
assertTrue
(
rs
.
wasNull
());
}
else
{
trace
(
"BigDecimal i="
+
i
+
" bd="
+
bd
+
" ; i1="
+
i1
+
" bd1="
+
bd1
);
assert
True
(!
rs
.
wasNull
());
assert
False
(
rs
.
wasNull
());
assertTrue
(
i1
==
i
);
assertTrue
(
bd1
.
compareTo
(
new
BigDecimal
(
bd
))
==
0
);
}
...
...
h2/src/test/org/h2/test/jdbc/TestStatement.java
浏览文件 @
5f105925
...
...
@@ -204,7 +204,7 @@ public class TestStatement extends TestBase {
assertEquals
(
ResultSet
.
CONCUR_READ_ONLY
,
stat2
.
getResultSetConcurrency
());
assertEquals
(
0
,
stat
.
getMaxFieldSize
());
assert
True
(!
((
JdbcStatement
)
stat2
).
isClosed
());
assert
False
(
((
JdbcStatement
)
stat2
).
isClosed
());
stat2
.
close
();
assertTrue
(((
JdbcStatement
)
stat2
).
isClosed
());
...
...
@@ -279,19 +279,19 @@ public class TestStatement extends TestBase {
trace
(
"execute"
);
result
=
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))"
);
assert
True
(!
result
);
assert
False
(
result
);
result
=
stat
.
execute
(
"INSERT INTO TEST VALUES(1,'Hello')"
);
assert
True
(!
result
);
assert
False
(
result
);
result
=
stat
.
execute
(
"INSERT INTO TEST(VALUE,ID) VALUES('JDBC',2)"
);
assert
True
(!
result
);
assert
False
(
result
);
result
=
stat
.
execute
(
"UPDATE TEST SET VALUE='LDBC' WHERE ID=2"
);
assert
True
(!
result
);
assert
False
(
result
);
result
=
stat
.
execute
(
"DELETE FROM TEST WHERE ID=3"
);
assert
True
(!
result
);
assert
False
(
result
);
result
=
stat
.
execute
(
"SELECT * FROM TEST"
);
assertTrue
(
result
);
result
=
stat
.
execute
(
"DROP TABLE TEST"
);
assert
True
(!
result
);
assert
False
(
result
);
assertThrows
(
ErrorCode
.
METHOD_ONLY_ALLOWED_FOR_QUERY
,
stat
).
executeQuery
(
"CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))"
);
...
...
@@ -324,9 +324,9 @@ public class TestStatement extends TestBase {
stat
.
execute
(
"DROP TABLE TEST"
);
stat
.
executeUpdate
(
"DROP TABLE IF EXISTS TEST"
);
assert
True
(
stat
.
getWarnings
()
==
null
);
assert
Null
(
stat
.
getWarnings
()
);
stat
.
clearWarnings
();
assert
True
(
stat
.
getWarnings
()
==
null
);
assert
Null
(
stat
.
getWarnings
()
);
assertTrue
(
conn
==
stat
.
getConnection
());
assertEquals
(
"SOME_ID"
,
statBC
.
enquoteIdentifier
(
"SOME_ID"
,
false
));
...
...
h2/src/test/org/h2/test/jdbcx/TestXA.java
浏览文件 @
5f105925
...
...
@@ -148,13 +148,13 @@ public class TestXA extends TestBase {
XAResource
res
=
xa
.
getXAResource
();
res
.
start
(
xid
,
XAResource
.
TMNOFLAGS
);
assert
True
(!
c
.
getAutoCommit
());
assert
False
(
c
.
getAutoCommit
());
res
.
end
(
xid
,
XAResource
.
TMSUCCESS
);
res
.
commit
(
xid
,
true
);
assertTrue
(
c
.
getAutoCommit
());
res
.
start
(
xid
,
XAResource
.
TMNOFLAGS
);
assert
True
(!
c
.
getAutoCommit
());
assert
False
(
c
.
getAutoCommit
());
res
.
end
(
xid
,
XAResource
.
TMFAIL
);
res
.
rollback
(
xid
);
assertTrue
(
c
.
getAutoCommit
());
...
...
@@ -193,7 +193,7 @@ public class TestXA extends TestBase {
xa
.
getXAResource
().
start
(
xid
,
XAResource
.
TMNOFLAGS
);
Connection
c
=
xa
.
getConnection
();
assert
True
(!
c
.
getAutoCommit
());
assert
False
(
c
.
getAutoCommit
());
c
.
close
();
xa
.
close
();
}
...
...
h2/src/test/org/h2/test/recover/RecoverLobTest.java
浏览文件 @
5f105925
...
...
@@ -69,7 +69,7 @@ public class RecoverLobTest extends TestBase {
int
id
=
rs
.
getInt
(
1
);
String
data
=
rs
.
getString
(
2
);
assert
True
(
data
!=
null
);
assert
NotNull
(
data
);
assertTrue
(
data
.
length
()
==
10000
*
id
);
}
...
...
h2/src/test/org/h2/test/store/TestCacheLIRS.java
浏览文件 @
5f105925
...
...
@@ -449,8 +449,8 @@ public class TestCacheLIRS extends TestBase {
Integer
x
=
test
.
get
(
i
);
Integer
y
=
test
.
peek
(
i
);
if
(
i
<
size
/
2
)
{
assert
True
(
"i: "
+
i
,
x
!=
null
);
assert
True
(
"i: "
+
i
,
y
!=
null
);
assert
NotNull
(
"i: "
+
i
,
x
);
assert
NotNull
(
"i: "
+
i
,
y
);
assertEquals
(
i
*
10
,
x
.
intValue
());
assertEquals
(
i
*
10
,
y
.
intValue
());
}
else
{
...
...
@@ -469,7 +469,7 @@ public class TestCacheLIRS extends TestBase {
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Integer
x
=
test
.
get
(
i
);
if
(
i
<
size
/
2
||
i
==
size
-
1
)
{
assert
True
(
"i: "
+
i
,
x
!=
null
);
assert
NotNull
(
"i: "
+
i
,
x
);
assertEquals
(
i
*
10
,
x
.
intValue
());
}
else
{
assertNull
(
x
);
...
...
h2/src/test/org/h2/test/store/TestCacheLongKeyLIRS.java
浏览文件 @
5f105925
...
...
@@ -378,8 +378,8 @@ public class TestCacheLongKeyLIRS extends TestBase {
Integer
x
=
test
.
get
(
i
);
Integer
y
=
test
.
peek
(
i
);
if
(
i
<
size
/
2
)
{
assert
True
(
"i: "
+
i
,
x
!=
null
);
assert
True
(
"i: "
+
i
,
y
!=
null
);
assert
NotNull
(
"i: "
+
i
,
x
);
assert
NotNull
(
"i: "
+
i
,
y
);
assertEquals
(
i
*
10
,
x
.
intValue
());
assertEquals
(
i
*
10
,
y
.
intValue
());
}
else
{
...
...
@@ -398,7 +398,7 @@ public class TestCacheLongKeyLIRS extends TestBase {
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Integer
x
=
test
.
get
(
i
);
if
(
i
<
size
/
2
||
i
==
size
-
1
||
i
==
size
-
2
)
{
assert
True
(
"i: "
+
i
,
x
!=
null
);
assert
NotNull
(
"i: "
+
i
,
x
);
assertEquals
(
i
*
10
,
x
.
intValue
());
}
else
{
assertNull
(
x
);
...
...
h2/src/test/org/h2/test/store/TestDataUtils.java
浏览文件 @
5f105925
...
...
@@ -141,7 +141,7 @@ public class TestDataUtils extends TestBase {
}
try
{
HashMap
<
String
,
String
>
map
=
DataUtils
.
parseMap
(
buff
.
toString
());
assert
False
(
map
==
null
);
assert
NotNull
(
map
);
// ok
}
catch
(
IllegalStateException
e
)
{
// ok - but not another exception
...
...
h2/src/test/org/h2/test/store/TestMVRTree.java
浏览文件 @
5f105925
...
...
@@ -134,7 +134,7 @@ public class TestMVRTree extends TestMVStore {
for
(
SpatialKey
k
;
it
.
hasNext
();)
{
k
=
it
.
next
();
// System.out.println(k + ": " + r.get(k));
assert
True
(
k
!=
null
);
assert
NotNull
(
k
);
}
s
.
close
();
}
...
...
@@ -181,7 +181,7 @@ public class TestMVRTree extends TestMVStore {
assertEquals
(
len
,
r
.
size
());
int
count
=
0
;
for
(
SpatialKey
k
:
r
.
keySet
())
{
assert
True
(
r
.
get
(
k
)
!=
null
);
assert
NotNull
(
r
.
get
(
k
)
);
count
++;
}
assertEquals
(
len
,
count
);
...
...
@@ -413,7 +413,7 @@ public class TestMVRTree extends TestMVStore {
while
(
it
.
hasNext
())
{
SpatialKey
n
=
it
.
next
();
String
a
=
map
.
get
(
n
);
assert
False
(
a
==
null
);
assert
NotNull
(
a
);
}
break
;
}
...
...
@@ -424,7 +424,7 @@ public class TestMVRTree extends TestMVStore {
while
(
it
.
hasNext
())
{
SpatialKey
n
=
it
.
next
();
String
a
=
map
.
get
(
n
);
assert
False
(
a
==
null
);
assert
NotNull
(
a
);
}
break
;
}
...
...
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
5f105925
...
...
@@ -528,7 +528,7 @@ public class TestMVStore extends TestBase {
sleep
(
10
);
}
Throwable
e
=
exRef
.
get
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertEquals
(
DataUtils
.
ERROR_WRITING_FAILED
,
DataUtils
.
getErrorCode
(
e
.
getMessage
()));
}
catch
(
IllegalStateException
e
)
{
...
...
@@ -894,7 +894,7 @@ public class TestMVStore extends TestBase {
s
.
close
();
s
=
openStore
(
fileName
);
Object
test
=
s
.
getStoreHeader
().
get
(
"test"
);
assert
False
(
test
==
null
);
assert
NotNull
(
test
);
assertEquals
(
"123"
,
test
.
toString
());
s
.
close
();
}
...
...
@@ -1506,8 +1506,8 @@ public class TestMVStore extends TestBase {
s
.
setRetentionTime
(
45000
);
assertEquals
(
2
,
s
.
getCurrentVersion
());
meta
=
s
.
getMetaMap
();
assert
True
(
meta
.
get
(
"name.data"
)
!=
null
);
assert
True
(
meta
.
get
(
"name.data0"
)
!=
null
);
assert
NotNull
(
meta
.
get
(
"name.data"
)
);
assert
NotNull
(
meta
.
get
(
"name.data0"
)
);
assertNull
(
meta
.
get
(
"name.data1"
));
m
=
s
.
openMap
(
"data"
);
m0
=
s
.
openMap
(
"data0"
);
...
...
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
浏览文件 @
5f105925
...
...
@@ -174,7 +174,7 @@ public class TestMVStoreBenchmark extends TestBase {
for
(
int
a
=
0
;
a
<
5
;
a
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
String
x
=
map
.
get
(
i
);
assert
True
(
x
!=
null
);
assert
NotNull
(
x
);
}
}
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
5f105925
...
...
@@ -180,7 +180,7 @@ public class TestMVTableEngine extends TestBase {
stat
.
execute
(
"checkpoint"
);
stat
.
execute
(
"shutdown immediately"
);
Exception
ex
=
t
.
getException
();
assert
True
(
ex
!=
null
);
assert
NotNull
(
ex
);
try
{
conn
.
close
();
}
catch
(
Exception
e
)
{
...
...
h2/src/test/org/h2/test/store/TestTransactionStore.java
浏览文件 @
5f105925
...
...
@@ -860,7 +860,7 @@ public class TestTransactionStore extends TestBase {
assertNull
(
map
.
get
(
x
));
}
}
catch
(
SQLException
e
)
{
assert
True
(
map
.
get
(
x
)
!=
null
);
assert
NotNull
(
map
.
get
(
x
)
);
assertFalse
(
map
.
tryRemove
(
x
));
// PostgreSQL needs to rollback
buff
.
append
(
" -> rollback"
);
...
...
h2/src/test/org/h2/test/unit/TestClassLoaderLeak.java
浏览文件 @
5f105925
...
...
@@ -50,7 +50,7 @@ public class TestClassLoaderLeak extends TestBase {
Thread
.
sleep
(
10
);
}
ClassLoader
cl
=
ref
.
get
();
assert
True
(
cl
==
nul
l
);
assert
Null
(
c
l
);
// fill the memory, so a heap dump is created
// using -XX:+HeapDumpOnOutOfMemoryError
// which can be analyzed using EclipseMAT
...
...
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
5f105925
...
...
@@ -219,16 +219,16 @@ public class TestFileSystem extends TestBase {
String
resource
=
"org/h2/test/scripts/testSimple.in.txt"
;
InputStream
in
;
in
=
getClass
().
getResourceAsStream
(
"/"
+
resource
);
assert
True
(
in
!=
null
);
assert
NotNull
(
in
);
in
.
close
();
in
=
getClass
().
getClassLoader
().
getResourceAsStream
(
resource
);
assert
True
(
in
!=
null
);
assert
NotNull
(
in
);
in
.
close
();
in
=
FileUtils
.
newInputStream
(
"classpath:"
+
resource
);
assert
True
(
in
!=
null
);
assert
NotNull
(
in
);
in
.
close
();
in
=
FileUtils
.
newInputStream
(
"classpath:/"
+
resource
);
assert
True
(
in
!=
null
);
assert
NotNull
(
in
);
in
.
close
();
}
...
...
@@ -320,7 +320,7 @@ public class TestFileSystem extends TestBase {
for
(
String
f
:
FileUtils
.
newDirectoryStream
(
"zip:"
+
getBaseDir
()
+
"/fsJar.zip"
))
{
assertFalse
(
FileUtils
.
isAbsolute
(
f
));
assert
True
(!
FileUtils
.
isDirectory
(
f
));
assert
False
(
FileUtils
.
isDirectory
(
f
));
assertTrue
(
FileUtils
.
size
(
f
)
>
0
);
assertTrue
(
f
.
endsWith
(
FileUtils
.
getName
(
f
)));
assertEquals
(
0
,
FileUtils
.
lastModified
(
f
));
...
...
@@ -599,7 +599,7 @@ public class TestFileSystem extends TestBase {
IOUtils
.
copyFiles
(
fsBase
+
"/test"
,
fsBase
+
"/test3"
);
FileUtils
.
move
(
fsBase
+
"/test3"
,
fsBase
+
"/test2"
);
FileUtils
.
move
(
fsBase
+
"/test2"
,
fsBase
+
"/test2"
);
assert
True
(!
FileUtils
.
exists
(
fsBase
+
"/test3"
));
assert
False
(
FileUtils
.
exists
(
fsBase
+
"/test3"
));
assertTrue
(
FileUtils
.
exists
(
fsBase
+
"/test2"
));
assertEquals
(
10000
,
FileUtils
.
size
(
fsBase
+
"/test2"
));
byte
[]
buffer2
=
new
byte
[
10000
];
...
...
@@ -624,7 +624,7 @@ public class TestFileSystem extends TestBase {
assertTrue
(
FileUtils
.
isDirectory
(
fsBase
+
"/testDir"
));
if
(!
fsBase
.
startsWith
(
"jdbc:"
))
{
FileUtils
.
deleteRecursive
(
fsBase
+
"/testDir"
,
false
);
assert
True
(!
FileUtils
.
exists
(
fsBase
+
"/testDir"
));
assert
False
(
FileUtils
.
exists
(
fsBase
+
"/testDir"
));
}
}
}
...
...
h2/src/test/org/h2/test/unit/TestNetUtils.java
浏览文件 @
5f105925
...
...
@@ -125,7 +125,7 @@ public class TestNetUtils extends TestBase {
closeSilently
(
socket
);
closeSilently
(
serverSocket
);
if
(
task
!=
null
)
{
assert
True
(
task
.
getException
()
!=
null
);
assert
NotNull
(
task
.
getException
()
);
assertEquals
(
javax
.
net
.
ssl
.
SSLHandshakeException
.
class
.
getName
(),
task
.
getException
().
getClass
().
getName
());
assertContains
(
task
.
getException
().
getMessage
(),
"certificate_unknown"
);
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
5f105925
...
...
@@ -476,7 +476,7 @@ public class TestTools extends TestBase {
assertEquals
(
ResultSet
.
FETCH_FORWARD
,
rs
.
getFetchDirection
());
assertEquals
(
0
,
rs
.
getFetchSize
());
assertEquals
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
rs
.
getType
());
assert
True
(
rs
.
getStatement
()
==
null
);
assert
Null
(
rs
.
getStatement
()
);
assertFalse
(
rs
.
isClosed
());
rs
.
beforeFirst
();
...
...
@@ -760,7 +760,7 @@ public class TestTools extends TestBase {
assertEquals
(
Double
.
MIN_VALUE
,
rs
.
getDouble
(
"b"
));
assertEquals
(
Long
.
MIN_VALUE
,
rs
.
getLong
(
"c"
));
assertEquals
(
Short
.
MIN_VALUE
,
rs
.
getShort
(
"d"
));
assert
True
(!
rs
.
getBoolean
(
"e"
));
assert
False
(
rs
.
getBoolean
(
"e"
));
assertEquals
(
new
byte
[]
{
(
byte
)
10
,
(
byte
)
20
},
rs
.
getBytes
(
"f"
));
assertEquals
(
"2007-12-31"
,
rs
.
getString
(
"g"
));
assertEquals
(
"23:59:59"
,
rs
.
getString
(
"h"
));
...
...
@@ -902,8 +902,8 @@ public class TestTools extends TestBase {
"SELECT * FROM TEST ORDER BY ID"
);
rs
.
next
();
assertEquals
(
1
,
rs
.
getInt
(
1
));
assert
True
(
rs
.
getString
(
2
)
==
null
);
assert
True
(
rs
.
getString
(
3
)
==
null
);
assert
Null
(
rs
.
getString
(
2
)
);
assert
Null
(
rs
.
getString
(
3
)
);
rs
.
next
();
assertEquals
(
2
,
rs
.
getInt
(
1
));
assertEquals
(
"face"
,
rs
.
getString
(
2
));
...
...
h2/src/test/org/h2/test/unit/TestValue.java
浏览文件 @
5f105925
...
...
@@ -302,7 +302,7 @@ public class TestValue extends TestBase {
for
(
int
i
=
0
;
i
<
d
.
length
-
1
;
i
++)
{
assertTrue
(
values
[
i
].
compareTypeSafe
(
values
[
i
+
1
],
null
)
<
0
);
assertTrue
(
values
[
i
+
1
].
compareTypeSafe
(
values
[
i
],
null
)
>
0
);
assert
True
(!
values
[
i
].
equals
(
values
[
i
+
1
]));
assert
False
(
values
[
i
].
equals
(
values
[
i
+
1
]));
}
}
...
...
h2/src/test/org/h2/test/utils/TestColumnNamer.java
浏览文件 @
5f105925
...
...
@@ -47,7 +47,7 @@ public class TestColumnNamer extends TestBase {
for
(
String
id
:
ids
)
{
Expression
columnExp
=
ValueExpression
.
getDefault
();
String
newColumnName
=
columnNamer
.
getColumnName
(
columnExp
,
index
+
1
,
id
);
assert
True
(
newColumnName
!=
null
);
assert
NotNull
(
newColumnName
);
assertTrue
(
newColumnName
.
length
()
<=
30
);
assertTrue
(
newColumnName
.
length
()
>=
1
);
assertEquals
(
newColumnName
,
expectedColumnName
[
index
]);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论