add Limit api

add Limit api: need to implement
This commit is contained in:
liuchongrui 2014-09-19 10:50:33 +08:00
parent 846c226496
commit 41894813a2
2 changed files with 67 additions and 1 deletions

View File

@ -1,11 +1,16 @@
package org.bench4q.monitor.api;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import org.bench4q.monitor.model.LimitModel;
import org.bench4q.monitor.model.MonitorMain;
import org.hyperic.sigar.SigarException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@ -13,9 +18,23 @@ import org.springframework.web.bind.annotation.ResponseBody;
public class MainController {
@RequestMapping("/all")
@ResponseBody
MonitorMain getMainModel() throws SigarException, InterruptedException, ExecutionException {
MonitorMain getMainModel() throws SigarException, InterruptedException,
ExecutionException {
MonitorMain retModel = new MonitorMain();
return retModel;
}
@RequestMapping("/startMonitor/{testPlanId}")
@ResponseBody
public String start(@PathVariable UUID testPlanId,
@RequestBody LimitModel limits) {
return new String("startted");
}
@RequestMapping(value = "/{testPlanId}", method = RequestMethod.GET)
@ResponseBody
MonitorMain brief(@PathVariable UUID testPlanId) throws SigarException,
InterruptedException, ExecutionException {
return new MonitorMain();
}
}

View File

@ -0,0 +1,47 @@
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 LimitModel {
@XmlElementWrapper
@XmlElement
private List<ParameterModel> params;
public List<ParameterModel> getParams() {
return params;
}
public void setParams(List<ParameterModel> params) {
this.params = params;
}
@XmlRootElement
public static class ParameterModel {
private String name;
private double limit;
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElement
public double getLimit() {
return limit;
}
public void setLimit(double limit) {
this.limit = limit;
}
}
}