Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
6877b149
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,发现更多精彩内容 >>
提交
6877b149
编写于
1月 29, 2012
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add number format
上级
2dd6dfc5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
24 deletion
+51
-24
cat-consumer/src/main/resources/META-INF/dal/model/transaction-report.xml
.../main/resources/META-INF/dal/model/transaction-report.xml
+13
-18
cat-consumer/src/test/java/com/dianping/cat/consumer/AllTests.java
...mer/src/test/java/com/dianping/cat/consumer/AllTests.java
+4
-2
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/NumberFormatTest.java
...m/dianping/cat/consumer/transaction/NumberFormatTest.java
+28
-0
cat-home/src/test/java/com/dianping/cat/SimpleServer.java
cat-home/src/test/java/com/dianping/cat/SimpleServer.java
+5
-3
pom.xml
pom.xml
+1
-1
未找到文件。
cat-consumer/src/main/resources/META-INF/dal/model/transaction-report.xml
浏览文件 @
6877b149
<?xml version="1.0" encoding="UTF-8"?>
<model
model-package=
"com.dianping.cat.consumer.transaction.model"
enable-merger=
"true"
enable-json-builder=
"true"
enable-xml-parser=
"true"
enable-base-visitor=
"true"
>
<model
model-package=
"com.dianping.cat.consumer.transaction.model"
enable-merger=
"true"
enable-json-builder=
"true"
enable-xml-parser=
"true"
enable-base-visitor=
"true"
>
<entity
name=
"transaction-report"
root=
"true"
>
<attribute
name=
"domain"
key=
"true"
/>
<attribute
name=
"startTime"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
...
...
@@ -10,34 +9,30 @@
</entity>
<entity
name=
"type"
class-name=
"TransactionType"
>
<attribute
name=
"id"
key=
"true"
/>
<entity-ref
name=
"name"
type=
"map"
/>
<attribute
name=
"totalCount"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"failCount"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"failPercent"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"min"
value-type=
"double"
primitive=
"true"
default-value=
"Double.MAX_VALUE"
/>
<attribute
name=
"max"
value-type=
"double"
primitive=
"true"
default-value=
"Double.MIN_VALUE"
/>
<attribute
name=
"avg"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"failPercent"
value-type=
"double"
primitive=
"true"
format=
"0.#%"
/>
<attribute
name=
"min"
value-type=
"double"
primitive=
"true"
default-value=
"Double.MAX_VALUE"
/>
<attribute
name=
"max"
value-type=
"double"
primitive=
"true"
default-value=
"Double.MIN_VALUE"
/>
<attribute
name=
"avg"
value-type=
"double"
primitive=
"true"
format=
"0.#"
/>
<attribute
name=
"sum"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sum2"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"std"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"std"
value-type=
"double"
primitive=
"true"
format=
"0.#"
/>
<element
name=
"success-message-id"
value-type=
"String"
/>
<element
name=
"fail-message-id"
value-type=
"String"
/>
<entity-ref
name=
"name"
type=
"map"
/>
</entity>
<entity
name=
"name"
class-name=
"TransactionName"
>
<attribute
name=
"id"
key=
"true"
/>
<attribute
name=
"totalCount"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"failCount"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"failPercent"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"min"
value-type=
"double"
primitive=
"true"
default-value=
"Double.MAX_VALUE"
/>
<attribute
name=
"max"
value-type=
"double"
primitive=
"true"
default-value=
"Double.MIN_VALUE"
/>
<attribute
name=
"avg"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"failPercent"
value-type=
"double"
primitive=
"true"
format=
"0.#%"
/>
<attribute
name=
"min"
value-type=
"double"
primitive=
"true"
default-value=
"Double.MAX_VALUE"
/>
<attribute
name=
"max"
value-type=
"double"
primitive=
"true"
default-value=
"Double.MIN_VALUE"
/>
<attribute
name=
"avg"
value-type=
"double"
primitive=
"true"
format=
"0.#"
/>
<attribute
name=
"sum"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sum2"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"std"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"std"
value-type=
"double"
primitive=
"true"
format=
"0.#"
/>
<element
name=
"success-message-id"
value-type=
"String"
/>
<element
name=
"fail-message-id"
value-type=
"String"
/>
</entity>
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/AllTests.java
浏览文件 @
6877b149
...
...
@@ -6,6 +6,7 @@ import org.junit.runners.Suite.SuiteClasses;
import
com.dianping.cat.consumer.failure.FailureAnalyzerStoreTest
;
import
com.dianping.cat.consumer.failure.FailureAnalyzerTest
;
import
com.dianping.cat.consumer.transaction.NumberFormatTest
;
import
com.dianping.cat.consumer.transaction.TransactionReportMessageAnalyzerTest
;
@RunWith
(
Suite
.
class
)
...
...
@@ -17,10 +18,11 @@ ManyAnalyzerTest.class,
OneAnalyzerTwoDurationTest
.
class
,
/* .model.failure */
FailureAnalyzerTest
.
class
,
FailureAnalyzerStoreTest
.
class
,
FailureAnalyzerTest
.
class
,
FailureAnalyzerStoreTest
.
class
,
/* .transaction */
NumberFormatTest
.
class
,
TransactionReportMessageAnalyzerTest
.
class
})
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/NumberFormatTest.java
0 → 100644
浏览文件 @
6877b149
package
com.dianping.cat.consumer.transaction
;
import
junit.framework.Assert
;
import
org.junit.Test
;
public
class
NumberFormatTest
{
@Test
public
void
test
()
{
check
(
12
,
"0"
,
"12"
);
check
(
12.34
,
"0"
,
"12"
);
check
(
12
,
"0.#"
,
"12"
);
check
(
12.34
,
"0.#"
,
"12.3"
);
check
(
12.35
,
"0.#"
,
"12.4"
);
check
(
12.34
,
"0.##"
,
"12.34"
);
check
(
12.346
,
"0.##"
,
"12.35"
);
check
(
0.3467
,
"0.#%"
,
"34.7%"
);
}
private
void
check
(
Number
number
,
String
format
,
String
expected
)
{
String
actual
=
new
java
.
text
.
DecimalFormat
(
format
).
format
(
number
);
Assert
.
assertEquals
(
expected
,
actual
);
}
}
cat-home/src/test/java/com/dianping/cat/SimpleServer.java
浏览文件 @
6877b149
...
...
@@ -23,7 +23,7 @@ public class SimpleServer extends SimpleServerSupport {
private
static
ComponentAdaptor
s_adaptor
=
new
ComponentAdaptor
();
private
static
MVC
s_mvc
=
new
MVC
();
private
static
CatServlet
s_cat
=
new
CatServlet
();
@AfterClass
...
...
@@ -72,7 +72,7 @@ public class SimpleServer extends SimpleServerSupport {
@Override
protected
void
postConfigure
(
Context
ctx
)
{
ServletHolder
holder
=
new
ServletHolder
(
s_mvc
);
ctx
.
addServlet
(
new
ServletHolder
(
s_cat
),
"/s/*"
);
ctx
.
addServlet
(
holder
,
"/"
);
ctx
.
addServlet
(
holder
,
"/r/*"
);
...
...
@@ -92,7 +92,9 @@ public class SimpleServer extends SimpleServerSupport {
@Test
public
void
startServer
()
throws
Exception
{
// s_adaptor.display("/cat/r");
// open the page in the default browser
s_adaptor
.
display
(
"/cat/r"
);
System
.
out
.
println
(
String
.
format
(
"[%s] Press any key to stop server ... "
,
getTimestamp
()));
System
.
in
.
read
();
}
...
...
pom.xml
浏览文件 @
6877b149
...
...
@@ -43,7 +43,7 @@
<dependency>
<groupId>
com.site.common
</groupId>
<artifactId>
test-framework
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
-a1
</version>
</dependency>
<dependency>
<groupId>
com.site.common
</groupId>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录