change test plan submit

This commit is contained in:
hmm 2014-09-05 15:13:06 +08:00
parent 319e2cc646
commit 731edb5ea7
4 changed files with 40 additions and 38 deletions

View File

@ -7,12 +7,10 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class ScheduleModel { public class ScheduleModel {
private List<PointModel> points; private List<PointModel> points;
@XmlElementWrapper(name = "points")
@XmlElement(name = "point")
public List<PointModel> getPoints() { public List<PointModel> getPoints() {
return points; return points;
} }
@ -45,22 +43,28 @@ public class ScheduleModel {
return result; return result;
} }
@XmlRootElement
public static class PointModel { public static class PointModel {
// Time Unit is second // Time Unit is second
private long timeInSecond; private long timeInSecond;
private int load; private int load;
@XmlElement
public PointModel() {
}
public PointModel(long timeInSecond, int load) {
this.setTimeInSecond(timeInSecond);
this.setLoad(load);
}
public long getTimeInSecond() { public long getTimeInSecond() {
return timeInSecond; return timeInSecond;
} }
public void setTimeInSecond(long time) { public void setTimeInSecond(long timeInSecond) {
this.timeInSecond = time; this.timeInSecond = timeInSecond;
} }
@XmlElement
public int getLoad() { public int getLoad() {
return load; return load;
} }
@ -68,13 +72,5 @@ public class ScheduleModel {
public void setLoad(int load) { public void setLoad(int load) {
this.load = load; this.load = load;
} }
public PointModel() {
}
public PointModel(long timeInSecond, int load) {
this.timeInSecond = timeInSecond;
this.load = load;
}
} }
} }

View File

@ -14,7 +14,7 @@ public class WebScriptModel {
public WebScriptModel(int id, int load, ScheduleModel scheduleModel, public WebScriptModel(int id, int load, ScheduleModel scheduleModel,
String filterTypeMatches) { String filterTypeMatches) {
this.id = id; this.id = id;
this.scheduleModel = scheduleModel; this.setScheduleModel(scheduleModel);
this.filterTypeMatches = filterTypeMatches; this.filterTypeMatches = filterTypeMatches;
} }
@ -34,13 +34,7 @@ public class WebScriptModel {
this.isFilterTimer = timer; this.isFilterTimer = timer;
} }
public ScheduleModel getScheduleModel() {
return scheduleModel;
}
public void setScheduleModel(ScheduleModel scheduleModel) {
this.scheduleModel = scheduleModel;
}
public String getFilterTypeMatches() { public String getFilterTypeMatches() {
return filterTypeMatches; return filterTypeMatches;
@ -50,4 +44,12 @@ public class WebScriptModel {
this.filterTypeMatches = filterTypeMatches; this.filterTypeMatches = filterTypeMatches;
} }
public ScheduleModel getScheduleModel() {
return scheduleModel;
}
public void setScheduleModel(ScheduleModel scheduleModel) {
this.scheduleModel = scheduleModel;
}
} }

View File

@ -1,9 +1,6 @@
function ScriptModel(ID, load, warmup, cooldown, executeRange, isFilterTimer, filterTypeMatches) { function ScriptModel(ID, schedule, isFilterTimer, filterTypeMatches) {
this.id = ID; this.id = ID;
this.load = load; this.scheduleModel = schedule;
this.warmup = warmup;
this.executeRange = executeRange;
this.cooldown = cooldown;
this.isFilterTimer = isFilterTimer; this.isFilterTimer = isFilterTimer;
this.filterTypeMatches = filterTypeMatches; this.filterTypeMatches = filterTypeMatches;
}; };

View File

@ -65,7 +65,15 @@ function getScriptId(scriptName) {
return scriptId; return scriptId;
} }
function getPointModelList(allocation,requireLoadArrayObj,executeRangeArrayObj){
var pointModelList = new Array();
for(var i=1;i< requireLoadArrayObj.length;i++){
var realLoad = parseInt(parseInt(requireLoadArrayObj[i].value)*allocation/100);
var pointModel = new WebPointModel(parseInt(executeRangeArrayObj[i].value),realLoad);
pointModelList.push(pointModel);
}
return pointModelList;
}
function start() { function start() {
var scriptList = new Array(); var scriptList = new Array();
@ -73,17 +81,16 @@ function start() {
ipList = getIpList(); ipList = getIpList();
var input = $("#userConfig").find("tbody").find("tr").find(".allocation-input"); var input = $("#userConfig").find("tbody").find("tr").find(".allocation-input");
var allocationList = new Array(); var allocationList = new Array();
var loadList = new Array();
var requireLoad = parseInt($("#RequireLoad").val());
var scriptList = new Array(); var scriptList = new Array();
var scriptIdList = new Array(); var scriptIdList = new Array();
var warmUp = parseInt($("#WarmUp").val());
var coolDown = parseInt($("#CoolDown").val()); //
var executeRange = parseInt($("#ExecuteRange").val()); 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++) for ( var i = 0; i < input.length; i++)
allocationList.push(parseInt(input[i].value)); allocationList.push(parseInt(input[i].value));
for ( var j = 0; j < input.length; j++)
loadList.push(parseInt(requireLoad * allocationList[j] / 100));
scriptIdList = getScriptIdList(); scriptIdList = getScriptIdList();
var isFilterTimer = false; var isFilterTimer = false;
@ -104,8 +111,8 @@ function start() {
filterTypeMatches = filterTypeMatches.substring(0,filterTypeMatches.length-1); filterTypeMatches = filterTypeMatches.substring(0,filterTypeMatches.length-1);
for ( var k = 0; k < input.length; k++){ for ( var k = 0; k < input.length; k++){
scriptList.push(new ScriptModel(scriptIdList[k], loadList[k], warmUp, var scheduleModel = new WebScheduleModel(getPointModelList(allocationList[k],requireLoadArrayObj,executeRangeArrayObj));
coolDown, executeRange,isFilterTimer,filterTypeMatches)); scriptList.push(new ScriptModel(scriptIdList[k],scheduleModel ,isFilterTimer,filterTypeMatches));
} }