remove the bug

This commit is contained in:
coderfengyun 2014-01-07 17:09:56 +08:00
parent 260140ba04
commit c956248fce
2 changed files with 38 additions and 24 deletions

View File

@ -2,6 +2,7 @@ package org.bench4q.master.api;
import java.util.UUID;
import org.bench4q.master.exception.Bench4QException;
import org.bench4q.master.service.infrastructure.MonitorResultService;
import org.bench4q.master.service.infrastructure.UserService;
import org.bench4q.share.models.master.MonitorLogicalDiskResponseModel;
@ -35,12 +36,16 @@ public class MonitorController extends BaseController {
@ResponseBody
public MonitorLogicalDiskResponseModel logicDiskMonitorSUTInfo(
@PathVariable UUID testPlanRunId, @PathVariable String hostName,
@PathVariable int port, @PathVariable long duationBegin) {
@PathVariable int port, @PathVariable long duationBegin)
throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
return null;
throw new Bench4QException(400 + "", "not permitted",
"/{testPlanRunId}/script/{scriptId}/{fieldName}");
}
return this.getMonitorResultService().loadLogicalDiskResults(
testPlanRunId, hostName, port, duationBegin);
MonitorLogicalDiskResponseModel ret = this.getMonitorResultService()
.loadLogicalDiskResults(testPlanRunId, hostName, port,
duationBegin);
return ret == null ? new MonitorLogicalDiskResponseModel() : ret;
}
@RequestMapping(value = "/memorySUTInfo", method = { RequestMethod.GET,
@ -48,36 +53,46 @@ public class MonitorController extends BaseController {
@ResponseBody
public MonitorMemoryResponseModel memorySUTInfo(
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
@RequestParam int port, @RequestParam long duationBegin) {
@RequestParam int port, @RequestParam long duationBegin)
throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
return null;
throw new Bench4QException(400 + "", "not permitted",
"/memorySUTInfo");
}
return this.getMonitorResultService().loadMemoryModels(testPlanRunId,
hostName, port, duationBegin);
MonitorMemoryResponseModel ret = this.getMonitorResultService()
.loadMemoryModels(testPlanRunId, hostName, port, duationBegin);
return ret == null ? new MonitorMemoryResponseModel() : ret;
}
@RequestMapping(value = "/processorSUTInfo", method = { RequestMethod.GET })
@ResponseBody
public MonitorProcessorResponseModel processorSUTInfo(
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
@RequestParam int port, @RequestParam long duationBegin) {
@RequestParam int port, @RequestParam long duationBegin)
throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
return null;
throw new Bench4QException(400 + "", "not permitted",
"/processorSUTInfo");
}
return this.getMonitorResultService().loadProcessorModels(
testPlanRunId, hostName, port, duationBegin);
MonitorProcessorResponseModel ret = this.getMonitorResultService()
.loadProcessorModels(testPlanRunId, hostName, port,
duationBegin);
return ret == null ? new MonitorProcessorResponseModel() : ret;
}
@RequestMapping(value = "/networkInfo", method = { RequestMethod.GET })
@ResponseBody
public MonitorNetworkReponseModel networkInfo(
@RequestParam UUID testPlanRunId, @RequestParam String hostName,
@RequestParam int port, @RequestParam long duationBegin) {
@RequestParam int port, @RequestParam long duationBegin)
throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
return null;
throw new Bench4QException(400 + "", "not permitted",
"/networkInfo");
}
return this.getMonitorResultService().loadNetworkInterfaceModels(
testPlanRunId, hostName, port, duationBegin);
MonitorNetworkReponseModel ret = this.getMonitorResultService()
.loadNetworkInterfaceModels(testPlanRunId, hostName, port,
duationBegin);
return ret == null ? new MonitorNetworkReponseModel() : ret;
}
}

View File

@ -38,7 +38,7 @@ public class TestPlanTester extends TestBase_MakeUpTestPlan {
private int scriptSumNum;
public static int SCRIPTID1 = 61;
private static int SCRIPTID2 = 2;
private static String Monitor_Host_Name = "127.0.0.1";
private static String Monitor_Host_Name = "133.133.12.3";
private static String monitor_port = "5556";
public TestPlanBusinessModel getTestPlanBusinessModel() {
@ -260,12 +260,11 @@ public class TestPlanTester extends TestBase_MakeUpTestPlan {
private void getLogicalDiskResult(UUID testPlanID, String hostName,
String port) throws IOException {
HttpResponse httpResponse = this.httpRequester
.sendGet(
TestBase.BASE_URL
+ "/monitorController/logicDiskMonitorSUTInfo?testPlanRunId="
+ testPlanID.toString() + "/" + hostName
+ "/6565/0", null, this.createAccessTokenMap());
HttpResponse httpResponse = this.httpRequester.sendGet(
TestBase.BASE_URL
+ "/monitorController/logicDiskMonitorSUTInfo/"
+ testPlanID.toString() + "/" + hostName + "/6565/0",
null, this.createAccessTokenMap());
System.out.println(httpResponse.getContent());
}