submit limitmodel of testplan
This commit is contained in:
parent
b4289bed3b
commit
18d7bf0fbb
|
@ -30,8 +30,6 @@ import org.bench4q.master.domain.service.TestResultSave;
|
||||||
import org.bench4q.master.domain.valueobject.limitation.TestPlanObserver;
|
import org.bench4q.master.domain.valueobject.limitation.TestPlanObserver;
|
||||||
import org.bench4q.master.domain.valueobject.transaction.impl.TestPlanLoadApplication;
|
import org.bench4q.master.domain.valueobject.transaction.impl.TestPlanLoadApplication;
|
||||||
import org.bench4q.share.enums.master.TestPlanStatus;
|
import org.bench4q.share.enums.master.TestPlanStatus;
|
||||||
import org.bench4q.share.helper.MarshalHelper;
|
|
||||||
import org.bench4q.share.models.monitor.LimitModel;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "testplan")
|
@Table(name = "testplan")
|
||||||
|
@ -51,7 +49,7 @@ public class TestPlan implements IAggregate {
|
||||||
private TestResultSave testResultSave;
|
private TestResultSave testResultSave;
|
||||||
private TestPlanRepository repository;
|
private TestPlanRepository repository;
|
||||||
private boolean hasToStop;
|
private boolean hasToStop;
|
||||||
private LimitModel limitModel;
|
private String limitModel;
|
||||||
private List<TestPlanObserver> observers = new ArrayList<TestPlanObserver>();
|
private List<TestPlanObserver> observers = new ArrayList<TestPlanObserver>();
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@ -265,10 +263,9 @@ public class TestPlan implements IAggregate {
|
||||||
}
|
}
|
||||||
//start monitor to check the limit
|
//start monitor to check the limit
|
||||||
UUID testPlanIdUuid = UUID.fromString(this.testPlanRunId);
|
UUID testPlanIdUuid = UUID.fromString(this.testPlanRunId);
|
||||||
String limitModelString = MarshalHelper.tryMarshal(this.limitModel);
|
|
||||||
if (getMonitors() != null) {
|
if (getMonitors() != null) {
|
||||||
for (Monitor monitor : getMonitors()) {
|
for (Monitor monitor : getMonitors()) {
|
||||||
monitor.start(testPlanIdUuid, limitModelString);
|
monitor.start(testPlanIdUuid, this.limitModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,12 +346,12 @@ public class TestPlan implements IAggregate {
|
||||||
this.hasToStop = hasToStop;
|
this.hasToStop = hasToStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transient
|
@Column(name = "limitModel",columnDefinition = "LONGTEXT", nullable = true)
|
||||||
public LimitModel getLimitModel() {
|
public String getLimitModel() {
|
||||||
return limitModel;
|
return limitModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLimitModel(LimitModel limitModel) {
|
public void setLimitModel(String limitModel) {
|
||||||
this.limitModel = limitModel;
|
this.limitModel = limitModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.bench4q.share.models.master.MonitorModel;
|
||||||
import org.bench4q.share.models.master.RunningScriptModel;
|
import org.bench4q.share.models.master.RunningScriptModel;
|
||||||
import org.bench4q.share.models.master.TestPlanModel;
|
import org.bench4q.share.models.master.TestPlanModel;
|
||||||
import org.bench4q.share.models.master.statistics.ScriptResultModel;
|
import org.bench4q.share.models.master.statistics.ScriptResultModel;
|
||||||
|
import org.bench4q.share.models.monitor.LimitModel;
|
||||||
import org.bench4q.share.models.monitor.MonitorMain;
|
import org.bench4q.share.models.monitor.MonitorMain;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -142,7 +143,10 @@ public class TestPlanFactory {
|
||||||
monitors.add(monitorInBusiness);
|
monitors.add(monitorInBusiness);
|
||||||
}
|
}
|
||||||
result.setMonitors(monitors);
|
result.setMonitors(monitors);
|
||||||
result.setLimitModel(testPlanModel.getLimitModel());
|
LimitModel limitModel = testPlanModel.getLimitModel();
|
||||||
|
if(limitModel != null){
|
||||||
|
result.setLimitModel(MarshalHelper.tryMarshal(testPlanModel.getLimitModel()));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,16 @@ function getPointModelList(allocation,chartPoint){
|
||||||
return pointModelList;
|
return pointModelList;
|
||||||
}
|
}
|
||||||
function getLimitValue(){
|
function getLimitValue(){
|
||||||
|
var limitableFieldArray = $("#targetMode").find("input[class='load-config-input limitable-field']");
|
||||||
|
var params = new Array();
|
||||||
|
for(var i=0;i< limitableFieldArray.length;i++){
|
||||||
|
var field = limitableFieldArray[i];
|
||||||
|
var name = field.name;
|
||||||
|
var value = field.value;
|
||||||
|
var param = new ParameterModel(name,value);
|
||||||
|
params.push(param);
|
||||||
|
}
|
||||||
|
return new LimitModel(params);
|
||||||
}
|
}
|
||||||
function start() {
|
function start() {
|
||||||
var scriptList = new Array();
|
var scriptList = new Array();
|
||||||
|
@ -113,6 +122,17 @@ function start() {
|
||||||
//delete last |
|
//delete last |
|
||||||
if(filterTypeMatches != "")
|
if(filterTypeMatches != "")
|
||||||
filterTypeMatches = filterTypeMatches.substring(0,filterTypeMatches.length-1);
|
filterTypeMatches = filterTypeMatches.substring(0,filterTypeMatches.length-1);
|
||||||
|
|
||||||
|
var selectMode = $('input[name="modeSelect"]:checked').val();
|
||||||
|
var currentChart;
|
||||||
|
var limitModel = null;
|
||||||
|
if(selectMode == "custom mode"){
|
||||||
|
currentChart = customChart;
|
||||||
|
}else{
|
||||||
|
currentChart = targetChart;
|
||||||
|
//collect limit
|
||||||
|
limitModel = getLimitValue();
|
||||||
|
}
|
||||||
var chartPoint = currentChart.options.series[0].data;
|
var chartPoint = currentChart.options.series[0].data;
|
||||||
//get schedule model by selected mode
|
//get schedule model by selected mode
|
||||||
for ( var k = 0; k < input.length; k++){
|
for ( var k = 0; k < input.length; k++){
|
||||||
|
@ -120,8 +140,6 @@ function start() {
|
||||||
scriptList.push(new ScriptModel(scriptIdList[k],scheduleModel ,isFilterTimer,filterTypeMatches));
|
scriptList.push(new ScriptModel(scriptIdList[k],scheduleModel ,isFilterTimer,filterTypeMatches));
|
||||||
}
|
}
|
||||||
|
|
||||||
//collect limit
|
|
||||||
var limitModel = getLimitValue();
|
|
||||||
var name = $("#testConfigurationName").val();
|
var name = $("#testConfigurationName").val();
|
||||||
var testPlan = new TestPlanRequestModel(scriptList, ipList, name, limitModel);
|
var testPlan = new TestPlanRequestModel(scriptList, ipList, name, limitModel);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -159,7 +177,7 @@ function loadLimitableFields(){
|
||||||
var tdNode2 = document.createElement("td");
|
var tdNode2 = document.createElement("td");
|
||||||
var inputNode = document.createElement("input");
|
var inputNode = document.createElement("input");
|
||||||
inputNode.setAttribute("name", script[j]);
|
inputNode.setAttribute("name", script[j]);
|
||||||
inputNode.setAttribute("class","load-config-input");
|
inputNode.setAttribute("class","load-config-input limitable-field");
|
||||||
inputNode.setAttribute("type","text");
|
inputNode.setAttribute("type","text");
|
||||||
if(j%2){
|
if(j%2){
|
||||||
tdNode.appendChild(textNode);
|
tdNode.appendChild(textNode);
|
||||||
|
|
|
@ -81,7 +81,7 @@ function loadSchedulePlot() {
|
||||||
options.series[0].data.push([ExecuteRange,RequireLoad]);
|
options.series[0].data.push([ExecuteRange,RequireLoad]);
|
||||||
}
|
}
|
||||||
var chart = new Highcharts.Chart(options);
|
var chart = new Highcharts.Chart(options);
|
||||||
currentChart = chart;
|
customChart = chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ function loadSchedulePlot2() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
series : [ {
|
series : [ {
|
||||||
data : [[ 0 , 0 ]]
|
data : []
|
||||||
} ]
|
} ]
|
||||||
};
|
};
|
||||||
var InitialUsers = parseInt($('input[name="initial-users"]').val());
|
var InitialUsers = parseInt($('input[name="initial-users"]').val());
|
||||||
|
@ -186,5 +186,5 @@ function loadSchedulePlot2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var chart = new Highcharts.Chart(options);
|
var chart = new Highcharts.Chart(options);
|
||||||
currentChart = chart;
|
targetChart = chart;
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
var currentChart;
|
var customChart;
|
||||||
|
var targetChart;
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
loadScripts();
|
loadScripts();
|
||||||
loadSchedulePlot();
|
loadSchedulePlot();
|
||||||
|
|
|
@ -162,7 +162,7 @@ body {
|
||||||
class="load-config-input" type="text" value="10"
|
class="load-config-input" type="text" value="10"
|
||||||
onblur="loadSchedulePlot2();checkLoadConfig()" /></td>
|
onblur="loadSchedulePlot2();checkLoadConfig()" /></td>
|
||||||
<td><input name="maximum-users"
|
<td><input name="maximum-users"
|
||||||
class="load-config-input" type="text" value="10"
|
class="load-config-input" type="text" value="20"
|
||||||
onblur="loadSchedulePlot2();checkLoadConfig()" /></td>
|
onblur="loadSchedulePlot2();checkLoadConfig()" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in New Issue