Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
3c0b7521
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,发现更多精彩内容 >>
提交
3c0b7521
编写于
10月 15, 2013
作者:
Y
yong.you
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the test case error
上级
01a01fa2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
25 deletion
+37
-25
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
...n/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
+5
-0
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/advanced/CrossInfoTest.java
...ava/com/dianping/cat/consumer/advanced/CrossInfoTest.java
+32
-25
未找到文件。
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
浏览文件 @
3c0b7521
...
...
@@ -263,4 +263,9 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
m_remoteRole
=
remoteRole
;
}
}
public
void
setServerConfigManager
(
ServerConfigManager
serverConfigManager
)
{
m_serverConfigManager
=
serverConfigManager
;
}
}
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/advanced/CrossInfoTest.java
浏览文件 @
3c0b7521
...
...
@@ -3,7 +3,9 @@ package com.dianping.cat.consumer.advanced;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.consumer.cross.CrossAnalyzer
;
import
com.dianping.cat.consumer.cross.CrossAnalyzer.CrossInfo
;
import
com.dianping.cat.message.Message
;
...
...
@@ -12,11 +14,32 @@ import com.dianping.cat.message.internal.DefaultTransaction;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
public
class
CrossInfoTest
{
public
class
CrossInfoTest
extends
ComponentTestCase
{
public
MessageTree
buildMockMessageTree
()
{
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setMessageId
(
"Cat-c0a80746-373452-6"
);
// 192.168.7.70 machine logview
tree
.
setIpAddress
(
"192.168.0.1"
);
return
tree
;
}
@Test
public
void
testParsePigeonClientTransaction
()
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
public
void
testParseOtherTransaction
()
throws
Exception
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
analyzer
.
setServerConfigManager
(
lookup
(
ServerConfigManager
.
class
));
DefaultTransaction
t
=
new
DefaultTransaction
(
"Other"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
CrossInfo
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
Assert
.
assertEquals
(
true
,
info
==
null
);
}
@Test
public
void
testParsePigeonClientTransaction
()
throws
Exception
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
analyzer
.
setServerConfigManager
(
lookup
(
ServerConfigManager
.
class
));
DefaultTransaction
t
=
new
DefaultTransaction
(
"Call"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
CrossInfo
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
...
...
@@ -36,8 +59,9 @@ public class CrossInfoTest {
}
@Test
public
void
testParsePigeonServerTransaction
()
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
public
void
testParsePigeonServerTransaction
()
throws
Exception
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
analyzer
.
setServerConfigManager
(
lookup
(
ServerConfigManager
.
class
));
DefaultTransaction
t
=
new
DefaultTransaction
(
"Service"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
...
...
@@ -58,9 +82,10 @@ public class CrossInfoTest {
}
@Test
public
void
testParsePigeonServerTransactionWithPort
()
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
public
void
testParsePigeonServerTransactionWithPort
()
throws
Exception
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
analyzer
.
setServerConfigManager
(
lookup
(
ServerConfigManager
.
class
));
DefaultTransaction
t
=
new
DefaultTransaction
(
"Service"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
CrossInfo
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
...
...
@@ -75,22 +100,4 @@ public class CrossInfoTest {
Assert
.
assertEquals
(
info
.
getDetailType
(),
"PigeonService"
);
Assert
.
assertEquals
(
info
.
getRemoteRole
(),
"Pigeon.Client"
);
}
@Test
public
void
testParseOtherTransaction
()
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
DefaultTransaction
t
=
new
DefaultTransaction
(
"Other"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
CrossInfo
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
Assert
.
assertEquals
(
true
,
info
==
null
);
}
public
MessageTree
buildMockMessageTree
()
{
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setMessageId
(
"Cat-c0a80746-373452-6"
);
// 192.168.7.70 machine logview
tree
.
setIpAddress
(
"192.168.0.1"
);
return
tree
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录