Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
03887f4a
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,发现更多精彩内容 >>
提交
03887f4a
编写于
11月 01, 2013
作者:
H
Hao Zhu
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #171 from youyong205/biz
Biz
上级
573869f1
0b1c3d70
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
119 addition
and
50 deletion
+119
-50
cat-home/src/test/java/com/dianping/cat/ModuleInitializerTest.java
...src/test/java/com/dianping/cat/ModuleInitializerTest.java
+0
-24
cat-home/src/test/java/com/dianping/cat/UITest.java
cat-home/src/test/java/com/dianping/cat/UITest.java
+119
-0
cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java
.../src/test/java/com/dianping/cat/demo/TestSendMessage.java
+0
-3
cat-home/src/test/java/com/dianping/cat/home/UploaderAndCleanerTest.java
...st/java/com/dianping/cat/home/UploaderAndCleanerTest.java
+0
-23
未找到文件。
cat-home/src/test/java/com/dianping/cat/ModuleInitializerTest.java
已删除
100644 → 0
浏览文件 @
573869f1
package
com.dianping.cat
;
import
java.io.File
;
import
org.junit.Test
;
import
org.unidal.initialization.DefaultModuleContext
;
import
org.unidal.initialization.Module
;
import
org.unidal.initialization.ModuleContext
;
import
org.unidal.initialization.ModuleInitializer
;
import
org.unidal.lookup.ContainerLoader
;
public
class
ModuleInitializerTest
{
@Test
public
void
testInitialize
()
throws
InterruptedException
{
ModuleContext
ctx
=
new
DefaultModuleContext
(
ContainerLoader
.
getDefaultContainer
());
ModuleInitializer
initializer
=
ctx
.
lookup
(
ModuleInitializer
.
class
);
Module
catCoreModule
=
ctx
.
lookup
(
Module
.
class
,
CatHomeModule
.
ID
);
ctx
.
setAttribute
(
"cat-client-config-file"
,
new
File
(
"/data/appdatas/cat/client.xml"
));
initializer
.
execute
(
ctx
,
catCoreModule
);
Thread
.
sleep
(
1000
);
}
}
cat-home/src/test/java/com/dianping/cat/UITest.java
0 → 100644
浏览文件 @
03887f4a
package
com.dianping.cat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.unidal.helper.Urls
;
import
org.unidal.webres.helper.Files
;
public
class
UITest
{
private
String
m_date
;
private
String
m_local_host
=
"localhost:2281"
;
private
String
m_qa_host
=
"cat.qa.dianpingoa.com"
;
private
List
<
Item
>
m_items
=
new
ArrayList
<
Item
>();
@Before
public
void
setUp
()
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
Calendar
.
MINUTE
,
0
);
cal
.
set
(
Calendar
.
SECOND
,
0
);
cal
.
set
(
Calendar
.
MILLISECOND
,
0
);
cal
.
add
(
Calendar
.
HOUR
,
-
3
);
m_date
=
new
SimpleDateFormat
(
"yyyyMMddHH"
).
format
(
cal
.
getTime
());
m_items
.
add
(
new
Item
(
"http://%s/cat/r/home?domain=Cat&ip=&date=%s&reportType=&op=view"
,
"Home"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/metric?domain=Cat&ip=&date=%s&reportType=&op=view"
,
"Metric"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/t?domain=Cat&ip=&date=%s&reportType=&op=view"
,
"Transaction"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/e?domain=Cat&ip=&date=%s&reportType=&op=view"
,
"Event"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/p?domain=Cat&ip=&date=%s&reportType=&op=view"
,
"Problem"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/h?domain=Cat&ip=&date=%s&reportType=&op=view"
,
"Heartbeat"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/cross?domain=GroupService&ip=&date=%s&reportType=&op=view"
,
"Cross"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/cache?domain=GroupService&ip=&date=%s&reportType=&op=view"
,
"Cache"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/sql?domain=GroupService&ip=&date=%s&reportType=&op=view"
,
"Sql"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/matrix?domain=GroupService&ip=&date=%s&reportType=&op=view"
,
"Matrix"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/statistics?domain=Cat&ip=&date=%s&reportType=&op=view"
,
"Bug"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/statistics?domain=Cat&ip=&date=%s&reportType=&op=service"
,
"Service"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/statistics?domain=Cat&ip=&date=%s&reportType=&op=utilization"
,
"Utilization"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/statistics?domain=Cat&ip=&date=%s&reportType=&op=heavy"
,
"Heavy"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/state?domain=Cat&ip=&date=%s&reportType=&op=view"
,
"State"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/state?domain=GroupService&ip=&date=%s&reportType=&op=view"
,
"State"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/t?domain=Cat&ip=&date=%s&reportType=&op=history"
,
"TransactionHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/e?domain=Cat&ip=&date=%s&reportType=&op=history"
,
"EventHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/p?domain=Cat&ip=&date=%s&reportType=&op=history"
,
"ProblemHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/h?domain=Cat&ip=&date=%s&reportType=&op=history"
,
"HeartbeatHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/cross?domain=GroupService&ip=&date=%s&reportType=&op=history"
,
"CrossHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/cache?domain=GroupService&ip=&date=%s&reportType=&op=history"
,
"CacheHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/sql?domain=GroupService&ip=&date=%s&reportType=&op=history"
,
"SqlHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/matrix?domain=GroupService&ip=&date=%s&reportType=&op=history"
,
"MatrixHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/state?domain=GroupService&ip=&date=%s&reportType=&op=history"
,
"StateHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/statistics?domain=Cat&ip=&date=%s&reportType=&op=historyBug"
,
"BugHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/statistics?domain=Cat&ip=&date=%s&reportType=&op=historyService"
,
"ServiceHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/statistics?domain=Cat&ip=&date=%s&reportType=&op=historyUtilization"
,
"UtilizationHistory"
));
m_items
.
add
(
new
Item
(
"http://%s/cat/r/statistics?domain=Cat&ip=&date=%s&reportType=&op=historyHeavy"
,
"HeavyHistory"
));
}
@Test
public
void
test
()
{
for
(
Item
item
:
m_items
)
{
try
{
compare
(
item
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
public
void
compare
(
Item
item
)
throws
Exception
{
String
url
=
item
.
getUrl
();
String
localUrl
=
String
.
format
(
url
,
m_local_host
,
m_date
);
String
qaUrl
=
String
.
format
(
url
,
m_qa_host
,
m_date
);
String
localContent
=
Files
.
forIO
().
readFrom
(
Urls
.
forIO
().
connectTimeout
(
5000
).
openStream
(
localUrl
),
"utf-8"
);
String
qaContent
=
Files
.
forIO
().
readFrom
(
Urls
.
forIO
().
connectTimeout
(
5000
).
openStream
(
qaUrl
),
"utf-8"
);
String
localTrim
=
localContent
.
replaceAll
(
"\\s*"
,
""
);
String
qaTrim
=
qaContent
.
replaceAll
(
"\\s*"
,
""
);
if
(!
localTrim
.
equals
(
qaTrim
))
{
System
.
err
.
println
(
item
.
getTitle
()
+
" Fail!"
);
}
}
public
static
class
Item
{
private
String
m_url
;
private
String
m_title
;
public
Item
(
String
url
,
String
title
)
{
m_url
=
url
;
m_title
=
title
;
}
public
String
getUrl
()
{
return
m_url
;
}
public
String
getTitle
()
{
return
m_title
;
}
}
}
cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java
浏览文件 @
03887f4a
...
...
@@ -446,9 +446,6 @@ public class TestSendMessage {
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
Transaction
t
=
Cat
.
newTransaction
(
"Trace"
,
"Test"
+
i
);
try
{
// your bussiness code
// for see the message on cat in problem report
Cat
.
logTrace
(
"Trace"
,
"Info"
);
Cat
.
logTrace
(
"Trace"
,
"Dubug"
,
Trace
.
SUCCESS
,
"sss"
);
Trace
trace
=
Cat
.
newTrace
(
"Trace"
,
"Error"
);
...
...
cat-home/src/test/java/com/dianping/cat/home/UploaderAndCleanerTest.java
已删除
100644 → 0
浏览文件 @
573869f1
package
com.dianping.cat.home
;
import
java.io.File
;
import
org.junit.Test
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.hadoop.hdfs.UploaderAndCleaner
;
public
class
UploaderAndCleanerTest
extends
ComponentTestCase
{
@Test
public
void
test
()
throws
Exception
{
ServerConfigManager
serverConfigManager
=
lookup
(
ServerConfigManager
.
class
);
serverConfigManager
.
initialize
(
new
File
(
"/data/appdatas/cat/server.xml"
));
UploaderAndCleaner
task
=
lookup
(
UploaderAndCleaner
.
class
);
task
.
deleteOldReports
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录