diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/api/ScriptController.java b/Bench4Q-Master/src/main/java/org/bench4q/master/api/ScriptController.java index 8dbdcf04..dbfa49cf 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/api/ScriptController.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/api/ScriptController.java @@ -102,14 +102,14 @@ public class ScriptController extends BaseController { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { return buildReponseModel(false, "has no power for recording script!!!", "", -1, null, null, - null); + null,null); } Port port = new Port(); synchronized (PORT_LOCK) { port = this.getPortPoolService().getAPortNotInUse(); if (port == null) { return buildReponseModel(false, "port is in use!", "", -1, - null, null, null); + null, null, null,null); } } UUID uuid = UUID.randomUUID(); @@ -118,7 +118,7 @@ public class ScriptController extends BaseController { return buildReponseModel(true, "", this.getScriptCapturer() .getIpHttpCaptureServerAdress(), port.getPort(), null, null, - uuid.toString()); + uuid.toString(),null); } @RequestMapping(value = "/startScriptRecording", method = { @@ -129,13 +129,13 @@ public class ScriptController extends BaseController { if (!checkScope(UserService.NORAML_AUTHENTICATION)) { return buildReponseModel(false, "has no power for stopScriptCapture!!!", "", -1, null, - null, null); + null, null,null); } this.getScriptCapturer().startRecording(port); return buildReponseModel(true, "RecordServer stop", "", port, null, - null, fileNameUUID); + null, fileNameUUID,null); } private String buildScriptSavePath() { @@ -158,7 +158,7 @@ public class ScriptController extends BaseController { if (!checkScope(UserService.NORAML_AUTHENTICATION)) { return buildReponseModel(false, "has no power for stopScriptCapture!!!", "", -1, null, - null, null); + null, null,null); } this.getScriptCapturer().stopCurrentRecord(port); @@ -167,7 +167,7 @@ public class ScriptController extends BaseController { } return buildReponseModel(true, "RecordServer stop", "", port, null, - null, fileNameUUID); + null, fileNameUUID,null); } @RequestMapping(value = "/saveScriptToDB", method = { RequestMethod.GET, @@ -179,14 +179,14 @@ public class ScriptController extends BaseController { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { return buildReponseModel(false, "saveScriptToDB check your scope fail!", "", -1, null, - null, null); + null, null,null); } File file = new File(buildScriptSavePath() + System.getProperty("file.separator") + fileNameUUID + ".xml"); if (!file.exists()) { return buildReponseModel(false, "no that script", null, -1, null, - null, fileNameUUID); + null, fileNameUUID,null); } try { String content = FileUtils.readFileToString(file); @@ -195,10 +195,10 @@ public class ScriptController extends BaseController { this.getPrincipal().getId(), content, null); // this.getUserService().add return buildReponseModel(success, "Save to DataBase!!", "", port, - null, null, null); + null, null, null,null); } catch (Exception e) { return buildReponseModel(false, "exception when read from file", - null, -1, null, null, fileNameUUID); + null, -1, null, null, fileNameUUID,null); } } @@ -218,12 +218,12 @@ public class ScriptController extends BaseController { boolean success = this.getScriptService().saveScript(scriptName, this.getPrincipal().getId(), scenarioModel, paramFiles); logger.info("upload script:" + scenarioModel); - return buildReponseModel(success, null, null, -1, null, null, null); + return buildReponseModel(success, null, null, -1, null, null, null,null); } catch (Exception e) { this.logger.error(ExceptionLog.getStackTrace(e)); return buildReponseModel(false, "The script is not in the right format", null, -1, null, - null, null); + null, null,null); } } @@ -238,8 +238,22 @@ public class ScriptController extends BaseController { this.getPrincipal()); return this.buildReponseModel(true, null, null, 0, - dealWithCollection(scripts), null, null); + dealWithCollection(scripts), null, null,null); } + + @RequestMapping(value = "/loadFilterTypeList", method = { RequestMethod.POST, + RequestMethod.GET }) + @ResponseBody + public OperateScriptServerResponseModel loadFilterTypeList() { + if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { + return null; + } + String[] filterTypeList = this.getScriptService().loadFilterTypeList(); + + return this.buildReponseModel(true, null, null, 0, + null, null, null,filterTypeList); + } + @RequestMapping(value = "/queryScriptsByDate", method = RequestMethod.POST) @ResponseBody @@ -252,7 +266,7 @@ public class ScriptController extends BaseController { .queryScriptsByCreateTime(startDate, endDate, this.getPrincipal()); return this.buildReponseModel(true, null, null, 0, - dealWithCollection(scripts), null, null); + dealWithCollection(scripts), null, null,null); } private List dealWithCollection(Collection