refactor testPlan result
This commit is contained in:
parent
054af23c0f
commit
e9ffadad75
|
@ -1,63 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="gbk">
|
||||
<title>???--???????????</title>
|
||||
<style type="text/css">
|
||||
body{margin:0;padding:0;font-size:14px;font-family:"????",Arial, Helvetica, sans-serif;}
|
||||
img,ul,li,form,h2,ol{border:0;padding:0;margin:0;list-style:none;}
|
||||
.cl{clear:both;height:0px;line-height:0px;font-size:0px;overflow:hidden;}
|
||||
input{vertical-align:middle;}
|
||||
a:link{color:#0033cc}
|
||||
a:visited{color:#800080;}
|
||||
a:hover{color:#800080;}
|
||||
a:actived{color:#800080;}
|
||||
#content{width:95%;align:center;margin:0 auto 0;}
|
||||
.logo{float:left;width:141px;margin:10px 0 0 0;}
|
||||
.title{float:right;width:;line-height:24px;background:#e5ecf9;margin:20px 0 0 0;padding-left:8px;}
|
||||
.title a{margin-left:320px;}
|
||||
.tip{font-size:18px;margin:25px 0 25px 5px;*margin:25px 0 25px 5px;}
|
||||
.reason{margin:25px 0 33px 5px;*margin:25px 0 30px 5px;}
|
||||
.reason li{line-height:24px;height:24px;}
|
||||
.searchbox{margin:0 0 40px 8px;*margin:0 0 40px 8px;}
|
||||
.help{margin:0 0 100px 5px;}
|
||||
.footer{margin:50px 0 20px 0;*margin:50px 0 20px 0;text-align:center;color:#666666;}
|
||||
.footer a{color:#666666;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="95%" align="center">
|
||||
<tr height="60">
|
||||
<td height="65" valign="top" width="141"><a href="http://www.baidu.com/"><img border="0" src="http://www.baidu.com/search/img/logo.gif" alt="????????" /></a></td>
|
||||
<td valign="bottom">
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr bgcolor="#e5ecf9">
|
||||
<td height="24"> <b class="p1">???????????</b></td>
|
||||
<td class="p2" height="24"><div align="right"><a href="http://www.baidu.com/">??????</a> | <a href="http://www.baidu.com/search/jiqiao.html">????????</a> </div></td>
|
||||
</tr>
|
||||
<tr><td class="p2" height="20" colspan="2"></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="content">
|
||||
<h2 class="tip" style="padding-left:144px"><p>????????????????ÖÎ????!<br><br></p><hr color="#dddddd" size="1"></h2>
|
||||
</div>
|
||||
<div id="content">
|
||||
<ol class="reason" style="padding-left:144px">
|
||||
<li> 1. ?????????????????????</li><br>
|
||||
<li> 2. ????????????????????????<a href="http://www.baidu.com/more/index.html">?????</a>????????????</li><br>
|
||||
<li> 3. ??????????????????</li>
|
||||
<li class="searchbox"><br>
|
||||
<form action="http://www.baidu.com/s" name="f">
|
||||
<input type="text" name="wd" size="35" maxlength="100"><input type="hidden" name="cl" value="3"><input type="hidden" name="tn" value="baiduerr"><input type="submit" value="??????">
|
||||
</form></li>
|
||||
<li class="help">
|
||||
4.?????¦Ê??????ï…???<a href="http://qingting.baidu.com/">??????????</a>??
|
||||
<br><br><br>
|
||||
<b>?????????</b><a href="http://news.baidu.com/">????</a>??<a href="http://tieba.baidu.com/">???</a>??<a href="http://zhidao.baidu.com/">???</a>??<a href="http://music.baidu.com/">????</a>??<a href="http://image.baidu.com/">??</a>??<a href="http://video.baidu.com/">???</a>??<a href="http://map.baidu.com/">???</a>??<a href="http://baike.baidu.com/">???</a>??<a href="http://wenku.baidu.com/">???</a>??<a href="http://www.hao123.com/">hao123</a>
|
||||
</li>??</ol>
|
||||
|
||||
<div class="footer">© 2014 Baidu <a href="http://www.baidu.com/duty/index.html">????????</a></div>
|
||||
</div>
|
||||
</body>
|
||||
</html
|
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ui>
|
||||
<plugin name="CsvProvider">
|
||||
<params>
|
||||
<param name="fileName" label="The name of the input file(Required)">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="separator"
|
||||
label="The separator of the input file and the following fieldNames">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="fieldNames" label="fields names:">
|
||||
<nfield />
|
||||
</param>
|
||||
<param name="shared" label="to share the file descriptor">
|
||||
<checkbox>
|
||||
<choice value="enable" default="false" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loop" label="when to the EOF, is in loop">
|
||||
<checkbox>
|
||||
<choice value="enable" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loadAtRuntime" label="is to load it at runtime">
|
||||
<checkbox>
|
||||
<choice value="loadAtRuntime" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="commentPrefix" label="perfix of the commnet">
|
||||
<nfield></nfield>
|
||||
</param>
|
||||
</params>
|
||||
</plugin>
|
||||
<behavior name="next">
|
||||
<params>
|
||||
<param name="loadAtRuntime" label="is to load it at runtime">
|
||||
<checkbox>
|
||||
<choice value="loadAtRuntime" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="commentPrefix" label="perfix of the commnet">
|
||||
<nfield></nfield>
|
||||
</param>
|
||||
</params>
|
||||
</behavior>
|
||||
<timer name="reset">
|
||||
<params>
|
||||
<param name="fileName" label="The name of the input file(Required)">
|
||||
<field size="7" />
|
||||
</param>
|
||||
</params>
|
||||
</timer>
|
||||
</ui>
|
|
@ -1,45 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ui>
|
||||
<plugin name="HBase">
|
||||
<params>
|
||||
<group name="dataSample">
|
||||
<param name="sampleRate" label="The cycle of sampling, unit is minute">
|
||||
<field size="5"></field>
|
||||
</param>
|
||||
<param name="sendRate" label="The cycle of sending, unit is day">
|
||||
<field size="5"></field>
|
||||
</param>
|
||||
</group>
|
||||
<group name="dataGenerateParams">
|
||||
<param name="generatorParams">
|
||||
<table cols="paramName;dataType;generator;min;max"></table>
|
||||
</param>
|
||||
</group>
|
||||
<group name="tranfer">
|
||||
<param name="communicationProtocal">
|
||||
<dropdownbox rows="http;tcp;udp" />
|
||||
</param>
|
||||
<param name="dataGenerateProtocal">
|
||||
<dropdownbox rows="_split;+split" />
|
||||
</param>
|
||||
</group>
|
||||
</params>
|
||||
</plugin>
|
||||
<behavior name="Send">
|
||||
<params>
|
||||
<param name="beginTime">
|
||||
<date />
|
||||
</param>
|
||||
<param name="endTime">
|
||||
<date />
|
||||
</param>
|
||||
<param name="beginUser">
|
||||
<field size="5"></field>
|
||||
</param>
|
||||
<param name="endUser">
|
||||
<field size="5"></field>
|
||||
</param>
|
||||
</params>
|
||||
</behavior>
|
||||
</ui>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ui>
|
||||
<behaviorInfos>
|
||||
<behaviorInfos>
|
||||
<name>reset</name>
|
||||
</behaviorInfos>
|
||||
<behaviorInfos>
|
||||
<name>next</name>
|
||||
</behaviorInfos>
|
||||
</behaviorInfos>
|
||||
<name>CsvProvider</name>
|
||||
<params>
|
||||
<param>
|
||||
<lable>The name of the input file(Required)</lable>
|
||||
<name>fileName</name>
|
||||
</param>
|
||||
</params>
|
||||
</ui>
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- <!DOCTYPE ui SYSTEM "ui.dtd"> -->
|
||||
<ui>
|
||||
<plugin name="test">
|
||||
<params>
|
||||
<param name="fileName" label="The name of the input file(Required)">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="separator"
|
||||
label="The separator of the input file and the following fieldNames">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="fieldNames" label="fields names:">
|
||||
<nfield />
|
||||
</param>
|
||||
<param name="shared" label="to share the file descriptor">
|
||||
<checkbox>
|
||||
<choice value="enable" default="false" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loop" label="when to the EOF, is in loop">
|
||||
<checkbox>
|
||||
<choice value="enable" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loadAtRuntime" label="is to load it at runtime">
|
||||
<checkbox>
|
||||
<choice value="loadAtRuntime" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="commentPrefix" label="perfix of the commnet">
|
||||
<nfield></nfield>
|
||||
</param>
|
||||
</params>
|
||||
</plugin>
|
||||
<behavior name="next">
|
||||
<params />
|
||||
</behavior>
|
||||
<behavior name="reset">
|
||||
<params />
|
||||
</behavior>
|
||||
</ui>
|
|
@ -166,7 +166,6 @@ public class TestPlanController extends BaseController {
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/getBehaviorsBrief/{testPlanRunID}/{scriptId}")
|
||||
@ResponseBody
|
||||
public ScriptBehaviorsBriefModel getBehaviorsBrief(
|
||||
|
@ -177,7 +176,7 @@ public class TestPlanController extends BaseController {
|
|||
+ "when get behaviors's brief", "/getBehaviorsBrief");
|
||||
}
|
||||
ScriptBehaviorsBriefModel result = this
|
||||
.getTestPlanScriptResultService().getScriptBehaviorsBrief(
|
||||
.getTestPlanScriptResultService().getLatestScriptBehaviorsBrief(
|
||||
testPlanRunID, scriptId);
|
||||
return result;
|
||||
}
|
||||
|
@ -192,7 +191,7 @@ public class TestPlanController extends BaseController {
|
|||
+ "when get behaviors's brief", "/getBehaviorsBrief");
|
||||
}
|
||||
ScriptPagesBriefModel pagesBriefModel = this
|
||||
.getTestPlanScriptResultService().getScriptPagesBrief(
|
||||
.getTestPlanScriptResultService().getLatestScriptPagesBrief(
|
||||
testPlanRunId, scriptId);
|
||||
return pagesBriefModel;
|
||||
}
|
||||
|
@ -284,6 +283,7 @@ public class TestPlanController extends BaseController {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/scriptBrief/{testPlanId}/{scriptId}/latestResult")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@ResponseBody
|
||||
|
|
|
@ -273,6 +273,8 @@ public class TestPlan implements IAggregate {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<Object> createMonitorFinishedResult() {
|
||||
List<Object> resultList = new LinkedList<Object>();
|
||||
if (getMonitors() != null) {
|
||||
|
|
|
@ -47,7 +47,6 @@ public class TestPlanScript implements RunningScriptInterface {
|
|||
private Set<RunningAgentDB> runningAgents;
|
||||
private Set<TestPlanScriptResult> testPlanScriptResults;
|
||||
private boolean finish;
|
||||
|
||||
private TestPlanFactory testPlanFactory;
|
||||
private TransactionFactory transactionFactory;
|
||||
private RunningScriptSampler sampler;
|
||||
|
|
|
@ -189,11 +189,12 @@ public class TestPlanFactory {
|
|||
try {
|
||||
|
||||
fields[i].setAccessible(true);
|
||||
testPlanScriptResult.setResultContent(MarshalHelper.marshal(
|
||||
fields[i].getType(), fields[i].get(scriptResultModel)));
|
||||
String content=MarshalHelper.marshal(
|
||||
fields[i].getType(), fields[i].get(scriptResultModel));
|
||||
testPlanScriptResult.setResultContent(content);
|
||||
} catch (IllegalArgumentException | IllegalAccessException
|
||||
| JAXBException e) {
|
||||
Logger.getLogger(MonitorResult.class).info(
|
||||
Logger.getLogger(this.getClass()).info(
|
||||
ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class TestPlanScriptResultService {
|
|||
return results;
|
||||
}
|
||||
|
||||
public ScriptBehaviorsBriefModel getScriptBehaviorsBrief(UUID testPlanId,
|
||||
public ScriptBehaviorsBriefModel getLatestScriptBehaviorsBrief(UUID testPlanId,
|
||||
int scriptId) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
try {
|
||||
|
@ -108,7 +108,6 @@ public class TestPlanScriptResultService {
|
|||
return new ScriptBehaviorsBriefModel();
|
||||
}
|
||||
|
||||
|
||||
private TestPlanScriptResult doGetLastSampleResult(UUID testPlanId,
|
||||
int scriptId, Class<?> resultType, Session session) {
|
||||
TestPlanScript testPlanScript = this.getTestPlanRepository()
|
||||
|
@ -126,7 +125,7 @@ public class TestPlanScriptResultService {
|
|||
return null;
|
||||
}
|
||||
|
||||
public ScriptPagesBriefModel getScriptPagesBrief(UUID testPlanId,
|
||||
public ScriptPagesBriefModel getLatestScriptPagesBrief(UUID testPlanId,
|
||||
int scriptId) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
ScriptPagesBriefModel result = new ScriptPagesBriefModel();
|
||||
|
@ -148,6 +147,7 @@ public class TestPlanScriptResultService {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ScriptBriefResultModel getLatestScriptBriefResultModel(
|
||||
UUID testPlanId, int scriptId) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
|
@ -160,4 +160,5 @@ public class TestPlanScriptResultService {
|
|||
ScriptBriefResultModel.class,
|
||||
testPlanScriptResult.getResultContent());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bench4q.share.models.agent.BehaviorBriefModel;
|
||||
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
|
||||
import org.bench4q.share.models.agent.statistics.DataStatisticsModel;
|
||||
|
@ -51,14 +50,32 @@ public class BehaviorsBriefStatistics extends ScriptStatistics {
|
|||
statusList.add(getCopy(behaviorId, statusCode));
|
||||
}
|
||||
behaviorBriefModel.setDetailStatusCodeResultModels(statusList);
|
||||
this.setBehaviorCount(behaviorBriefModel);
|
||||
list.add(behaviorBriefModel);
|
||||
}
|
||||
agentBehaviorsBriefModel.setBehaviorBriefModels(list);
|
||||
result.setTestBehaviorsBriefModel(agentBehaviorsBriefModel);
|
||||
result.setBehaviorBriefModels(agentBehaviorsBriefModel
|
||||
.getBehaviorBriefModels());
|
||||
makeUpResultModelWithSamplingTime(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void setBehaviorCount(BehaviorBriefModel behaviorBriefModel) {
|
||||
long totalCount = 0, successfulCount = 0;
|
||||
if (behaviorBriefModel.getDetailStatusCodeResultModels() == null) {
|
||||
return;
|
||||
}
|
||||
for (BehaviorStatusCodeResultModel behaviorStatusCodeResultModel : behaviorBriefModel
|
||||
.getDetailStatusCodeResultModels()) {
|
||||
totalCount += behaviorStatusCodeResultModel.getCount();
|
||||
if (behaviorStatusCodeResultModel.getStatusCode() == 200) {
|
||||
successfulCount += behaviorStatusCodeResultModel.getCount();
|
||||
}
|
||||
}
|
||||
behaviorBriefModel.setTotalCount(totalCount);
|
||||
behaviorBriefModel.setSuccessfulCount(successfulCount);
|
||||
}
|
||||
|
||||
private BehaviorStatusCodeResultModel getCopy(int behaviorId, int statusCode) {
|
||||
BehaviorStatusCodeResultModel statusInMap = this.getMap()
|
||||
.get(behaviorId).get(statusCode);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class Test_RunningScriptSampler extends TestBase_MakeUpTestPlan {
|
|||
assertNotNull(scriptResultModel);
|
||||
assertNotNull(scriptResultModel.getScriptBriefResultModel());
|
||||
assertTrue(scriptResultModel.getScriptBehaviorsBriefModel()
|
||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels().size() > 0);
|
||||
.getBehaviorBriefModels().size() > 0);
|
||||
assertTrue(scriptResultModel.getScriptPagesBriefModel()
|
||||
.getScriptPageBriefModels().size() > 0);
|
||||
}
|
||||
|
|
|
@ -43,12 +43,12 @@ public class Test_TestPlanScriptResultService extends TestBase_MakeUpTestPlan {
|
|||
this.getScriptId(), 0);
|
||||
ScriptPagesBriefModel scriptPagesBriefModel = this
|
||||
.getTestPlanScriptResultService()
|
||||
.getScriptPagesBrief(
|
||||
.getLatestScriptPagesBrief(
|
||||
UUID.fromString("fdfe0e55-c65f-4829-ae7c-b1d3a90f62d5"),
|
||||
this.getScriptId());
|
||||
ScriptBehaviorsBriefModel behavirosResults = this
|
||||
.getTestPlanScriptResultService()
|
||||
.getScriptBehaviorsBrief(
|
||||
.getLatestScriptBehaviorsBrief(
|
||||
UUID.fromString("fdfe0e55-c65f-4829-ae7c-b1d3a90f62d5"),
|
||||
this.getScriptId());
|
||||
assertEquals(0, results.size());
|
||||
|
|
Loading…
Reference in New Issue