add filter think-time and sort the js of testplan
This commit is contained in:
parent
26d689e005
commit
96941bb33b
|
@ -1 +1 @@
|
|||
filter.type.list=text/css,text/html,text/plain,image/*,*javascript,application/json,application/xml
|
||||
filter.type.list=text/css,text/html,text/plain,image/*,*javascript,application/json,application/xml,think-time
|
|
@ -47,8 +47,4 @@ public class TestPlanRequestModel {
|
|||
public void setScriptList(List<WebScriptModel> scriptList) {
|
||||
this.scriptList = scriptList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,9 +8,10 @@ public class WebScriptModel {
|
|||
private long warmup;
|
||||
private long executeRange;
|
||||
private long cooldown;
|
||||
private boolean staticResources;
|
||||
private boolean timer;
|
||||
private boolean isFilterTimer;
|
||||
private String filterTypeMatches = null;
|
||||
|
||||
|
||||
public WebScriptModel() {
|
||||
}
|
||||
public WebScriptModel(int id,int load,long warmup,long executeRange,long cooldown,String filterTypeMatches){
|
||||
|
@ -61,17 +62,11 @@ public class WebScriptModel {
|
|||
public void setCooldown(long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
public boolean isStaticResources() {
|
||||
return staticResources;
|
||||
public boolean isFilterTimer() {
|
||||
return isFilterTimer;
|
||||
}
|
||||
public void setStaticResources(boolean staticResources) {
|
||||
this.staticResources = staticResources;
|
||||
}
|
||||
public boolean isTimer() {
|
||||
return timer;
|
||||
}
|
||||
public void setTimer(boolean timer) {
|
||||
this.timer = timer;
|
||||
public void setIsFilterTimer(boolean timer) {
|
||||
this.isFilterTimer = timer;
|
||||
}
|
||||
public String getFilterTypeMatches() {
|
||||
return filterTypeMatches;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class TestPlanService {
|
|||
runnningScriptModel.setRequireLoad(scriptModel.getLoad());
|
||||
ScriptFilterOptionsModel scriptFilterOptionsModel = new ScriptFilterOptionsModel();
|
||||
scriptFilterOptionsModel.setFilterTypeMatches(scriptModel.getFilterTypeMatches());
|
||||
scriptFilterOptionsModel.setFilterTimer(scriptModel.isTimer());
|
||||
scriptFilterOptionsModel.setFilterTimer(scriptModel.isFilterTimer());
|
||||
|
||||
TestScriptConfig testScriptConfig = new TestScriptConfig();
|
||||
testScriptConfig.setCoolDown(scriptModel.getCooldown());
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
function getIpList() {
|
||||
var inputNode = $("#ipConfig").find("input");
|
||||
var length = inputNode.length;
|
||||
var ipList = new Array();
|
||||
for ( var i = 0; i < length; i++)
|
||||
ipList.push(inputNode[i].value);
|
||||
return ipList;
|
||||
}
|
||||
|
||||
function getScriptIdList() {
|
||||
var select =$("#userConfig").find("select");
|
||||
var scriptNameList = new Array();
|
||||
var scriptIdList = new Array();
|
||||
for ( var i = 0; i < select.length; i++)
|
||||
scriptNameList.push(select[i].options[select[i].selectedIndex].value);
|
||||
for ( var j = 0; j < select.length; j++)
|
||||
scriptIdList.push(getScriptId(scriptNameList[j]));
|
||||
return scriptIdList;
|
||||
|
||||
}
|
||||
function getScriptFilterOptions(){
|
||||
var scriptConfigTr=$("#userConfig").find("tbody").find("tr");
|
||||
var scriptFilterOptions=new Array();
|
||||
for(var i=0;i<scriptConfigTr.length;i++){
|
||||
var td=$(scriptConfigTr[i]).find("td");
|
||||
var staticResources=false;
|
||||
var timer=false;
|
||||
if(td[3].checked ){
|
||||
staticResources=truel
|
||||
}
|
||||
if(td[3].checked){
|
||||
timer=true;
|
||||
}
|
||||
|
||||
scriptFilterOptions.push(new ScriptFilterOptions(staticResources,timer));
|
||||
}
|
||||
return scriptFilterOptions;
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
function ScriptModel(ID, load, warmup, cooldown, executeRange, isFilterTimer, filterTypeMatches) {
|
||||
this.id = ID;
|
||||
this.load = load;
|
||||
this.warmup = warmup;
|
||||
this.executeRange = executeRange;
|
||||
this.cooldown = cooldown;
|
||||
this.isFilterTimer = isFilterTimer;
|
||||
this.filterTypeMatches = filterTypeMatches;
|
||||
}
|
||||
|
||||
|
||||
function TestPlanRequestModel(scriptList, ipList, testPlanName) {
|
||||
this.scriptList = scriptList;
|
||||
this.ipList = ipList;
|
||||
this.testPlanName = testPlanName;
|
||||
};
|
|
@ -0,0 +1,113 @@
|
|||
function loadScripts(){
|
||||
$.post("loadScripts", {}, function(data) {
|
||||
if (!data.success) {
|
||||
information(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.scripts;
|
||||
var script = new Array();
|
||||
for ( var i = 0; i < data.length; i++)
|
||||
script.push(data[i].name);
|
||||
for ( var j = 0; j < script.length; j++) {
|
||||
var textNode = document.createTextNode(script[j]);
|
||||
var optionNode = document.createElement("option");
|
||||
optionNode.setAttribute("value", script[j]);
|
||||
optionNode.appendChild(textNode);
|
||||
var selectNode = document.getElementsByName("select")[0];
|
||||
selectNode.appendChild(optionNode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadFilterTypeList(){
|
||||
$.post("loadFilterTypeList", {}, function(data) {
|
||||
if(!data.success){
|
||||
information(data.failedMessage);
|
||||
return;
|
||||
}else{
|
||||
if(!document.getElementsByClassName('clicked')[0]){
|
||||
var table = $("<table></table>");
|
||||
data = data.filterTypeList;
|
||||
var filter = new Array();
|
||||
for ( var i = 0; i < data.length; i++)
|
||||
filter.push(data[i]);
|
||||
for( var j = 0; j < filter.length; j++){
|
||||
var checkbox = createCheckbox(filter[j],filter[j]);
|
||||
if(j%2==0){
|
||||
var tr = $("<tr></tr>");
|
||||
table.append(tr);
|
||||
}
|
||||
tr.append(checkbox);
|
||||
}
|
||||
$('#filterList').append(table);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getScriptId(scriptName) {
|
||||
var scriptId;
|
||||
$.ajaxSetup({
|
||||
async : false
|
||||
});
|
||||
$.post("loadScripts", {}, function(data) {
|
||||
if (data.success) {
|
||||
data = data.scripts;
|
||||
for ( var i = 0; i < data.length; i++) {
|
||||
if (data[i].name == scriptName) {
|
||||
scriptId = data[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else information(data.failedMessage);
|
||||
});
|
||||
return scriptId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function start() {
|
||||
var scriptList = new Array();
|
||||
var ipList = new Array();
|
||||
ipList = getIpList();
|
||||
var input = $("#userConfig").find("tbody").find("tr").find(".allocation-input");
|
||||
var allocationList = new Array();
|
||||
var loadList = new Array();
|
||||
var requireLoad = parseInt($("#RequireLoad").val());
|
||||
var scriptList = new Array();
|
||||
var scriptIdList = new Array();
|
||||
var warmUp = parseInt($("#WarmUp").val());
|
||||
var coolDown = parseInt($("#CoolDown").val());
|
||||
var executeRange = parseInt($("#ExecuteRange").val());
|
||||
for ( var i = 0; i < input.length; i++)
|
||||
allocationList.push(parseInt(input[i].value));
|
||||
for ( var j = 0; j < input.length; j++)
|
||||
loadList.push(parseInt(requireLoad * allocationList[j] / 100));
|
||||
scriptIdList = getScriptIdList();
|
||||
// var scriptFilterOptions=getScriptFilterOptions();
|
||||
for ( var k = 0; k < input.length; k++){
|
||||
scriptList.push(new ScriptModel(scriptIdList[k], loadList[k], warmUp,
|
||||
coolDown, executeRange));
|
||||
}
|
||||
var filterSelected = $("#filterList div input[name='filterList']:checked");
|
||||
for(var i=0;i<filterSelected.length;i++)
|
||||
filterArray.push(filterSelected[i].id);
|
||||
|
||||
var name = $("#testConfigurationName").val();
|
||||
var testPlan = new TestPlanRequestModel(scriptList, ipList, name);
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "runTestPlan",
|
||||
contentType : "application/json",
|
||||
data : JSON.stringify(testPlan),
|
||||
success : function(data) {
|
||||
if (data.success)
|
||||
window.location.replace("testPlans.jsp");
|
||||
else
|
||||
information(data.failedMessage);
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
function createCheckbox(id,text){
|
||||
var line = $("<td style=\"cursor:pointer;\"></td>");
|
||||
line.click(function(){
|
||||
if(document.getElementById(id).checked){
|
||||
document.getElementById(id).checked = false;
|
||||
}else{
|
||||
document.getElementById(id).checked = true;
|
||||
}
|
||||
|
||||
})
|
||||
var input = $("<input type='checkbox' name='filterList' id="+id+">");
|
||||
input.attr("text",text);
|
||||
line.append(input);
|
||||
line.append(document.createTextNode(text));
|
||||
line.addClass("line");
|
||||
return line;
|
||||
}
|
|
@ -0,0 +1,378 @@
|
|||
$(document).ready(function() {
|
||||
loadScripts();
|
||||
loadSchedulePlot();
|
||||
loadFilterTypeList();
|
||||
});
|
||||
|
||||
$("#selectFilter #ok").click(function() {
|
||||
$("#selectFilter").hide();
|
||||
// $("#selectFilter #ok").addClass("clicked");
|
||||
// filter=[];
|
||||
});
|
||||
$("#createFilter").click(function(){
|
||||
$("#selectFilter").show();
|
||||
})
|
||||
function toggleTestExecutionPlan() {
|
||||
$("#loadTestExecutionPlan").slideToggle();
|
||||
$('#loadConfigMessage').attr("class", "hide");
|
||||
if ($("#icon-load").attr("class") == "icon-plus")
|
||||
$("#icon-load").attr("class", "icon-minus");
|
||||
else
|
||||
$("#icon-load").attr("class", "icon-plus");
|
||||
}
|
||||
function toggleUserScenarios() {
|
||||
$("#userScenarios").slideToggle();
|
||||
$('#alertMessage').attr("class", "hide");
|
||||
$('#userConfigMessage').attr("class", "hide");
|
||||
if ($("#icon-user").attr("class") == "icon-plus")
|
||||
$("#icon-user").attr("class", "icon-minus");
|
||||
else
|
||||
$("#icon-user").attr("class", "icon-plus");
|
||||
}
|
||||
function toggleIpConfig() {
|
||||
$("#ipConfig").slideToggle();
|
||||
$('#ipConfigMessage').attr("class", "hide");
|
||||
if ($("#icon-ip").attr("class").indexOf("icon-plus") >= 0)
|
||||
$("#icon-ip").attr("class", "icon-minus");
|
||||
else
|
||||
$("#icon-ip").attr("class", "icon-plus");
|
||||
}
|
||||
|
||||
var scenarioConfigContent;
|
||||
function addScenario() {
|
||||
|
||||
var newTdNode = document.createElement("td");
|
||||
var newINode = document.createElement("i");
|
||||
newINode.setAttribute("class", "icon-trash");
|
||||
|
||||
newINode.setAttribute("style", "cursor:pointer");
|
||||
|
||||
newINode.setAttribute("onClick", "deleteScenarios(this)");
|
||||
newTdNode.appendChild(newINode);
|
||||
var lastInputNodeValue;
|
||||
var lengthBeforAddAction = $("#userConfig").find("input").length;
|
||||
lastInputNodeValue = document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction - 1].value;
|
||||
if (document.getElementById("userConfig").childNodes.length == 2) {
|
||||
scenarioConfigContent = $("#userConfig").html();
|
||||
document.getElementById("userConfig").innerHTML = $("#userConfig").html()+ scenarioConfigContent;
|
||||
var length = $("#userConfig").find("tr").length;
|
||||
document.getElementById("userConfig").getElementsByTagName("tr")[length - 1].appendChild(newTdNode);
|
||||
} else {
|
||||
document.getElementById("userConfig").innerHTML =$("#userConfig").html()+ scenarioConfigContent;
|
||||
var length = $("#userConfig").find("tr").length;
|
||||
document.getElementById("userConfig").getElementsByTagName("tr")[length - 1].appendChild(newTdNode);
|
||||
}
|
||||
if (lengthBeforAddAction <= 2) {
|
||||
var allocationLess = parseInt(100 / (lengthBeforAddAction + 1));
|
||||
var allocationMore = 100 - parseInt(100 / (lengthBeforAddAction + 1))
|
||||
* lengthBeforAddAction;
|
||||
for ( var i = 0; i < lengthBeforAddAction; i++) {
|
||||
document.getElementById("userConfig").getElementsByTagName("input")[i]
|
||||
.setAttribute("value", allocationLess);
|
||||
}
|
||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction]
|
||||
.setAttribute("value", allocationMore);
|
||||
} else {
|
||||
var allocationLess = parseInt(lastInputNodeValue / 2);
|
||||
var allocationMore = lastInputNodeValue - allocationLess;
|
||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction - 1]
|
||||
.setAttribute("value", allocationLess);
|
||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction]
|
||||
.setAttribute("value", allocationMore);
|
||||
}
|
||||
if ($("#userConfig").find("input").length == 10) {
|
||||
$("#userScenariosButton").attr("class",
|
||||
"btn disabled");
|
||||
$("#userScenariosButton").attr("onClick",
|
||||
"");
|
||||
}
|
||||
changeTotal();
|
||||
checkUserScenarios();
|
||||
}
|
||||
|
||||
function deleteScenarios(selectedNode) {
|
||||
var deleteNode = selectedNode.parentNode.parentNode.parentNode;
|
||||
var Node = deleteNode.parentNode;
|
||||
var previousSiblingNode = deleteNode.previousSibling;
|
||||
Node.removeChild(deleteNode);
|
||||
Node.removeChild(previousSiblingNode);
|
||||
if ($("#userConfig").find("input").length < 10) {
|
||||
$("#userScenariosButton").attr("class",
|
||||
"btn btn-primary");
|
||||
$("#userScenariosButton").attr("onClick",
|
||||
"addScenario()");
|
||||
}
|
||||
changeTotal();
|
||||
checkUserScenarios();
|
||||
}
|
||||
|
||||
function addIP() {
|
||||
var th1 = document.createElement("th");
|
||||
var th2 = document.createElement("th");
|
||||
var th3 = document.createElement("th");
|
||||
var textNode = document.createTextNode("IP:");
|
||||
var inputNode = document.createElement("input");
|
||||
var tr = document.createElement("tr");
|
||||
|
||||
// inputNode.attr({type:"text",class:"ip-input",onblur:"checkIP()"});
|
||||
|
||||
inputNode.setAttribute("type", "text");
|
||||
inputNode.setAttribute("class", "ip-input");
|
||||
inputNode.setAttribute("onblur", "checkIP()");
|
||||
var i = document.createElement("i");
|
||||
i.setAttribute("class", "icon-trash");
|
||||
i.setAttribute("style", "cursor:pointer");
|
||||
i.setAttribute("onClick", "deleteIP(this)");
|
||||
th1.appendChild(textNode);
|
||||
th2.appendChild(inputNode);
|
||||
th3.appendChild(i);
|
||||
tr.appendChild(th1);
|
||||
tr.appendChild(th2);
|
||||
tr.appendChild(th3);
|
||||
document.getElementById("ipConfigTable").appendChild(tr);
|
||||
checkIP();
|
||||
}
|
||||
|
||||
function deleteIP(selectedNode) {
|
||||
var deletedNode = selectedNode.parentNode.parentNode;
|
||||
var parentNode = deletedNode.parentNode;
|
||||
parentNode.removeChild(deletedNode);
|
||||
checkIP();
|
||||
}
|
||||
|
||||
function changeTotal() {
|
||||
var inputNode = $("#userConfig").find(".allocation-input");
|
||||
var total = 0;
|
||||
var length = inputNode.length;
|
||||
for ( var i = 0; i < length; i++) {
|
||||
total = parseInt(total) + parseInt(inputNode[i].value);
|
||||
}
|
||||
document.getElementById("totalNumber").innerHTML = total + "%";
|
||||
checkTotalAllocation();
|
||||
}
|
||||
|
||||
function viewScript(node) {
|
||||
var scriptId;
|
||||
var scriptName;
|
||||
var selectNodes = document.getElementsByName("select");
|
||||
var index = node.parentNode.parentNode.rowIndex - 1;
|
||||
scriptName = selectNodes[index].options[selectNodes[index].selectedIndex].value;
|
||||
scriptId = getScriptId(scriptName);
|
||||
window.open("editScript.jsp?name=" + scriptName + "&scriptId=" + scriptId);
|
||||
}
|
||||
|
||||
function checkTotalAllocation() {
|
||||
if (document.getElementById("totalNumber").childNodes[0].nodeValue == "100%") {
|
||||
$("#totalNumber").attr("class","total-right");
|
||||
$("#alertMessage").attr("class", "hide");
|
||||
} else {
|
||||
$("#totalNumber").attr("class","total-false");
|
||||
$("#alertMessage").attr("class", "show");
|
||||
}
|
||||
}
|
||||
|
||||
function checkRequireLoad() {
|
||||
if (parseInt($("#RequireLoad").val()) <= 0
|
||||
|| $("#RequireLoad").val() == "")
|
||||
$("#RequireLoad").attr("class",
|
||||
"load-config-input-alert");
|
||||
else
|
||||
$("#RequireLoad").attr("class",
|
||||
"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() == "")
|
||||
$("#ExecuteRange").attr("class",
|
||||
"load-config-input-alert");
|
||||
else
|
||||
$("#ExecuteRange").attr("class",
|
||||
"load-config-input");
|
||||
}
|
||||
|
||||
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")
|
||||
$("#loadConfigMessage").attr("class",
|
||||
"hide");
|
||||
else
|
||||
$("#loadConfigMessage").attr("class",
|
||||
"show");
|
||||
}
|
||||
|
||||
function checkUserScenarios() {
|
||||
var input= $("#userScenarios").find("input");
|
||||
var boolean = 0;
|
||||
var number = 0;
|
||||
for ( var i = 0; i < input.length; i++) {
|
||||
if (input[i].value == "" || parseInt(input[i].value) <= 0) {
|
||||
// input[i].setAttribute("class", "allocation-input-alert");
|
||||
boolean = 1;
|
||||
}
|
||||
// else
|
||||
// input[i].setAttribute("class", "allocation-input");
|
||||
}
|
||||
for ( var k = 0; k < input.length; k++) {
|
||||
if ($(input[k]).attr("class") == "allocation-input")
|
||||
number++;
|
||||
}
|
||||
if (number == input.length)
|
||||
boolean = 0;
|
||||
if (boolean == 1)
|
||||
$("#userConfigMessage").attr("class",
|
||||
"show");
|
||||
else
|
||||
$("#userConfigMessage").attr("class",
|
||||
"hide");
|
||||
|
||||
}
|
||||
|
||||
function checkIP() {
|
||||
|
||||
var input = $("#ipConfig").find("input");
|
||||
var patrn = /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/;
|
||||
var boolean = 0;
|
||||
var number = 0;
|
||||
for ( var i = 0; i < input.length; i++) {
|
||||
if (input[i].value == "" || patrn.exec(input[i].value) == null) {
|
||||
input[i].setAttribute("class", "ip-input-alert");
|
||||
boolean = 1;
|
||||
} else
|
||||
input[i].setAttribute("class", "ip-input");
|
||||
}
|
||||
for ( var k = 0; k < input.length; k++) {
|
||||
if (input[k].getAttribute("class") == "ip-input")
|
||||
number++;
|
||||
}
|
||||
if (number == input.length)
|
||||
boolean = 0;
|
||||
if (boolean == 1)
|
||||
$("#ipConfigMessage")
|
||||
.attr("class", "show");
|
||||
else
|
||||
$("#ipConfigMessage")
|
||||
.attr("class", "hide");
|
||||
}
|
||||
|
||||
function checkName() {
|
||||
if ($("#testConfigurationName").val() == "") {
|
||||
$("#testConfigurationName").attr("class",
|
||||
"name-input-alert");
|
||||
$("#nameMessage").attr("class", "show");
|
||||
} else {
|
||||
$("#testConfigurationName").attr("class",
|
||||
"name-input");
|
||||
$("#nameMessage").attr("class", "hide");
|
||||
}
|
||||
}
|
||||
|
||||
function checkAllInpute() {
|
||||
checkLoadConfig();
|
||||
checkUserScenarios();
|
||||
checkIP();
|
||||
checkName();
|
||||
}
|
||||
|
||||
function loadSchedulePlot() {
|
||||
var options = {
|
||||
chart : {
|
||||
renderTo : 'highchartsPlot',
|
||||
defaultSeriesType : 'line',
|
||||
type : 'area',
|
||||
height : 300,
|
||||
|
||||
},
|
||||
plotOptions : {
|
||||
series : {
|
||||
fillOpacity : 0.5,
|
||||
}
|
||||
},
|
||||
credits : {
|
||||
enabled : false
|
||||
},
|
||||
legend : {
|
||||
enabled : false
|
||||
},
|
||||
title : {
|
||||
text : $.i18n.prop('test-loadSchedule') ,
|
||||
x : -50
|
||||
},
|
||||
xAxis : {
|
||||
categories : [ 0 ],
|
||||
min : 0,
|
||||
},
|
||||
yAxis : {
|
||||
plotLines : [ {
|
||||
value : 0,
|
||||
width : 1,
|
||||
color : '#808080'
|
||||
} ],
|
||||
min : 0
|
||||
},
|
||||
tooltip : {
|
||||
formatter : function() {
|
||||
return '<b>' + + '</b><br/>' + this.y
|
||||
+ 'users after' + this.x + 'seconds';
|
||||
}
|
||||
},
|
||||
series : [ {
|
||||
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 chart = new Highcharts.Chart(options);
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
checkAllInpute();
|
||||
if ($("#nameMessage").attr("class") == "hide"
|
||||
&& $("#loadConfigMessage").attr(
|
||||
"class") == "hide"
|
||||
&& $("#alertMessage").attr("class") == "hide"
|
||||
&& $("#userConfigMessage").attr(
|
||||
"class") == "hide"
|
||||
&& $("#ipConfigMessage").attr("class") == "hide")
|
||||
start();
|
||||
}
|
||||
|
||||
function createNewScript(){
|
||||
window.open("script.jsp");
|
||||
}
|
||||
|
||||
|
|
@ -1,75 +1,13 @@
|
|||
var script = new Array();
|
||||
var filter = new Array();
|
||||
var filterArray = new Array();
|
||||
$(document).ready(function() {
|
||||
$.post("loadScripts", {}, function(data) {
|
||||
if (!data.success) {
|
||||
information(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.scripts;
|
||||
for ( var i = 0; i < data.length; i++)
|
||||
script.push(data[i].name);
|
||||
for ( var j = 0; j < script.length; j++) {
|
||||
var textNode = document.createTextNode(script[j]);
|
||||
var optionNode = document.createElement("option");
|
||||
optionNode.setAttribute("value", script[j]);
|
||||
optionNode.appendChild(textNode);
|
||||
var selectNode = document.getElementsByName("select")[0];
|
||||
selectNode.appendChild(optionNode);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
loadScripts();
|
||||
loadSchedulePlot();
|
||||
loadFilterTypeList();
|
||||
});
|
||||
|
||||
|
||||
function createFilter(){
|
||||
$.post("loadFilterTypeList", {}, function(data) {
|
||||
if(!data.success){
|
||||
information(data.failedMessage);
|
||||
return;
|
||||
}else{
|
||||
$('#selectFilter').show();
|
||||
if(!document.getElementsByClassName('clicked')[0]){
|
||||
var table = $("<table></table>");
|
||||
data = data.filterTypeList;
|
||||
for ( var i = 0; i < data.length; i++)
|
||||
filter.push(data[i]);
|
||||
for( var j = 0; j < filter.length; j++){
|
||||
var checkbox = createCheckbox(filter[j],filter[j]);
|
||||
if(j%2==0){
|
||||
var tr = $("<tr></tr>");
|
||||
table.append(tr);
|
||||
}
|
||||
tr.append(checkbox);
|
||||
}
|
||||
$('#filterList').append(table);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createCheckbox(id,text){
|
||||
var line = $("<td></td>");
|
||||
line.click(function(){
|
||||
document.getElementById(id).checked = true;
|
||||
})
|
||||
var input = $("<input type='checkbox' name='filterList' id="+id+">");
|
||||
input.attr("text",text);
|
||||
line.append(input);
|
||||
line.append(document.createTextNode(text));
|
||||
line.addClass("line");
|
||||
return line;
|
||||
}
|
||||
|
||||
$("#selectFilter #ok").click(function() {
|
||||
$("#selectFilter").hide();
|
||||
$("#selectFilter #ok").addClass("clicked");
|
||||
filter=[];
|
||||
// $("#selectFilter #ok").addClass("clicked");
|
||||
// filter=[];
|
||||
});
|
||||
|
||||
function toggleTestExecutionPlan() {
|
||||
|
@ -211,27 +149,6 @@ function changeTotal() {
|
|||
checkTotalAllocation();
|
||||
}
|
||||
|
||||
function getScriptId(scriptName) {
|
||||
var scriptId;
|
||||
$.ajaxSetup({
|
||||
async : false
|
||||
});
|
||||
$.post("loadScripts", {}, function(data) {
|
||||
if (data.success) {
|
||||
data = data.scripts;
|
||||
for ( var i = 0; i < data.length; i++) {
|
||||
if (data[i].name == scriptName) {
|
||||
scriptId = data[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else information(data.failedMessage);
|
||||
});
|
||||
return scriptId;
|
||||
|
||||
}
|
||||
|
||||
function viewScript(node) {
|
||||
var scriptId;
|
||||
var scriptName;
|
||||
|
@ -439,114 +356,6 @@ function loadSchedulePlot() {
|
|||
options.series[0].data.push(0);
|
||||
var chart = new Highcharts.Chart(options);
|
||||
}
|
||||
function ScriptFilterOptions(staticResources,timer){
|
||||
this.staticResources=staticResources;
|
||||
this.timer=timer;
|
||||
}
|
||||
|
||||
|
||||
function ScriptModel(ID, load, warmup, cooldown, executeRange) {
|
||||
this.id = ID;
|
||||
this.load = load;
|
||||
this.warmup = warmup;
|
||||
this.executeRange = executeRange;
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
|
||||
TestPlanRequestModel = function(scriptList, ipList, testPlanName) {
|
||||
this.scriptList = scriptList;
|
||||
this.ipList = ipList;
|
||||
this.testPlanName = testPlanName;
|
||||
|
||||
};
|
||||
|
||||
function getIpList() {
|
||||
var inputNode = $("#ipConfig").find("input");
|
||||
var length = inputNode.length;
|
||||
var ipList = new Array();
|
||||
for ( var i = 0; i < length; i++)
|
||||
ipList.push(inputNode[i].value);
|
||||
return ipList;
|
||||
}
|
||||
|
||||
function getScriptIdList() {
|
||||
var select =$("#userConfig").find("select");
|
||||
var scriptNameList = new Array();
|
||||
var scriptIdList = new Array();
|
||||
for ( var i = 0; i < select.length; i++)
|
||||
scriptNameList.push(select[i].options[select[i].selectedIndex].value);
|
||||
for ( var j = 0; j < select.length; j++)
|
||||
scriptIdList.push(getScriptId(scriptNameList[j]));
|
||||
return scriptIdList;
|
||||
|
||||
}
|
||||
function getScriptFilterOptions(){
|
||||
var scriptConfigTr=$("#userConfig").find("tbody").find("tr");
|
||||
var scriptFilterOptions=new Array();
|
||||
for(var i=0;i<scriptConfigTr.length;i++){
|
||||
var td=$(scriptConfigTr[i]).find("td");
|
||||
var staticResources=false;
|
||||
var timer=false;
|
||||
if(td[3].checked ){
|
||||
staticResources=truel
|
||||
}
|
||||
if(td[3].checked){
|
||||
timer=true;
|
||||
}
|
||||
|
||||
scriptFilterOptions.push(new ScriptFilterOptions(staticResources,timer));
|
||||
}
|
||||
return scriptFilterOptions;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function start() {
|
||||
var scriptList = new Array();
|
||||
var ipList = new Array();
|
||||
ipList = getIpList();
|
||||
var input = $("#userConfig").find("tbody").find("tr").find(".allocation-input");
|
||||
var allocationList = new Array();
|
||||
var loadList = new Array();
|
||||
var requireLoad = parseInt($("#RequireLoad").val());
|
||||
var scriptList = new Array();
|
||||
var scriptIdList = new Array();
|
||||
var warmUp = parseInt($("#WarmUp").val());
|
||||
var coolDown = parseInt($("#CoolDown").val());
|
||||
var executeRange = parseInt($("#ExecuteRange").val());
|
||||
for ( var i = 0; i < input.length; i++)
|
||||
allocationList.push(parseInt(input[i].value));
|
||||
for ( var j = 0; j < input.length; j++)
|
||||
loadList.push(parseInt(requireLoad * allocationList[j] / 100));
|
||||
scriptIdList = getScriptIdList();
|
||||
// var scriptFilterOptions=getScriptFilterOptions();
|
||||
for ( var k = 0; k < input.length; k++){
|
||||
scriptList.push(new ScriptModel(scriptIdList[k], loadList[k], warmUp,
|
||||
coolDown, executeRange));
|
||||
}
|
||||
var filterSelected = $("#filterList div input[name='filterList']:checked");
|
||||
for(var i=0;i<filterSelected.length;i++)
|
||||
filterArray.push(filterSelected[i].id);
|
||||
|
||||
var name = $("#testConfigurationName").val();
|
||||
var testPlan = new TestPlanRequestModel(scriptList, ipList, name);
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "runTestPlan",
|
||||
contentType : "application/json",
|
||||
data : JSON.stringify(testPlan),
|
||||
success : function(data) {
|
||||
if (data.success)
|
||||
window.location.replace("testPlans.jsp");
|
||||
else
|
||||
information(data.failedMessage);
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
checkAllInpute();
|
||||
|
|
|
@ -140,7 +140,6 @@ body {
|
|||
<tr>
|
||||
<th><fmt:message key="allocation" /> %</th>
|
||||
<th><fmt:message key="scriptname" /></th>
|
||||
<th><fmt:message key="filterTime" /></th>
|
||||
<th><fmt:message key="actions" /></th>
|
||||
|
||||
</tr>
|
||||
|
@ -150,10 +149,6 @@ body {
|
|||
<td><input class="allocation-input " value="100"
|
||||
type="text" onblur="changeTotal();checkUserScenarios()" /> %</td>
|
||||
<td><select name="select"></select></td>
|
||||
<td><input type="checkbox" name="timer" value="false"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title=<fmt:message key="timeTip" />> <fmt:message
|
||||
key="filterTime" /><br></td>
|
||||
<td><a href="#" class="button" onClick="viewScript(this)"><img
|
||||
src="images/script_edit.png" alt="Add"> <fmt:message
|
||||
key="test-editScript" /></a></td>
|
||||
|
@ -177,8 +172,7 @@ body {
|
|||
onClick="createNewScript()">
|
||||
<fmt:message key="test_jsp_makeNewScript" />
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" id="createFilter"
|
||||
onClick="createFilter()">
|
||||
<button type="submit" class="btn btn-primary" id="createFilter">
|
||||
<fmt:message key="plugin_jsp_filter" />
|
||||
</button>
|
||||
<div class="modal hide" id="selectFilter">
|
||||
|
@ -232,11 +226,15 @@ body {
|
|||
<script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script>
|
||||
<script src="lib/chrisma/js/jquery.cookie.js"></script>
|
||||
<script src="lib/chrisma/js/theme.js"></script>
|
||||
<script src="script/Share/loadProperties.js"></script>
|
||||
<script src="http://code.highcharts.com/highcharts.js"></script>
|
||||
<script src="script/test.js"></script>
|
||||
<script src="lib/other/jquery.noty.packaged.min.js"></script>
|
||||
<script src="script/scriptManager/uiFactory.js"></script>
|
||||
<script src="script/Share/loadProperties.js"></script>
|
||||
<script src="script/TestPlan/TestPlanModels.js"></script>
|
||||
<script src="script/TestPlan/TestPlanUI.js"></script>
|
||||
<script src="script/TestPlan/TestPlanServer.js"></script>
|
||||
<script src="script/TestPlan/TestPlanDataCollect.js"></script>
|
||||
<script src="script/TestPlan/test.js"></script>
|
||||
</fmt:bundle>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue