diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/TestPlan.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/TestPlan.java index 731f07f2..9ff78811 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/TestPlan.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/TestPlan.java @@ -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.transaction.impl.TestPlanLoadApplication; import org.bench4q.share.enums.master.TestPlanStatus; -import org.bench4q.share.helper.MarshalHelper; -import org.bench4q.share.models.monitor.LimitModel; @Entity @Table(name = "testplan") @@ -51,7 +49,7 @@ public class TestPlan implements IAggregate { private TestResultSave testResultSave; private TestPlanRepository repository; private boolean hasToStop; - private LimitModel limitModel; + private String limitModel; private List observers = new ArrayList(); @Id @@ -265,10 +263,9 @@ public class TestPlan implements IAggregate { } //start monitor to check the limit UUID testPlanIdUuid = UUID.fromString(this.testPlanRunId); - String limitModelString = MarshalHelper.tryMarshal(this.limitModel); if (getMonitors() != null) { 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; } - @Transient - public LimitModel getLimitModel() { + @Column(name = "limitModel",columnDefinition = "LONGTEXT", nullable = true) + public String getLimitModel() { return limitModel; } - public void setLimitModel(LimitModel limitModel) { + public void setLimitModel(String limitModel) { this.limitModel = limitModel; } diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/factory/TestPlanFactory.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/factory/TestPlanFactory.java index 95c230a0..08dd37fd 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/factory/TestPlanFactory.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/factory/TestPlanFactory.java @@ -43,6 +43,7 @@ import org.bench4q.share.models.master.MonitorModel; import org.bench4q.share.models.master.RunningScriptModel; import org.bench4q.share.models.master.TestPlanModel; import org.bench4q.share.models.master.statistics.ScriptResultModel; +import org.bench4q.share.models.monitor.LimitModel; import org.bench4q.share.models.monitor.MonitorMain; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -142,7 +143,10 @@ public class TestPlanFactory { monitors.add(monitorInBusiness); } result.setMonitors(monitors); - result.setLimitModel(testPlanModel.getLimitModel()); + LimitModel limitModel = testPlanModel.getLimitModel(); + if(limitModel != null){ + result.setLimitModel(MarshalHelper.tryMarshal(testPlanModel.getLimitModel())); + } return result; } diff --git a/Bench4Q-Web/src/main/webapp/script/TestPlan/TestPlanServer.js b/Bench4Q-Web/src/main/webapp/script/TestPlan/TestPlanServer.js index 5825d460..d6ce8162 100644 --- a/Bench4Q-Web/src/main/webapp/script/TestPlan/TestPlanServer.js +++ b/Bench4Q-Web/src/main/webapp/script/TestPlan/TestPlanServer.js @@ -81,7 +81,16 @@ function getPointModelList(allocation,chartPoint){ return pointModelList; } 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() { var scriptList = new Array(); @@ -113,6 +122,17 @@ function start() { //delete last | if(filterTypeMatches != "") 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; //get schedule model by selected mode for ( var k = 0; k < input.length; k++){ @@ -120,8 +140,6 @@ function start() { scriptList.push(new ScriptModel(scriptIdList[k],scheduleModel ,isFilterTimer,filterTypeMatches)); } - //collect limit - var limitModel = getLimitValue(); var name = $("#testConfigurationName").val(); var testPlan = new TestPlanRequestModel(scriptList, ipList, name, limitModel); $.ajax({ @@ -159,7 +177,7 @@ function loadLimitableFields(){ var tdNode2 = document.createElement("td"); var inputNode = document.createElement("input"); inputNode.setAttribute("name", script[j]); - inputNode.setAttribute("class","load-config-input"); + inputNode.setAttribute("class","load-config-input limitable-field"); inputNode.setAttribute("type","text"); if(j%2){ tdNode.appendChild(textNode); diff --git a/Bench4Q-Web/src/main/webapp/script/TestPlan/TestPlanUI.js b/Bench4Q-Web/src/main/webapp/script/TestPlan/TestPlanUI.js index b38fece6..11efec70 100644 --- a/Bench4Q-Web/src/main/webapp/script/TestPlan/TestPlanUI.js +++ b/Bench4Q-Web/src/main/webapp/script/TestPlan/TestPlanUI.js @@ -81,7 +81,7 @@ function loadSchedulePlot() { options.series[0].data.push([ExecuteRange,RequireLoad]); } var chart = new Highcharts.Chart(options); - currentChart = chart; + customChart = chart; } @@ -172,7 +172,7 @@ function loadSchedulePlot2() { } }, series : [ { - data : [[ 0 , 0 ]] + data : [] } ] }; var InitialUsers = parseInt($('input[name="initial-users"]').val()); @@ -186,5 +186,5 @@ function loadSchedulePlot2() { } var chart = new Highcharts.Chart(options); - currentChart = chart; + targetChart = chart; } \ No newline at end of file diff --git a/Bench4Q-Web/src/main/webapp/script/TestPlan/test.js b/Bench4Q-Web/src/main/webapp/script/TestPlan/test.js index 12d1c3b7..0f808a90 100644 --- a/Bench4Q-Web/src/main/webapp/script/TestPlan/test.js +++ b/Bench4Q-Web/src/main/webapp/script/TestPlan/test.js @@ -1,4 +1,5 @@ -var currentChart; +var customChart; +var targetChart; $(document).ready(function() { loadScripts(); loadSchedulePlot(); diff --git a/Bench4Q-Web/src/main/webapp/test.jsp b/Bench4Q-Web/src/main/webapp/test.jsp index dd964734..9a60bff7 100644 --- a/Bench4Q-Web/src/main/webapp/test.jsp +++ b/Bench4Q-Web/src/main/webapp/test.jsp @@ -162,7 +162,7 @@ body { class="load-config-input" type="text" value="10" onblur="loadSchedulePlot2();checkLoadConfig()" />