Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
612a1c6d
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,发现更多精彩内容 >>
提交
612a1c6d
编写于
8月 27, 2013
作者:
Y
yong.you
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the page
上级
9a442d9d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
13 deletion
+23
-13
cat-home/src/main/java/com/dianping/cat/report/task/heavy/MatrixReportVisitor.java
...m/dianping/cat/report/task/heavy/MatrixReportVisitor.java
+2
-2
cat-home/src/main/webapp/jsp/report/service/service.jsp
cat-home/src/main/webapp/jsp/report/service/service.jsp
+1
-0
cat-home/src/main/webapp/jsp/report/service/serviceHistory.jsp
...ome/src/main/webapp/jsp/report/service/serviceHistory.jsp
+1
-0
cat-home/src/test/java/com/dianping/cat/report/task/heavy/HeavyReportBuilderTest.java
...ianping/cat/report/task/heavy/HeavyReportBuilderTest.java
+19
-11
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/task/heavy/MatrixReportVisitor.java
浏览文件 @
612a1c6d
...
...
@@ -51,8 +51,8 @@ public class MatrixReportVisitor extends BaseVisitor {
private
void
updateUrl
(
Url
url
,
String
logview
,
long
max
)
{
url
.
setDomain
(
m_currentDomain
);
url
.
setName
(
m_currentName
);
url
.
setLogview
(
logview
);
if
(
max
>
url
.
getCount
())
{
url
.
setLogview
(
logview
);
url
.
setCount
(
max
);
}
}
...
...
@@ -60,8 +60,8 @@ public class MatrixReportVisitor extends BaseVisitor {
private
void
updateService
(
Service
service
,
String
logview
,
long
max
)
{
service
.
setDomain
(
m_currentDomain
);
service
.
setName
(
m_currentName
);
service
.
setLogview
(
logview
);
if
(
max
>
service
.
getCount
())
{
service
.
setLogview
(
logview
);
service
.
setCount
(
max
);
}
}
...
...
cat-home/src/main/webapp/jsp/report/service/service.jsp
浏览文件 @
612a1c6d
...
...
@@ -37,6 +37,7 @@
</div>
<div
class=
"span10"
>
<div
class=
"report"
>
</br>
<table
class=
"table table-striped table-bordered table-condensed"
>
<tr>
<th
class=
"left"
>
Server(Domain)
</th>
...
...
cat-home/src/main/webapp/jsp/report/service/serviceHistory.jsp
浏览文件 @
612a1c6d
...
...
@@ -45,6 +45,7 @@
</div>
<div
class=
"span10"
>
<div
class=
"report"
>
</br>
<table
class=
"table table-striped table-bordered table-condensed"
>
<tr>
<th
class=
"left"
>
Server(Domain)
</th>
...
...
cat-home/src/test/java/com/dianping/cat/report/task/heavy/HeavyReportBuilderTest.java
浏览文件 @
612a1c6d
package
com.dianping.cat.report.task.heavy
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.unidal.lookup.ComponentTestCase
;
import
org.unidal.webres.helper.Files
;
import
com.dianping.cat.helper.CatString
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.heavy.entity.HeavyReport
;
import
com.dianping.cat.home.heavy.transform.DefaultSaxParser
;
import
com.dianping.cat.service.ReportConstants
;
public
class
HeavyReportBuilderTest
extends
ComponentTestCase
{
@Test
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
HeavyReportBuilder
builder
=
lookup
(
HeavyReportBuilder
.
class
);
builder
.
buildHourlyTask
(
"heavy"
,
"cat"
,
new
SimpleDateFormat
(
"yyyyMMddHH"
).
parse
(
"2013082609"
));
Date
date
=
new
SimpleDateFormat
(
"yyyyMMddHH"
).
parse
(
"2013082600"
);
builder
.
buildHourlyTask
(
ReportConstants
.
REPORT_HEAVY
,
CatString
.
CAT
,
new
SimpleDateFormat
(
"yyyyMMddHH"
).
parse
(
"2013082714"
));
builder
.
buildHourlyTask
(
ReportConstants
.
REPORT_HEAVY
,
CatString
.
CAT
,
new
SimpleDateFormat
(
"yyyyMMddHH"
).
parse
(
"2013082715"
));
// for (int i = 0; i < 24; i++) {
// Date current = new Date(date.getTime() + TimeUtil.ONE_HOUR * i);
// builder.buildHourlyTask(ReportConstants.REPORT_HEAVY, CatString.CAT, current);
// }
//
// builder.buildDailyTask(ReportConstants.REPORT_HEAVY, CatString.CAT, date);
}
@Test
public
void
testMerge
()
throws
Exception
{
public
void
testMerge
()
throws
Exception
{
String
oldXml
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"old.xml"
),
"utf-8"
);
String
newXml
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"new.xml"
),
"utf-8"
);
HeavyReport
reportOld
=
DefaultSaxParser
.
parse
(
oldXml
);
HeavyReport
reportNew
=
DefaultSaxParser
.
parse
(
newXml
);
String
expected
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"result.xml"
),
"utf-8"
);
System
.
out
.
println
(
expected
);
String
expected
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"result.xml"
),
"utf-8"
);
HeavyReportMerger
merger
=
new
HeavyReportMerger
(
new
HeavyReport
(
reportOld
.
getDomain
()));
reportOld
.
accept
(
merger
);
reportNew
.
accept
(
merger
);
Assert
.
assertEquals
(
"Check the merge result!"
,
expected
.
replace
(
"\r"
,
""
),
merger
.
getHeavyReport
()
.
toString
().
replace
(
"\r"
,
""
));
Assert
.
assertEquals
(
"Check the merge result!"
,
expected
.
replace
(
"\r"
,
""
),
merger
.
getHeavyReport
()
.
toString
()
.
replace
(
"\r"
,
""
));
Assert
.
assertEquals
(
"Source report is changed!"
,
newXml
.
replace
(
"\r"
,
""
),
reportNew
.
toString
().
replace
(
"\r"
,
""
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录