This commit is contained in:
daisyonly 2014-09-05 10:35:59 +08:00
commit e918b08277
13 changed files with 120 additions and 108 deletions

View File

@ -368,7 +368,7 @@ public class ScriptController extends BaseController {
OperateScriptServerResponseModel responseModel = new OperateScriptServerResponseModel(); OperateScriptServerResponseModel responseModel = new OperateScriptServerResponseModel();
responseModel.setSuccess(isSuccess); responseModel.setSuccess(isSuccess);
responseModel.setFailCauseString(failCauseString); responseModel.setFailCauseString(failCauseString);
responseModel.setHostName(hostName); responseModel.setHostNameString(hostName);
responseModel.setPort(port); responseModel.setPort(port);
responseModel.setFileName(fileName); responseModel.setFileName(fileName);
if (scriptModels == null || scriptModels.size() == 0) { if (scriptModels == null || scriptModels.size() == 0) {

View File

@ -37,16 +37,7 @@ public class OperateScriptServerResponseModel {
public void setFailCauseString(String failCauseString) { public void setFailCauseString(String failCauseString) {
this.failCauseString = failCauseString; this.failCauseString = failCauseString;
} }
@XmlElement
public String getHostNameString() {
return hostNameString;
}
public void setHostName(String hostNameString) {
this.hostNameString = hostNameString;
}
@XmlElement @XmlElement
public int getPort() { public int getPort() {
return port; return port;
@ -65,6 +56,15 @@ public class OperateScriptServerResponseModel {
this.fileName = fileName; this.fileName = fileName;
} }
@XmlElement
public String getHostNameString() {
return hostNameString;
}
public void setHostNameString(String hostNameString) {
this.hostNameString = hostNameString;
}
@XmlElement @XmlElement
public List<ScriptModel> getScriptModels() { public List<ScriptModel> getScriptModels() {
return scriptModels; return scriptModels;

View File

@ -226,11 +226,11 @@ body {
<script src="lib/bootstrap/js/bootstrap-modal.js"></script> <script src="lib/bootstrap/js/bootstrap-modal.js"></script>
<script src="lib/chrisma/js/jquery.cookie.js"></script> <script src="lib/chrisma/js/jquery.cookie.js"></script>
<script src="lib/chrisma/js/theme.js"></script> <script src="lib/chrisma/js/theme.js"></script>
<!-- <script src="script/base.js"></script> -->
<script src="lib/HashMap/HashMap.js"></script> <script src="lib/HashMap/HashMap.js"></script>
<script src="lib/other/jstree.min.js"></script> <script src="lib/other/jstree.min.js"></script>
<script src="lib/other/jquery.msgbox.min.js"></script> <script src="lib/other/jquery.msgbox.min.js"></script>
<script src="lib/other/jquery.noty.packaged.min.js"></script> <script src="lib/other/jquery.noty.packaged.min.js"></script>
<script src="script/base.js"></script>
<script src="script/scriptManager/scriptModels.js"></script> <script src="script/scriptManager/scriptModels.js"></script>
<script src="script/scriptManager/editorFactory.js"></script> <script src="script/scriptManager/editorFactory.js"></script>
<script src="script/scriptManager/containerFactory.js"></script> <script src="script/scriptManager/containerFactory.js"></script>

View File

@ -91,13 +91,15 @@ select{
border:red 2px solid; border:red 2px solid;
} }
.load-config-input{ .load-config-input{
width:100px; width:150px;
} }
.load-config-input-alert{ .load-config-input-alert{
width:100px; width:100px;
border:red 2px solid; border:red 2px solid;
} }
#loadConfig td{
padding-left:50px;
}
.allocation-input{ .allocation-input{
width:100px; width:100px;
} }
@ -112,3 +114,6 @@ select{
width:150px; width:150px;
border:red 2px solid; border:red 2px solid;
} }
#addStep{
margin-left:50px;
}

View File

@ -145,7 +145,7 @@ body {
<div class="modal hide fade" id="myModal"> <div class="modal hide fade" id="myModal">
<div class="modal-header"> <div class="modal-header">
<button type="button" id="myModal-close" class="close" <button type="button" id="myModal-close" class="close"
data-dismiss="modal">×</button> data-dismiss="modal" onclick="resetMsg()">×</button>
<h3> <h3>
<fmt:message key="settings" /> <fmt:message key="settings" />
</h3> </h3>

View File

@ -13,16 +13,16 @@ function startServer() {
$("#target-url2").val($("#target-url").val()); $("#target-url2").val($("#target-url").val());
$('#scriptInfo2').text( $('#scriptInfo2').text(
$.i18n.prop("setProxy")+ $.i18n.prop("setProxy")+
" IP:133.133.2.100" " IP:"+server.hostNameString
+ " ,port: " + server.port + " , port: " + server.port
+ $.i18n.prop("recordScript")) + $.i18n.prop("recordScript"))
$('#stopRecording').attr('disabled', false); $('#stopRecording').attr('disabled', true);
$('#startRecording').attr('disabled', false); $('#startRecording').attr('disabled', false);
startServerSuccess = true; startServerSuccess = true;
stopServerSuccess = false;
} else { } else {
$('#scriptInfo').html( $('#scriptInfo').html(
$.i18n.prop("startServerFail") + data.failedMessage); $.i18n.prop("startServerFail") + data.failedMessage);
information($.i18n.prop("startServerFail") + data.failedMessage);
} }
}, "json"); }, "json");
} }
@ -46,7 +46,6 @@ function startRecording() {
$('#stopRecording').attr('disabled', false); $('#stopRecording').attr('disabled', false);
$('#startRecording').attr('disabled', true); $('#startRecording').attr('disabled', true);
startRecordingSuccess = true; startRecordingSuccess = true;
stopServerSuccess = false;
} }
}, "json"); }, "json");
} else { } else {
@ -63,19 +62,15 @@ function stopRecording() {
if (!data.success) { if (!data.success) {
$('#scriptInfo3').text( $('#scriptInfo3').text(
"stop record server error:" + data.failedMessage); "stop record server error:" + data.failedMessage);
$('#stopRecording').attr('disabled', true);
$('#startRecording').attr('disabled', false); $('#startRecording').attr('disabled', false);
} }
else { else {
$('#scriptInfo3').text($.i18n.prop("stopRecord")); $('#scriptInfo3').text($.i18n.prop("stopRecord"));
$('#stopRecording').attr('disabled', true);
$('#fileName').show(); $('#fileName').show();
stopServer(); stopServer();
stopServerSuccess = true;
startRecordingSuccess = false; startRecordingSuccess = false;
} }
$('#stopRecording').attr('disabled', true);
}, "json"); }, "json");
} else { } else {
$('#scriptInfo3').text("record script server has not started"); $('#scriptInfo3').text("record script server has not started");
@ -91,13 +86,11 @@ function stopServer() {
if (!data.success) { if (!data.success) {
$('#scriptInfo3').text( $('#scriptInfo3').text(
"stop record server error:" + data.failedMessage); "stop record server error:" + data.failedMessage);
$('#stopRecording').attr('disabled', true);
$('#startRecording').attr('disabled', false);
} }
else { else {
stopServerSuccess = true;
startServerSuccess = false; startServerSuccess = false;
} }
$('#startRecording').attr('disabled', false);
}, "json"); }, "json");
} else { } else {
$('#scriptInfo3').text("record script server has not started"); $('#scriptInfo3').text("record script server has not started");

View File

@ -5,12 +5,12 @@ $('.btn-setting').click(function(e) {
function dismiss(container){ function dismiss(container){
$(container).modal('hide'); $(container).modal('hide');
if(startRecordingSuccess && !stopServerSuccess){ if(startRecordingSuccess){
stopRecording(); stopRecording();
$('#fileName').hide(); $('#fileName').hide();
} }else if(startServerSuccess)
if(startServerSuccess && !stopServerSuccess)
stopServer(); stopServer();
resetMsg();
} }
$('#uploadScript') $('#uploadScript')
@ -51,4 +51,7 @@ $(document).ready(function() {
function refresh() { function refresh() {
location.replace(location); location.replace(location);
}
function resetMsg(){
$('#scriptInfo').html($.i18n.prop("startServer"));
} }

View File

@ -16,9 +16,7 @@ function loadScript(table) {
new Date(scripts[i].createDateTime), new Date(scripts[i].createDateTime),
editButton + deleteButton ]).draw().node(); editButton + deleteButton ]).draw().node();
$(tr).attr("id", scripts[i].id); $(tr).attr("id", scripts[i].id);
} }
} else { } else {
information(data.failedMessage); information(data.failedMessage);
} }

