add loadMonitorResults in history
This commit is contained in:
parent
6a0b391faf
commit
65737b278e
|
@ -2,18 +2,15 @@ package org.bench4q.master.api;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bench4q.master.service.communication.MonitorService;
|
import org.bench4q.master.service.infrastructure.MonitorResultService;
|
||||||
import org.bench4q.master.service.infrastructure.UserService;
|
import org.bench4q.master.service.infrastructure.UserService;
|
||||||
import org.bench4q.share.models.master.MonitorLogicalDiskResponseModel;
|
import org.bench4q.share.models.master.MonitorLogicalDiskResponseModel;
|
||||||
import org.bench4q.share.models.master.MonitorMemoryResponseModel;
|
import org.bench4q.share.models.master.MonitorMemoryResponseModel;
|
||||||
import org.bench4q.share.models.master.MonitorNetworkReponseModel;
|
import org.bench4q.share.models.master.MonitorNetworkReponseModel;
|
||||||
import org.bench4q.share.models.master.MonitorProcessorResponseModel;
|
import org.bench4q.share.models.master.MonitorProcessorResponseModel;
|
||||||
import org.bench4q.share.models.monitor.LogicalDiskModel;
|
|
||||||
import org.bench4q.share.models.monitor.MemoryModel;
|
|
||||||
import org.bench4q.share.models.monitor.NetworkInterfaceModel;
|
|
||||||
import org.bench4q.share.models.monitor.ProcessorModel;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
@ -22,37 +19,28 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(value = "/monitorController")
|
@RequestMapping(value = "/monitorController")
|
||||||
public class MonitorController extends BaseController {
|
public class MonitorController extends BaseController {
|
||||||
private MonitorService monitorService;
|
private MonitorResultService monitorResultService;
|
||||||
|
|
||||||
public MonitorService getMonitorService() {
|
private MonitorResultService getMonitorResultService() {
|
||||||
return monitorService;
|
return monitorResultService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setMonitorService(MonitorService monitorService) {
|
private void setMonitorResultService(
|
||||||
this.monitorService = monitorService;
|
MonitorResultService monitorResultService) {
|
||||||
|
this.monitorResultService = monitorResultService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/logicDiskMonitorSUTInfo", method = RequestMethod.GET)
|
@RequestMapping(value = "/logicDiskMonitorSUTInfo/{testPlanRunId}/{hostName}/{port}/{duationBegin}", method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public MonitorLogicalDiskResponseModel logicDiskMonitorSUTInfo(
|
public MonitorLogicalDiskResponseModel logicDiskMonitorSUTInfo(
|
||||||
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
|
@PathVariable UUID testPlanRunId, @PathVariable String hostName,
|
||||||
@RequestParam int port) {
|
@PathVariable int port, @PathVariable long duationBegin) {
|
||||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||||
return buildDiskResponseModel(false,
|
return null;
|
||||||
"you don't have the power to check the monitor", null);
|
|
||||||
}
|
}
|
||||||
return buildDiskResponseModel(true, "", this.getMonitorService()
|
return this.getMonitorResultService().loadLogicalDiskResults(
|
||||||
.logicDisk(testPlanRunId, hostName, port));
|
testPlanRunId, hostName, port, duationBegin);
|
||||||
}
|
|
||||||
|
|
||||||
private MonitorLogicalDiskResponseModel buildDiskResponseModel(
|
|
||||||
boolean success, String failCause, LogicalDiskModel logicalDiskModel) {
|
|
||||||
MonitorLogicalDiskResponseModel result = new MonitorLogicalDiskResponseModel();
|
|
||||||
result.setSuccess(success);
|
|
||||||
result.setFailCause(failCause);
|
|
||||||
result.setLogicalDiskModel(logicalDiskModel);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/memorySUTInfo", method = { RequestMethod.GET,
|
@RequestMapping(value = "/memorySUTInfo", method = { RequestMethod.GET,
|
||||||
|
@ -60,66 +48,36 @@ public class MonitorController extends BaseController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public MonitorMemoryResponseModel memorySUTInfo(
|
public MonitorMemoryResponseModel memorySUTInfo(
|
||||||
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
|
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
|
||||||
@RequestParam int port) {
|
@RequestParam int port, @RequestParam long duationBegin) {
|
||||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||||
return buildMemoryResponseModel(false, "no scope for memory ", null);
|
return null;
|
||||||
}
|
}
|
||||||
return buildMemoryResponseModel(true, "", this.getMonitorService()
|
return this.getMonitorResultService().loadMemoryModels(testPlanRunId,
|
||||||
.memory(testPlanRunId, hostName, port));
|
hostName, port, duationBegin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MonitorMemoryResponseModel buildMemoryResponseModel(
|
@RequestMapping(value = "/processorSUTInfo", method = { RequestMethod.GET })
|
||||||
boolean success, String failCause, MemoryModel memoryModel) {
|
|
||||||
MonitorMemoryResponseModel result = new MonitorMemoryResponseModel();
|
|
||||||
result.setSuccess(success);
|
|
||||||
result.setFailCause(failCause);
|
|
||||||
result.setMemoryModel(memoryModel);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/processorSUTInfo", method = { RequestMethod.GET,
|
|
||||||
RequestMethod.POST })
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public MonitorProcessorResponseModel processorSUTInfo(
|
public MonitorProcessorResponseModel processorSUTInfo(
|
||||||
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
|
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
|
||||||
@RequestParam int port) {
|
@RequestParam int port, @RequestParam long duationBegin) {
|
||||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||||
return buildProcessorResponseModel(false, "no scope for processor",
|
return null;
|
||||||
null);
|
|
||||||
}
|
}
|
||||||
return buildProcessorResponseModel(true, "", this.getMonitorService()
|
return this.getMonitorResultService().loadProcessorModels(
|
||||||
.processor(testPlanRunId, hostName, port));
|
testPlanRunId, hostName, port, duationBegin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MonitorProcessorResponseModel buildProcessorResponseModel(
|
@RequestMapping(value = "/networkInfo", method = { RequestMethod.GET })
|
||||||
boolean success, String failCause, ProcessorModel processorModel) {
|
|
||||||
MonitorProcessorResponseModel resultModel = new MonitorProcessorResponseModel();
|
|
||||||
resultModel.setSuccess(success);
|
|
||||||
resultModel.setFailCause(failCause);
|
|
||||||
resultModel.setProcessorModel(processorModel);
|
|
||||||
return resultModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/networkInfo", method = { RequestMethod.GET,
|
|
||||||
RequestMethod.POST })
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public MonitorNetworkReponseModel networkInfo(
|
public MonitorNetworkReponseModel networkInfo(
|
||||||
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
|
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
|
||||||
@RequestParam int port) {
|
@RequestParam int port, @RequestParam long duationBegin) {
|
||||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||||
return buildNetworkResponseModel(false, "no scope for network",
|
return null;
|
||||||
null);
|
|
||||||
}
|
}
|
||||||
return buildNetworkResponseModel(true, "", this.getMonitorService()
|
return this.getMonitorResultService().loadNetworkInterfaceModels(
|
||||||
.networkInterface(testPlanRunId, hostName, port));
|
testPlanRunId, hostName, port, duationBegin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MonitorNetworkReponseModel buildNetworkResponseModel(
|
|
||||||
boolean success, String failCause, NetworkInterfaceModel model) {
|
|
||||||
MonitorNetworkReponseModel result = new MonitorNetworkReponseModel();
|
|
||||||
result.setSuccess(success);
|
|
||||||
result.setFailCause(failCause);
|
|
||||||
result.setModel(model);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue