Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
0489d819
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,发现更多精彩内容 >>
提交
0489d819
编写于
12月 13, 2012
作者:
Y
youyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the cat bug
上级
0a6f24a3
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
199 addition
and
89 deletion
+199
-89
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionAnalyzer.java
...ianping/cat/consumer/transaction/TransactionAnalyzer.java
+16
-72
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionReportUrlFilter.java
.../cat/consumer/transaction/TransactionReportUrlFilter.java
+83
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionReportFilterTest.java
...cat/consumer/transaction/TransactionReportFilterTest.java
+2
-3
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transactionFilter.xml
...m/dianping/cat/consumer/transaction/transactionFilter.xml
+18
-7
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/TypeCompartor.java
...dianping/cat/report/page/cross/display/TypeCompartor.java
+9
-3
cat-home/src/main/java/com/dianping/cat/report/page/model/transaction/TransactionReportMerger.java
...eport/page/model/transaction/TransactionReportMerger.java
+1
-0
cat-home/src/main/java/com/dianping/cat/report/task/transaction/TransactionMerger.java
...anping/cat/report/task/transaction/TransactionMerger.java
+5
-0
cat-home/src/main/java/com/dianping/cat/report/task/transaction/TransactionReportBuilder.java
...cat/report/task/transaction/TransactionReportBuilder.java
+4
-1
cat-home/src/main/webapp/css/body.css
cat-home/src/main/webapp/css/body.css
+1
-1
cat-home/src/main/webapp/jsp/report/chart.jsp
cat-home/src/main/webapp/jsp/report/chart.jsp
+1
-1
cat-home/src/main/webapp/jsp/report/comment.jsp
cat-home/src/main/webapp/jsp/report/comment.jsp
+1
-1
cat-home/src/test/java/com/dianping/cat/report/analyzer/UrlTransasctionBugTest.java
.../dianping/cat/report/analyzer/UrlTransasctionBugTest.java
+58
-0
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionAnalyzer.java
浏览文件 @
0489d819
...
...
@@ -15,6 +15,7 @@ import java.util.Set;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dainping.cat.consumer.dal.report.Report
;
import
com.dainping.cat.consumer.dal.report.ReportDao
;
...
...
@@ -36,7 +37,6 @@ import com.dianping.cat.message.spi.AbstractMessageAnalyzer;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.storage.Bucket
;
import
com.dianping.cat.storage.BucketManager
;
import
org.unidal.lookup.annotation.Inject
;
public
class
TransactionAnalyzer
extends
AbstractMessageAnalyzer
<
TransactionReport
>
implements
LogEnabled
{
@Inject
...
...
@@ -52,11 +52,11 @@ public class TransactionAnalyzer extends AbstractMessageAnalyzer<TransactionRepo
private
void
clearAllDuration
(
TransactionReport
report
)
{
Collection
<
Machine
>
machines
=
report
.
getMachines
().
values
();
for
(
Machine
machine
:
machines
)
{
for
(
TransactionType
type
:
machine
.
getTypes
().
values
())
{
type
.
getAllDurations
().
clear
();
for
(
TransactionName
name
:
type
.
getNames
().
values
())
{
name
.
getAllDurations
().
clear
();
}
...
...
@@ -303,7 +303,7 @@ public class TransactionAnalyzer extends AbstractMessageAnalyzer<TransactionRepo
private
void
storeReports
(
boolean
atEnd
)
{
Bucket
<
String
>
reportBucket
=
null
;
Transaction
t
=
Cat
.
getProducer
().
newTransaction
(
"Checkpoint"
,
getClass
().
getSimpleName
());
t
.
setStatus
(
Message
.
SUCCESS
);
try
{
...
...
@@ -311,20 +311,20 @@ public class TransactionAnalyzer extends AbstractMessageAnalyzer<TransactionRepo
for
(
TransactionReport
report
:
m_reports
.
values
())
{
try
{
Set
<
String
>
domainNames
=
report
.
getDomainNames
();
domainNames
.
clear
();
domainNames
.
addAll
(
getDomains
());
Set
<
String
>
domainNames
=
report
.
getDomainNames
();
domainNames
.
clear
();
domainNames
.
addAll
(
getDomains
());
set95Line
(
report
);
clearAllDuration
(
report
);
String
xml
=
new
TransactionReportFilter
(
50
).
buildXml
(
report
);
String
domain
=
report
.
getDomain
();
set95Line
(
report
);
clearAllDuration
(
report
);
String
xml
=
new
TransactionReportUrlFilter
(
).
buildXml
(
report
);
String
domain
=
report
.
getDomain
();
reportBucket
.
storeById
(
domain
,
xml
);
}
catch
(
Exception
e
)
{
reportBucket
.
storeById
(
domain
,
xml
);
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
getProducer
().
logError
(
e
);
}
Cat
.
getProducer
().
logError
(
e
);
}
}
if
(
atEnd
&&
!
isLocalMode
())
{
...
...
@@ -334,7 +334,7 @@ public class TransactionAnalyzer extends AbstractMessageAnalyzer<TransactionRepo
for
(
TransactionReport
report
:
m_reports
.
values
())
{
try
{
Report
r
=
m_reportDao
.
createLocal
();
String
xml
=
new
TransactionReport
Filter
(
50
).
buildXml
(
report
);
String
xml
=
new
TransactionReport
UrlFilter
(
).
buildXml
(
report
);
String
domain
=
report
.
getDomain
();
r
.
setName
(
"transaction"
);
...
...
@@ -373,60 +373,4 @@ public class TransactionAnalyzer extends AbstractMessageAnalyzer<TransactionRepo
}
}
public
static
class
TransactionReportFilter
extends
com
.
dianping
.
cat
.
consumer
.
transaction
.
model
.
transform
.
DefaultXmlBuilder
{
private
String
m_domain
;
private
int
m_maxItems
;
public
TransactionReportFilter
(
int
maxItem
)
{
m_maxItems
=
maxItem
;
}
@Override
public
void
visitTransactionReport
(
TransactionReport
transactionReport
)
{
m_domain
=
transactionReport
.
getDomain
();
super
.
visitTransactionReport
(
transactionReport
);
}
@Override
public
void
visitType
(
TransactionType
type
)
{
long
totalCount
=
type
.
getTotalCount
();
int
value
=
(
int
)
(
totalCount
/
10000
);
int
count
=
0
;
String
successMessageUrl
=
null
;
value
=
Math
.
min
(
value
,
5
);
if
(!
"Cat"
.
equals
(
m_domain
)
&&
(
value
>
0
))
{
if
(
"URL"
.
equals
(
type
.
getId
()))
{
List
<
String
>
names
=
new
ArrayList
<
String
>();
Map
<
String
,
TransactionName
>
transactionNames
=
type
.
getNames
();
if
(
transactionNames
.
size
()
>
m_maxItems
)
{
for
(
TransactionName
transactionName
:
transactionNames
.
values
())
{
if
(
transactionName
.
getTotalCount
()
<=
value
)
{
names
.
add
(
transactionName
.
getId
());
count
+=
transactionName
.
getTotalCount
();
if
(
successMessageUrl
==
null
)
{
successMessageUrl
=
transactionName
.
getSuccessMessageUrl
();
}
}
}
for
(
String
name
:
names
)
{
transactionNames
.
remove
(
name
);
}
if
(
count
>
0
)
{
TransactionName
name
=
new
TransactionName
(
"OTHERS"
);
name
.
setSuccessMessageUrl
(
successMessageUrl
);
name
.
setTotalCount
(
count
);
name
.
setMin
(
0
);
name
.
setMax
(
0
);
type
.
getNames
().
put
(
"OTHERS"
,
name
);
}
}
}
}
super
.
visitType
(
type
);
}
}
}
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionReportUrlFilter.java
0 → 100644
浏览文件 @
0489d819
package
com.dianping.cat.consumer.transaction
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionName
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionType
;
public
class
TransactionReportUrlFilter
extends
com
.
dianping
.
cat
.
consumer
.
transaction
.
model
.
transform
.
DefaultXmlBuilder
{
private
int
m_maxItems
=
500
;
private
void
mergeName
(
TransactionName
old
,
TransactionName
other
)
{
old
.
setTotalCount
(
old
.
getTotalCount
()
+
other
.
getTotalCount
());
old
.
setFailCount
(
old
.
getFailCount
()
+
other
.
getFailCount
());
if
(
other
.
getMin
()
<
old
.
getMin
())
{
old
.
setMin
(
other
.
getMin
());
}
if
(
other
.
getMax
()
>
old
.
getMax
())
{
old
.
setMax
(
other
.
getMax
());
}
old
.
setSum
(
old
.
getSum
()
+
other
.
getSum
());
old
.
setSum2
(
old
.
getSum2
()
+
other
.
getSum2
());
old
.
setLine95Value
(
0
);
if
(
old
.
getTotalCount
()
>
0
)
{
old
.
setFailPercent
(
old
.
getFailCount
()
*
100.0
/
old
.
getTotalCount
());
old
.
setAvg
(
old
.
getSum
()
/
old
.
getTotalCount
());
}
if
(
old
.
getSuccessMessageUrl
()
==
null
)
{
old
.
setSuccessMessageUrl
(
other
.
getSuccessMessageUrl
());
}
if
(
old
.
getFailMessageUrl
()
==
null
)
{
old
.
setFailMessageUrl
(
other
.
getFailMessageUrl
());
}
}
@Override
public
void
visitTransactionReport
(
TransactionReport
transactionReport
)
{
super
.
visitTransactionReport
(
transactionReport
);
}
@Override
public
void
visitType
(
TransactionType
type
)
{
if
(
"URL"
.
equals
(
type
.
getId
()))
{
Map
<
String
,
TransactionName
>
transactionNames
=
type
.
getNames
();
int
size
=
transactionNames
.
size
();
if
(
size
>
m_maxItems
)
{
List
<
TransactionName
>
all
=
new
ArrayList
<
TransactionName
>(
transactionNames
.
values
());
Collections
.
sort
(
all
,
new
TransactionNameCompator
());
type
.
getNames
().
clear
();
for
(
int
i
=
0
;
i
<
m_maxItems
;
i
++)
{
type
.
addName
(
all
.
get
(
i
));
}
TransactionName
other
=
type
.
findOrCreateName
(
"OTHERS"
);
for
(
int
i
=
m_maxItems
;
i
<
size
;
i
++)
{
mergeName
(
other
,
all
.
get
(
i
));
}
}
}
super
.
visitType
(
type
);
}
public
static
class
TransactionNameCompator
implements
Comparator
<
TransactionName
>
{
@Override
public
int
compare
(
TransactionName
o1
,
TransactionName
o2
)
{
return
(
int
)
(
o2
.
getTotalCount
()
-
o1
.
getTotalCount
());
}
}
}
\ No newline at end of file
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionReportFilterTest.java
浏览文件 @
0489d819
...
...
@@ -3,11 +3,10 @@ package com.dianping.cat.consumer.transaction;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
org.unidal.helper.Files
;
import
com.dianping.cat.consumer.transaction.TransactionAnalyzer.TransactionReportFilter
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.consumer.transaction.model.transform.DefaultDomParser
;
import
org.unidal.helper.Files
;
public
class
TransactionReportFilterTest
{
@Test
...
...
@@ -16,7 +15,7 @@ public class TransactionReportFilterTest {
String
source
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"transaction.xml"
),
"utf-8"
);
TransactionReport
report
=
parser
.
parse
(
source
);
TransactionReport
Filter
f1
=
new
TransactionReportFilter
(
1
);
TransactionReport
UrlFilter
f1
=
new
TransactionReportUrlFilter
(
);
String
expected1
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"transactionFilter.xml"
),
"utf-8"
);
report
.
accept
(
f1
);
...
...
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transactionFilter.xml
浏览文件 @
0489d819
<?xml
version="1.0"
encoding="utf-8"?>
<?xml
version="1.0"
encoding="utf-8"?>
<transaction-report
domain=
"MobileApi"
startTime=
"2012-06-18 14:00:00"
endTime=
"2012-06-18 14:59:59"
>
<domain>
Cat
</domain>
...
...
@@ -64,6 +64,23 @@
<range
value=
"10"
count=
"2"
sum=
"25.99"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"16"
count=
"2"
/>
</name>
<name
id=
"/city.bin"
totalCount=
"1"
failCount=
"0"
failPercent=
"0.00"
min=
"38.21"
max=
"38.21"
avg=
"0.0"
sum=
"38.2"
sum2=
"1460.0"
std=
"0.0"
tps=
"0.00"
line95Value=
"38.00"
line95Sum=
"38.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999961753-0
</successMessageUrl>
<range
value=
"10"
count=
"1"
sum=
"38.21"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"64"
count=
"1"
/>
</name>
<name
id=
"/location.bin"
totalCount=
"1"
failCount=
"0"
failPercent=
"0.00"
min=
"249.694"
max=
"249.694"
avg=
"0.0"
sum=
"249.7"
sum2=
"62347.1"
std=
"0.0"
tps=
"0.00"
line95Value=
"249.00"
line95Sum=
"249.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999968913-0
</successMessageUrl>
<range
value=
"10"
count=
"1"
sum=
"249.694"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"256"
count=
"1"
/>
</name>
<name
id=
"/locatecategory.bin"
totalCount=
"10"
failCount=
"0"
failPercent=
"0.00"
min=
"5.392"
max=
"5.392"
avg=
"0.0"
sum=
"5.4"
sum2=
"29.1"
std=
"0.0"
tps=
"0.00"
line95Value=
"5.00"
line95Sum=
"5.00"
...
...
@@ -85,12 +102,6 @@
<duration
value=
"256"
count=
"1"
/>
<duration
value=
"4096"
count=
"1"
/>
</name>
<name
id=
"OTHERS"
totalCount=
"2"
failCount=
"0"
failPercent=
"0.00"
min=
"0.0"
max=
"0.0"
avg=
"0.0"
sum=
"0.0"
sum2=
"0.0"
std=
"0.0"
tps=
"0.00"
line95Value=
"0.00"
line95Sum=
"0.00"
line95Count=
"0"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999961753-0
</successMessageUrl>
</name>
</type>
</machine>
</transaction-report>
\ No newline at end of file
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/TypeCompartor.java
浏览文件 @
0489d819
...
...
@@ -25,10 +25,16 @@ public class TypeCompartor implements Comparator<TypeDetailInfo> {
return
1
;
}
if
(
m_sorted
.
equals
(
"name"
))
{
if
(
m1
.
getProjectName
().
equals
(
m2
.
getProjectName
())){
return
m1
.
getIp
().
compareTo
(
m2
.
getIp
());
if
(
m1
.
getProjectName
()
!=
null
&&
m2
.
getProjectName
()
!=
null
)
{
if
(!
m1
.
getProjectName
().
equals
(
m2
.
getProjectName
()))
{
return
m1
.
getProjectName
().
compareTo
(
m2
.
getProjectName
());
}
}
if
(
m1
.
getIp
()
!=
null
&&
m2
.
getIp
()
!=
null
)
{
if
(!
m1
.
getIp
().
equals
(
m2
.
getIp
()))
{
return
m1
.
getIp
().
compareTo
(
m2
.
getIp
());
}
}
return
m1
.
getProjectName
().
compareTo
(
m2
.
getProjectName
());
}
if
(
m_sorted
.
equals
(
"total"
))
{
return
(
int
)
(
m2
.
getTotalCount
()
-
m1
.
getTotalCount
());
...
...
cat-home/src/main/java/com/dianping/cat/report/page/model/transaction/TransactionReportMerger.java
浏览文件 @
0489d819
...
...
@@ -199,6 +199,7 @@ public class TransactionReportMerger extends DefaultMerger {
report
.
getIps
().
addAll
(
transactionReport
.
getIps
());
}
@Override
public
void
visitType
(
TransactionType
type
)
{
if
(!
m_allName
||
m_allName
&&
m_type
.
equals
(
type
.
getId
()))
{
...
...
cat-home/src/main/java/com/dianping/cat/report/task/transaction/TransactionMerger.java
浏览文件 @
0489d819
...
...
@@ -9,6 +9,7 @@ import java.util.Set;
import
com.dainping.cat.consumer.dal.report.Report
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.consumer.transaction.TransactionReportUrlFilter
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.consumer.transaction.model.transform.DefaultSaxParser
;
import
com.dianping.cat.report.page.model.transaction.TransactionReportMerger
;
...
...
@@ -53,6 +54,8 @@ public class TransactionMerger implements ReportMerger<TransactionReport> {
transactionReport
.
setStartTime
(
TaskHelper
.
todayZero
(
date
));
Date
end
=
new
Date
(
TaskHelper
.
tomorrowZero
(
date
).
getTime
()
-
1000
);
transactionReport
.
setEndTime
(
end
);
new
TransactionReportUrlFilter
().
visitTransactionReport
(
transactionReport
);
return
transactionReport
;
}
...
...
@@ -64,6 +67,8 @@ public class TransactionMerger implements ReportMerger<TransactionReport> {
.
mergesForAllMachine
(
transactionReport2
);
transactionReport
.
addMachine
(
allMachines
);
transactionReport
.
getIps
().
add
(
"All"
);
new
TransactionReportUrlFilter
().
visitTransactionReport
(
transactionReport
);
return
transactionReport
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/transaction/TransactionReportBuilder.java
浏览文件 @
0489d819
...
...
@@ -10,6 +10,7 @@ import com.dainping.cat.consumer.dal.report.Report;
import
com.dainping.cat.consumer.dal.report.ReportEntity
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.configuration.NetworkInterfaceManager
;
import
com.dianping.cat.consumer.transaction.TransactionReportUrlFilter
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.consumer.transaction.model.transform.DefaultSaxParser
;
import
com.dianping.cat.helper.TimeUtil
;
...
...
@@ -184,7 +185,7 @@ public class TransactionReportBuilder extends AbstractReportBuilder implements R
Dailyreport
dailyreport
=
m_dailyReportDao
.
findByNameDomainPeriod
(
new
Date
(
startTime
),
domain
,
"transaction"
,
DailyreportEntity
.
READSET_FULL
);
String
xml
=
dailyreport
.
getContent
();
TransactionReport
reportModel
=
DefaultSaxParser
.
parse
(
xml
);
reportModel
.
accept
(
merger
);
}
catch
(
Exception
e
)
{
...
...
@@ -194,6 +195,8 @@ public class TransactionReportBuilder extends AbstractReportBuilder implements R
TransactionReport
transactionReport
=
merger
.
getTransactionReport
();
transactionReport
.
setStartTime
(
start
);
transactionReport
.
setEndTime
(
end
);
new
TransactionReportUrlFilter
().
visitTransactionReport
(
transactionReport
);
return
transactionReport
;
}
}
cat-home/src/main/webapp/css/body.css
浏览文件 @
0489d819
...
...
@@ -174,7 +174,7 @@ a.heartbeat {
text-align
:
center
;
font-size
:
medium
;
font-weight
:
bold
;
width
:
8
0px
;
width
:
10
0px
;
}
.domain
{
...
...
cat-home/src/main/webapp/jsp/report/chart.jsp
浏览文件 @
0489d819
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.unidal.org/webres"
%>
<res:bean
id=
"res"
/>
<html>
<
!DOCTYPE html>
<
html>
<head>
<style
type=
"text/css"
>
body
{
...
...
cat-home/src/main/webapp/jsp/report/comment.jsp
浏览文件 @
0489d819
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<
!DOCTYPE html>
<
html>
<head>
<title>
Insert title here
</title>
</head>
...
...
cat-home/src/test/java/com/dianping/cat/report/analyzer/UrlTransasctionBugTest.java
0 → 100644
浏览文件 @
0489d819
package
com.dianping.cat.report.analyzer
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.unidal.lookup.ComponentTestCase
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dainping.cat.consumer.dal.report.Report
;
import
com.dainping.cat.consumer.dal.report.ReportDao
;
import
com.dainping.cat.consumer.dal.report.ReportEntity
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.consumer.transaction.model.transform.DefaultSaxParser
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.dal.report.DailyreportDao
;
import
com.site.helper.Files
;
public
class
UrlTransasctionBugTest
extends
ComponentTestCase
{
@Inject
private
DailyreportDao
m_dailyreportDao
;
@Inject
private
ReportDao
m_reportDao
;
@Before
public
void
setUp
()
throws
Exception
{
super
.
setUp
();
m_dailyreportDao
=
lookup
(
DailyreportDao
.
class
);
m_reportDao
=
lookup
(
ReportDao
.
class
);
}
@Test
public
void
test
()
throws
Exception
{
String
dateStr
=
"2012-12-13 14:00:00"
;
Date
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
parse
(
dateStr
);
List
<
Report
>
reports
=
m_reportDao
.
findAllByDomainNameDuration
(
date
,
new
Date
(
date
.
getTime
()+
TimeUtil
.
ONE_HOUR
),
"ShopWeb"
,
"transaction"
,
ReportEntity
.
READSET_FULL
);
File
file
=
new
File
(
"text.txt"
);
Files
.
forIO
().
writeTo
(
file
,
"12312"
);
for
(
Report
report:
reports
){
try
{
TransactionReport
temp
=
DefaultSaxParser
.
parse
(
report
.
getContent
());
System
.
out
.
println
(
temp
);
}
catch
(
Exception
e
){
//File file = new File("text.txt");
Files
.
forIO
().
writeTo
(
file
,
report
.
getContent
());
}
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录