get test plan schedule model from chart

This commit is contained in:
hmm 2014-09-24 11:09:47 +08:00
parent cbc19f8207
commit a7553c3c98
13 changed files with 136 additions and 62 deletions

View File

@ -1 +0,0 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK"><script type='text/javascript'>document.domain='baidu.com';</script></head><body></body><script>try{parent.bdcallback({"CNYBA.fx":{na:"美元人民币",pc:"6.1400",op:"0.0000",la:"6.1403",hi:"6.1411",lo:"6.1360",bp1:"6.1418",ap1:"6.1403",zde:"0.0003",zdf:"0.00",type:"4",time:"2014-09-19 16:31:55"},"HKCNBA.fx":{na:"港元人民币",pc:"0.7922",op:"0.0000",la:"0.7921",hi:"0.7923",lo:"0.7916",bp1:"0.7924",ap1:"0.7921",zde:"-0.0001",zdf:"-0.01",type:"4",time:"2014-09-19 17:15:40"},"ERCNBA.fx":{na:"欧元人民币",pc:"7.9341",op:"0.0000",la:"7.9099",hi:"7.9356",lo:"7.8995",bp1:"7.9131",ap1:"7.9099",zde:"-0.0242",zdf:"-0.31",type:"4",time:"2014-09-19 17:17:09"},"UKCNBA.fx":{na:"英镑人民币",pc:"10.0696",op:"0.0000",la:"10.0590",hi:"10.1469",lo:"10.0406",bp1:"10.0640",ap1:"10.0590",zde:"-0.0106",zdf:"-0.11",type:"4",time:"2014-09-19 17:17:08"},"USDJPY.fx":{na:"美元日元",pc:"108.7800",op:"108.8000",la:"108.8200",hi:"109.4500",lo:"108.7600",bp1:"108.8200",ap1:"108.8400",zde:"0.0400",zdf:"0.04",type:"1",time:"2014-09-19 17:18:58"},"EURUSD.fx":{na:"欧元美元",pc:"1.2917",op:"1.2917",la:"1.2884",hi:"1.2928",lo:"1.2866",bp1:"1.2884",ap1:"1.2885",zde:"-0.0033",zdf:"-0.26",type:"1",time:"2014-09-19 17:18:57"},"GBPUSD.fx":{na:"英镑美元",pc:"1.6427",op:"1.6438",la:"1.6382",hi:"1.6523",lo:"1.6353",bp1:"1.6382",ap1:"1.6386",zde:"-0.0045",zdf:"-0.27",type:"1",time:"2014-09-19 17:18:57"},"tofnow":{time:"2014-09-19 17:24:08"}})}catch(e){}</script></html

View File

@ -121,7 +121,7 @@ public class ResponseParser {
charset = Charset.forName("utf-8");
}
this.getResponseHeader().setContentCharset(charset);
logger.error(e, e);
// logger.error(e, e);
}
this.setResponseBody(new String(contentBodyAfterDecoded, charset));
}
@ -159,7 +159,7 @@ public class ResponseParser {
charset = this.getResponseHeader().getContentCharset();
if (charset == null)
charset = Charset.forName("utf-8");
logger.error(e, e);
// logger.error(e, e);
}
byte[] responseBytes = responseBody.getBytes(charset);
responseBytes = contentEncoder.encoderContent(responseBytes);

View File

@ -209,4 +209,7 @@ stopTestPlan=Stop Test
stop=Stop
testProxySettings=testProxySettings
startRecording=startRecording
stopRecording=Stop Recording
stopRecording=Stop Recording
custom-mode=Custom Mode
target-mode=Target Mode
load-mode=Load Mode

View File

@ -210,4 +210,7 @@ stopTestPlan=\u505C\u6B62\u6D4B\u8BD5
stop=\u505C\u6B62
testProxySettings=\u6d4b\u8bd5Proxy\u8bbe\u7f6e
startRecording=\u5f00\u59cb\u5f55\u5236
stopRecording=\u505C\u6B62\u5f55\u5236
stopRecording=\u505C\u6B62\u5f55\u5236
custom-mode=\u5E38\u89C4\u6A21\u5F0F
target-mode=\u76EE\u6807\u6A21\u5F0F
load-mode=\u65BD\u538B\u6A21\u5F0F

View File

@ -114,4 +114,19 @@ select{
}
div#test-plan-continuous{
width:100%;
}
.modeSelectLabel{
margin-right:15px;
cursor:default;
}
.modeSelectDiv{
margin-bottom:10px;
margin-top:5px;
font-size:14px;
}
.modeSelectRadio{
margin-left:15px;
}
.modeSelectTitle{
margin-right:15px;
}

