Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
45825588
C
cat
项目概览
梦中观雨
/
cat
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
45825588
编写于
11月 27, 2013
作者:
A
ainilife
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine the code
上级
f16d63d6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
63 deletion
+4
-63
cat-core/src/test/java/com/dianping/cat/message/spi/core/MockMessageTreeBuilder.java
...dianping/cat/message/spi/core/MockMessageTreeBuilder.java
+0
-0
cat-core/src/test/java/com/dianping/cat/storage/dump/LocalMessageBucketManagerTest.java
...nping/cat/storage/dump/LocalMessageBucketManagerTest.java
+4
-10
cat-core/src/test/java/com/dianping/cat/storage/dump/LocalMessageRecovery.java
...a/com/dianping/cat/storage/dump/LocalMessageRecovery.java
+0
-53
未找到文件。
cat-core/src/
main
/java/com/dianping/cat/message/spi/core/MockMessageTreeBuilder.java
→
cat-core/src/
test
/java/com/dianping/cat/message/spi/core/MockMessageTreeBuilder.java
浏览文件 @
45825588
文件已移动
cat-core/src/test/java/com/dianping/cat/storage/dump/LocalMessageBucketManagerTest.java
浏览文件 @
45825588
...
...
@@ -75,27 +75,21 @@ public class LocalMessageBucketManagerTest extends ComponentTestCase {
return
transaction
;
}
@Test
public
void
test
()
{
}
@Test
public
void
testReadWrite
()
throws
Exception
{
MessageCodec
codec
=
lookup
(
MessageCodec
.
class
,
PlainTextMessageCodec
.
ID
);
LocalMessageBucketManager
manager
=
(
LocalMessageBucketManager
)
lookup
(
MessageBucketManager
.
class
,
LocalMessageBucketManager
.
ID
);
MessageCodec
codec
=
lookup
(
MessageCodec
.
class
,
PlainTextMessageCodec
.
ID
);
MessageIdFactory
factory
=
new
MockMessageIdFactory
();
manager
.
setLocalIp
(
m_ip
);
long
now
=
1343532130488L
;
int
num
=
5000
;
Thread
.
sleep
(
100
);
manager
.
setLocalIp
(
m_ip
);
factory
.
setIpAddress
(
"7f000001"
);
factory
.
initialize
(
"source"
);
Thread
.
sleep
(
100
);
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
DefaultMessageTree
tree
=
newMessageTree
(
factory
.
getNextId
(),
i
,
now
+
i
*
10L
);
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
...
...
cat-core/src/test/java/com/dianping/cat/storage/dump/LocalMessageRecovery.java
已删除
100644 → 0
浏览文件 @
f16d63d6
package
com.dianping.cat.storage.dump
;
import
java.io.File
;
import
org.jboss.netty.buffer.ChannelBuffer
;
import
org.jboss.netty.buffer.ChannelBuffers
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.message.spi.MessageCodec
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.codec.PlainTextMessageCodec
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
@Ignore
public
class
LocalMessageRecovery
extends
ComponentTestCase
{
private
MessageCodec
m_codec
;
@Test
public
void
test
()
throws
Exception
{
recovery
(
"10.1.6.108"
);
}
public
void
recovery
(
String
ip
)
throws
Exception
{
m_codec
=
lookup
(
MessageCodec
.
class
,
PlainTextMessageCodec
.
ID
);
File
dataFile
=
new
File
(
"/Users/youyong/midasMerchantServerWorker-10.1.8.77-"
+
ip
);
MessageBlockReader
reader
=
new
MessageBlockReader
(
dataFile
);
String
message
=
readMessage
(
reader
,
27
);
String
id
=
"midasMerchantServerWorker-0a01084d-382328-27"
;
if
(
message
.
indexOf
(
id
)>-
1
){
System
.
out
.
println
(
message
);
}
}
private
String
readMessage
(
MessageBlockReader
reader
,
int
index
)
throws
Exception
{
byte
[]
data
=
reader
.
readMessage
(
index
);
if
(
data
==
null
){
return
""
;
}
ChannelBuffer
buf
=
ChannelBuffers
.
dynamicBuffer
(
data
.
length
);
MessageTree
tree
=
new
DefaultMessageTree
();
buf
.
writeBytes
(
data
);
m_codec
.
decode
(
buf
,
tree
);
return
tree
.
toString
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录