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();
responseModel.setSuccess(isSuccess);
responseModel.setFailCauseString(failCauseString);
responseModel.setHostName(hostName);
responseModel.setHostNameString(hostName);
responseModel.setPort(port);
responseModel.setFileName(fileName);
if (scriptModels == null || scriptModels.size() == 0) {

View File

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

View File

@ -226,11 +226,11 @@ body {
<script src="lib/bootstrap/js/bootstrap-modal.js"></script>
<script src="lib/chrisma/js/jquery.cookie.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/other/jstree.min.js"></script>
<script src="lib/other/jquery.msgbox.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/editorFactory.js"></script>
<script src="script/scriptManager/containerFactory.js"></script>

View File

@ -91,13 +91,15 @@ select{
border:red 2px solid;
}
.load-config-input{
width:100px;
width:150px;
}
.load-config-input-alert{
width:100px;
border:red 2px solid;
}
#loadConfig td{
padding-left:50px;
}
.allocation-input{
width:100px;
}
@ -112,3 +114,6 @@ select{
width:150px;
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-header">
<button type="button" id="myModal-close" class="close"
data-dismiss="modal">×</button>
data-dismiss="modal" onclick="resetMsg()">×</button>
<h3>
<fmt:message key="settings" />
</h3>

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ function ScriptModel(ID, load, warmup, cooldown, executeRange, isFilterTimer, fi
this.cooldown = cooldown;
this.isFilterTimer = isFilterTimer;
this.filterTypeMatches = filterTypeMatches;
}
};
function TestPlanRequestModel(scriptList, ipList, testPlanName) {
@ -14,3 +14,12 @@ function TestPlanRequestModel(scriptList, ipList, testPlanName) {
this.ipList = ipList;
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',
type : 'area',
height : 300,
},
plotOptions : {
series : {
fillOpacity : 0.5,
fillOpacity : 0.85,
color : '#369bd7'
}
},
credits : {
@ -44,6 +44,9 @@ function loadSchedulePlot() {
xAxis : {
categories : [ 0 ],
min : 0,
title : {
text : 'Time(s)'
}
},
yAxis : {
plotLines : [ {
@ -51,6 +54,9 @@ function loadSchedulePlot() {
width : 1,
color : '#808080'
} ],
title : {
text : 'Users'
},
min : 0
},
tooltip : {
@ -63,16 +69,18 @@ function loadSchedulePlot() {
data : [ 0 ]
} ]
};
var RequireLoad = parseInt($("#RequireLoad").val());
var WarmUp = parseInt($("#WarmUp").val());
var CoolDown = parseInt($("#CoolDown").val());
var ExecuteRange = parseInt($("#ExecuteRange").val());
options.xAxis.categories.push(WarmUp);
options.xAxis.categories.push(WarmUp + ExecuteRange);
options.xAxis.categories.push(WarmUp + ExecuteRange + CoolDown);
options.series[0].data.push(RequireLoad);
options.series[0].data.push(RequireLoad);
options.series[0].data.push(0);
var RequireLoadLength = $('input[name="RequireLoad"]').length;
var RequireLoad = 0;
for(var i = 1; i < RequireLoadLength; i++){
RequireLoad = parseInt($('input[name="RequireLoad"]')[i].value);
options.series[0].data.push(RequireLoad);
}
var ExecuteRangeLength = $('input[name="ExecuteRange"]').length;
var ExecuteRange = 0;
for(var i = 1; i < ExecuteRangeLength; i++){
ExecuteRange += parseInt($('input[name="ExecuteRange"]')[i].value);
options.xAxis.categories.push(ExecuteRange);
}
var chart = new Highcharts.Chart(options);
}

View File

@ -9,6 +9,22 @@ $("#selectFilter #ok").click(function() {
$("#createFilter").click(function() {
$("#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;
function addScenario() {
//create delete button

View File

@ -82,41 +82,44 @@ body {
</div>
<div id="loadTestExecutionPlan" class="content-frame row-fluid">
<div class="span4">
<table id="loadConfig" class="table-margin-top">
<tr>
<td><fmt:message key="test-load" /></td>
<td><input id="RequireLoad" class="load-config-input"
type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
</tr>
<tr>
<td height="15"></td>
</tr>
<tr>
<td><fmt:message key="test-warmUp" />(s)</td>
<td><input id="WarmUp" class="load-config-input"
type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
</tr>
<tr>
<td height="15"></td>
</tr>
<tr>
<td><fmt:message key="test-coldDown" />(s)</td>
<td><input id="CoolDown" class="load-config-input"
type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
</tr>
<tr>
<td height="15"></td>
</tr>
<tr>
<td><fmt:message key="test-excuteRange" />(s)</td>
<td><input id="ExecuteRange" class="load-config-input"
type="text" value="10"
onblur="loadSchedulePlot();checkLoadConfig()" /></td>
</tr>
</table>
<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><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>
</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><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>
@ -225,6 +228,7 @@ body {
<script src="lib/chrisma/js/theme.js"></script>
<script src="http://code.highcharts.com/highcharts.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/Share/loadProperties.js"></script>
<script src="script/TestPlan/TestPlanModels.js"></script>