View File

@ -59,26 +59,6 @@ function checkRequireLoad() {
"load-config-input"); "load-config-input");
} }
function checkWarmUp() {
if (parseInt($("#WarmUp").val()) <= 0
|| $("#WarmUp").val() == "")
$("#WarmUp").attr("class",
"load-config-input-alert");
else
$("#WarmUp").attr("class",
"load-config-input");
}
function checkCoolDown() {
if (parseInt($("#CoolDown").val()) <= 0
|| $("#CoolDown").val() == "")
$("#CoolDown").attr("class",
"load-config-input-alert");
else
$("#CoolDown").attr("class",
"load-config-input");
}
function checkExecuteRange() { function checkExecuteRange() {
if (parseInt($("#ExecuteRange").val()) <= 0 if (parseInt($("#ExecuteRange").val()) <= 0
|| $("#ExecuteRange").val() == "") || $("#ExecuteRange").val() == "")
@ -91,13 +71,9 @@ function checkExecuteRange() {
function checkLoadConfig() { function checkLoadConfig() {
checkExecuteRange(); checkExecuteRange();
checkCoolDown();
checkRequireLoad(); checkRequireLoad();
checkWarmUp(); if ($('input[name="ExecuteRange"]').attr("class") == "load-config-input"
if ($("#ExecuteRange").attr("class") == "load-config-input" && $('input[name="RequireLoad"]').attr("class") == "load-config-input")
&& $("#CoolDown").attr("class") == "load-config-input"
&& $("#WarmUp").attr("class") == "load-config-input"
&& $("#RequireLoad").attr("class") == "load-config-input")
$("#loadConfigMessage").attr("class", $("#loadConfigMessage").attr("class",
"hide"); "hide");
else else

View File

@ -6,11 +6,20 @@ function ScriptModel(ID, load, warmup, cooldown, executeRange, isFilterTimer, fi
this.cooldown = cooldown; this.cooldown = cooldown;
this.isFilterTimer = isFilterTimer; this.isFilterTimer = isFilterTimer;
this.filterTypeMatches = filterTypeMatches; this.filterTypeMatches = filterTypeMatches;
} };
function TestPlanRequestModel(scriptList, ipList, testPlanName) { function TestPlanRequestModel(scriptList, ipList, testPlanName) {
this.scriptList = scriptList; this.scriptList = scriptList;
this.ipList = ipList; this.ipList = ipList;
this.testPlanName = testPlanName; this.testPlanName = testPlanName;
}; };
function WebScheduleModel(points){
this.points = points;
}
function WebPointModel(timeInSecond, load){
this.timeInSecond = timeInSecond;
this.load = load;
}

View File

@ -24,11 +24,11 @@ function loadSchedulePlot() {
defaultSeriesType : 'line', defaultSeriesType : 'line',
type : 'area', type : 'area',
height : 300, height : 300,
}, },
plotOptions : { plotOptions : {
series : { series : {
fillOpacity : 0.5, fillOpacity : 0.85,
color : '#369bd7'
} }
}, },
credits : { credits : {
@ -44,6 +44,9 @@ function loadSchedulePlot() {
xAxis : { xAxis : {
categories : [ 0 ], categories : [ 0 ],
min : 0, min : 0,
title : {
text : 'Time(s)'
}
}, },
yAxis : { yAxis : {
plotLines : [ { plotLines : [ {
@ -51,6 +54,9 @@ function loadSchedulePlot() {
width : 1, width : 1,
color : '#808080' color : '#808080'
} ], } ],
title : {
text : 'Users'
},
min : 0 min : 0
}, },
tooltip : { tooltip : {
@ -63,16 +69,18 @@ function loadSchedulePlot() {
data : [ 0 ] data : [ 0 ]
} ] } ]
}; };
var RequireLoad = parseInt($("#RequireLoad").val()); var RequireLoadLength = $('input[name="RequireLoad"]').length;
var WarmUp = parseInt($("#WarmUp").val()); var RequireLoad = 0;
var CoolDown = parseInt($("#CoolDown").val()); for(var i = 1; i < RequireLoadLength; i++){
var ExecuteRange = parseInt($("#ExecuteRange").val()); RequireLoad = parseInt($('input[name="RequireLoad"]')[i].value);
options.xAxis.categories.push(WarmUp); options.series[0].data.push(RequireLoad);
options.xAxis.categories.push(WarmUp + ExecuteRange); }
options.xAxis.categories.push(WarmUp + ExecuteRange + CoolDown); var ExecuteRangeLength = $('input[name="ExecuteRange"]').length;
options.series[0].data.push(RequireLoad); var ExecuteRange = 0;
options.series[0].data.push(RequireLoad); for(var i = 1; i < ExecuteRangeLength; i++){
options.series[0].data.push(0); ExecuteRange += parseInt($('input[name="ExecuteRange"]')[i].value);
options.xAxis.categories.push(ExecuteRange);
}
var chart = new Highcharts.Chart(options); var chart = new Highcharts.Chart(options);
} }

View File

@ -9,6 +9,22 @@ $("#selectFilter #ok").click(function() {
$("#createFilter").click(function() { $("#createFilter").click(function() {
$("#selectFilter").show(); $("#selectFilter").show();
}) })
$("#addStep").click(function(){
var clone=$("#step-clone-continuous").clone();
clone.removeAttr('id');
clone.show();
clone.appendTo('#test-plan-continuous');
loadSchedulePlot();
checkLoadConfig();
});
function deleteStep(){
var deleteStep = document.getElementsByClassName('deleteStep');
var length = deleteStep.length;
var deleteObj = $(deleteStep[length-1]).parent().parent().parent().parent().parent();
deleteObj.remove();
loadSchedulePlot();
checkLoadConfig();
}
var scenarioConfigContent; var scenarioConfigContent;
function addScenario() { function addScenario() {
//create delete button //create delete button

View File

@ -82,41 +82,44 @@ body {
</div> </div>
<div id="loadTestExecutionPlan" class="content-frame row-fluid"> <div id="loadTestExecutionPlan" class="content-frame row-fluid">
<div class="span4"> <div class="span4">
<table id="loadConfig" class="table-margin-top"> <div id="test-plan-continuous" class="form" style="float:left;">
<tr> <div id="step-clone-continuous" class="field-line" style="display:none;">
<td><fmt:message key="test-load" /></td> <table id="loadConfig" class="table-margin-top">
<td><input id="RequireLoad" class="load-config-input" <tr>
type="text" value="10" <td><fmt:message key="test-load" /></td>
onblur="loadSchedulePlot();checkLoadConfig()" /></td> <td><fmt:message key="test-excuteRange" />(s)</td>
</tr> </tr>
<tr> <tr>
<td height="15"></td> <td><input name="RequireLoad" class="load-config-input"
</tr> type="text" value="10"
<tr> onblur="loadSchedulePlot();checkLoadConfig()" /></td>
<td><fmt:message key="test-warmUp" />(s)</td> <td width="186px"><input name="ExecuteRange" class="load-config-input"
<td><input id="WarmUp" class="load-config-input" type="text" value="10"
type="text" value="10" onblur="loadSchedulePlot();checkLoadConfig()" />
onblur="loadSchedulePlot();checkLoadConfig()" /></td> <a href="#" class="deleteStep" onClick="deleteStep()"><img src="/images/delete.png" alt="Delete" width="16" height="16"></a></td>
</tr> </tr>
<tr> </table>
<td height="15"></td> </div>
</tr> <div class="field-inline">
<tr> <table id="loadConfig" class="table-margin-top">
<td><fmt:message key="test-coldDown" />(s)</td> <tr>
<td><input id="CoolDown" class="load-config-input" <td><fmt:message key="test-load" /></td>
type="text" value="10" <td><fmt:message key="test-excuteRange" />(s)</td>
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
</tr> </tr>
<tr> <tr>
<td height="15"></td> <td><input name="RequireLoad" class="load-config-input"
</tr> type="text" value="10"
<tr> onblur="loadSchedulePlot();checkLoadConfig()" /></td>
<td><fmt:message key="test-excuteRange" />(s)</td> <td width="186px"><input name="ExecuteRange" class="load-config-input"
<td><input id="ExecuteRange" class="load-config-input" type="text" value="10"
type="text" value="10" onblur="loadSchedulePlot();checkLoadConfig()" /></td>
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
</tr> </tr>
</table> </table>
</div>
</div>
<button type="submit" class="btn btn-primary" id="addStep">Add step</button>
<span id="loadConfigMessage" class="hide">all input can <span id="loadConfigMessage" class="hide">all input can
not be empty <br />and must be greater than zero! not be empty <br />and must be greater than zero!
</span> </span>
@ -225,6 +228,7 @@ body {
<script src="lib/chrisma/js/theme.js"></script> <script src="lib/chrisma/js/theme.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script>
<script src="lib/other/jquery.noty.packaged.min.js"></script> <script src="lib/other/jquery.noty.packaged.min.js"></script>
<script src="script/base.js"></script>
<script src="script/scriptManager/uiFactory.js"></script> <script src="script/scriptManager/uiFactory.js"></script>
<script src="script/Share/loadProperties.js"></script> <script src="script/Share/loadProperties.js"></script>
<script src="script/TestPlan/TestPlanModels.js"></script> <script src="script/TestPlan/TestPlanModels.js"></script>