finish the detail table

This commit is contained in:
fanfuxiaoran 2014-01-08 21:39:28 +08:00
parent b26a90232c
commit fe02bc63f9
10 changed files with 288 additions and 122 deletions

View File

@ -14,6 +14,7 @@ import org.bench4q.share.models.monitor.ProcessorModel;
import org.bench4q.share.models.monitor.ProcessorModelChild;
import org.bench4q.web.model.ResultModel;
import org.bench4q.web.service.MonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
@ -40,18 +41,18 @@ public class MonitorController extends BaseControllerService {
public MonitorService getMonitorService() {
return monitorService;
}
@Autowired
public void setMonitorService(MonitorService monitorService) {
this.monitorService = monitorService;
}
@RequestMapping("{ip}/{port}/cpu/{cpuInstance}/{fieldName}/{startTime}")
@RequestMapping("/{testPlanId}/SUT/{ip}/{port}/cpu/{cpuInstance}/{fieldName}/{startTime}")
@ResponseBody
public List<ResultModel> getCpuResult(
@ModelAttribute("accessToken") String accessToken,
@RequestParam("testPlanId") String testplanID,
@PathVariable("testPlanId") String testplanID,
@PathVariable String ip, @PathVariable String port,
@PathVariable String cpuInstance, @PathVariable String startTime) {
@PathVariable String cpuInstance, @PathVariable String fieldName,@PathVariable String startTime) {
System.out.println("enter get cpu data ");
MonitorProcessorResponseModel monitorProcessorResponseModel = this
.getMonitorService().getCpus(accessToken, testplanID, ip, port,
@ -59,7 +60,7 @@ public class MonitorController extends BaseControllerService {
try {
return extractCpuResultModelList(
monitorProcessorResponseModel.getProcessorModels(),
cpuInstance, startTime);
cpuInstance,fieldName);
} catch (NullPointerException e) {
e.printStackTrace();
@ -67,11 +68,11 @@ public class MonitorController extends BaseControllerService {
}
}
@RequestMapping("{ip}/{port}/memory/{fieldName}/{startTime}")
@RequestMapping("/testPlanId/SUT/{ip}/{port}/memory/{fieldName}/{startTime}")
@ResponseBody
public List<ResultModel> geMemoryStatus(
@ModelAttribute("accessToken") String accessToken,
@RequestParam("testPlanId") String testPlanId,
@PathVariable("testPlanId") String testPlanId,
@RequestParam String ip, @RequestParam String port,
@PathVariable String fieldName, @PathVariable String startTime) {
@ -114,11 +115,11 @@ public class MonitorController extends BaseControllerService {
}
@RequestMapping("{ip}/{port}/network/{instance}/{fieldName}/{startTime}")
@RequestMapping("/testPlanIds/SUT/{ip}/{port}/network/{instance}/{fieldName}/{startTime}")
@ResponseBody
public List<ResultModel> getNetwork(
@ModelAttribute("accessToken") String accessToken,
@RequestParam("testPlanId") String testplanID,
@PathVariable("testPlanId") String testplanID,
@PathVariable String ip, @PathVariable String port,
@PathVariable String instance, @PathVariable String fieldName,
@PathVariable String startTime) {
@ -186,7 +187,7 @@ public class MonitorController extends BaseControllerService {
if (processorModelChild.getInstance()
.equalsIgnoreCase(instance)) {
ResultModel resultModel = this.getMonitorService()
.getResultModel(processorModel, fieldNames);
.getResultModel(processorModelChild, fieldNames);
resultModel.setFinished(false);
resultModel.setTime(processorModel.getSamplingTime());
return resultModel;
@ -227,4 +228,5 @@ public class MonitorController extends BaseControllerService {
}
}
}

View File

@ -4,7 +4,7 @@ import java.util.Date;
public class ResultModel {
private boolean finished;
private long data;
private double data;
private Date time;
public boolean isFinished() {
return finished;
@ -12,11 +12,11 @@ public boolean isFinished() {
public void setFinished(boolean finished) {
this.finished = finished;
}
public long getData() {
public double getData() {
return data;
}
public void setData(long data) {
this.data = data;
public void setData(double d) {
this.data = d;
}
public Date getTime() {
return time;

View File

@ -11,6 +11,7 @@ import org.bench4q.share.models.monitor.NetworkInterfaceModel;
import org.bench4q.share.models.monitor.NetworkInterfaceModelChild;
import org.bench4q.share.models.monitor.ProcessorModel;
import org.bench4q.share.models.monitor.ProcessorModelChild;
import org.bench4q.web.model.ResultModel;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestParam;
@ -26,7 +27,20 @@ public class MonitorService extends BaseService {
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
public ResultModel getResultModel(Object object, List<String> fieldNames) {
ResultModel resultModel = new ResultModel();
try {
for (String fieldName : fieldNames)
resultModel.setData((double)this.getSpecificFieldValue(object,
fieldName));
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return resultModel;
}
public List<String> getCpuList(
@ModelAttribute("accessToken") String accessToken,
@RequestParam("testPlanId") String testPlanId,

View File

@ -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.ParameterModel;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.scriptrecord.BatchModel;
@ -43,7 +42,8 @@ public class TestPlanService extends BaseService {
public MonitorService getMonitorService() {
return monitorService;
}
@Autowired
@Autowired
public void setMonitorService(MonitorService monitorService) {
this.monitorService = monitorService;
}
@ -61,8 +61,6 @@ public class TestPlanService extends BaseService {
// TODO Auto-generated constructor stub
}
public TestPlanResultModel getRunningTestPlanModel(String accessToken,
String testPlanId) {
String url = this.getBaseUrl() + "/getRunningInfo";
@ -79,54 +77,59 @@ public class TestPlanService extends BaseService {
sutInfo.setIp(ip);
sutInfo.setPort(port);
List<ResultInfoModel> resultInfoModels = new ArrayList<ResultInfoModel>();
for(int i=0;i<2;i++){
/* ResultInfoModel cpuInfoModel = createResultInfoModel("cpu",
ResultInfoModel cpuInfoModel = createCpuResultInfoModel("cpu",
this.monitorService.getCpuList(accessToken, testPlanId, ip,
port));
if (cpuInfoModel != null)
resultInfoModels.add(cpuInfoModel);*/
resultInfoModels.add(cpuInfoModel);
System.out.println("ok");
ResultInfoModel networkInfoModel = createResultInfoModel(
ResultInfoModel networkInfoModel = createNetworkResultInfoModel(
"network",
this.getMonitorService().getNetworkList(accessToken,
testPlanId, ip, port));
if (networkInfoModel != null)
resultInfoModels.add(networkInfoModel);
resultInfoModels.add(new ResultInfoModel("memory", null));
if(sutInfo.getChildResults().size()<3)
{
resultInfoModels.clear();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else {
sutInfo.setChildResults(resultInfoModels);
break;
}
}
resultInfoModels.add(createMemoryResultInfoModel("Memory"));
sutInfo.setChildResults(resultInfoModels);
return sutInfo;
}
private ResultInfoModel createResultInfoModel(String resultName,
private ResultInfoModel createCpuResultInfoModel(String resultName,
List<String> results) {
if (results.size() <= 0)
return null;
ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
new ArrayList<ResultInfoModel>());
for (String result : results) {
resultInfoModel.getChildResults().add(
new ResultInfoModel(result, null));
for (String result:results) {
resultInfoModel.getChildResults().add(getCpuResultInfo(result));
}
return resultInfoModel;
}
private ResultInfoModel createNetworkResultInfoModel(String resultName,
List<String> results) {
if (results.size() <= 0)
return null;
ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
new ArrayList<ResultInfoModel>());
for (String result:results) {
resultInfoModel.getChildResults().add(getNetworkResultInfo(result));
}
return resultInfoModel;
}
private ResultInfoModel createMemoryResultInfoModel(String resultName) {
ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
new ArrayList<ResultInfoModel>());
resultInfoModel.getChildResults().add(getMemoryResultInfo());
return resultInfoModel;
}
public TestPlanBusinessModel createTestPlan(TestPlanRequestModel testPlan,
int port) {
TestPlanBusinessModel testPlanModel = new TestPlanBusinessModel();
@ -174,6 +177,26 @@ public class TestPlanService extends BaseService {
return ipList;
}
private ResultInfoModel getCpuResultInfo(String result) {
String[] fields = new String[] { "processorTimePercent",
"processorTimePercent", "privilegedTimePercent" };
return getResultInfoModel(result, fields);
}
private ResultInfoModel getNetworkResultInfo(String result) {
String[] fields = new String[] { "bytesTotalPerSecond",
"bytesReceivedPerSecond", "bytesReceivedPerSecond" };
return getResultInfoModel(result, fields);
}
private ResultInfoModel getMemoryResultInfo() {
String result = "Result";
String[] fields = new String[] { "pagesPerSecond",
"pagesInputPerSecond", "pagesOutputPerSecond", "cacheBytes",
"committedBytes", "availableKiloBytes" };
return getResultInfoModel(result, fields);
}
public ResultInfoModel getScriptBriefStatusResultInfo() {
String result = "briefStatus";

View File

@ -42,10 +42,10 @@ margin-top: 5px;
.table-bordered th{
.datatable .table-bordered th{
border-top: 3px solid #7dac2a;
}
.table-bordered thead:first-child tr:first-child th{
.datatable table-bordered thead:first-child tr:first-child th{
border-top: 3px solid #369bd7;
border-bottom:1px solid #eee;
}
@ -77,3 +77,11 @@ margin-top: 5px;
border-bottom: 1px solid #ccc;
border-top: 3px solid #ccc;
}
.innerTable{
margin:0;
padding:0;
background-color: #fff;
border: 1px solid #ccc;
width:130%;
}

View File

@ -49,11 +49,11 @@ body {
<li><a href="#"><fmt:message key="result" /></a></li>
</ul>
</div>
<!-- <div class="row-fluid" id="test">
<div class="row-fluid" id="test">
<div class="span4 span-brief" id="status">Test Status<br/><br></div>
<div class="span4 span-brief" id="vu">VUs active<br/><br></div>
<div class="span4 span-brief-last" id="request">Requests<br/><br></div>
</div> -->
</div>
<div class="row-fluid">
<h4 class="pull-left">Charts</h4>
<div class="field-inline">

View File

@ -1,5 +1,5 @@
var Chart = function (){};
var intervalTime = 5000;
var Chart=function(){};
Chart.prototype.createChart = function(container) {
container.highcharts({
chart : {
@ -52,15 +52,20 @@ Chart.prototype.removeAxis=function(axisId) {
};
Chart.prototype.addPoint=function(seriesId,point ) {
if(point.y=="NaN")
point.y=0;
this.highChart.get(seriesId).addPoint([ point.x, point.y ]);
};
/*Chart.prototype.addPoints=function(seriesId,data ) {
Chart.prototype.addPoints=function(seriesId,data ) {
var chart=this;
for(var i=0;i<data.length;i++){
chart.addPoint(seriesId,data[i]);
}
}*/
}
var Point = function(x, y) {
this.x = x;
this.y = y;
@ -78,11 +83,13 @@ Chart.prototype.addGraph = function(model) {
clearInterval(intervalId);
return;
}
if(data instanceof Array)
for(var i=0;i<data.length;i++){
chart.addDataToGraph(chart,model,intervalId,data[i]);
if(data instanceof Array) {
var points=new Array();
for(var i=0;i<data.length;i++){
chart.addDataToGraph(chart,model,intervalId,data[i]);
}
}
else chart.addDataToGraph(chart,model,intervalId,data)
}, "json");

View File

@ -1,5 +1,6 @@
$(document).ready(function() {
testPlanId = getvars()['testPlanId'];
var testStatus;
if (!getTestPlanStatus(testPlanId))
return;
var tree = getResultInfoTree(testPlanId);
@ -27,6 +28,7 @@ function getTestPlanStatus(testPlanId) {
flag=false;
return;
}
testStatus=data.currentStatus;
$("#status").html($("#status").html()+"<h4>"+data.currentStatus+"</h4>")
if (data.currentStatus == "Complete"
|| data.currentStatus == "InRunning") {

View File

@ -1,13 +1,12 @@
$('.datatable').dataTable({
"sDom": "<'row-fluid'<'span6'l>>t<'row-fluid'<'span3 center'p>>",
$('.dataTable').dataTable({
"sDom" : "<'row-fluid'<'span6'l>>t<'row-fluid'<'span3 center'p>>",
"sPaginationType" : "bootstrap",
"oLanguage" : {
"sLengthMenu" : "_MENU_ records per page",
},
"bDestroy": true
});
},
"bDestroy" : true
});
// get script list in running test plan------------------------------------
function getScriptList(testPlanId) {
@ -20,7 +19,7 @@ function getScriptList(testPlanId) {
success : function(data) {
if (data == null)
return null;
if(data.runningScriptModels.length<=0)
if (data.runningScriptModels.length <= 0)
return null;
for ( var i = 0; i < data.runningScriptModels.length; i++) {
scriptList.push(data.runningScriptModels[i])
@ -33,31 +32,31 @@ function getScriptList(testPlanId) {
}
// page-----------------------------------------------------------
var PageResult=function(){
var PageResult = function() {
this.result = new Array();
this.intevalTime = 3000;
this.header = new Array("page", "scriptName", "countFromBegin", "minResponseTimeFromBegin","maxResponseTimeFromBegin",
"averageResponseTimeThisTime","latestResponseTime");
this.intevalTime = 5000;
this.header = new Array("page", "scriptName", "countFromBegin",
"minResponseTimeFromBegin", "maxResponseTimeFromBegin",
"averageResponseTimeThisTime", "latestResponseTime");
this.table = $("#page").dataTable();
}
PageResult.prototype.addResultToTable=function(){
PageResult.prototype.addResultToTable = function() {
this.table.fnClearTable();
var result = this.result;
for ( var i = 0; i < result.length; i++) {
var row = extractRowDataActionBefore(result[i],
this.header, null);
var row = extractRowDataActionBefore(result[i], this.header, null);
this.table.fnAddData(row);
}
}
var PageResultModel=function(page,scriptPageBriefModel,scriptName){
this.page=page;
this.countFromBegin=scriptPageBriefModel.countFromBegin;
this.minResponseTimeFromBegin=scriptPageBriefModel.minResponseTimeFromBegin;
this.maxResponseTimeFromBegin=scriptPageBriefModel.maxResponseTimeFromBegin;
this.averageResponseTimeThisTime=scriptPageBriefModel.averageResponseTimeThisTime;
this.latestResponseTime=scriptPageBriefModel.latestResponseTime;
this.scriptName=scriptName;
var PageResultModel = function(page, scriptPageBriefModel, scriptName) {
this.page = page;
this.countFromBegin = scriptPageBriefModel.countFromBegin;
this.minResponseTimeFromBegin = scriptPageBriefModel.minResponseTimeFromBegin;
this.maxResponseTimeFromBegin = scriptPageBriefModel.maxResponseTimeFromBegin;
this.averageResponseTimeThisTime = scriptPageBriefModel.averageResponseTimeThisTime;
this.latestResponseTime = scriptPageBriefModel.latestResponseTime;
this.scriptName = scriptName;
}
PageResult.prototype.getResult = function(testPlanId, scriptList) {
@ -69,7 +68,7 @@ PageResult.prototype.getResult = function(testPlanId, scriptList) {
clearInterval(intervalId);
return;
}
if (scriptList.length == 0) {
clearInterval(intervalId);
return;
@ -77,27 +76,30 @@ PageResult.prototype.getResult = function(testPlanId, scriptList) {
pageResult.result = [];
finishedCount = 0;
for ( var i = 0; i < scriptList.length; i++) {
pageResult.getSinglePageResult(pageResult,intervalId,finishedCount,scriptList[i]);
pageResult.getSinglePageResult(pageResult, intervalId,
finishedCount, scriptList[i]);
}
}, this.intevalTime);
}
PageResult.prototype.getSinglePageResult=function(pageResult,intervalId,finishedCount,script){
var urlPath=[testPlanId,"script",script.scriptId,"page"];
var url=generateUrl(urlPath);
PageResult.prototype.getSinglePageResult = function(pageResult, intervalId,
finishedCount, script) {
var urlPath = [ testPlanId, "script", script.scriptId, "page" ];
var url = generateUrl(urlPath);
$.post(url, {}, function(data) {
if (data == null||data.scriptPageBriefModels==null) {
if (data == null || data.scriptPageBriefModels == null) {
clearInterval(intervalId);
return;
}
data=data.scriptPageBriefModels;
var scriptPagesFinished=true;
for(var i=0;i<data.length;i++){
data = data.scriptPageBriefModels;
var scriptPagesFinished = true;
for ( var i = 0; i < data.length; i++) {
pageResult.result = $.merge(pageResult.result,
[new PageResultModel("page"+i,data[i],script.scriptName)]);
if(!data[i].finished)
scriptPagesFinished=false;
[ new PageResultModel("page" + i, data[i],
script.scriptName) ]);
if (!data[i].finished)
scriptPagesFinished = false;
}
if (scriptPagesFinished)
finishedCount++;
@ -105,26 +107,29 @@ PageResult.prototype.getSinglePageResult=function(pageResult,intervalId,finished
}, "json");
}
// Behavior-------------------------------------------------------
var BehaviorResult = function() {
this.behaviors = new Array();
this.intevalTime = 3000;
this.intevalTime = 5000;
this.header = new Array("Url", "Script", "Successful", "Total");
this.actionAdd = "<img src='/images/add.png' alt='details' title='details' class='detail-picture'>";
this.actionDelete="<img src='/images/add.png' alt='details' title='details' class='detail-picture'>";
this.actionAdd = "<img src='/images/add.png' alt='details' title='details' class='show-detail-picture'>";
this.actionDelete = "<img src='/images/add.png' alt='details' title='details' class='detail-picture'>";
this.table = $("#url").dataTable();
};
BehaviorResult.prototype.getResult = function(testPlanId, scriptList) {
var behaviorResult = this;
var finishedCount = 0;
var count = 0;
var intervalId = setInterval(function() {
count++;
behaviorResult.addBehaviorsToTable();
behaviorResult.DetailAddListener();
if (finishedCount >= scriptList.length) {
clearInterval(intervalId);
return;
}
if (scriptList.length == 0) {
clearInterval(intervalId);
return;
@ -132,62 +137,159 @@ BehaviorResult.prototype.getResult = function(testPlanId, scriptList) {
behaviorResult.behaviors = [];
finishedCount = 0;
for ( var i = 0; i < scriptList.length; i++) {
behaviorResult.getSingleBehaviorResult(behaviorResult,intervalId,finishedCount,scriptList[i]);
behaviorResult.getSingleBehaviorResult(behaviorResult, intervalId,
finishedCount, scriptList[i]);
}
if (testStatus == "Complete" && count == 2) {
clearInterval(intervalId);
return;
}
}, this.intevalTime);
}
function generateUrl(urlPath){
var url="";
for(var i=0;i<urlPath.length;i++)
url+="/"+urlPath[i];
return url;
function generateUrl(urlPath) {
var url = "";
for ( var i = 0; i < urlPath.length; i++)
url += "/" + urlPath[i];
return url;
}
BehaviorResult.prototype.getSingleBehaviorResult=function(behaviorResult,intevalId,finishedCount,script){
var urlPath=[testPlanId,"script",script.scriptId,"behaviors"];
var url=generateUrl(urlPath);
BehaviorResult.prototype.getSingleBehaviorResult = function(behaviorResult,
intevalId, finishedCount, script) {
var urlPath = [ testPlanId, "script", script.scriptId, "behaviors" ];
var url = generateUrl(urlPath);
$.post(url, {}, function(data) {
if (data == null) {
clearInterval(intervalId);
return;
}
if (data.finished||data.testBehaviorsBriefModel==null)
{
finishedCount++;
}
if(data.testBehaviorsBriefModel!=null)
behaviorResult.behaviors = $.merge(behaviorResult.behaviors,
behaviorResult.getBehaviorsList(data.testBehaviorsBriefModel.behaviorBriefModels,script.scriptName));
if (data.finished || data.testBehaviorsBriefModel == null) {
finishedCount++;
}
if (data.testBehaviorsBriefModel != null)
behaviorResult.behaviors = $.merge(behaviorResult.behaviors,
behaviorResult.getBehaviorsList(
data.testBehaviorsBriefModel.behaviorBriefModels,
script.scriptName));
}, "json");
}
var Behavior=function(behaviorBriefModel,scriptName){
this.behaviorBriefModel=behaviorBriefModel;
this.scriptName=scriptName;
var Behavior = function(behaviorBriefModel, scriptName) {
this.behaviorBriefModel = behaviorBriefModel;
this.scriptName = scriptName;
}
BehaviorResult.prototype.getBehaviorsList=function(behaviorBriefModels,scriptName){
var behaviors=new Array();
for(var i=0;i<behaviorBriefModels.length;i++){
behaviors.push(new Behavior(behaviorBriefModels[i],scriptName));
BehaviorResult.prototype.getBehaviorsList = function(behaviorBriefModels,
scriptName) {
var behaviors = new Array();
for ( var i = 0; i < behaviorBriefModels.length; i++) {
behaviors.push(new Behavior(behaviorBriefModels[i], scriptName));
}
return behaviors;
}
BehaviorResult.prototype.addBehaviorsToTable = function() {
this.table.fnClearTable();
var behaviors = this.behaviors;
for ( var i = 0; i < behaviors.length; i++) {
var row = extractRowDataActionBefore(new BehaviorModel(behaviors[i].behaviorBriefModel,behaviors[i].scriptName),
var row = extractRowDataActionBefore(new BehaviorModel(
behaviors[i].behaviorBriefModel, behaviors[i].scriptName),
this.header, this.actionAdd);
this.table.fnAddData(row);
}
}
BehaviorResult.prototype.showUrlResponseResult = function(parentDom, url) {
BehaviorResult.prototype.DetailAddListener = function() {
var behaviorResult = this;
$(".show-detail-picture").click(function() {
var brotherDom = $(this.parentNode.parentNode);
var url = getColumn(this, 1);
behaviorResult.showUrlDetailResult(brotherDom, url);
var td=$(this.parentNode);
td.html("");
td.html('<img src="/images/delete.png" alt="details" title="details" class="delete-detail-picture">');
behaviorResult.DetailAddListener();
});
$(".delete-detail-picture").click(function() {
var brotherDom = $(this.parentNode.parentNode);
brotherDom.next("tr").remove();
var td=$(this.parentNode);
td.html("");
td.html('<img src="/images/add.png" alt="details" title="details" class="show-detail-picture">');
behaviorResult.DetailAddListener();
});
}
BehaviorResult.prototype.showUrlDetailResult = function(brotherDom, url) {
var theader = [ "url", "statusCode", "count",
"contentLength", "minResponseTime", "maxResponseTime",
"totalResponseTimeThisTime" ];
var behavior = this.searchBehaviorByUrl(url);
if (behavior == null)
return;
var dataRows = new Array();
for ( var i = 0; i < behavior.behaviorBriefModel.detailStatusCodeResultModels.length; i++) {
dataRows.push(extractRowDataActionBefore(new BehaviorDetailModel(url,
behavior.behaviorBriefModel.detailStatusCodeResultModels[i]),
theader, null));
}
var tr = this.drawUrlDetailResult(theader, dataRows);
tr.insertAfter(brotherDom);
var table = $(tr.children("td").children("div").children("table")[0]);
for ( var i = 0; i < dataRows.length; i++) {
this.addDataToDetailTable($(table.children("tbody")[0]),dataRows[i]);
}
}
BehaviorResult.prototype.addDataToDetailTable=function(tbody,dataRow){
var tr=$("<tr></tr>");
for(var i=0;i<dataRow.length;i++){
var td=$("<td></td>");
td.html(dataRow[i]);
tr.append(td);
}
tbody.append(tr);
}
BehaviorResult.prototype.drawUrlDetailResult = function(theader) {
var table = this.getDetaileTable(theader)
var div = $("<div></div>");
div.append(table);
var td = $("<td colspan='5'></td>");
td.append(div);
var tr = $("<tr></tr>");
tr.append(td);
return tr;
}
BehaviorResult.prototype.getDetaileTable = function(theader) {
var table = $("<table></table>");
table.addClass("innerTable");
var thead = $("<thead></thead>");
var tr = $("<tr></tr>");
for ( var i = 0; i < theader.length; i++) {
tr.append("<th>" + theader[i] + "</th>");
}
thead.append(tr);
table.append(thead);
table.append("<tbody></tbody>");
// add table row
return table;
}
BehaviorResult.prototype.searchBehaviorByUrl = function(url) {
var behaviors = this.behaviors;
for ( var i = 0; i < behaviors.length; i++) {
if (behaviors[i].behaviorBriefModel.behaviorUrl == url) {
return behaviors[i];
}
}
return null;
}
BehaviorResult.prototype.extractBehaviorModel = function() {
}
BehaviorResult.prototype.deleteUrlDetailResponse = function() {
}
var BehaviorModel = function(behavior, scriptName) {
this.Url = behavior.behaviorUrl;
@ -196,6 +298,13 @@ var BehaviorModel = function(behavior, scriptName) {
behavior.detailStatusCodeResultModels, 200);
this.Total = this.getTotalCount(behavior.detailStatusCodeResultModels);
}
var BehaviorDetailModel = function(url, behaviorDetaile) {
this.url = url;
for ( var key in behaviorDetaile) {
if(key.indexOf("contentType")<0)
this[key] = behaviorDetaile[key];
}
}
BehaviorModel.prototype.getStatusCount = function(behaviorStatusResultList,
statusCode) {
if (behaviorStatusResultList == null)
@ -216,5 +325,6 @@ BehaviorModel.prototype.getTotalCount = function(behaviorStatusResultList) {
}
return count;
}
// need to abstract the tow
// part----------------------------------------------------

View File

@ -63,7 +63,7 @@ var SutResult=function(testPlanId){
sutResultInfo.root=null;
return;
}
scriptResultTree.createRoot("SUT","hostName");
scriptResultTree.createRoot("SUT","SUT");
sutResultInfo.root=scriptResultTree.root;
sutResultInfo.data=data;
sutResultInfo.createTree(data);