add getScriptResultData

This commit is contained in:
fanfuxiaoran 2013-12-08 23:14:23 +08:00
parent 0f76fd7584
commit dc16e09088
5 changed files with 79 additions and 33 deletions

14
.gitignore vendored
View File

@ -1,13 +1,13 @@
/target
.project
.classpath
/target
.project
.classpath
/.settings
/.externalToolBuilders
.externalToolBuilders
/src/main/webapp/.htaccess
/logs/
/logs/log.log

View File

@ -32,7 +32,7 @@ public abstract class BaseControllerService {
public static final Properties prop = new Properties();
public BaseControllerService() {
/*String masterIpFilePath;
String masterIpFilePath;
try {
masterIpFilePath = BaseControllerService.class.getClassLoader()
.getResource("").toURI().getPath()
@ -47,9 +47,9 @@ public abstract class BaseControllerService {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}*/
}
this.masterIP="127.0.0.1:7979/";
/*this.masterIP="127.0.0.1:7979/";*/
}
public HttpRequester getHttpRequester() {

View File

@ -74,8 +74,11 @@ body {
<script src='js/jquery.dataTables.min.js'></script>
<script src="js/theme.js"></script>
<script src="js/jquery.i18n.properties-1.0.9.js"></script>
<script src="js/highcharts.js"></script>
<script src="script/base.js"></script>
<script src="script/uiCreate.js"></script>
<script src="script/graph.oper.js"></script>
<script src="script/highChartTheme.js"></script>
<script src="script/result-new.js"></script>
</fmt:bundle>
</body>

View File

@ -13,7 +13,7 @@ Highcharts.theme = {
plotShadow: true,
plotBorderWidth: 1
},
title: {
/* title: {
style: {
color: '#000',
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
@ -24,7 +24,7 @@ Highcharts.theme = {
color: '#666666',
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
}
},
},*/
xAxis: {
gridLineWidth: 1,
lineColor: '#000',

View File

@ -1,6 +1,7 @@
var container = $('#container');
var containerHeader = $('#containerHeader');
var testPlanId;
var initShowList=null;
var urlModel = new UrlModel();
var testBriefModelField = new Array("name", "uuid", "scripts", "SUT", "status");
var scriptInfo = new Array("name", "id", "load", "warm up", "execute",
@ -10,9 +11,7 @@ var scriptResult = new Array("averageResponseTime",
"failThroughputThisTime");
var containerModel = new ContainerModel();
var runningInfo=null;
function ContainerModel() {
this.testBox = "testBox";
@ -30,10 +29,6 @@ $(document).ready(
function() {
/* testPlanId = getvars()['testPlanId']; */
testPlanId = 1;
var scripts = new Array("www", "wxr");
var allList = createScriptList(scripts, scriptResult);
initChartBox(container, containerModel.scriptChartBox, "char",
allList, null, null);
getRunningInfo(urlModel.runInfo, testPlanId);
/* getScriptResult(urlModel.scriptResult,testPlanId,initScriptResultContainer); */
@ -45,17 +40,53 @@ function getRunningInfo(url, testPlanId) {
testPlanId : testPlanId
}, function(data) {
processTestBriefInfo(data);
runningInfo=data;
}, "json");
}
function getScriptResult(url, testPlanId, scriptId, callback) {
$.post(url, {
testPlanId : testPlanId,
scriptId : scriptId
}, callback(data), "json");
function updateChart(){}
/*function getScriptResult( chart,testPlanId, scriptIndexModel,showList) {
var intervalId = null;
intervalId = setInterval(function() {
for(var i=0;i<showList.child.length;i++){
var scriptName=showList.child[i].key;
var result=new Array();
var series=new Array();
for(var j=0;j<showList.child[i].child.length;j++){
result.push(showList.child[i].child[j].key);
series.push(chart.get(scriptName+"_"+showList.child[i].key));
}
var scriptId=getScriptIdByName(scriptName,scriptIndexModels);
$.post("getScriptBriefStatus", {
testPlanId : testPlanId,
scriptId : scriptId
}, function(data){
for(var i=0;i<result.length;i++){
for(var key in data){
if(key==result[i])
series[i].addPoint([(new Date()).getTime(),data.key]);
//add finish
}
}
},"json");
}
});
}*/
function getScriptIdByName(scriptName,scriptIndexModels){
for(var i=0;i<scriptIndexModels.length;i++){
if(scriptName==scriptIndexModels[i].scriptName){
return scriptIndexModels[i],scriptId;
}
}
}
//need to refactor to createTree
function createScriptList(scripts, scriptResult) {
function createSelectTree(scriptIndexModels, scriptResult) {
var scripts=new Array();
for(var i=0;i<scriptIndexModels.length;i++){
scripts.push(scriptIndexModels[i].scriptName);
}
if (scripts.length == null || scripts.length <= 0)
return;
var list = new treeNode("Script", "", new Array());
@ -78,14 +109,20 @@ function processTestBriefInfo(data) {
if (data != null) {
/* initTestInfoContainer(containerHeader, data); */
if (data.scriptIndexModels != null && data.scriptIndexModels.length > 0) {
initTestScriptContainer(container, data.scriptIndexModels);
/* initScriptResultContainer(container, data.scriptIndexModels); */
initTestScriptTable(container, data.scriptIndexModels);
var allTree=createSelectTree(data.scriptIndexModels,scriptResult);
var initShowList = new treeNode("", "", null);
initChartBox(container, containerModel.scriptChartBox, "script chart", allTree, initShowLists);
getScriptResult(chart,testPlanId,data.scriptIndexModel);
updateChart();
}
if (data.monitorModels != null && data.monitorModels.length > 0)
initSUTContainer(parent, data.monitorModels);
} else
alert("get testplan runing info is error! ");
}
function updateChart(id,data){
}
function initTestInfoContainer(parent, data) {
var box = createBox(4, "Test");
@ -104,7 +141,7 @@ function initTestInfoContainer(parent, data) {
ul.append(createLi("status", data.status, "green", "icon-arrow-up"));
}
function initTestScriptContainer(parent, data) {
function initTestScriptTable(parent, data) {
var box = createBox(12, "Scripts");
/* addId(box, containerModel.scriptBox); */
addCloseAndMinIcons(box);
@ -125,24 +162,30 @@ function initSUTContainer(data) {
}
function initChartBox(parent, id, title, allList, initShowList, data) {
function initChartBox(parent, id, title, allList, initShowList) {
var box = createChartBox(id, 12, title);
var div=$("<div></div>");
addId(div,id+"Chart");
box.append(div);
parent.append(box);
if (allList == null)
alert("list is null");
var excessList = generateExcessList(allList, initShowList);
if (initShowList == null)
initShowList = new treeNode("", "", null);
var chart=createChart(id+"Chart", initAxis);
var initAxis=null;
var chart=createChart(div, initAxis);
addChartEvent(id, excessList, initShowList);
}
function createChart(id, initAxis) {
var container = $("#" + id);
function createChart(container, initAxis) {
container.highcharts({});
var chart = container.highcharts();
chart.xAxis[0].update({
type : 'datetime',
});
if(initAxis==null)
return chart;
for(var i=0;i<initAxis.length;i++){
addAxis(chart,initAxis[i],initAxis[i]);
}