From 667692794465d81bb19ab698bd4f038c91bc79bc Mon Sep 17 00:00:00 2001 From: coderfengyun Date: Fri, 19 Sep 2014 13:47:44 +0800 Subject: [PATCH] add new api for query fields can be limited add new api for query fields can be limited --- .../bench4q/monitor/api/MainController.java | 9 +++++++- .../monitor/model/LimitableFieldsModel.java | 23 +++++++++++++++++++ .../TestBench4qTestScriptAdapter.java | 4 ++-- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/LimitableFieldsModel.java diff --git a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java index 31ea4747..f613a718 100644 --- a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java +++ b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java @@ -4,6 +4,7 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import org.bench4q.monitor.model.LimitModel; +import org.bench4q.monitor.model.LimitableFieldsModel; import org.bench4q.monitor.model.MonitorMain; import org.hyperic.sigar.SigarException; import org.springframework.stereotype.Controller; @@ -24,7 +25,13 @@ public class MainController { return retModel; } - @RequestMapping("/startMonitor/{testPlanId}") + @RequestMapping(value = "/limitableFields") + @ResponseBody + public LimitableFieldsModel limitableFields() { + return new LimitableFieldsModel(); + } + + @RequestMapping(value = "/startMonitor/{testPlanId}", method = RequestMethod.PUT) @ResponseBody public String start(@PathVariable UUID testPlanId, @RequestBody LimitModel limits) { diff --git a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/LimitableFieldsModel.java b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/LimitableFieldsModel.java new file mode 100644 index 00000000..49ab3c45 --- /dev/null +++ b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/LimitableFieldsModel.java @@ -0,0 +1,23 @@ +package org.bench4q.monitor.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class LimitableFieldsModel { + private List fields; + + @XmlElementWrapper(name = "fieldList") + @XmlElement(name = "field") + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } + +} diff --git a/Bench4Q-Recorder/src/test/java/org/bench4q/recorder/TestBench4qTestScriptAdapter.java b/Bench4Q-Recorder/src/test/java/org/bench4q/recorder/TestBench4qTestScriptAdapter.java index de9fc850..2f7a01ad 100644 --- a/Bench4Q-Recorder/src/test/java/org/bench4q/recorder/TestBench4qTestScriptAdapter.java +++ b/Bench4Q-Recorder/src/test/java/org/bench4q/recorder/TestBench4qTestScriptAdapter.java @@ -9,6 +9,7 @@ import org.bench4q.recorder.httpcapture.Bench4qTestScriptAdapter; import org.bench4q.share.helper.RunScenarioModelHelper; import org.bench4q.share.models.agent.ParameterModel; import org.bench4q.share.models.agent.RunScenarioModel; +import org.bench4q.share.models.agent.scriptrecord.BehaviorModel; import org.junit.Test; public class TestBench4qTestScriptAdapter { @@ -34,8 +35,7 @@ public class TestBench4qTestScriptAdapter { params.add(RunScenarioModelHelper.createParameterModel("url", "www.baidu.com")); this.getBench4qTestScriptAdapter().insertUserBehaviorsToScenario( - RunScenarioModelHelper.createUserBehaviorModel(0, "http", - "get", params)); + BehaviorModel.UserBehaviorBuilder(0, "http", "get", params)); assertEquals( 1, RunScenarioModelHelper.getBatches(