Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
indiff7643
Terarkdb
提交
f617135d
T
Terarkdb
项目概览
indiff7643
/
Terarkdb
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Terarkdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f617135d
编写于
11月 02, 2014
作者:
F
fyrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[RocksJava] Testcase improvements
上级
1fe7a4c6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
137 addition
and
24 deletion
+137
-24
java/org/rocksdb/ReadOptions.java
java/org/rocksdb/ReadOptions.java
+0
-1
java/org/rocksdb/test/BlockBasedTableConfigTest.java
java/org/rocksdb/test/BlockBasedTableConfigTest.java
+53
-17
java/org/rocksdb/test/PlainTableConfigTest.java
java/org/rocksdb/test/PlainTableConfigTest.java
+6
-1
java/org/rocksdb/test/ReadOptionsTest.java
java/org/rocksdb/test/ReadOptionsTest.java
+78
-5
未找到文件。
java/org/rocksdb/ReadOptions.java
浏览文件 @
f617135d
...
...
@@ -155,7 +155,6 @@ public class ReadOptions extends RocksObject {
@Override
protected
void
disposeInternal
()
{
assert
(
isInitialized
());
disposeInternal
(
nativeHandle_
);
}
private
native
void
disposeInternal
(
long
handle
);
...
...
java/org/rocksdb/test/BlockBasedTableConfigTest.java
浏览文件 @
f617135d
...
...
@@ -5,49 +5,85 @@
package
org.rocksdb.test
;
import
org.junit.AfterClass
;
import
org.junit.ClassRule
;
import
org.junit.Test
;
import
org.rocksdb.
BlockBasedTableConfig
;
import
org.rocksdb.ChecksumType
;
import
org.rocksdb.IndexType
;
import
org.rocksdb.
*
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
public
class
BlockBasedTableConfigTest
{
@ClassRule
public
static
final
RocksMemoryResource
rocksMemoryResource
=
new
RocksMemoryResource
();
@AfterClass
public
static
void
printMessage
(){
System
.
out
.
println
(
"Passed BlockBasedTableConfigTst."
);
}
@Test
public
void
shouldTestBlockBasedTableConfig
()
{
BlockBasedTableConfig
blockBasedTableConfig
=
new
BlockBasedTableConfig
();
blockBasedTableConfig
.
setNoBlockCache
(
true
);
assert
(
blockBasedTableConfig
.
noBlockCache
());
blockBasedTableConfig
.
setBlockCacheSize
(
8
*
1024
);
assert
(
blockBasedTableConfig
.
blockCacheSize
()
==
(
8
*
1024
));
assertThat
(
blockBasedTableConfig
.
noBlockCache
()).
isTrue
();
blockBasedTableConfig
.
setBlockCacheSize
(
8
*
1024
);
assertThat
(
blockBasedTableConfig
.
blockCacheSize
()).
isEqualTo
(
8
*
1024
);
blockBasedTableConfig
.
setBlockSizeDeviation
(
12
);
assert
(
blockBasedTableConfig
.
blockSizeDeviation
()
==
12
);
assertThat
(
blockBasedTableConfig
.
blockSizeDeviation
()).
isEqualTo
(
12
);
blockBasedTableConfig
.
setBlockRestartInterval
(
15
);
assert
(
blockBasedTableConfig
.
blockRestartInterval
()
==
15
);
assertThat
(
blockBasedTableConfig
.
blockRestartInterval
()).
isEqualTo
(
15
);
blockBasedTableConfig
.
setWholeKeyFiltering
(
false
);
assert
(!
blockBasedTableConfig
.
wholeKeyFiltering
());
assertThat
(
blockBasedTableConfig
.
wholeKeyFiltering
()).
isFalse
();
blockBasedTableConfig
.
setCacheIndexAndFilterBlocks
(
true
);
assert
(
blockBasedTableConfig
.
cacheIndexAndFilterBlocks
());
assertThat
(
blockBasedTableConfig
.
cacheIndexAndFilterBlocks
()).
isTrue
();
blockBasedTableConfig
.
setHashIndexAllowCollision
(
false
);
assert
(!
blockBasedTableConfig
.
hashIndexAllowCollision
());
assertThat
(
blockBasedTableConfig
.
hashIndexAllowCollision
()).
isFalse
();
blockBasedTableConfig
.
setBlockCacheCompressedSize
(
40
);
assert
(
blockBasedTableConfig
.
blockCacheCompressedSize
()
==
40
);
assertThat
(
blockBasedTableConfig
.
blockCacheCompressedSize
()).
isEqualTo
(
40
);
blockBasedTableConfig
.
setChecksumType
(
ChecksumType
.
kNoChecksum
);
blockBasedTableConfig
.
setChecksumType
(
ChecksumType
.
kxxHash
);
assert
(
blockBasedTableConfig
.
checksumType
().
equals
(
assert
That
(
blockBasedTableConfig
.
checksumType
().
equals
(
ChecksumType
.
kxxHash
));
blockBasedTableConfig
.
setIndexType
(
IndexType
.
kHashSearch
);
assert
(
blockBasedTableConfig
.
indexType
().
equals
(
assert
That
(
blockBasedTableConfig
.
indexType
().
equals
(
IndexType
.
kHashSearch
));
blockBasedTableConfig
.
setBlockCacheCompressedNumShardBits
(
4
);
assert
(
blockBasedTableConfig
.
blockCacheCompressedNumShardBits
()
==
4
);
assert
That
(
blockBasedTableConfig
.
blockCacheCompressedNumShardBits
()).
isEqualTo
(
4
);
blockBasedTableConfig
.
setCacheNumShardBits
(
5
);
assert
(
blockBasedTableConfig
.
cacheNumShardBits
()
==
5
);
assertThat
(
blockBasedTableConfig
.
cacheNumShardBits
()).
isEqualTo
(
5
);
blockBasedTableConfig
.
setBlockSize
(
10
);
assertThat
(
blockBasedTableConfig
.
blockSize
()).
isEqualTo
(
10
);
System
.
out
.
println
(
"Passed BlockBasedTableConfigTest."
);
}
@Test
public
void
shouldTestBlockBasedTableWithFilter
()
{
Options
options
=
new
Options
();
options
.
setTableFormatConfig
(
new
BlockBasedTableConfig
().
setFilter
(
new
BloomFilter
(
10
)));
assertThat
(
options
.
tableFactoryName
()).
isEqualTo
(
"BlockBasedTable"
);
}
@Test
public
void
shouldTestBlockBasedTableWithoutFilter
()
{
Options
options
=
new
Options
();
options
.
setTableFormatConfig
(
new
BlockBasedTableConfig
().
setFilter
(
null
));
assertThat
(
options
.
tableFactoryName
()).
isEqualTo
(
"BlockBasedTable"
);
}
}
java/org/rocksdb/test/PlainTableConfigTest.java
浏览文件 @
f617135d
...
...
@@ -5,6 +5,7 @@
package
org.rocksdb.test
;
import
org.junit.AfterClass
;
import
org.junit.ClassRule
;
import
org.junit.Test
;
import
org.rocksdb.EncodingType
;
...
...
@@ -16,6 +17,11 @@ public class PlainTableConfigTest {
public
static
final
RocksMemoryResource
rocksMemoryResource
=
new
RocksMemoryResource
();
@AfterClass
public
static
void
printMessage
(){
System
.
out
.
println
(
"Passed PlainTableConfigTest."
);
}
@Test
public
void
shouldTestPlainTableConfig
()
{
PlainTableConfig
plainTableConfig
=
new
PlainTableConfig
();
...
...
@@ -36,6 +42,5 @@ public class PlainTableConfigTest {
assert
(
plainTableConfig
.
fullScanMode
());
plainTableConfig
.
setStoreIndexInFile
(
true
);
assert
(
plainTableConfig
.
storeIndexInFile
());
System
.
out
.
println
(
"Passed PlainTableConfigTest."
);
}
}
java/org/rocksdb/test/ReadOptionsTest.java
浏览文件 @
f617135d
...
...
@@ -7,17 +7,29 @@ package org.rocksdb.test;
import
java.util.Random
;
import
org.junit.AfterClass
;
import
org.junit.ClassRule
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.
rocksdb.RocksDB
;
import
org.
junit.rules.ExpectedException
;
import
org.rocksdb.ReadOptions
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
public
class
ReadOptionsTest
{
@ClassRule
public
static
final
RocksMemoryResource
rocksMemoryResource
=
new
RocksMemoryResource
();
@Rule
public
ExpectedException
exception
=
ExpectedException
.
none
();
@AfterClass
public
static
void
printMessage
(){
System
.
out
.
println
(
"Passed ReadOptionsTest."
);
}
@Test
public
void
shouldTestReadOptions
()
{
ReadOptions
opt
=
new
ReadOptions
();
...
...
@@ -25,21 +37,82 @@ public class ReadOptionsTest {
{
// VerifyChecksums test
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setVerifyChecksums
(
boolValue
);
assert
(
opt
.
verifyChecksums
()
==
boolValue
);
assert
That
(
opt
.
verifyChecksums
()).
isEqualTo
(
boolValue
);
}
{
// FillCache test
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setFillCache
(
boolValue
);
assert
(
opt
.
fillCache
()
==
boolValue
);
assert
That
(
opt
.
fillCache
()).
isEqualTo
(
boolValue
);
}
{
// Tailing test
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setTailing
(
boolValue
);
assert
(
opt
.
tailing
()
==
boolValue
);
assertThat
(
opt
.
tailing
()).
isEqualTo
(
boolValue
);
}
{
// Snapshot null test
opt
.
setSnapshot
(
null
);
assertThat
(
opt
.
snapshot
()).
isNull
();
}
opt
.
dispose
();
System
.
out
.
println
(
"Passed ReadOptionsTest."
);
}
@Test
public
void
shouldFailVerifyChecksumUninitialized
(){
ReadOptions
readOptions
=
setupUninitializedReadOptions
(
exception
);
readOptions
.
setVerifyChecksums
(
true
);
}
@Test
public
void
shouldFailSetFillCacheUninitialized
(){
ReadOptions
readOptions
=
setupUninitializedReadOptions
(
exception
);
readOptions
.
setFillCache
(
true
);
}
@Test
public
void
shouldFailFillCacheUninitialized
(){
ReadOptions
readOptions
=
setupUninitializedReadOptions
(
exception
);
readOptions
.
fillCache
();
}
@Test
public
void
shouldFailSetTailingUninitialized
(){
ReadOptions
readOptions
=
setupUninitializedReadOptions
(
exception
);
readOptions
.
setTailing
(
true
);
}
@Test
public
void
shouldFailTailingUninitialized
(){
ReadOptions
readOptions
=
setupUninitializedReadOptions
(
exception
);
readOptions
.
tailing
();
}
@Test
public
void
shouldFailSetSnapshotUninitialized
(){
ReadOptions
readOptions
=
setupUninitializedReadOptions
(
exception
);
readOptions
.
setSnapshot
(
null
);
}
@Test
public
void
shouldFailSnapshotUninitialized
(){
ReadOptions
readOptions
=
setupUninitializedReadOptions
(
exception
);
readOptions
.
snapshot
();
}
private
ReadOptions
setupUninitializedReadOptions
(
ExpectedException
exception
)
{
ReadOptions
readOptions
=
new
ReadOptions
();
readOptions
.
dispose
();
exception
.
expect
(
AssertionError
.
class
);
return
readOptions
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录