提交 612a1c6d 编写于 作者: Y yong.you

modify the page

上级 9a442d9d
......@@ -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);
}
}
......
......@@ -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>
......
......@@ -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>
......
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.
先完成此消息的编辑!
想要评论请 注册