View File

@ -64,7 +64,7 @@ body {
<div class="image"></div>
<div class="desc">
<h3>
<fmt:message key="scriptmanagerment" />
<fmt:message key="scriptmanagement" />
</h3>
</div> <span class="step-number two">3</span>
</a></li>

View File

@ -49,4 +49,6 @@ stopTestPlan_fail=Stop running test plan fail
startRecordingMessage=Please click start recording
stopRecordingMessage=Please click stop recording
failed-connect-server=failed to connect server
close-proxy-setting=clear the proxy setting
close-proxy-setting=clear the proxy setting
custom-mode=custom mode
target-mode=target mode

View File

@ -46,3 +46,5 @@ startRecordingMessage=\u8bf7\u70b9\u51fb\u5f00\u59cb\u5f55\u5236
stopRecordingMessage=\u8bf7\u70b9\u51fb\u505c\u6b62\u5f55\u5236
failed-connect-server=\u8FDE\u63A5\u670D\u52A1\u5668\u5931\u8D25\uFF01
close-proxy-setting=\u8BF7\u5173\u95ED\u4EE3\u7406
custom-mode=\u5E38\u89C4\u6A21\u5F0F
target-mode=\u76EE\u6807\u6A21\u5F0F

View File

@ -6,10 +6,11 @@ function ScriptModel(ID, schedule, isFilterTimer, filterTypeMatches) {
};
function TestPlanRequestModel(scriptList, ipList, testPlanName) {
function TestPlanRequestModel(scriptList, ipList, testPlanName, limitModel) {
this.scriptList = scriptList;
this.ipList = ipList;
this.testPlanName = testPlanName;
this.limitModel = limitModel;
};
function WebScheduleModel(points){
@ -19,4 +20,13 @@ function WebScheduleModel(points){
function WebPointModel(timeInSecond, load){
this.timeInSecond = timeInSecond;
this.load = load;
}
function LimitModel(params){
this.params = params;
}
function ParameterModel(name, limit){
this.name = name;
this.limit = limit;
}

View File

@ -71,14 +71,11 @@ function getScriptId(scriptName) {
return scriptId;
}
function getPointModelList(allocation,requireLoadArrayObj,executeRangeArrayObj){
function getPointModelList(allocation,chartPoint){
var pointModelList = new Array();
var preExeRange = 0;
var zeroPointModel = new WebPointModel(0,0);
pointModelList.push(zeroPointModel);
for(var i=1;i< requireLoadArrayObj.length;i++){
var realLoad = parseInt(parseInt(requireLoadArrayObj[i].value)*allocation/100);
var pointModel = new WebPointModel(preExeRange+=parseInt(executeRangeArrayObj[i].value),realLoad);
for(var i=0;i< chartPoint.length;i++){
var realLoad = parseInt(parseInt(chartPoint[i][1])*allocation/100);
var pointModel = new WebPointModel(parseInt(chartPoint[i][0]),realLoad);
pointModelList.push(pointModel);
}
return pointModelList;
@ -93,10 +90,6 @@ function start() {
var scriptList = new Array();
var scriptIdList = new Array();
//
var requireLoadArrayObj = $("#test-plan-continuous").find("input[name='RequireLoad']");
var executeRangeArrayObj = $("#test-plan-continuous").find("input[name='ExecuteRange']");
for ( var i = 0; i < input.length; i++)
allocationList.push(parseInt(input[i].value));
@ -118,13 +111,15 @@ function start() {
//delete last |
if(filterTypeMatches != "")
filterTypeMatches = filterTypeMatches.substring(0,filterTypeMatches.length-1);
var chartPoint = currentChart.options.series[0].data;
//get schedule model by selected mode
for ( var k = 0; k < input.length; k++){
var scheduleModel = new WebScheduleModel(getPointModelList(allocationList[k],requireLoadArrayObj,executeRangeArrayObj));
var scheduleModel = new WebScheduleModel(getPointModelList(allocationList[k],chartPoint));
scriptList.push(new ScriptModel(scriptIdList[k],scheduleModel ,isFilterTimer,filterTypeMatches));
}
//collect limit
var name = $("#testConfigurationName").val();
var testPlan = new TestPlanRequestModel(scriptList, ipList, name);
$.ajax({
@ -144,7 +139,18 @@ function start() {
});
}
function loadLimitableFields(){
$.post("getLimitableFields", {}, function(data) {
if(!data.success){
information(data.failedMessage);
return;
}else{
data.limitableFields.fields;//this is list<String>, limitable fields' name
}
}).error(function(){
information($.i18n.prop('failed-connect-server'));
});
}
function createNewScript(){
window.open("script.jsp");
}

View File

@ -81,6 +81,7 @@ function loadSchedulePlot() {
options.series[0].data.push([ExecuteRange,RequireLoad]);
}
var chart = new Highcharts.Chart(options);
currentChart = chart;
}
@ -108,4 +109,9 @@ function toggleIpConfig() {
$("#icon-ip").attr("class", "icon-minus");
else
$("#icon-ip").attr("class", "icon-plus");
}
function changeMode(newModeId, oldModeId){
$("#"+oldModeId).addClass("hide");
$("#"+newModeId).removeClass("hide");
}

View File

@ -1,3 +1,4 @@
var currentChart;
$(document).ready(function() {
loadScripts();
loadSchedulePlot();

View File

@ -80,55 +80,82 @@ body {
<fmt:message key="testPlanConfig" />
</p>
</div>
<div id="loadTestExecutionPlan" class="content-frame row-fluid">
<div class="span4">
<div id="test-plan-continuous" class="form" style="float:left;">
<div id="step-clone-continuous" class="field-line" style="display:none;">
<div id="loadTestExecutionPlan">
<div id="modeSelectDiv" class="modeSelectDiv">
<span class="modeSelectTitle"><fmt:message key="load-mode" />:</span>
<input
type="radio" name="modeSelect" id="customSelected"
class="modeSelectRadio" value="custom mode" onclick="changeMode('customMode','targetMode')" checked>
<span
class="modeSelectLabel"><fmt:message key="custom-mode" /></span>
<input type="radio" name="modeSelect" id="targetSelected"
class="modeSelectRadio" value="target mode" onclick="changeMode('targetMode','customMode')">
<span
class="modeSelectLabel"><fmt:message key="target-mode" /></span>
</div>
<div id="customMode" class="content-frame row-fluid">
<div class="span4">
<div id="test-plan-continuous" class="form" style="float: left;">
<div id="step-clone-continuous" class="field-line"
style="display: none;">
<table id="loadConfig" class="table-margin-top">
<tr>
<td><fmt:message key="test-load" /></td>
<td><fmt:message key="test-excuteRange" />(s)</td>
</tr>
<tr>
<td width="186px"><input name="RequireLoad" class="load-config-input"
type="text" value="10"
<td width="186px"><input name="RequireLoad"
class="load-config-input" type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
<td width="186px"><input name="ExecuteRange" class="load-config-input"
type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" />
<a href="#" class="deleteStep" onClick="deleteStep()"><img src="/images/delete.png" alt="Delete" width="16" height="16"></a></td>
<td width="186px"><input name="ExecuteRange"
class="load-config-input" type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /> <a
href="#" class="deleteStep" onClick="deleteStep()"><img
src="/images/delete.png" alt="Delete" width="16"
height="16"></a></td>
</tr>
</table>
</div>
<div class="field-inline">
<table id="loadConfig" class="table-margin-top">
<tr>
<td><fmt:message key="test-load" /></td>
<td><fmt:message key="test-excuteRange" />(s)</td>
</tr>
<tr>
<td width="186px"><input name="RequireLoad" class="load-config-input"
type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
<td width="186px"><input name="ExecuteRange" class="load-config-input"
type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
</tr>
</table>
</div>
</div>
<button type="submit" class="btn btn-primary" id="addStep">Add step</button>
<span id="loadConfigMessage" class="hide">all input can
not be empty <br />and must be greater than zero!
</span>
</div>
<div class="span8">
<div id="highchartsPlot"></div>
</div>
</div>
</div>
<div class="field-inline">
<table id="loadConfig" class="table-margin-top">
<tr>
<td><fmt:message key="test-load" /></td>
<td><fmt:message key="test-excuteRange" />(s)</td>
</tr>
<tr>
<td width="186px"><input name="RequireLoad"
class="load-config-input" type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
<td width="186px"><input name="ExecuteRange"
class="load-config-input" type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
</tr>
</table>
</div>
</div>
<button type="submit" class="btn btn-primary" id="addStep">Add
step</button>
<span id="loadConfigMessage" class="hide">all input can
not be empty <br />and must be greater than zero!
</span>
</div>
<div class="span8">
<div id="highchartsPlot"></div>
</div>
</div>
<div id="targetMode" class="hide content-frame row-fluid">
<div class="span4">
<span id="loadConfigMessage2" class="hide">all input can
not be empty <br />and must be greater than zero!
</span>
</div>
<div class="span8">
<div id="highchartsPlot2"></div>
</div>
</div>
</div>
<div class="title-frame" onClick="toggleUserScenarios()">
<i class="icon-minus" id="icon-user"></i>
<p class="title">