Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
d61ca8cd
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,发现更多精彩内容 >>
提交
d61ca8cd
编写于
7月 16, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the testcase
上级
4b419a66
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
71 addition
and
23 deletion
+71
-23
cat-core/src/main/java/com/dianping/cat/config/app/AppDataService.java
...main/java/com/dianping/cat/config/app/AppDataService.java
+35
-6
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
+1
-1
cat-home/src/test/java/com/dianping/cat/report/analyzer/TopologyGraphTest.java
...a/com/dianping/cat/report/analyzer/TopologyGraphTest.java
+35
-16
未找到文件。
cat-core/src/main/java/com/dianping/cat/config/app/AppDataService.java
浏览文件 @
d61ca8cd
package
com.dianping.cat.config.app
;
import
java.util.Date
;
import
java.util.List
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.app.AppDataCommand
;
import
com.dianping.cat.app.AppDataCommandDao
;
import
com.dianping.cat.app.AppDataCommandEntity
;
public
class
AppDataService
{
public
void
insert
(){
@Inject
private
AppDataCommandDao
m_dao
;
public
void
insert
()
{
}
public
void
queryAvg
(
QueryEntity
entity
)
{
int
commandId
=
entity
.
getCommand
();
Date
period
=
entity
.
getDate
();
int
city
=
entity
.
getCity
();
int
operator
=
entity
.
getOperator
();
int
network
=
entity
.
getNetwork
();
int
appVersion
=
entity
.
getVersion
();
int
connnectType
=
entity
.
getChannel
();
int
code
=
entity
.
getCode
();
int
platform
=
entity
.
getPlatfrom
();
try
{
List
<
AppDataCommand
>
datas
=
m_dao
.
findData
(
commandId
,
period
,
city
,
operator
,
network
,
appVersion
,
connnectType
,
code
,
platform
,
AppDataCommandEntity
.
READSET_DATA
);
for
(
AppDataCommand
data
:
datas
)
{
}
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
);
}
}
public
void
queryCount
(
QueryEntity
entity
)
{
}
public
void
querySuccessRate
(
QueryEntity
entity
)
{
...
...
@@ -50,5 +79,5 @@ public class AppDataService {
m_avg
=
avg
;
}
}
}
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
浏览文件 @
d61ca8cd
...
...
@@ -18,7 +18,7 @@
</readset>
</readsets>
<query-defs>
<query
name=
"insert-data"
type=
"INSERT"
>
<query
name=
"insert-data"
type=
"INSERT"
>
<param
name=
"command-id"
/>
<statement>
<![CDATA[INSERT INTO <TABLE/>
(
<FIELDS/>
)
VALUES(
<VALUES/>
)]]>
</statement>
...
...
cat-home/src/test/java/com/dianping/cat/report/analyzer/TopologyGraphTest.java
浏览文件 @
d61ca8cd
package
com.dianping.cat.report.analyzer
;
import
java.
text.ParseException
;
import
java.
io.File
;
import
java.text.SimpleDateFormat
;
import
org.junit.Test
;
import
org.unidal.eunit.helper.Files
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.home.dependency.graph.entity.TopologyGraph
;
import
com.dianping.cat.report.page.dependency.graph.TopologyGraphManager
;
public
class
TopologyGraphTest
extends
ComponentTestCase
{
public
class
TopologyGraphTest
extends
ComponentTestCase
{
@Test
public
void
test
()
throws
ParseException
{
public
void
test
()
throws
Exception
{
build
(
"2014-07-06 18:00"
);
build
(
"2014-07-06 18:01"
);
build
(
"2014-07-06 18:02"
);
build
(
"2014-07-06 18:03"
);
build
(
"2014-07-06 18:04"
);
build
(
"2014-07-06 18:05"
);
build
(
"2014-07-06 18:06"
);
build
(
"2014-07-06 18:07"
);
build
(
"2014-07-06 18:08"
);
build
(
"2014-07-06 18:09"
);
}
public
void
build
(
String
date
)
throws
Exception
{
TopologyGraphManager
manager
=
lookup
(
TopologyGraphManager
.
class
);
String
date
=
"2014-07-06 18:00"
;
SimpleDateFormat
formate
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
TopologyGraph
graph
=
manager
.
queryGraphFromDB
(
formate
.
parse
(
date
).
getTime
());
System
.
out
.
println
(
graph
);
}
@Test
public
void
test1
(){
ProductLineConfigManager
manager
=
lookup
(
ProductLineConfigManager
.
class
);
System
.
out
.
println
(
manager
.
getCompany
());
try
{
TopologyGraph
graph
=
manager
.
queryGraphFromDB
(
formate
.
parse
(
date
).
getTime
());
if
(
graph
!=
null
)
{
File
file
=
new
File
(
"/tmp/"
+
date
+
".txt"
);
if
(!
file
.
exists
())
{
file
.
createNewFile
();
}
Files
.
forIO
().
writeTo
(
file
,
graph
.
toString
());
}
else
{
System
.
err
.
println
(
date
+
" is null1"
);
}
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
date
+
" is null1"
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录