start monitor in TestMonitorSampler

change LimitModel in monitor
This commit is contained in:
hmm 2014-09-25 13:40:43 +08:00
parent 18d7bf0fbb
commit 89b6e39e0c
3 changed files with 13 additions and 10 deletions

View File

@ -47,13 +47,7 @@ public class Monitor {
private Set<MonitorResult> results; private Set<MonitorResult> results;
private Logger logger = Logger.getLogger(Monitor.class); private Logger logger = Logger.getLogger(Monitor.class);
private TestPlanFactory testPlanFactory; private TestPlanFactory testPlanFactory;
private MonitorMessenger monitorMessenger;
@Autowired
private void setMonitorMessenger(MonitorMessenger monitorMessenger) {
this.monitorMessenger = monitorMessenger;
}
public Monitor() { public Monitor() {
this.results = new HashSet<MonitorResult>(); this.results = new HashSet<MonitorResult>();
} }
@ -111,7 +105,7 @@ public class Monitor {
return ApplicationContextHelper.getContext().getBean( return ApplicationContextHelper.getContext().getBean(
TestMonitorSampler.class); TestMonitorSampler.class);
} }
@Transient @Transient
public TestPlanFactory getTestPlanFactory() { public TestPlanFactory getTestPlanFactory() {
return testPlanFactory; return testPlanFactory;
@ -144,7 +138,7 @@ public class Monitor {
} }
public void start(UUID testPlanId, String limitModel){ public void start(UUID testPlanId, String limitModel){
monitorMessenger.startMonitor(hostName, port, testPlanId, limitModel); this.getTestMonitorSampler().startMonitor(hostName, port, testPlanId, limitModel);
} }
public List<MonitorResult> createFinishedResult() { public List<MonitorResult> createFinishedResult() {

View File

@ -1,5 +1,7 @@
package org.bench4q.master.domain.valueobject.datastatistics; package org.bench4q.master.domain.valueobject.datastatistics;
import java.util.UUID;
import org.bench4q.master.infrastructure.communication.MonitorMessenger; import org.bench4q.master.infrastructure.communication.MonitorMessenger;
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;
@ -19,4 +21,7 @@ public class TestMonitorSampler {
return this.monitorMessenger.monitorModel(hostName, port); return this.monitorMessenger.monitorModel(hostName, port);
} }
public boolean startMonitor(String hostName, int port, UUID testPlanId, String limitModel){
return this.monitorMessenger.startMonitor(hostName, port, testPlanId, limitModel);
}
} }

View File

@ -5,13 +5,15 @@ import java.util.List;
import javax.xml.bind.annotation.XmlElement; 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;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement @XmlRootElement
public class LimitModel { public class LimitModel {
@XmlElementWrapper
@XmlElement
private List<ParameterModel> params; private List<ParameterModel> params;
@XmlElementWrapper(name = "limitParameterList")
@XmlElement(name = "limitParameter")
public List<ParameterModel> getParams() { public List<ParameterModel> getParams() {
return params; return params;
} }
@ -20,7 +22,9 @@ public class LimitModel {
this.params = params; this.params = params;
} }
@XmlRootElement @XmlRootElement
@XmlType(name = "limitParameterModel")
public static class ParameterModel { public static class ParameterModel {
private String name; private String name;
private double limit; private double limit;