Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
raphaelmichael
Rocketmq
提交
c92332e1
R
Rocketmq
项目概览
raphaelmichael
/
Rocketmq
与 Fork 源项目一致
Fork自
Apache RocketMQ / Rocketmq
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rocketmq
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c92332e1
编写于
12月 23, 2016
作者:
L
lollipop
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-rocketmq
上级
0014a4c8
4b446d77
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
277 addition
and
200 deletion
+277
-200
pom.xml
pom.xml
+1
-7
rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerControllerTest.java
...ava/com/alibaba/rocketmq/broker/BrokerControllerTest.java
+53
-0
rocketmq-client/src/test/java/com/alibaba/rocketmq/client/ValidatorsTest.java
...test/java/com/alibaba/rocketmq/client/ValidatorsTest.java
+7
-11
rocketmq-store/pom.xml
rocketmq-store/pom.xml
+14
-4
rocketmq-store/src/main/java/com/alibaba/rocketmq/store/ha/HAService.java
...rc/main/java/com/alibaba/rocketmq/store/ha/HAService.java
+17
-11
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/DefaultMessageStoreTest.java
...a/com/alibaba/rocketmq/store/DefaultMessageStoreTest.java
+44
-34
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/MappedFileQueueTest.java
.../java/com/alibaba/rocketmq/store/MappedFileQueueTest.java
+25
-34
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/MappedFileTest.java
.../test/java/com/alibaba/rocketmq/store/MappedFileTest.java
+39
-43
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/RecoverTest.java
...src/test/java/com/alibaba/rocketmq/store/RecoverTest.java
+2
-1
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/StoreCheckpointTest.java
.../java/com/alibaba/rocketmq/store/StoreCheckpointTest.java
+16
-19
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/index/IndexFileTest.java
.../java/com/alibaba/rocketmq/store/index/IndexFileTest.java
+25
-36
rocketmq-store/src/test/resources/logback-test.xml
rocketmq-store/src/test/resources/logback-test.xml
+34
-0
未找到文件。
pom.xml
浏览文件 @
c92332e1
...
@@ -313,7 +313,6 @@
...
@@ -313,7 +313,6 @@
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-checkstyle-plugin
</artifactId>
<artifactId>
maven-checkstyle-plugin
</artifactId>
<version>
2.17
</version>
<version>
2.17
</version>
<executions>
<executions>
...
@@ -348,12 +347,7 @@
...
@@ -348,12 +347,7 @@
<artifactId>
maven-resources-plugin
</artifactId>
<artifactId>
maven-resources-plugin
</artifactId>
<version>
3.0.2
</version>
<version>
3.0.2
</version>
<configuration>
<configuration>
<resources>
<!-- We are not suppose to setup the customer resources here-->
<resource>
<directory>
src/main/resources
</directory>
<filtering>
false
</filtering>
</resource>
</resources>
<encoding>
${project.build.sourceEncoding}
</encoding>
<encoding>
${project.build.sourceEncoding}
</encoding>
</configuration>
</configuration>
</plugin>
</plugin>
...
...
rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerControllerTest.java
0 → 100644
浏览文件 @
c92332e1
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.alibaba.rocketmq.broker
;
import
com.alibaba.rocketmq.common.BrokerConfig
;
import
com.alibaba.rocketmq.remoting.netty.NettyClientConfig
;
import
com.alibaba.rocketmq.remoting.netty.NettyServerConfig
;
import
com.alibaba.rocketmq.store.config.MessageStoreConfig
;
import
org.junit.Test
;
/**
* @author shtykh_roman
*/
public
class
BrokerControllerTest
{
private
static
final
int
RESTART_NUM
=
3
;
/**
* Tests if the controller can be properly stopped and started.
*
* @throws Exception If fails.
*/
@Test
public
void
testRestart
()
throws
Exception
{
for
(
int
i
=
0
;
i
<
RESTART_NUM
;
i
++)
{
BrokerController
brokerController
=
new
BrokerController
(
//
new
BrokerConfig
(),
//
new
NettyServerConfig
(),
//
new
NettyClientConfig
(),
//
new
MessageStoreConfig
());
boolean
initResult
=
brokerController
.
initialize
();
System
.
out
.
println
(
"initialize "
+
initResult
);
brokerController
.
start
();
brokerController
.
shutdown
();
}
}
}
rocketmq-client/src/test/java/com/alibaba/rocketmq/client/ValidatorsTest.java
浏览文件 @
c92332e1
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
package
com.alibaba.rocketmq.client
;
package
com.alibaba.rocketmq.client
;
import
com.alibaba.rocketmq.client.exception.MQClientException
;
import
org.junit.Assert
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -24,16 +25,11 @@ import org.junit.Test;
...
@@ -24,16 +25,11 @@ import org.junit.Test;
public
class
ValidatorsTest
{
public
class
ValidatorsTest
{
@Test
@Test
public
void
topicValidatorTest
()
{
public
void
topicValidatorTest
()
throws
MQClientException
{
try
{
Validators
.
checkTopic
(
"Hello"
);
Validators
.
checkTopic
(
"Hello"
);
Validators
.
checkTopic
(
"%RETRY%Hello"
);
Validators
.
checkTopic
(
"%RETRY%Hello"
);
Validators
.
checkTopic
(
"_%RETRY%Hello"
);
Validators
.
checkTopic
(
"_%RETRY%Hello"
);
Validators
.
checkTopic
(
"-%RETRY%Hello"
);
Validators
.
checkTopic
(
"-%RETRY%Hello"
);
Validators
.
checkTopic
(
"223-%RETRY%Hello"
);
Validators
.
checkTopic
(
"223-%RETRY%Hello"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Assert
.
assertTrue
(
false
);
}
}
}
}
}
rocketmq-store/pom.xml
浏览文件 @
c92332e1
...
@@ -29,18 +29,28 @@
...
@@ -29,18 +29,28 @@
<name>
rocketmq-store ${project.version}
</name>
<name>
rocketmq-store ${project.version}
</name>
<dependencies>
<dependencies>
<dependency>
<groupId>
${project.groupId}
</groupId>
<artifactId>
rocketmq-common
</artifactId>
</dependency>
<dependency>
<groupId>
net.java.dev.jna
</groupId>
<artifactId>
jna
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
junit
</groupId>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
${project.groupId}
</groupId>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
rocketmq-common
</artifactId>
<artifactId>
logback-classic
</artifactId>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
net.java.dev.jna
</groupId>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
jna
</artifactId>
<artifactId>
logback-core
</artifactId>
<scope>
test
</scope>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
rocketmq-store/src/main/java/com/alibaba/rocketmq/store/ha/HAService.java
浏览文件 @
c92332e1
...
@@ -116,7 +116,7 @@ public class HAService {
...
@@ -116,7 +116,7 @@ public class HAService {
// this.groupTransferService.notifyTransferSome();
// this.groupTransferService.notifyTransferSome();
// }
// }
public
void
start
()
{
public
void
start
()
throws
Exception
{
this
.
acceptSocketService
.
beginAccept
();
this
.
acceptSocketService
.
beginAccept
();
this
.
acceptSocketService
.
start
();
this
.
acceptSocketService
.
start
();
this
.
groupTransferService
.
start
();
this
.
groupTransferService
.
start
();
...
@@ -181,20 +181,26 @@ public class HAService {
...
@@ -181,20 +181,26 @@ public class HAService {
}
}
public
void
beginAccept
()
{
public
void
beginAccept
()
throws
Exception
{
this
.
serverSocketChannel
=
ServerSocketChannel
.
open
();
this
.
selector
=
RemotingUtil
.
openSelector
();
this
.
serverSocketChannel
.
socket
().
setReuseAddress
(
true
);
this
.
serverSocketChannel
.
socket
().
bind
(
this
.
socketAddressListen
);
this
.
serverSocketChannel
.
configureBlocking
(
false
);
this
.
serverSocketChannel
.
register
(
this
.
selector
,
SelectionKey
.
OP_ACCEPT
);
}
@Override
public
void
shutdown
(
final
boolean
interrupt
)
{
super
.
shutdown
(
interrupt
);
try
{
try
{
this
.
serverSocketChannel
=
ServerSocketChannel
.
open
();
serverSocketChannel
.
close
();
this
.
selector
=
RemotingUtil
.
openSelector
();
}
this
.
serverSocketChannel
.
socket
().
setReuseAddress
(
true
);
catch
(
IOException
e
)
{
this
.
serverSocketChannel
.
socket
().
bind
(
this
.
socketAddressListen
);
log
.
error
(
"AcceptSocketService shutdown exception"
,
e
);
this
.
serverSocketChannel
.
configureBlocking
(
false
);
this
.
serverSocketChannel
.
register
(
this
.
selector
,
SelectionKey
.
OP_ACCEPT
);
}
catch
(
Exception
e
)
{
log
.
error
(
"beginAccept exception"
,
e
);
}
}
}
}
@Override
@Override
public
void
run
()
{
public
void
run
()
{
log
.
info
(
this
.
getServiceName
()
+
" service started"
);
log
.
info
(
this
.
getServiceName
()
+
" service started"
);
...
...
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/DefaultMessageStoreTest.java
浏览文件 @
c92332e1
...
@@ -17,11 +17,14 @@
...
@@ -17,11 +17,14 @@
package
com.alibaba.rocketmq.store
;
package
com.alibaba.rocketmq.store
;
import
com.alibaba.rocketmq.common.BrokerConfig
;
import
com.alibaba.rocketmq.store.config.FlushDiskType
;
import
com.alibaba.rocketmq.store.config.FlushDiskType
;
import
com.alibaba.rocketmq.store.config.MessageStoreConfig
;
import
com.alibaba.rocketmq.store.config.MessageStoreConfig
;
import
org.junit.AfterClass
;
import
org.junit.AfterClass
;
import
org.junit.BeforeClass
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
import
java.net.InetSocketAddress
;
import
java.net.InetSocketAddress
;
...
@@ -35,6 +38,8 @@ import static org.junit.Assert.assertTrue;
...
@@ -35,6 +38,8 @@ import static org.junit.Assert.assertTrue;
* @author shijia.wxr
* @author shijia.wxr
*/
*/
public
class
DefaultMessageStoreTest
{
public
class
DefaultMessageStoreTest
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DefaultMessageStoreTest
.
class
);
private
static
final
String
StoreMessage
=
"Once, there was a chance for me!"
;
private
static
final
String
StoreMessage
=
"Once, there was a chance for me!"
;
private
static
int
QUEUE_TOTAL
=
100
;
private
static
int
QUEUE_TOTAL
=
100
;
...
@@ -59,7 +64,7 @@ public class DefaultMessageStoreTest {
...
@@ -59,7 +64,7 @@ public class DefaultMessageStoreTest {
@Test
@Test
public
void
test_write_read
()
throws
Exception
{
public
void
test_write_read
()
throws
Exception
{
System
.
out
.
println
(
"================================================================"
);
logger
.
debug
(
"================================================================"
);
long
totalMsgs
=
100
;
long
totalMsgs
=
100
;
QUEUE_TOTAL
=
1
;
QUEUE_TOTAL
=
1
;
MessageBody
=
StoreMessage
.
getBytes
();
MessageBody
=
StoreMessage
.
getBytes
();
...
@@ -69,34 +74,32 @@ public class DefaultMessageStoreTest {
...
@@ -69,34 +74,32 @@ public class DefaultMessageStoreTest {
messageStoreConfig
.
setMapedFileSizeConsumeQueue
(
1024
*
4
);
messageStoreConfig
.
setMapedFileSizeConsumeQueue
(
1024
*
4
);
messageStoreConfig
.
setMaxHashSlotNum
(
100
);
messageStoreConfig
.
setMaxHashSlotNum
(
100
);
messageStoreConfig
.
setMaxIndexNum
(
100
*
10
);
messageStoreConfig
.
setMaxIndexNum
(
100
*
10
);
MessageStore
master
=
new
DefaultMessageStore
(
messageStoreConfig
,
null
,
n
ull
,
null
);
MessageStore
master
=
new
DefaultMessageStore
(
messageStoreConfig
,
null
,
n
ew
MyMessageArrivingListener
(),
new
BrokerConfig
()
);
boolean
load
=
master
.
load
();
boolean
load
=
master
.
load
();
assertTrue
(
load
);
assertTrue
(
load
);
master
.
start
();
master
.
start
();
for
(
long
i
=
0
;
i
<
totalMsgs
;
i
++)
{
try
{
PutMessageResult
result
=
master
.
putMessage
(
buildMessage
());
for
(
long
i
=
0
;
i
<
totalMsgs
;
i
++)
{
System
.
out
.
println
(
i
+
"\t"
+
result
.
getAppendMessageResult
().
getMsgId
());
PutMessageResult
result
=
master
.
putMessage
(
buildMessage
());
}
logger
.
debug
(
i
+
"\t"
+
result
.
getAppendMessageResult
().
getMsgId
());
}
for
(
long
i
=
0
;
i
<
totalMsgs
;
i
++)
{
try
{
for
(
long
i
=
0
;
i
<
totalMsgs
;
i
++)
{
GetMessageResult
result
=
master
.
getMessage
(
"GROUP_A"
,
"TOPIC_A"
,
0
,
i
,
1024
*
1024
,
null
);
GetMessageResult
result
=
master
.
getMessage
(
"GROUP_A"
,
"TOPIC_A"
,
0
,
i
,
1024
*
1024
,
null
);
if
(
result
==
null
)
{
if
(
result
==
null
)
{
System
.
out
.
println
(
"result == null "
+
i
);
logger
.
debug
(
"result == null "
+
i
);
}
}
assertTrue
(
result
!=
null
);
assertTrue
(
result
!=
null
);
result
.
release
();
result
.
release
();
System
.
out
.
println
(
"read "
+
i
+
" OK"
);
logger
.
debug
(
"read "
+
i
+
" OK"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
finally
{
master
.
shutdown
();
master
.
destroy
();
}
}
master
.
shutdown
();
logger
.
debug
(
"================================================================"
);
master
.
destroy
();
System
.
out
.
println
(
"================================================================"
);
}
}
public
MessageExtBrokerInner
buildMessage
()
{
public
MessageExtBrokerInner
buildMessage
()
{
...
@@ -116,39 +119,46 @@ public class DefaultMessageStoreTest {
...
@@ -116,39 +119,46 @@ public class DefaultMessageStoreTest {
@Test
@Test
public
void
test_group_commit
()
throws
Exception
{
public
void
test_group_commit
()
throws
Exception
{
System
.
out
.
println
(
"================================================================"
);
logger
.
debug
(
"================================================================"
);
long
totalMsgs
=
100
;
long
totalMsgs
=
100
;
QUEUE_TOTAL
=
1
;
QUEUE_TOTAL
=
1
;
MessageBody
=
StoreMessage
.
getBytes
();
MessageBody
=
StoreMessage
.
getBytes
();
MessageStoreConfig
messageStoreConfig
=
new
MessageStoreConfig
();
MessageStoreConfig
messageStoreConfig
=
new
MessageStoreConfig
();
messageStoreConfig
.
setMapedFileSizeCommitLog
(
1024
*
8
);
messageStoreConfig
.
setMapedFileSizeCommitLog
(
1024
*
8
);
messageStoreConfig
.
setFlushDiskType
(
FlushDiskType
.
SYNC_FLUSH
);
messageStoreConfig
.
setFlushDiskType
(
FlushDiskType
.
SYNC_FLUSH
);
MessageStore
master
=
new
DefaultMessageStore
(
messageStoreConfig
,
null
,
n
ull
,
null
);
MessageStore
master
=
new
DefaultMessageStore
(
messageStoreConfig
,
null
,
n
ew
MyMessageArrivingListener
(),
new
BrokerConfig
()
);
boolean
load
=
master
.
load
();
boolean
load
=
master
.
load
();
assertTrue
(
load
);
assertTrue
(
load
);
master
.
start
();
master
.
start
();
for
(
long
i
=
0
;
i
<
totalMsgs
;
i
++)
{
try
{
PutMessageResult
result
=
master
.
putMessage
(
buildMessage
());
for
(
long
i
=
0
;
i
<
totalMsgs
;
i
++)
{
System
.
out
.
println
(
i
+
"\t"
+
result
.
getAppendMessageResult
().
getMsgId
());
PutMessageResult
result
=
master
.
putMessage
(
buildMessage
());
}
logger
.
debug
(
i
+
"\t"
+
result
.
getAppendMessageResult
().
getMsgId
());
}
for
(
long
i
=
0
;
i
<
totalMsgs
;
i
++)
{
try
{
for
(
long
i
=
0
;
i
<
totalMsgs
;
i
++)
{
GetMessageResult
result
=
master
.
getMessage
(
"GROUP_A"
,
"TOPIC_A"
,
0
,
i
,
1024
*
1024
,
null
);
GetMessageResult
result
=
master
.
getMessage
(
"GROUP_A"
,
"TOPIC_A"
,
0
,
i
,
1024
*
1024
,
null
);
if
(
result
==
null
)
{
if
(
result
==
null
)
{
System
.
out
.
println
(
"result == null "
+
i
);
logger
.
debug
(
"result == null "
+
i
);
}
}
assertTrue
(
result
!=
null
);
assertTrue
(
result
!=
null
);
result
.
release
();
result
.
release
();
System
.
out
.
println
(
"read "
+
i
+
" OK"
);
logger
.
debug
(
"read "
+
i
+
" OK"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
finally
{
master
.
shutdown
();
master
.
destroy
();
}
logger
.
debug
(
"================================================================"
);
}
private
class
MyMessageArrivingListener
implements
MessageArrivingListener
{
@Override
public
void
arriving
(
String
topic
,
int
queueId
,
long
logicOffset
,
long
tagsCode
)
{
// Do nothing here
}
}
master
.
shutdown
();
master
.
destroy
();
System
.
out
.
println
(
"================================================================"
);
}
}
}
}
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/MappedFileQueueTest.java
浏览文件 @
c92332e1
...
@@ -21,11 +21,14 @@
...
@@ -21,11 +21,14 @@
package
com.alibaba.rocketmq.store
;
package
com.alibaba.rocketmq.store
;
import
org.junit.*
;
import
org.junit.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.*;
public
class
MappedFileQueueTest
{
public
class
MappedFileQueueTest
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MappedFileQueueTest
.
class
);
// private static final String StoreMessage =
// private static final String StoreMessage =
// "Once, there was a chance for me! but I did not treasure it. if";
// "Once, there was a chance for me! but I did not treasure it. if";
...
@@ -49,7 +52,7 @@ public class MappedFileQueueTest {
...
@@ -49,7 +52,7 @@ public class MappedFileQueueTest {
@Test
@Test
public
void
test_getLastMapedFile
()
{
public
void
test_getLastMapedFile
()
{
final
String
fixedMsg
=
"0123456789abcdef"
;
final
String
fixedMsg
=
"0123456789abcdef"
;
System
.
out
.
println
(
"================================================================"
);
logger
.
debug
(
"================================================================"
);
MappedFileQueue
mappedFileQueue
=
MappedFileQueue
mappedFileQueue
=
new
MappedFileQueue
(
"target/unit_test_store/a/"
,
1024
,
null
);
new
MappedFileQueue
(
"target/unit_test_store/a/"
,
1024
,
null
);
...
@@ -58,21 +61,21 @@ public class MappedFileQueueTest {
...
@@ -58,21 +61,21 @@ public class MappedFileQueueTest {
assertTrue
(
mappedFile
!=
null
);
assertTrue
(
mappedFile
!=
null
);
boolean
result
=
mappedFile
.
appendMessage
(
fixedMsg
.
getBytes
());
boolean
result
=
mappedFile
.
appendMessage
(
fixedMsg
.
getBytes
());
if
(!
result
)
{
if
(!
result
)
{
System
.
out
.
println
(
"appendMessage "
+
i
);
logger
.
debug
(
"appendMessage "
+
i
);
}
}
assertTrue
(
result
);
assertTrue
(
result
);
}
}
mappedFileQueue
.
shutdown
(
1000
);
mappedFileQueue
.
shutdown
(
1000
);
mappedFileQueue
.
destroy
();
mappedFileQueue
.
destroy
();
System
.
out
.
println
(
"MappedFileQueue.getLastMappedFile() OK"
);
logger
.
debug
(
"MappedFileQueue.getLastMappedFile() OK"
);
}
}
@Test
@Test
public
void
test_findMapedFileByOffset
()
{
public
void
test_findMapedFileByOffset
()
{
final
String
fixedMsg
=
"abcd"
;
final
String
fixedMsg
=
"abcd"
;
System
.
out
.
println
(
"================================================================"
);
logger
.
debug
(
"================================================================"
);
MappedFileQueue
mappedFileQueue
=
MappedFileQueue
mappedFileQueue
=
new
MappedFileQueue
(
"target/unit_test_store/b/"
,
1024
,
null
);
new
MappedFileQueue
(
"target/unit_test_store/b/"
,
1024
,
null
);
...
@@ -80,40 +83,34 @@ public class MappedFileQueueTest {
...
@@ -80,40 +83,34 @@ public class MappedFileQueueTest {
MappedFile
mappedFile
=
mappedFileQueue
.
getLastMappedFile
(
0
);
MappedFile
mappedFile
=
mappedFileQueue
.
getLastMappedFile
(
0
);
assertTrue
(
mappedFile
!=
null
);
assertTrue
(
mappedFile
!=
null
);
boolean
result
=
mappedFile
.
appendMessage
(
fixedMsg
.
getBytes
());
boolean
result
=
mappedFile
.
appendMessage
(
fixedMsg
.
getBytes
());
//
System.out.println
("appendMessage " + bytes);
//
logger.debug
("appendMessage " + bytes);
assertTrue
(
result
);
assertTrue
(
result
);
}
}
MappedFile
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
0
);
MappedFile
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
0
);
assertTrue
(
mappedFile
!=
null
);
assertTrue
(
mappedFile
!=
null
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
0
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
0
);
System
.
out
.
println
(
mappedFile
.
getFileFromOffset
());
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
100
);
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
100
);
assertTrue
(
mappedFile
!=
null
);
assertTrue
(
mappedFile
!=
null
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
0
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
0
);
System
.
out
.
println
(
mappedFile
.
getFileFromOffset
());
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
);
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
);
assertTrue
(
mappedFile
!=
null
);
assertTrue
(
mappedFile
!=
null
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
1024
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
1024
);
System
.
out
.
println
(
mappedFile
.
getFileFromOffset
());
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
+
100
);
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
+
100
);
assertTrue
(
mappedFile
!=
null
);
assertTrue
(
mappedFile
!=
null
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
1024
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
1024
);
System
.
out
.
println
(
mappedFile
.
getFileFromOffset
());
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
*
2
);
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
*
2
);
assertTrue
(
mappedFile
!=
null
);
assertTrue
(
mappedFile
!=
null
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
1024
*
2
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
1024
*
2
);
System
.
out
.
println
(
mappedFile
.
getFileFromOffset
());
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
*
2
+
100
);
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
*
2
+
100
);
assertTrue
(
mappedFile
!=
null
);
assertTrue
(
mappedFile
!=
null
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
1024
*
2
);
assertEquals
(
mappedFile
.
getFileFromOffset
(),
1024
*
2
);
System
.
out
.
println
(
mappedFile
.
getFileFromOffset
());
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
*
4
);
mappedFile
=
mappedFileQueue
.
findMappedFileByOffset
(
1024
*
4
);
assertTrue
(
mappedFile
==
null
);
assertTrue
(
mappedFile
==
null
);
...
@@ -122,13 +119,13 @@ public class MappedFileQueueTest {
...
@@ -122,13 +119,13 @@ public class MappedFileQueueTest {
mappedFileQueue
.
shutdown
(
1000
);
mappedFileQueue
.
shutdown
(
1000
);
mappedFileQueue
.
destroy
();
mappedFileQueue
.
destroy
();
System
.
out
.
println
(
"MappedFileQueue.findMappedFileByOffset() OK"
);
logger
.
debug
(
"MappedFileQueue.findMappedFileByOffset() OK"
);
}
}
@Test
@Test
public
void
test_commit
()
{
public
void
test_commit
()
{
final
String
fixedMsg
=
"0123456789abcdef"
;
final
String
fixedMsg
=
"0123456789abcdef"
;
System
.
out
.
println
(
"================================================================"
);
logger
.
debug
(
"================================================================"
);
MappedFileQueue
mappedFileQueue
=
MappedFileQueue
mappedFileQueue
=
new
MappedFileQueue
(
"target/unit_test_store/c/"
,
1024
,
null
);
new
MappedFileQueue
(
"target/unit_test_store/c/"
,
1024
,
null
);
...
@@ -142,42 +139,36 @@ public class MappedFileQueueTest {
...
@@ -142,42 +139,36 @@ public class MappedFileQueueTest {
boolean
result
=
mappedFileQueue
.
flush
(
0
);
boolean
result
=
mappedFileQueue
.
flush
(
0
);
assertFalse
(
result
);
assertFalse
(
result
);
assertEquals
(
1024
*
1
,
mappedFileQueue
.
getFlushedWhere
());
assertEquals
(
1024
*
1
,
mappedFileQueue
.
getFlushedWhere
());
System
.
out
.
println
(
"1 "
+
result
+
" "
+
mappedFileQueue
.
getFlushedWhere
());
result
=
mappedFileQueue
.
flush
(
0
);
result
=
mappedFileQueue
.
flush
(
0
);
assertFalse
(
result
);
assertFalse
(
result
);
assertEquals
(
1024
*
2
,
mappedFileQueue
.
getFlushedWhere
());
assertEquals
(
1024
*
2
,
mappedFileQueue
.
getFlushedWhere
());
System
.
out
.
println
(
"2 "
+
result
+
" "
+
mappedFileQueue
.
getFlushedWhere
());
result
=
mappedFileQueue
.
flush
(
0
);
result
=
mappedFileQueue
.
flush
(
0
);
assertFalse
(
result
);
assertFalse
(
result
);
assertEquals
(
1024
*
3
,
mappedFileQueue
.
getFlushedWhere
());
assertEquals
(
1024
*
3
,
mappedFileQueue
.
getFlushedWhere
());
System
.
out
.
println
(
"3 "
+
result
+
" "
+
mappedFileQueue
.
getFlushedWhere
());
result
=
mappedFileQueue
.
flush
(
0
);
result
=
mappedFileQueue
.
flush
(
0
);
assertFalse
(
result
);
assertFalse
(
result
);
assertEquals
(
1024
*
4
,
mappedFileQueue
.
getFlushedWhere
());
assertEquals
(
1024
*
4
,
mappedFileQueue
.
getFlushedWhere
());
System
.
out
.
println
(
"4 "
+
result
+
" "
+
mappedFileQueue
.
getFlushedWhere
());
result
=
mappedFileQueue
.
flush
(
0
);
result
=
mappedFileQueue
.
flush
(
0
);
assertFalse
(
result
);
assertFalse
(
result
);
assertEquals
(
1024
*
5
,
mappedFileQueue
.
getFlushedWhere
());
assertEquals
(
1024
*
5
,
mappedFileQueue
.
getFlushedWhere
());
System
.
out
.
println
(
"5 "
+
result
+
" "
+
mappedFileQueue
.
getFlushedWhere
());
result
=
mappedFileQueue
.
flush
(
0
);
result
=
mappedFileQueue
.
flush
(
0
);
assertFalse
(
result
);
assertFalse
(
result
);
assertEquals
(
1024
*
6
,
mappedFileQueue
.
getFlushedWhere
());
assertEquals
(
1024
*
6
,
mappedFileQueue
.
getFlushedWhere
());
System
.
out
.
println
(
"6 "
+
result
+
" "
+
mappedFileQueue
.
getFlushedWhere
());
mappedFileQueue
.
shutdown
(
1000
);
mappedFileQueue
.
shutdown
(
1000
);
mappedFileQueue
.
destroy
();
mappedFileQueue
.
destroy
();
System
.
out
.
println
(
"MappedFileQueue.flush() OK"
);
logger
.
debug
(
"MappedFileQueue.flush() OK"
);
}
}
@Test
@Test
public
void
test_getMapedMemorySize
()
{
public
void
test_getMapedMemorySize
()
{
final
String
fixedMsg
=
"abcd"
;
final
String
fixedMsg
=
"abcd"
;
System
.
out
.
println
(
"================================================================"
);
logger
.
debug
(
"================================================================"
);
MappedFileQueue
mappedFileQueue
=
MappedFileQueue
mappedFileQueue
=
new
MappedFileQueue
(
"target/unit_test_store/d/"
,
1024
,
null
);
new
MappedFileQueue
(
"target/unit_test_store/d/"
,
1024
,
null
);
...
@@ -191,7 +182,7 @@ public class MappedFileQueueTest {
...
@@ -191,7 +182,7 @@ public class MappedFileQueueTest {
assertEquals
(
fixedMsg
.
length
()
*
1024
,
mappedFileQueue
.
getMappedMemorySize
());
assertEquals
(
fixedMsg
.
length
()
*
1024
,
mappedFileQueue
.
getMappedMemorySize
());
mappedFileQueue
.
shutdown
(
1000
);
mappedFileQueue
.
shutdown
(
1000
);
mappedFileQueue
.
destroy
();
mappedFileQueue
.
destroy
();
System
.
out
.
println
(
"MappedFileQueue.getMappedMemorySize() OK"
);
logger
.
debug
(
"MappedFileQueue.getMappedMemorySize() OK"
);
}
}
}
}
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/MappedFileTest.java
浏览文件 @
c92332e1
...
@@ -24,6 +24,8 @@ import org.junit.AfterClass;
...
@@ -24,6 +24,8 @@ import org.junit.AfterClass;
import
org.junit.BeforeClass
;
import
org.junit.BeforeClass
;
import
org.junit.Ignore
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -31,7 +33,10 @@ import static org.junit.Assert.assertTrue;
...
@@ -31,7 +33,10 @@ import static org.junit.Assert.assertTrue;
public
class
MappedFileTest
{
public
class
MappedFileTest
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MappedFileTest
.
class
);
private
static
final
String
StoreMessage
=
"Once, there was a chance for me!"
;
private
static
final
String
StoreMessage
=
"Once, there was a chance for me!"
;
@BeforeClass
@BeforeClass
...
@@ -44,50 +49,41 @@ public class MappedFileTest {
...
@@ -44,50 +49,41 @@ public class MappedFileTest {
}
}
@Test
@Test
public
void
test_write_read
()
{
public
void
test_write_read
()
throws
IOException
{
try
{
MappedFile
mappedFile
=
new
MappedFile
(
"target/unit_test_store/MappedFileTest/000"
,
1024
*
64
);
MappedFile
mappedFile
=
new
MappedFile
(
"target/unit_test_store/MappedFileTest/000"
,
1024
*
64
);
boolean
result
=
mappedFile
.
appendMessage
(
StoreMessage
.
getBytes
());
boolean
result
=
mappedFile
.
appendMessage
(
StoreMessage
.
getBytes
());
assertTrue
(
result
);
assertTrue
(
result
);
logger
.
debug
(
"write OK"
);
System
.
out
.
println
(
"write OK"
);
SelectMappedBufferResult
selectMappedBufferResult
=
mappedFile
.
selectMappedBuffer
(
0
);
SelectMappedBufferResult
selectMappedBufferResult
=
mappedFile
.
selectMappedBuffer
(
0
);
byte
[]
data
=
new
byte
[
StoreMessage
.
length
()];
byte
[]
data
=
new
byte
[
StoreMessage
.
length
()];
selectMappedBufferResult
.
getByteBuffer
().
get
(
data
);
selectMappedBufferResult
.
getByteBuffer
().
get
(
data
);
String
readString
=
new
String
(
data
);
String
readString
=
new
String
(
data
);
logger
.
debug
(
"Read: "
+
readString
);
System
.
out
.
println
(
"Read: "
+
readString
);
assertTrue
(
readString
.
equals
(
StoreMessage
));
assertTrue
(
readString
.
equals
(
StoreMessage
));
mappedFile
.
shutdown
(
1000
);
mappedFile
.
shutdown
(
1000
);
assertTrue
(!
mappedFile
.
isAvailable
());
assertTrue
(!
mappedFile
.
isAvailable
());
selectMappedBufferResult
.
release
();
selectMappedBufferResult
.
release
();
assertTrue
(
mappedFile
.
isCleanupOver
());
assertTrue
(
mappedFile
.
isCleanupOver
());
assertTrue
(
mappedFile
.
destroy
(
1000
));
assertTrue
(
mappedFile
.
destroy
(
1000
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
@Ignore
@Ignore
public
void
test_jvm_crashed
()
{
public
void
test_jvm_crashed
()
throws
IOException
{
try
{
MappedFile
mappedFile
=
new
MappedFile
(
"target/unit_test_store/MappedFileTest/10086"
,
1024
*
64
);
MappedFile
mappedFile
=
new
MappedFile
(
"target/unit_test_store/MappedFileTest/10086"
,
1024
*
64
);
boolean
result
=
mappedFile
.
appendMessage
(
StoreMessage
.
getBytes
());
boolean
result
=
mappedFile
.
appendMessage
(
StoreMessage
.
getBytes
());
assertTrue
(
result
);
assertTrue
(
result
);
logger
.
debug
(
"write OK"
);
System
.
out
.
println
(
"write OK"
);
SelectMappedBufferResult
selectMappedBufferResult
=
mappedFile
.
selectMappedBuffer
(
0
);
SelectMappedBufferResult
selectMappedBufferResult
=
mappedFile
.
selectMappedBuffer
(
0
);
selectMappedBufferResult
.
release
();
selectMappedBufferResult
.
release
();
mappedFile
.
shutdown
(
1000
);
mappedFile
.
shutdown
(
1000
);
byte
[]
data
=
new
byte
[
StoreMessage
.
length
()];
byte
[]
data
=
new
byte
[
StoreMessage
.
length
()];
selectMappedBufferResult
.
getByteBuffer
().
get
(
data
);
selectMappedBufferResult
.
getByteBuffer
().
get
(
data
);
String
readString
=
new
String
(
data
);
String
readString
=
new
String
(
data
);
logger
.
debug
(
readString
);
System
.
out
.
println
(
readString
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
}
}
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/RecoverTest.java
浏览文件 @
c92332e1
...
@@ -25,6 +25,7 @@ import com.alibaba.rocketmq.common.message.MessageExt;
...
@@ -25,6 +25,7 @@ import com.alibaba.rocketmq.common.message.MessageExt;
import
com.alibaba.rocketmq.store.config.MessageStoreConfig
;
import
com.alibaba.rocketmq.store.config.MessageStoreConfig
;
import
org.junit.AfterClass
;
import
org.junit.AfterClass
;
import
org.junit.BeforeClass
;
import
org.junit.BeforeClass
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.Test
;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
...
@@ -36,7 +37,7 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -36,7 +37,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
@Ignore
(
"This test need to be fixed!"
)
public
class
RecoverTest
{
public
class
RecoverTest
{
private
static
final
String
StoreMessage
=
"Once, there was a chance for me!aaaaaaaaaaaaaaaaaaaaaaaa"
;
private
static
final
String
StoreMessage
=
"Once, there was a chance for me!aaaaaaaaaaaaaaaaaaaaaaaa"
;
...
...
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/StoreCheckpointTest.java
浏览文件 @
c92332e1
...
@@ -24,6 +24,8 @@ import org.junit.AfterClass;
...
@@ -24,6 +24,8 @@ import org.junit.AfterClass;
import
org.junit.BeforeClass
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.junit.Test
;
import
java.io.IOException
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
...
@@ -38,24 +40,19 @@ public class StoreCheckpointTest {
...
@@ -38,24 +40,19 @@ public class StoreCheckpointTest {
}
}
@Test
@Test
public
void
test_write_read
()
{
public
void
test_write_read
()
throws
IOException
{
try
{
StoreCheckpoint
storeCheckpoint
=
new
StoreCheckpoint
(
"target/checkpoint_test/0000"
);
StoreCheckpoint
storeCheckpoint
=
new
StoreCheckpoint
(
"target/checkpoint_test/0000"
);
long
physicMsgTimestamp
=
0xAABB
;
long
physicMsgTimestamp
=
0xAABB
;
long
logicsMsgTimestamp
=
0xCCDD
;
long
logicsMsgTimestamp
=
0xCCDD
;
storeCheckpoint
.
setPhysicMsgTimestamp
(
physicMsgTimestamp
);
storeCheckpoint
.
setPhysicMsgTimestamp
(
physicMsgTimestamp
);
storeCheckpoint
.
setLogicsMsgTimestamp
(
logicsMsgTimestamp
);
storeCheckpoint
.
setLogicsMsgTimestamp
(
logicsMsgTimestamp
);
storeCheckpoint
.
flush
();
storeCheckpoint
.
flush
();
long
diff
=
physicMsgTimestamp
-
storeCheckpoint
.
getMinTimestamp
();
long
diff
=
physicMsgTimestamp
-
storeCheckpoint
.
getMinTimestamp
();
assertTrue
(
diff
==
3000
);
assertTrue
(
diff
==
3000
);
storeCheckpoint
.
shutdown
();
storeCheckpoint
.
shutdown
();
storeCheckpoint
=
new
StoreCheckpoint
(
"target/checkpoint_test/0000"
);
storeCheckpoint
=
new
StoreCheckpoint
(
"target/checkpoint_test/0000"
);
assertTrue
(
physicMsgTimestamp
==
storeCheckpoint
.
getPhysicMsgTimestamp
());
assertTrue
(
physicMsgTimestamp
==
storeCheckpoint
.
getPhysicMsgTimestamp
());
assertTrue
(
logicsMsgTimestamp
==
storeCheckpoint
.
getLogicsMsgTimestamp
());
assertTrue
(
logicsMsgTimestamp
==
storeCheckpoint
.
getLogicsMsgTimestamp
());
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
assertTrue
(
false
);
}
}
}
}
}
rocketmq-store/src/test/java/com/alibaba/rocketmq/store/index/IndexFileTest.java
浏览文件 @
c92332e1
...
@@ -25,6 +25,7 @@ import org.junit.Test;
...
@@ -25,6 +25,7 @@ import org.junit.Test;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
...
@@ -34,47 +35,35 @@ public class IndexFileTest {
...
@@ -34,47 +35,35 @@ public class IndexFileTest {
private
static
final
int
indexNum
=
400
;
private
static
final
int
indexNum
=
400
;
@Test
@Test
public
void
test_put_index
()
{
public
void
test_put_index
()
throws
Exception
{
try
{
IndexFile
indexFile
=
new
IndexFile
(
"100"
,
hashSlotNum
,
indexNum
,
0
,
0
);
IndexFile
indexFile
=
new
IndexFile
(
"100"
,
hashSlotNum
,
indexNum
,
0
,
0
);
for
(
long
i
=
0
;
i
<
(
indexNum
-
1
);
i
++)
{
for
(
long
i
=
0
;
i
<
(
indexNum
-
1
);
i
++)
{
boolean
putResult
=
indexFile
.
putKey
(
Long
.
toString
(
i
),
i
,
System
.
currentTimeMillis
());
boolean
putResult
=
indexFile
.
putKey
(
Long
.
toString
(
i
),
i
,
System
.
currentTimeMillis
());
assertTrue
(
putResult
);
assertTrue
(
putResult
);
}
boolean
putResult
=
indexFile
.
putKey
(
Long
.
toString
(
400
),
400
,
System
.
currentTimeMillis
());
assertFalse
(
putResult
);
indexFile
.
destroy
(
0
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
assertTrue
(
false
);
}
}
boolean
putResult
=
indexFile
.
putKey
(
Long
.
toString
(
400
),
400
,
System
.
currentTimeMillis
());
assertFalse
(
putResult
);
indexFile
.
destroy
(
0
);
}
}
@Test
@Test
public
void
test_put_get_index
()
{
public
void
test_put_get_index
()
throws
Exception
{
try
{
IndexFile
indexFile
=
new
IndexFile
(
"200"
,
hashSlotNum
,
indexNum
,
0
,
0
);
IndexFile
indexFile
=
new
IndexFile
(
"200"
,
hashSlotNum
,
indexNum
,
0
,
0
);
for
(
long
i
=
0
;
i
<
(
indexNum
-
1
);
i
++)
{
for
(
long
i
=
0
;
i
<
(
indexNum
-
1
);
i
++)
{
boolean
putResult
=
indexFile
.
putKey
(
Long
.
toString
(
i
),
i
,
System
.
currentTimeMillis
());
boolean
putResult
=
indexFile
.
putKey
(
Long
.
toString
(
i
),
i
,
System
.
currentTimeMillis
());
assertTrue
(
putResult
);
assertTrue
(
putResult
);
}
boolean
putResult
=
indexFile
.
putKey
(
Long
.
toString
(
400
),
400
,
System
.
currentTimeMillis
());
assertFalse
(
putResult
);
final
List
<
Long
>
phyOffsets
=
new
ArrayList
<
Long
>();
indexFile
.
selectPhyOffset
(
phyOffsets
,
"60"
,
10
,
0
,
Long
.
MAX_VALUE
,
true
);
for
(
Long
offset
:
phyOffsets
)
{
System
.
out
.
println
(
offset
);
}
assertFalse
(
phyOffsets
.
isEmpty
());
indexFile
.
destroy
(
0
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
assertTrue
(
false
);
}
}
boolean
putResult
=
indexFile
.
putKey
(
Long
.
toString
(
400
),
400
,
System
.
currentTimeMillis
());
assertFalse
(
putResult
);
final
List
<
Long
>
phyOffsets
=
new
ArrayList
<
Long
>();
indexFile
.
selectPhyOffset
(
phyOffsets
,
"60"
,
10
,
0
,
Long
.
MAX_VALUE
,
true
);
assertFalse
(
phyOffsets
.
isEmpty
());
assertEquals
(
1
,
phyOffsets
.
size
());
indexFile
.
destroy
(
0
);
}
}
}
}
rocketmq-store/src/test/resources/logback-test.xml
0 → 100644
浏览文件 @
c92332e1
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain producerGroup copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n
</pattern>
</encoder>
</appender>
<logger
name=
"com.alibaba.rocketmq.store"
level=
"WARN"
additivity=
"false"
>
<appender-ref
ref=
"STDOUT"
/>
</logger>
<root
level=
"WARN"
>
<appender-ref
ref=
"STDOUT"
/>
</root>
</configuration>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录