parent
030794d5ca
commit
226e9ec522
|
@ -174,10 +174,10 @@ public class TestPlanController extends BaseController {
|
||||||
public ScriptBehaviorsBriefModel getBehaviorsBrief(
|
public ScriptBehaviorsBriefModel getBehaviorsBrief(
|
||||||
@PathVariable UUID testPlanRunID, @PathVariable int scriptId)
|
@PathVariable UUID testPlanRunID, @PathVariable int scriptId)
|
||||||
throws Bench4QException, NullPointerException {
|
throws Bench4QException, NullPointerException {
|
||||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
// if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||||
throw new Bench4QException(HAVE_NO_POWER, EXCEPTION_HAPPEND
|
// throw new Bench4QException(HAVE_NO_POWER, EXCEPTION_HAPPEND
|
||||||
+ "when get behaviors's brief", "/getBehaviorsBrief");
|
// + "when get behaviors's brief", "/getBehaviorsBrief");
|
||||||
}
|
// }
|
||||||
ScriptBehaviorsBriefModel result = this
|
ScriptBehaviorsBriefModel result = this
|
||||||
.getTestPlanScriptResultService()
|
.getTestPlanScriptResultService()
|
||||||
.getLatestScriptBehaviorsBrief(testPlanRunID, scriptId);
|
.getLatestScriptBehaviorsBrief(testPlanRunID, scriptId);
|
||||||
|
@ -189,10 +189,10 @@ public class TestPlanController extends BaseController {
|
||||||
public ScriptPagesBriefModel getPagesBrief(
|
public ScriptPagesBriefModel getPagesBrief(
|
||||||
@PathVariable UUID testPlanRunId, @PathVariable int scriptId)
|
@PathVariable UUID testPlanRunId, @PathVariable int scriptId)
|
||||||
throws Bench4QException {
|
throws Bench4QException {
|
||||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
// if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||||
throw new Bench4QException(HAVE_NO_POWER, EXCEPTION_HAPPEND
|
// throw new Bench4QException(HAVE_NO_POWER, EXCEPTION_HAPPEND
|
||||||
+ "when get behaviors's brief", "/getBehaviorsBrief");
|
// + "when get behaviors's brief", "/getBehaviorsBrief");
|
||||||
}
|
// }
|
||||||
ScriptPagesBriefModel pagesBriefModel = this
|
ScriptPagesBriefModel pagesBriefModel = this
|
||||||
.getTestPlanScriptResultService().getLatestScriptPagesBrief(
|
.getTestPlanScriptResultService().getLatestScriptPagesBrief(
|
||||||
testPlanRunId, scriptId);
|
testPlanRunId, scriptId);
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class BehaviorBriefStatistics extends ScriptStatistics {
|
||||||
result.setTotalCountFromBegin(this.totalCountFromBegin);
|
result.setTotalCountFromBegin(this.totalCountFromBegin);
|
||||||
for (BehaviorStatusCodeStatistics item : this.detailStatisticsMap
|
for (BehaviorStatusCodeStatistics item : this.detailStatisticsMap
|
||||||
.values()) {
|
.values()) {
|
||||||
result.getList().add(
|
result.getDetailStatusList().add(
|
||||||
(ScriptBehaviorStatusCodeModel) item.getStatistics());
|
(ScriptBehaviorStatusCodeModel) item.getStatistics());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class Test_BehaviorBriefStatistics {
|
||||||
assertEquals(8, result.getTotalCountFromBegin());
|
assertEquals(8, result.getTotalCountFromBegin());
|
||||||
int countForAllDetail = 0;
|
int countForAllDetail = 0;
|
||||||
for (ScriptBehaviorStatusCodeModel behaviorStatusCodeModel : result
|
for (ScriptBehaviorStatusCodeModel behaviorStatusCodeModel : result
|
||||||
.getList()) {
|
.getDetailStatusList()) {
|
||||||
countForAllDetail += behaviorStatusCodeModel.getCount();
|
countForAllDetail += behaviorStatusCodeModel.getCount();
|
||||||
}
|
}
|
||||||
assertEquals(result.getTotalCountFromBegin(), countForAllDetail);
|
assertEquals(result.getTotalCountFromBegin(), countForAllDetail);
|
||||||
|
|
|
@ -13,10 +13,10 @@ public class ScriptBehaviorBriefModel {
|
||||||
private String BehaviorUrl;
|
private String BehaviorUrl;
|
||||||
private long successCountFromBegin;
|
private long successCountFromBegin;
|
||||||
private long totalCountFromBegin;
|
private long totalCountFromBegin;
|
||||||
private List<ScriptBehaviorStatusCodeModel> list;
|
private List<ScriptBehaviorStatusCodeModel> detailStatusList;
|
||||||
|
|
||||||
public ScriptBehaviorBriefModel() {
|
public ScriptBehaviorBriefModel() {
|
||||||
this.setList(new LinkedList<ScriptBehaviorStatusCodeModel>());
|
this.setDetailStatusList(new LinkedList<ScriptBehaviorStatusCodeModel>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
|
@ -57,12 +57,12 @@ public class ScriptBehaviorBriefModel {
|
||||||
|
|
||||||
@XmlElementWrapper(name = "statusResults")
|
@XmlElementWrapper(name = "statusResults")
|
||||||
@XmlElement
|
@XmlElement
|
||||||
public List<ScriptBehaviorStatusCodeModel> getList() {
|
public List<ScriptBehaviorStatusCodeModel> getDetailStatusList() {
|
||||||
return list;
|
return detailStatusList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setList(List<ScriptBehaviorStatusCodeModel> list) {
|
public void setDetailStatusList(List<ScriptBehaviorStatusCodeModel> list) {
|
||||||
this.list = list;
|
this.detailStatusList = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,6 +289,7 @@ public class TestPlanController extends BaseController {
|
||||||
return fail(map, "");
|
return fail(map, "");
|
||||||
}
|
}
|
||||||
map = success(map);
|
map = success(map);
|
||||||
|
System.out.println(MarshalHelper.tryMarshal(scriptBehaviorsBriefModel));
|
||||||
map.put("behaviors", scriptBehaviorsBriefModel);
|
map.put("behaviors", scriptBehaviorsBriefModel);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,10 +156,9 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
for (ScriptBehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel
|
for (ScriptBehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel
|
||||||
.getBehaviorBriefModels()) {
|
.getBehaviorBriefModels()) {
|
||||||
|
if (behaviorBriefModel.getDetailStatusList() != null)
|
||||||
if (behaviorBriefModel.getList() != null)
|
|
||||||
behaviorStatusCodeResultModels.addAll(behaviorBriefModel
|
behaviorStatusCodeResultModels.addAll(behaviorBriefModel
|
||||||
.getList());
|
.getDetailStatusList());
|
||||||
}
|
}
|
||||||
return behaviorStatusCodeResultModels;
|
return behaviorStatusCodeResultModels;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
function Behavior() {
|
function Behavior() {
|
||||||
this.table = $("#url").DataTable();
|
this.table = $("#url").DataTable();
|
||||||
this.table.column(5).visible(false);
|
this.table.column(5).visible(false);
|
||||||
this.getBehaviorResultsFirstly = function(testPlanId, map,scripts) {
|
this.getBehaviorResultsFirstly = function(testPlanId, map, scripts) {
|
||||||
|
|
||||||
for(var i=0;i<scripts.length;i++){
|
for (var i = 0; i < scripts.length; i++) {
|
||||||
var url = testPlanId + "/" + scripts[i].scriptId
|
var url = testPlanId + "/" + scripts[i].scriptId + "/behaviors";
|
||||||
+ "/behaviors";
|
|
||||||
|
|
||||||
this.getBehaviorResult(url, map, scripts[i].scriptName, this.table);
|
this.getBehaviorResult(url, map, scripts[i].scriptName, this.table);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadBehaviorResults = function(testPlanId, scripts) {
|
this.loadBehaviorResults = function(testPlanId, scripts) {
|
||||||
|
|
||||||
var map = new HashMap();
|
var map = new HashMap();
|
||||||
this.getBehaviorResultsFirstly(testPlanId,map,scripts);
|
this.getBehaviorResultsFirstly(testPlanId, map, scripts);
|
||||||
var behavior = this;
|
var behavior = this;
|
||||||
if (scripts == null) {
|
if (scripts == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.intervalId = setInterval(function() {
|
this.intervalId = setInterval(
|
||||||
|
function() {
|
||||||
|
|
||||||
for ( var i = 0; i < scripts.length; i++) {
|
for (var i = 0; i < scripts.length; i++) {
|
||||||
|
|
||||||
var url = testPlanId + "/" + scripts[i].scriptId
|
var url = testPlanId + "/" + scripts[i].scriptId
|
||||||
+ "/behaviors";
|
+ "/behaviors";
|
||||||
behavior.getBehaviorResult(url, map, scripts[i].scriptName,
|
behavior.getBehaviorResult(url, map,
|
||||||
behavior.table);
|
scripts[i].scriptName, behavior.table);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
}
|
}
|
||||||
this.getBehaviorResult = function(url, map, scriptName, table) {
|
this.getBehaviorResult = function(url, map, scriptName, table) {
|
||||||
|
@ -44,12 +44,12 @@ function Behavior() {
|
||||||
map.put(scriptName, data);
|
map.put(scriptName, data);
|
||||||
behaviorResult.insertDataToTable(table, map);
|
behaviorResult.insertDataToTable(table, map);
|
||||||
if ($("#status").attr("status") == "Complete") {
|
if ($("#status").attr("status") == "Complete") {
|
||||||
if(behaviorResult.intervalId!=null){
|
if (behaviorResult.intervalId != null) {
|
||||||
clearInterval(behaviorResult.intervalId);
|
clearInterval(behaviorResult.intervalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}, "json").error(function(){
|
}, "json").error(function() {
|
||||||
information($.i18n.prop('failed-connect-server'));
|
information($.i18n.prop('failed-connect-server'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -57,20 +57,20 @@ function Behavior() {
|
||||||
this.insertDataToTable = function(table, map) {
|
this.insertDataToTable = function(table, map) {
|
||||||
|
|
||||||
table.clear();
|
table.clear();
|
||||||
for ( var k = 0; k < map.length(); k++) {
|
for (var k = 0; k < map.length(); k++) {
|
||||||
var names = map.getKeys();
|
var names = map.getKeys();
|
||||||
var behaviors = map.get(names[k]).behaviorBriefModels;
|
var behaviors = map.get(names[k]).behaviorBriefModels;
|
||||||
if (behaviors == null) {
|
if (behaviors == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( var j = 0; j < behaviors.length; j++) {
|
for (var j = 0; j < behaviors.length; j++) {
|
||||||
var data = behaviors[j];
|
var data = behaviors[j];
|
||||||
var rowNode = table.row.add(
|
var rowNode = table.row.add(
|
||||||
[ "", data.behaviorUrl, names[k], data.totalCount,
|
[ "", data.behaviorUrl, names[k],
|
||||||
data.successfulCount,
|
data.totalCountFromBegin,
|
||||||
data.detailStatusCodeResultModels ]).draw()
|
data.successCountFromBegin,
|
||||||
.node();
|
data.detailStatusList ]).draw().node();
|
||||||
var td = $(rowNode).find("td")[0];
|
var td = $(rowNode).find("td")[0];
|
||||||
$(td).addClass("details-control");
|
$(td).addClass("details-control");
|
||||||
}
|
}
|
||||||
|
@ -80,14 +80,20 @@ function Behavior() {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.createDetailTable = function(url, detailDatas) {
|
this.createDetailTable = function(url, detailDatas) {
|
||||||
var theader=[ $.i18n.prop('result-url'), $.i18n.prop('result-url-statusCode'), $.i18n.prop('result-url-count'), $.i18n.prop('result-url-contentLength'), $.i18n.prop('result-url-minRes'), $.i18n.prop('result-url-maxRes'), $.i18n.prop('result-url-totalRes')];
|
var theader = [ $.i18n.prop('result-url'),
|
||||||
|
$.i18n.prop('result-url-statusCode'),
|
||||||
|
$.i18n.prop('result-url-count'),
|
||||||
|
$.i18n.prop('result-url-contentLength'),
|
||||||
|
$.i18n.prop('result-url-minRes'),
|
||||||
|
$.i18n.prop('result-url-maxRes'),
|
||||||
|
$.i18n.prop('result-url-totalRes') ];
|
||||||
var table = $("<table></table>");
|
var table = $("<table></table>");
|
||||||
table.addClass("innerTable");
|
table.addClass("innerTable");
|
||||||
$(table).attr("style", "width: 100%;");
|
$(table).attr("style", "width: 100%;");
|
||||||
var thead = $("<thead></thead>");
|
var thead = $("<thead></thead>");
|
||||||
|
|
||||||
var tr = $("<tr></tr>");
|
var tr = $("<tr></tr>");
|
||||||
for ( var i = 0; i < theader.length; i++) {
|
for (var i = 0; i < theader.length; i++) {
|
||||||
var th = $("<th>" + theader[i] + "</th>");
|
var th = $("<th>" + theader[i] + "</th>");
|
||||||
th.attr("style", "width:10% ;");
|
th.attr("style", "width:10% ;");
|
||||||
tr.append(th);
|
tr.append(th);
|
||||||
|
@ -96,7 +102,7 @@ function Behavior() {
|
||||||
table.append(thead);
|
table.append(thead);
|
||||||
var tbody = $("<tbody></tbody>");
|
var tbody = $("<tbody></tbody>");
|
||||||
table.append(tbody);
|
table.append(tbody);
|
||||||
for ( var i = 0; i < detailDatas.length; i++) {
|
for (var i = 0; i < detailDatas.length; i++) {
|
||||||
var tr = this.createDetailRow(detailDatas[i], url, theader)
|
var tr = this.createDetailRow(detailDatas[i], url, theader)
|
||||||
tbody.append(tr);
|
tbody.append(tr);
|
||||||
|
|
||||||
|
@ -106,9 +112,12 @@ function Behavior() {
|
||||||
this.createDetailRow = function(detailData, url, theader) {
|
this.createDetailRow = function(detailData, url, theader) {
|
||||||
|
|
||||||
var tr = $("<tr></tr>");
|
var tr = $("<tr></tr>");
|
||||||
var dataArray = [url,detailData.statusCode,detailData.count,detailData.contentLength,detailData.minResponseTime,detailData.maxResponseTime,detailData.totalResponseTimeThisTime];
|
var dataArray = [ url, detailData.statusCode, detailData.count,
|
||||||
|
detailData.contentLength, detailData.minResponseTime,
|
||||||
|
detailData.maxResponseTime,
|
||||||
|
detailData.totalResponseTimeThisTime ];
|
||||||
dataArray[0] = url;
|
dataArray[0] = url;
|
||||||
for ( var i = 0; i < dataArray.length; i++) {
|
for (var i = 0; i < dataArray.length; i++) {
|
||||||
var td = $("<td></td>");
|
var td = $("<td></td>");
|
||||||
td.attr("style", "width: 10%;");
|
td.attr("style", "width: 10%;");
|
||||||
td.html(dataArray[i]);
|
td.html(dataArray[i]);
|
||||||
|
|
Loading…
Reference in New Issue