From bf83bfe1d105454f744f16399fa3af2e1c423ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A4=E5=87=B0=E9=99=A2=E5=A4=A7=E7=99=BD?= Date: Wed, 4 Sep 2019 20:16:47 +0800 Subject: [PATCH] =?UTF-8?q?!1=20=E6=96=B0=E7=89=88=E6=9C=ACv0.1.4beta=20*?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B0=20*=20update=20*=20update=20*=20=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E4=BF=9D=E5=AD=98=20*=20=E7=BB=86=E8=8A=82=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +- pom.xml | 7 +- .../business/advanced/action/MockAction.java | 5 +- .../action/PerformanceTestConfigAction.java | 7 +- .../action/PerformanceTestResultAction.java | 6 +- .../api/action/ApiAutoTestAction.java | 13 +- .../business/api/action/ApiUserAction.java | 3 +- .../business/base/action/BaseAction.java | 2 +- .../base/bean/PageReturnJSONObject.java | 38 ++ .../business/base/bean/ReturnJSONObject.java | 38 ++ .../message/action/InterfaceInfoAction.java | 2 + .../message/action/MessageAction.java | 12 +- .../business/message/action/UploadAction.java | 23 +- .../system/action/BusiMenuInfoAction.java | 22 +- .../system/action/GlobalSettingAction.java | 25 +- .../business/user/action/UserAction.java | 7 +- .../java/yi/master/constant/SystemConsts.java | 21 + .../message/parse/JSONMessageParse.java | 1 - .../message/process/MessageProcess.java | 10 +- .../message/test/MessageAutoTest.java | 10 +- .../performance/PerformanceTestObject.java | 39 +- .../yi/master/exception/AppErrorCode.java | 50 ++ .../exception/NoQueryDBFindException.java | 36 -- .../java/yi/master/exception/YiException.java | 73 +++ .../message/NotEnoughTestDataException.java | 42 -- .../interceptor/CallMethodInterceptor.java | 3 - .../master/interceptor/InterceptorAction.java | 24 +- .../yi/master/listener/InitWebListener.java | 13 +- src/main/java/yi/master/util/DBUtil.java | 2 +- .../java/yi/master/util/PracticalUtils.java | 25 + .../java/yi/master/util/cache/CacheUtil.java | 80 ++- .../java/yi/master/util/upload/Upload.java | 2 +- src/main/webapp/img/code.png | Bin 0 -> 5520 bytes src/main/webapp/index.html | 78 ++- .../js/{json => bak}/explanationMarks.json | 0 .../js/{json => bak}/messageProcess.json | 0 .../webapp/js/{json => bak}/protocol.json | 0 src/main/webapp/js/{json => bak}/readme.txt | 0 src/main/webapp/js/{ => bak}/requestUrls.js | 0 .../js/{json => bak}/webStepParameter.json | 0 src/main/webapp/js/dcits.js | 22 +- src/main/webapp/js/globalConstant.js | 597 ++++++++++++++++++ .../webapp/libs/h-ui.admin/js/H-ui.admin.js | 18 +- .../webapp/{js => libs}/jquery.spin.merge.js | 0 src/main/webapp/login.html | 15 +- .../resource/advanced/chooseMessageScene.html | 3 +- .../resource/advanced/chooseMessageScene.js | 6 +- .../resource/advanced/interfaceProbe.html | 3 +- .../resource/advanced/interfaceProbe.js | 30 +- .../webapp/resource/advanced/mockTest.html | 3 +- src/main/webapp/resource/advanced/mockTest.js | 26 +- .../resource/advanced/performanceTest.html | 3 +- .../resource/advanced/performanceTest.js | 28 +- .../advanced/performanceTestResult.html | 3 +- .../advanced/performanceTestResult.js | 18 +- .../advanced/performanceTestTaskList.html | 3 +- .../advanced/performanceTestTaskList.js | 14 +- .../resource/advanced/ptResultDetails.html | 3 +- .../resource/advanced/ptResultDetails.js | 5 +- .../webapp/resource/message/autoTask.html | 3 +- src/main/webapp/resource/message/autoTask.js | 24 +- .../webapp/resource/message/autoTest.html | 4 +- src/main/webapp/resource/message/autoTest.js | 12 +- .../webapp/resource/message/complexScene.html | 3 +- .../webapp/resource/message/complexScene.js | 20 +- .../webapp/resource/message/interface.html | 6 +- src/main/webapp/resource/message/interface.js | 76 +-- .../resource/message/interfaceParameter.html | 3 +- .../resource/message/interfaceParameter.js | 20 +- src/main/webapp/resource/message/message.html | 6 +- src/main/webapp/resource/message/message.js | 75 +-- .../webapp/resource/message/messageScene.html | 3 +- .../webapp/resource/message/messageScene.js | 52 +- src/main/webapp/resource/message/report.html | 3 +- src/main/webapp/resource/message/report.js | 12 +- .../webapp/resource/message/reportView.html | 3 +- .../webapp/resource/message/reportView.js | 4 +- src/main/webapp/resource/message/result.html | 3 +- src/main/webapp/resource/message/result.js | 11 +- .../resource/message/setCategoryList.html | 3 +- .../resource/message/setCategoryList.js | 10 +- .../webapp/resource/message/setScene.html | 3 +- src/main/webapp/resource/message/setScene.js | 22 +- .../message/testData-batchImportData.html | 3 +- .../message/testData-batchImportData.js | 4 +- .../webapp/resource/message/testData.html | 3 +- src/main/webapp/resource/message/testData.js | 28 +- src/main/webapp/resource/message/testSet.html | 3 +- src/main/webapp/resource/message/testSet.js | 16 +- .../resource/message/validateParameters.html | 3 +- .../resource/message/validateParameters.js | 30 +- .../resource/setting/businessSystem.html | 3 +- .../webapp/resource/setting/businessSystem.js | 10 +- .../setting/manageSystemInterface.html | 3 +- .../resource/setting/manageSystemInterface.js | 12 +- .../webapp/resource/setting/queryDbList.html | 3 +- .../webapp/resource/setting/queryDbList.js | 12 +- .../webapp/resource/setting/variable.html | 5 +- src/main/webapp/resource/setting/variable.js | 33 +- .../webapp/resource/system/globalSetting.html | 3 +- .../webapp/resource/system/globalSetting.js | 14 +- .../webapp/resource/system/logRecord.html | 3 +- src/main/webapp/resource/system/logRecord.js | 6 +- src/main/webapp/resource/system/menu.html | 3 +- src/main/webapp/resource/system/menu.js | 10 +- .../webapp/resource/system/opInterface.html | 3 +- .../webapp/resource/system/opInterface.js | 10 +- .../resource/template/customTemplate.htm | 6 +- src/main/webapp/resource/user/mail.html | 3 +- src/main/webapp/resource/user/mail.js | 10 +- src/main/webapp/resource/user/role.html | 3 +- src/main/webapp/resource/user/role.js | 18 +- src/main/webapp/resource/user/user.html | 3 +- src/main/webapp/resource/user/user.js | 12 +- src/main/webapp/resource/web/chooseCase.html | 3 +- src/main/webapp/resource/web/chooseCase.js | 5 +- .../webapp/resource/web/chooseElement.html | 3 +- src/main/webapp/resource/web/chooseElement.js | 3 +- src/main/webapp/resource/web/webCase.html | 3 +- src/main/webapp/resource/web/webCase.js | 14 +- src/main/webapp/resource/web/webElement.html | 3 +- src/main/webapp/resource/web/webElement.js | 22 +- .../resource/web/webElementCategory.html | 3 +- .../webapp/resource/web/webElementCategory.js | 8 +- src/main/webapp/resource/web/webStep.html | 3 +- src/main/webapp/resource/web/webStep.js | 30 +- src/main/webapp/resource/web/webSuite.html | 3 +- src/main/webapp/resource/web/webSuite.js | 16 +- .../webapp/resource/web/webSuiteCase.html | 3 +- src/main/webapp/resource/web/webSuiteCase.js | 12 +- .../webapp/resource/webscript/module.html | 3 +- src/main/webapp/resource/webscript/module.js | 12 +- src/main/webapp/resource/webscript/task.html | 3 +- src/main/webapp/resource/webscript/task.js | 6 +- src/main/webapp/welcome.html | 25 +- update.md | 12 + yi_20190801.sql | 2 +- 137 files changed, 1681 insertions(+), 698 deletions(-) create mode 100644 src/main/java/yi/master/business/base/bean/PageReturnJSONObject.java create mode 100644 src/main/java/yi/master/business/base/bean/ReturnJSONObject.java create mode 100644 src/main/java/yi/master/exception/AppErrorCode.java delete mode 100644 src/main/java/yi/master/exception/NoQueryDBFindException.java create mode 100644 src/main/java/yi/master/exception/YiException.java delete mode 100644 src/main/java/yi/master/exception/message/NotEnoughTestDataException.java create mode 100644 src/main/webapp/img/code.png rename src/main/webapp/js/{json => bak}/explanationMarks.json (100%) rename src/main/webapp/js/{json => bak}/messageProcess.json (100%) rename src/main/webapp/js/{json => bak}/protocol.json (100%) rename src/main/webapp/js/{json => bak}/readme.txt (100%) rename src/main/webapp/js/{ => bak}/requestUrls.js (100%) rename src/main/webapp/js/{json => bak}/webStepParameter.json (100%) create mode 100644 src/main/webapp/js/globalConstant.js rename src/main/webapp/{js => libs}/jquery.spin.merge.js (100%) diff --git a/.gitignore b/.gitignore index 9b768ef..f0b2fdf 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,6 @@ target/ logs/ .project -.classpath \ No newline at end of file +.classpath +.idea +/*.iml diff --git a/pom.xml b/pom.xml index d01016c..c41935f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,6 +6,8 @@ war MasterYi Interface Automated Test Platform http://maven.apache.org + + 2.3.15.3 4.2.4.Final @@ -14,6 +16,7 @@ 4.2.1 UTF-8 + org.apache.struts @@ -453,8 +456,8 @@ maven-compiler-plugin 2.3.2 - 1.7 - 1.7 + 1.8 + 1.8 diff --git a/src/main/java/yi/master/business/advanced/action/MockAction.java b/src/main/java/yi/master/business/advanced/action/MockAction.java index f490284..ff2dcc6 100644 --- a/src/main/java/yi/master/business/advanced/action/MockAction.java +++ b/src/main/java/yi/master/business/advanced/action/MockAction.java @@ -49,6 +49,7 @@ public class MockAction extends ActionSupport { private String requestMsg = ""; + @Override public String execute() { HttpServletRequest request = ServletActionContext.getRequest(); String homeUrl = CacheUtil.getSettingValue(SystemConsts.GLOBAL_SETTING_HOME); @@ -71,7 +72,6 @@ public class MockAction extends ActionSupport { requestMessageB.append(line); } } catch (Exception e) { - logger.error(request.getRequestURI() + "获取请求报文失败!", e); } finally { if (reader != null) { @@ -94,7 +94,7 @@ public class MockAction extends ActionSupport { responseMsg = config.validate(request, requestMsg); MockResponseConfig mockConfig = MockResponseConfig.getInstance(mock.getResponseMock()); - if ("true".equals(responseMsg)) { + if (SystemConsts.CUSTOM_TRUE_STRING.equals(responseMsg)) { responseMsg = mockConfig.generate(response, requestMsg); } else if (StringUtils.isNotBlank(mockConfig.getExampleErrorMsg())) { responseMsg = PracticalUtils.replaceGlobalVariable(mockConfig.getExampleErrorMsg().replace("${errorMsg}", responseMsg), null); @@ -105,7 +105,6 @@ public class MockAction extends ActionSupport { out.print(responseMsg); out.flush(); } catch (Exception e) { - logger.error("返回出参报文出错", e); } finally { if (out != null) { diff --git a/src/main/java/yi/master/business/advanced/action/PerformanceTestConfigAction.java b/src/main/java/yi/master/business/advanced/action/PerformanceTestConfigAction.java index b89193e..ea25139 100644 --- a/src/main/java/yi/master/business/advanced/action/PerformanceTestConfigAction.java +++ b/src/main/java/yi/master/business/advanced/action/PerformanceTestConfigAction.java @@ -21,6 +21,11 @@ import yi.master.util.PracticalUtils; import yi.master.util.cache.CacheUtil; import yi.master.util.jsonlib.JsonDateValueProcessor; +/** + * 性能测试配置相关接口 + * @author xuwangcheng + * @date 2019/8/30 16:00 + */ @Controller @Scope("prototype") public class PerformanceTestConfigAction extends BaseAction { @@ -136,7 +141,7 @@ public class PerformanceTestConfigAction extends BaseAction { @@ -119,7 +124,6 @@ public class PerformanceTestResultAction extends BaseAction extends ActionSupport implements ModelDriven { * ajax调用返回的map */ protected Map jsonMap = new HashMap(); - /** * 传入的泛型类 */ diff --git a/src/main/java/yi/master/business/base/bean/PageReturnJSONObject.java b/src/main/java/yi/master/business/base/bean/PageReturnJSONObject.java new file mode 100644 index 0000000..3327a07 --- /dev/null +++ b/src/main/java/yi/master/business/base/bean/PageReturnJSONObject.java @@ -0,0 +1,38 @@ +package yi.master.business.base.bean; + +/** + * 分页返回对象 + * @author xuwangcheng + * @version 1.0.0 + * @description + * @date 2019/9/4 19:08 + */ +public class PageReturnJSONObject extends ReturnJSONObject { + private Integer draw; + private Integer recordsTotal; + private Integer recordsFiltered; + + public Integer getDraw() { + return draw; + } + + public void setDraw(Integer draw) { + this.draw = draw; + } + + public Integer getRecordsTotal() { + return recordsTotal; + } + + public void setRecordsTotal(Integer recordsTotal) { + this.recordsTotal = recordsTotal; + } + + public Integer getRecordsFiltered() { + return recordsFiltered; + } + + public void setRecordsFiltered(Integer recordsFiltered) { + this.recordsFiltered = recordsFiltered; + } +} diff --git a/src/main/java/yi/master/business/base/bean/ReturnJSONObject.java b/src/main/java/yi/master/business/base/bean/ReturnJSONObject.java new file mode 100644 index 0000000..0af1dd4 --- /dev/null +++ b/src/main/java/yi/master/business/base/bean/ReturnJSONObject.java @@ -0,0 +1,38 @@ +package yi.master.business.base.bean; + +/** + * 通用json返回对象 + * @author xuwangcheng + * @version 1.0.0 + * @description + * @date 2019/9/4 19:06 + */ +public class ReturnJSONObject { + private String msg; + private Integer returnCode; + private Object data; + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public Integer getReturnCode() { + return returnCode; + } + + public void setReturnCode(Integer returnCode) { + this.returnCode = returnCode; + } + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } +} diff --git a/src/main/java/yi/master/business/message/action/InterfaceInfoAction.java b/src/main/java/yi/master/business/message/action/InterfaceInfoAction.java index 02969f6..106ad61 100644 --- a/src/main/java/yi/master/business/message/action/InterfaceInfoAction.java +++ b/src/main/java/yi/master/business/message/action/InterfaceInfoAction.java @@ -31,6 +31,8 @@ import yi.master.business.testconfig.bean.BusinessSystem; import yi.master.business.testconfig.service.BusinessSystemService; import yi.master.business.user.bean.User; import yi.master.constant.ReturnCodeConsts; +import yi.master.exception.AppErrorCode; +import yi.master.exception.YiException; import yi.master.util.FrameworkUtil; import yi.master.util.PracticalUtils; import yi.master.util.excel.ExportInterfaceInfo; diff --git a/src/main/java/yi/master/business/message/action/MessageAction.java b/src/main/java/yi/master/business/message/action/MessageAction.java index 2f64f52..c2710ef 100644 --- a/src/main/java/yi/master/business/message/action/MessageAction.java +++ b/src/main/java/yi/master/business/message/action/MessageAction.java @@ -156,16 +156,16 @@ public class MessageAction extends BaseAction{ if (model.getInterfaceInfo().getInterfaceId() == null) { model.setInterfaceInfo((messageService.get(model.getMessageId())).getInterfaceInfo()); } - + Set params = (interfaceInfoService.get(model.getInterfaceInfo().getInterfaceId())).getParameters(); String validateFalg = parseUtil.checkParameterValidity(new ArrayList(params), model.getParameterJson()); - + if (!"true".equals(validateFalg)) { jsonMap.put("msg", validateFalg); - jsonMap.put("returnCode", ReturnCodeConsts.MESSAGE_VALIDATE_ERROR); + jsonMap.put("returnCode", ReturnCodeConsts.MESSAGE_VALIDATE_ERROR); return SUCCESS; } - + User user = (User)(FrameworkUtil.getSessionMap().get("user")); if (model.getMessageId() == null) { //增加 @@ -193,9 +193,9 @@ public class MessageAction extends BaseAction{ public String get() { Message msg = messageService.get(id); - + MessageParse parseUtil = MessageParse.getParseInstance(msg.getMessageType()); - + msg.setParameterJson(parseUtil.messageFormatBeautify(parseUtil.depacketizeMessageToString(msg.getComplexParameter(), null))); jsonMap.put("returnCode", ReturnCodeConsts.SUCCESS_CODE); diff --git a/src/main/java/yi/master/business/message/action/UploadAction.java b/src/main/java/yi/master/business/message/action/UploadAction.java index 3930600..be51062 100644 --- a/src/main/java/yi/master/business/message/action/UploadAction.java +++ b/src/main/java/yi/master/business/message/action/UploadAction.java @@ -34,15 +34,18 @@ public class UploadAction extends ActionSupport { private Map jsonMap = new HashMap(); private File file; - - //提交过来的file的名字 - private String fileFileName; + + /** + * 提交过来的file的名字 + */ + private String fileFileName; private String downloadFileName; - - - //提交过来的file的MIME类型 - private String fileFileContentType; + + /** + * 提交过来的file的MIME类型 + */ + private String fileFileContentType; public String upload() { int returnCode = ReturnCodeConsts.SUCCESS_CODE; @@ -59,7 +62,7 @@ public class UploadAction extends ActionSupport { msg = "上传文件失败,请重试!"; } else { jsonMap.put("path", fps); - jsonMap.put("relativePath", fps.replace(FrameworkUtil.getProjectPath() + file.separator , "")); + jsonMap.put("relativePath", fps.replace(FrameworkUtil.getProjectPath() + File.separator , "")); } } @@ -70,8 +73,8 @@ public class UploadAction extends ActionSupport { } public InputStream getDownloadStream() throws FileNotFoundException { - String filePath = FrameworkUtil.getProjectPath() + file.separator + downloadFileName; - this.setFileFileName(downloadFileName.substring(downloadFileName.lastIndexOf(file.separator) + 1)); + String filePath = FrameworkUtil.getProjectPath() + File.separator + downloadFileName; + this.setFileFileName(downloadFileName.substring(downloadFileName.lastIndexOf(File.separator) + 1)); InputStream is = new FileInputStream(new File(filePath)); return is; } diff --git a/src/main/java/yi/master/business/system/action/BusiMenuInfoAction.java b/src/main/java/yi/master/business/system/action/BusiMenuInfoAction.java index 2c1d54a..637f254 100644 --- a/src/main/java/yi/master/business/system/action/BusiMenuInfoAction.java +++ b/src/main/java/yi/master/business/system/action/BusiMenuInfoAction.java @@ -16,9 +16,14 @@ import yi.master.business.user.bean.Role; import yi.master.business.user.bean.User; import yi.master.business.user.service.RoleService; import yi.master.constant.ReturnCodeConsts; +import yi.master.constant.SystemConsts; import yi.master.util.FrameworkUtil; - +/** + * 业务菜单信息 + * @author xuwangcheng + * @date 2019/8/30 15:30 + */ @Controller @Scope("prototype") public class BusiMenuInfoAction extends BaseAction { @@ -30,6 +35,7 @@ public class BusiMenuInfoAction extends BaseAction { @Autowired private RoleService roleService; + private BusiMenuInfoService busiMenuInfoService; @Autowired @@ -54,7 +60,7 @@ public class BusiMenuInfoAction extends BaseAction { * @return */ public String getUserMenus() { - User user = (User) FrameworkUtil.getSessionMap().get("user"); + User user = FrameworkUtil.getLoginUser(); Role role = roleService.get(user.getRole().getRoleId()); //获取一级菜单信息 List oneLevMenus = busiMenuInfoService.findAll("status='1'", "nodeLevel=0"); @@ -71,19 +77,22 @@ public class BusiMenuInfoAction extends BaseAction { private JSONObject formatMenuJson(List oneLevMenus, List userMenus) { JSONObject json = new JSONObject(); - for (BusiMenuInfo m1:oneLevMenus) { //一级节点 + //一级节点 + for (BusiMenuInfo m1:oneLevMenus) { JSONObject jobj = new JSONObject(); jobj.put("name", m1.getMenuName()); jobj.put("icon", m1.getIconName()); jobj.put("menu", new JSONArray()); - for (BusiMenuInfo m2:m1.getChilds()) { //二级节点 + //二级节点 + for (BusiMenuInfo m2:m1.getChilds()) { JSONObject jobj2 = new JSONObject(); jobj2.put("id", m1.getMenuId() + "-" + m2.getMenuId()); jobj2.put("name", m2.getMenuName()); jobj2.put("icon", m2.getIconName()); jobj2.put("childs", new JSONArray()); - for (BusiMenuInfo m3:m2.getChilds()) { //三级节点 + //三级节点 + for (BusiMenuInfo m3:m2.getChilds()) { for (BusiMenuInfo userM:userMenus) { if (userM.getMenuId().equals(m3.getMenuId())) { JSONObject jobj3 = new JSONObject(); @@ -104,8 +113,7 @@ public class BusiMenuInfoAction extends BaseAction { json.put(m1.getMenuId(), jobj); } } - - System.out.println(json.toString()); + return json; } diff --git a/src/main/java/yi/master/business/system/action/GlobalSettingAction.java b/src/main/java/yi/master/business/system/action/GlobalSettingAction.java index e730514..7600936 100644 --- a/src/main/java/yi/master/business/system/action/GlobalSettingAction.java +++ b/src/main/java/yi/master/business/system/action/GlobalSettingAction.java @@ -11,8 +11,10 @@ import yi.master.business.base.action.BaseAction; import yi.master.business.system.bean.GlobalSetting; import yi.master.business.system.service.GlobalSettingService; import yi.master.constant.ReturnCodeConsts; +import yi.master.constant.SystemConsts; import yi.master.statement.AnalyzeUtil; import yi.master.util.FrameworkUtil; +import yi.master.util.PracticalUtils; import yi.master.util.cache.CacheUtil; /** @@ -76,10 +78,23 @@ public class GlobalSettingAction extends BaseAction{ for (GlobalSetting setting:settingMap.values()) { jsonMap.put(setting.getSettingName(), CacheUtil.getSettingValue(setting.getSettingName())); } + jsonMap.put("returnCode", ReturnCodeConsts.SUCCESS_CODE); return SUCCESS; - + } + + /** + * 检查版本 + * @return + */ + public String checkSystemVersion () { + jsonMap.put("newVersion", PracticalUtils.checkVersion()); + jsonMap.put("versionUpgradeUrl", SystemConsts.VERSION_UPGRADE_URL); + jsonMap.put("version", SystemConsts.VERSION); + setSuccessReturnInfo(); + + return SUCCESS; } /** @@ -91,13 +106,7 @@ public class GlobalSettingAction extends BaseAction{ globalSettingService.updateSetting(entry.getKey(), ((String[])entry.getValue())[0]); CacheUtil.updateGlobalSettingValue(entry.getKey(), ((String[])entry.getValue())[0]); } - /*List settings = globalSettingService.findAll(); - Map globalSettingMap = new HashMap(); - //更新完成之后需要将更新的设置重新加载在session中 - for (GlobalSetting g:settings) { - globalSettingMap.put(g.getSettingName(), g); - } - StrutsUtils.getApplicationMap().put("settingMap", globalSettingMap);*/ + jsonMap.put("returnCode", ReturnCodeConsts.SUCCESS_CODE); return SUCCESS; diff --git a/src/main/java/yi/master/business/user/action/UserAction.java b/src/main/java/yi/master/business/user/action/UserAction.java index d187e53..0675ece 100644 --- a/src/main/java/yi/master/business/user/action/UserAction.java +++ b/src/main/java/yi/master/business/user/action/UserAction.java @@ -1,6 +1,7 @@ package yi.master.business.user.action; import java.io.File; +import java.io.InputStream; import java.security.NoSuchAlgorithmException; import java.sql.Timestamp; import java.util.List; @@ -354,13 +355,11 @@ public class UserAction extends BaseAction{ * @return */ public String createVerifyCode() { - //ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 100, 4, 4); LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100); - String imgPath = SystemConsts.VERIFY_CODE_FOLDER + File.separator + UUID.fastUUID() + ".png"; - lineCaptcha.write(FrameworkUtil.getProjectPath() + File.separator + imgPath); - setSuccessReturnInfo().setData("path", imgPath); + FrameworkUtil.getSessionMap().put(SystemConsts.SESSION_ATTRIBUTE_VERIFY_CODE , lineCaptcha.getCode()); + setSuccessReturnInfo().setData("img", lineCaptcha.getImageBase64()); return SUCCESS; } diff --git a/src/main/java/yi/master/constant/SystemConsts.java b/src/main/java/yi/master/constant/SystemConsts.java index a381d1f..6b6e82a 100644 --- a/src/main/java/yi/master/constant/SystemConsts.java +++ b/src/main/java/yi/master/constant/SystemConsts.java @@ -9,6 +9,11 @@ package yi.master.constant; * @version 1.0.0.0,2017.2.13 */ public class SystemConsts { + + /** + * 当前版本号 + */ + public static final String VERSION = "0.1.4beta"; /** * 默认admin角色的roleId @@ -184,4 +189,20 @@ public class SystemConsts { * 验证码图片厨存放文件夹 */ public static final String VERIFY_CODE_FOLDER = "code"; + + public static final String CUSTOM_FALSE_STRING = "false"; + public static final String CUSTOM_TRUE_STRING = "true"; + public static final String CUSTOM_TRUE_NUMBER = "1"; + public static final String CUSTOM_FALSE_NUMBER = "0"; + + /** + * 检查版本升级的网址 + */ + public static final String CHECK_VERSION_UPGRADE_URL = "http://www.xuwangcheng.com/yi/api/checkVersion"; + //public static final String CHECK_VERSION_UPGRADE_URL = "http://localhost:8080/api/checkVersion"; + + /** + * 版本升级地址 + */ + public static final String VERSION_UPGRADE_URL = "https://gitee.com/xuwangcheng/masteryi-automated-testing/wikis/pages?sort_id=1608611&doc_id=196989"; } diff --git a/src/main/java/yi/master/coretest/message/parse/JSONMessageParse.java b/src/main/java/yi/master/coretest/message/parse/JSONMessageParse.java index 6fe6b43..db3c2f5 100644 --- a/src/main/java/yi/master/coretest/message/parse/JSONMessageParse.java +++ b/src/main/java/yi/master/coretest/message/parse/JSONMessageParse.java @@ -50,7 +50,6 @@ public class JSONMessageParse extends MessageParse { Object obj = mapper.readValue(message, Object.class); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj); } catch (Exception e) { - LOGGER.info("json串美化失败:\n" + message, e); } return message; diff --git a/src/main/java/yi/master/coretest/message/process/MessageProcess.java b/src/main/java/yi/master/coretest/message/process/MessageProcess.java index ba8d2ec..449ef6e 100644 --- a/src/main/java/yi/master/coretest/message/process/MessageProcess.java +++ b/src/main/java/yi/master/coretest/message/process/MessageProcess.java @@ -23,15 +23,17 @@ public abstract class MessageProcess { public abstract String processRequestMessage(String requestMessage, String processParameter); /** * 处理返回报文 - * @param requestMessage - * @param processParameter - * @return + * @param responseMessage 返回保温 + * @param processParameter 处理参数 + * @return 返回仅供处理的出参报文 */ public abstract String processResponseMessage(String responseMessage, String processParameter); public static MessageProcess getProcessInstance(String processType) { - if (StringUtils.isBlank(processType)) return null; + if (StringUtils.isBlank(processType)) { + return null; + } switch (processType) { case MessageKeys.PROCESS_TYPE_SHANXI_OPEN_API: return sxOpenApiProcess; diff --git a/src/main/java/yi/master/coretest/message/test/MessageAutoTest.java b/src/main/java/yi/master/coretest/message/test/MessageAutoTest.java index ee71c0b..e5fc671 100644 --- a/src/main/java/yi/master/coretest/message/test/MessageAutoTest.java +++ b/src/main/java/yi/master/coretest/message/test/MessageAutoTest.java @@ -12,6 +12,7 @@ import java.util.Set; import java.util.TreeSet; import java.util.regex.Pattern; +import cn.hutool.core.util.NumberUtil; import org.apache.commons.lang3.StringUtils; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.log4j.Logger; @@ -45,6 +46,8 @@ import yi.master.constant.SystemConsts; import yi.master.coretest.message.parse.MessageParse; import yi.master.coretest.message.process.MessageProcess; import yi.master.coretest.message.protocol.TestClient; +import yi.master.exception.AppErrorCode; +import yi.master.exception.YiException; import yi.master.util.FrameworkUtil; import yi.master.util.PracticalUtils; import yi.master.util.cache.CacheUtil; @@ -143,7 +146,6 @@ public class MessageAutoTest { /** * 单场景测试 * @param testScene 测试要素对象 - * @param config 当前测试配置 * @return TestResult 测试结果详情 */ public TestResult singleTest(TestMessageScene testScene, Object procotolClient) { @@ -402,7 +404,6 @@ public class MessageAutoTest { * 批量测试 * @param user * @param setId - * @param autoTestFlag 是否为系统自动化测试 * @return */ public int[] batchTest (User user, Integer setId, String testMark, String guid) { @@ -559,6 +560,10 @@ public class MessageAutoTest { testScene.setNewClient("0".equals(complexScene.getNewClient()) ? true : false); int sceneCount = 0; for (MessageScene scene:complexScene.setScenes(messageSceneService)) { + if (StringUtils.isBlank(scene.getConfig().getSystemId()) + || !NumberUtil.isInteger(scene.getConfig().getSystemId())) { + throw new YiException(AppErrorCode.AUTO_TEST_COMPLEX_SCENE_LACK_BUSINESS_SYSTEM); + } Set tss = packageRequestObject(scene, config, businessSystemService.get(Integer.valueOf(scene.getConfig().getSystemId()))); if (tss.size() == 1) { testScene.getScenes().addAll(tss); @@ -579,7 +584,6 @@ public class MessageAutoTest { * 组装测试要素对象 * @param scene 对应的测试场景 * @param config 需要用到的测试配置 - * @param systemId 指定的测试系统,如果传入null,默认组装所有的测试环境 * @return */ @SuppressWarnings("static-access") diff --git a/src/main/java/yi/master/coretest/message/test/performance/PerformanceTestObject.java b/src/main/java/yi/master/coretest/message/test/performance/PerformanceTestObject.java index 6188b21..7a2a4c3 100644 --- a/src/main/java/yi/master/coretest/message/test/performance/PerformanceTestObject.java +++ b/src/main/java/yi/master/coretest/message/test/performance/PerformanceTestObject.java @@ -200,9 +200,15 @@ public class PerformanceTestObject { //获取请求地址 String requestUrl = ""; - if (StringUtils.isNotBlank(config.getMessageScene().getRequestUrl())) requestUrl = config.getMessageScene().getRequestUrl(); - if (StringUtils.isBlank(requestUrl) && StringUtils.isNotBlank(msg.getRequestUrl())) requestUrl = msg.getRequestUrl(); - if (StringUtils.isBlank(requestUrl)) requestUrl = info.getRequestUrlReal(); + if (StringUtils.isNotBlank(config.getMessageScene().getRequestUrl())) { + requestUrl = config.getMessageScene().getRequestUrl(); + } + if (StringUtils.isBlank(requestUrl) && StringUtils.isNotBlank(msg.getRequestUrl())) { + requestUrl = msg.getRequestUrl(); + } + if (StringUtils.isBlank(requestUrl)) { + requestUrl = info.getRequestUrlReal(); + } requestUrl = config.getBusinessSystem().getReuqestUrl(requestUrl, config.getBusinessSystem().getDefaultPath(), info.getInterfaceName()); @@ -222,11 +228,14 @@ public class PerformanceTestObject { infoMsg.add(timeTag() + "正在检查测试配置选项..."); //设置最大的超时时间,防止无限循环 if (config.getMaxTime() == null || config.getMaxTime() < 1 || config.getMaxTime() > PerformanceTestConfig.MAX_TEST_TIME) { - config.setMaxTime(PerformanceTestConfig.MAX_TEST_TIME);//最长时间8小时 + //最长时间8小时 + config.setMaxTime(PerformanceTestConfig.MAX_TEST_TIME); } //设置最大线程数 - if (config.getThreadCount() == null) config.setThreadCount(1); + if (config.getThreadCount() == null) { + config.setThreadCount(1); + } if (config.getThreadCount() > PerformanceTestConfig.MAX_THREAD_COUNT) { config.setThreadCount(PerformanceTestConfig.MAX_THREAD_COUNT); } @@ -252,7 +261,9 @@ public class PerformanceTestObject { * @return */ public boolean action() { - if (!running && globalStoped) setGlobalStoped(false); + if (!running && globalStoped) { + setGlobalStoped(false); + } currentStatus = "正在测试中"; infoMsg.add(timeTag() + "正在做最后的测试准备..."); //切分测试数据和测试次数到每个线程中 @@ -659,7 +670,6 @@ public class PerformanceTestObject { analyzeResult.getPressCpu().add((double) Math.round((PracticalUtils.sigar.getCpuPerc().getCombined() * 100) * 100) / 100); analyzeResult.getPressMemory().add((double) Math.round((PracticalUtils.sigar.getMem().getUsedPercent()) * 100) / 100); } catch (Exception e) { - logger.error("获取压力机资源消耗失败!", e); errorMsg.add(timeTag() + "获取压力机的资源消耗情况失败!"); analyzeResult.getPressCpu().add(0.00); @@ -674,7 +684,11 @@ public class PerformanceTestObject { } } - + /** + * 性能测试线程 + * @author xuwangcheng + * @date 2019/8/30 16:50 + */ class ThreadPerformanceTest implements Runnable { private List> threadParameters; private int maxCount; @@ -694,7 +708,7 @@ public class PerformanceTestObject { TestMessageScene threadTestScene = (TestMessageScene) testScene.clone(); //获取一个新的测试客户端 - Object procotolClient = TestClient.getTestClientInstance(info.getInterfaceProtocol()).getTestClient(); + Object protocolClient = TestClient.getTestClientInstance(info.getInterfaceProtocol()).getTestClient(); //停止条件 int testTime = 0; @@ -720,7 +734,8 @@ public class PerformanceTestObject { //可重复还是不可重复 Map replaceParameter = threadParameters.get(index); if ("0".equals(config.getParameterReuse())) { - threadParameters.remove(index);//不可复用 + //不可复用 + threadParameters.remove(index); } else { //可复用 index++; @@ -732,7 +747,7 @@ public class PerformanceTestObject { threadTestScene.setRequestMessage(repalceParameter(requestMessage, replaceParameter)); } //开始进行测试 - TestResult testResult = autoTest.singleTest(threadTestScene, procotolClient); + TestResult testResult = autoTest.singleTest(threadTestScene, protocolClient); testResults.add(testResult); testCount++; @@ -740,7 +755,7 @@ public class PerformanceTestObject { } threads.remove(Thread.currentThread().getName()); - TestClient.getTestClientInstance(info.getInterfaceProtocol()).putBackTestClient(procotolClient); + TestClient.getTestClientInstance(info.getInterfaceProtocol()).putBackTestClient(protocolClient); infoMsg.add(timeTag() + Thread.currentThread().getName() + " - 已停止测试!"); } diff --git a/src/main/java/yi/master/exception/AppErrorCode.java b/src/main/java/yi/master/exception/AppErrorCode.java new file mode 100644 index 0000000..1b9bd58 --- /dev/null +++ b/src/main/java/yi/master/exception/AppErrorCode.java @@ -0,0 +1,50 @@ +package yi.master.exception; + +/** + * 错误码 + * @author xuwangcheng + * @version 1.0.0 + * @description + * @date 2019/9/4 18:20 + */ +public enum AppErrorCode { + + //通用 + INTERNAL_SERVER_ERROR(500, "系统内部错误"), + + //自动化测试 + AUTO_TEST_COMPLEX_SCENE_LACK_BUSINESS_SYSTEM(100001, "测试场景没有配置独立的环境,请打开组合场景中的配置管理添加") + + + //组合场景相关 + + + //接口相关 + + + ; + + private Integer code; + private String msg; + + private AppErrorCode (int code, String msg) { + this.code = code; + this.msg = msg; + } + + public void setCode(int code) { + this.code = code; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public int getCode() { + return code; + } + + public String getMsg() { + return msg; + } +} diff --git a/src/main/java/yi/master/exception/NoQueryDBFindException.java b/src/main/java/yi/master/exception/NoQueryDBFindException.java deleted file mode 100644 index 843ed91..0000000 --- a/src/main/java/yi/master/exception/NoQueryDBFindException.java +++ /dev/null @@ -1,36 +0,0 @@ -package yi.master.exception; - - -/** - * 找不到指定的查询数据库信息 - * @author xuwangcheng - * @version 1.0.0.0,2017.2.13 - */ -public class NoQueryDBFindException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - public NoQueryDBFindException() { - super(); - } - - public NoQueryDBFindException(String message, Throwable cause, - boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - - public NoQueryDBFindException(String message, Throwable cause) { - super(message, cause); - } - - public NoQueryDBFindException(String message) { - super(message); - } - - public NoQueryDBFindException(Throwable cause) { - super(cause); - } - - - -} diff --git a/src/main/java/yi/master/exception/YiException.java b/src/main/java/yi/master/exception/YiException.java new file mode 100644 index 0000000..1b0f321 --- /dev/null +++ b/src/main/java/yi/master/exception/YiException.java @@ -0,0 +1,73 @@ +package yi.master.exception; + +import cn.hutool.core.util.StrUtil; + +/** + * 自定义异常 + * @author xuwangcheng + * @version 1.0.0 + * @description + * @date 2019/9/4 18:22 + */ +public class YiException extends RuntimeException { + private static final long serialVersionUID = 1L; + + private Integer code; + private String msg; + + public YiException(AppErrorCode code) { + this.code = code.getCode(); + this.msg = code.getMsg(); + } + + public YiException(AppErrorCode code, String ...params) { + this.code = code.getCode(); + this.msg = StrUtil.format(code.getMsg(), params); + } + + public YiException(AppErrorCode code, Throwable e, String ...params) { + super(e); + this.code = code.getCode(); + this.msg = StrUtil.format(code.getMsg(), params); + } + + public YiException(Integer code, String msg) { + this.code = code; + this.msg = msg; + } + + public YiException(Integer code, String msg, Throwable e) { + super(e); + this.code = code; + this.msg = msg; + } + + + public YiException(String msg) { + super(msg); + this.code = AppErrorCode.INTERNAL_SERVER_ERROR.getCode(); + this.msg = msg; + } + + public YiException(String msg, Throwable e) { + super(msg, e); + this.code = AppErrorCode.INTERNAL_SERVER_ERROR.getCode(); + this.msg = msg; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } +} diff --git a/src/main/java/yi/master/exception/message/NotEnoughTestDataException.java b/src/main/java/yi/master/exception/message/NotEnoughTestDataException.java deleted file mode 100644 index b0add4c..0000000 --- a/src/main/java/yi/master/exception/message/NotEnoughTestDataException.java +++ /dev/null @@ -1,42 +0,0 @@ -package yi.master.exception.message; - -/** - * 接口自动化
- * 拼装指定格式的报文,没有查找到足够的测试数据 - * @author xuwangcheng - * @version 1.0.0.0,2017.4.6 - * - */ -public class NotEnoughTestDataException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public NotEnoughTestDataException() { - super(); - } - - public NotEnoughTestDataException(String message, Throwable cause, boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - - public NotEnoughTestDataException(String message, Throwable cause) { - super(message, cause); - } - - public NotEnoughTestDataException(String message) { - super(message); - } - - public NotEnoughTestDataException(Throwable cause) { - super(cause); - } - - - - - -} diff --git a/src/main/java/yi/master/interceptor/CallMethodInterceptor.java b/src/main/java/yi/master/interceptor/CallMethodInterceptor.java index 376144c..59cdfa6 100644 --- a/src/main/java/yi/master/interceptor/CallMethodInterceptor.java +++ b/src/main/java/yi/master/interceptor/CallMethodInterceptor.java @@ -251,10 +251,7 @@ public class CallMethodInterceptor extends AbstractInterceptor { return result; } catch (Exception e) { - validateTime = Integer.valueOf(String.valueOf(System.currentTimeMillis() - beginTime)); - - logger.error("系统异常,请求失败!", e); logger.info("[" + timeTag + "]验证耗时:" + validateTime + "ms."); mark = PracticalUtils.getExceptionAllinformation(e); diff --git a/src/main/java/yi/master/interceptor/InterceptorAction.java b/src/main/java/yi/master/interceptor/InterceptorAction.java index 1640154..09d98d9 100644 --- a/src/main/java/yi/master/interceptor/InterceptorAction.java +++ b/src/main/java/yi/master/interceptor/InterceptorAction.java @@ -11,6 +11,8 @@ import org.apache.struts2.ServletActionContext; import org.springframework.stereotype.Controller; import yi.master.constant.ReturnCodeConsts; +import yi.master.exception.AppErrorCode; +import yi.master.exception.YiException; import yi.master.util.PracticalUtils; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; @@ -35,7 +37,7 @@ public class InterceptorAction extends ActionSupport{ /** * ajax调用返回给前台的map */ - private Map jsonMap=new HashMap(); + private Map jsonMap = new HashMap(); /** * 用户未登录或者登录失效 @@ -66,11 +68,21 @@ public class InterceptorAction extends ActionSupport{ * @return */ public String error() { - - jsonMap.put("returnCode", ReturnCodeConsts.SYSTEM_ERROR_CODE); - jsonMap.put("msg", "系统内部错误,请稍后再试!"); - - logger.error("系统内部错误:\n" + PracticalUtils.getExceptionAllinformation((Exception)ActionContext.getContext().getValueStack().findValue("exception"))); + Exception ex = (Exception)ActionContext.getContext().getValueStack().findValue("exception"); + String exDetails = PracticalUtils.getExceptionAllinformation(ex); + + logger.error("系统内部错误:\n" + exDetails); + jsonMap.put("exception", exDetails); + + if (ex instanceof YiException) { + YiException yiEx = (YiException) ex; + jsonMap.put("returnCode", yiEx.getCode()); + jsonMap.put("msg", yiEx.getMsg()); + return SUCCESS; + } + + jsonMap.put("returnCode", AppErrorCode.INTERNAL_SERVER_ERROR.getCode()); + jsonMap.put("msg", AppErrorCode.INTERNAL_SERVER_ERROR.getMsg()); return SUCCESS; } diff --git a/src/main/java/yi/master/listener/InitWebListener.java b/src/main/java/yi/master/listener/InitWebListener.java index fe8014d..96ce246 100644 --- a/src/main/java/yi/master/listener/InitWebListener.java +++ b/src/main/java/yi/master/listener/InitWebListener.java @@ -68,7 +68,7 @@ public class InitWebListener implements ServletContextListener { OperationInterfaceService opService =(OperationInterfaceService)ctx.getBean("operationInterfaceService"); GlobalSettingService settingService = (GlobalSettingService) ctx.getBean("globalSettingService"); DataDBService dbService = (DataDBService) ctx.getBean("dataDBService"); - //JobManager jobManager = (JobManager) ctx.getBean("jobManager"); + //获取当前系统的所有接口信息 LOGGER.info("获取当前系统的所有接口信息!"); @@ -86,7 +86,16 @@ public class InitWebListener implements ServletContextListener { } //放置到全局context中 CacheUtil.setSettingMap(globalSettingMap); - + + //获取系统版本号,如果与数据库中的版本号不一致则更新 + String version = CacheUtil.getSettingValue(SystemConsts.GLOBAL_SETTING_VERSION); + if (version == null || !version.equals(SystemConsts.VERSION)) { + LOGGER.warn("当前代码版本号为:v" + SystemConsts.VERSION + ",与数据库版本v" + version + "不一致!"); + + settingService.updateSetting(SystemConsts.GLOBAL_SETTING_VERSION, SystemConsts.VERSION); + CacheUtil.updateGlobalSettingValue(SystemConsts.GLOBAL_SETTING_VERSION, SystemConsts.VERSION); + } + //获取查询数据库信息 LOGGER.info("获取测试数据源信息!"); List dbs = dbService.findAll(); diff --git a/src/main/java/yi/master/util/DBUtil.java b/src/main/java/yi/master/util/DBUtil.java index c8fb5f4..7d2a6ac 100644 --- a/src/main/java/yi/master/util/DBUtil.java +++ b/src/main/java/yi/master/util/DBUtil.java @@ -99,7 +99,7 @@ public class DBUtil { /** * 传入数据库连接和要执行的sql语句 * 得到返回值,多个值只取第一个,没有值返回null - * @param dataDb对象 + * @param dbInfo DataDB对象 * @param sqlStr 需要执行的sql语句 * @return * @throws SQLException diff --git a/src/main/java/yi/master/util/PracticalUtils.java b/src/main/java/yi/master/util/PracticalUtils.java index a0e2808..3cf93a4 100644 --- a/src/main/java/yi/master/util/PracticalUtils.java +++ b/src/main/java/yi/master/util/PracticalUtils.java @@ -45,6 +45,7 @@ import cn.hutool.captcha.LineCaptcha; import net.sf.json.JSONObject; import net.sf.json.JsonConfig; import yi.master.business.advanced.bean.config.probe.ProbeConfig; +import yi.master.business.api.bean.ApiReturnInfo; import yi.master.business.message.bean.ComplexSceneConfig; import yi.master.business.message.bean.Parameter; import yi.master.business.message.bean.TestReport; @@ -56,6 +57,7 @@ import yi.master.business.testconfig.bean.BusinessSystem; import yi.master.business.testconfig.bean.GlobalVariable; import yi.master.business.testconfig.service.BusinessSystemService; import yi.master.business.testconfig.service.GlobalVariableService; +import yi.master.constant.ReturnCodeConsts; import yi.master.constant.SystemConsts; import yi.master.coretest.message.parse.MessageParse; import yi.master.coretest.message.protocol.HTTPTestClient; @@ -698,6 +700,29 @@ public class PracticalUtils { } } + /** + * 检查最新版本 + * @return + */ + public static String checkVersion() { + try { + //远程检查地址 + String checkUrl = SystemConsts.CHECK_VERSION_UPGRADE_URL + "?token=" + SystemConsts.REQUEST_ALLOW_TOKEN; + String msg = doGetHttpRequest(checkUrl); + Map json = jsonToMap(msg); + + if (ApiReturnInfo.SUCCESS_CODE.equals(json.get("returnCode").toString())) { + return json.get("data").toString(); + } + + return null; + } catch (Exception e) { + LOGGER.warn("检查版本失败!", e); + } + + return null; + } + /** * 组合场景中的json串配置转换为对应的Map * @param configJson diff --git a/src/main/java/yi/master/util/cache/CacheUtil.java b/src/main/java/yi/master/util/cache/CacheUtil.java index 28a7dec..0d0d8f7 100644 --- a/src/main/java/yi/master/util/cache/CacheUtil.java +++ b/src/main/java/yi/master/util/cache/CacheUtil.java @@ -141,7 +141,14 @@ public class CacheUtil { } } } - + + /** + * 保存日志记录 + * @author xuwangcheng + * @date 2019/8/30 15:42 + * @param + * @return {@link boolean} + */ public static boolean saveRecord() { LogRecord record = CacheUtil.records.poll(); if (record != null) { @@ -151,45 +158,98 @@ public class CacheUtil { } return false; } - + + /** + * 新增一个日志对象 + * @author xuwangcheng + * @date 2019/8/30 15:43 + * @param record record + */ public static void addRecord(LogRecord record) { if (record != null) { CacheUtil.records.offer(record); } } - + + /** + * 查询当前缓存的日志条数 + * @author xuwangcheng + * @date 2019/8/30 15:43 + * @param + * @return {@link int} + */ public static int getRecordCount() { return CacheUtil.records.size(); } - + + /** + * 设置性能测试对象 + * @author xuwangcheng + * @date 2019/8/30 15:43 + * @param ptObjects ptObjects + */ public static void setPtObjects( Map> ptObjects) { CacheUtil.ptObjects = ptObjects; } - + + /** + * 获取性能测试对象集合 + * @author xuwangcheng + * @date 2019/8/30 15:52 + * @param + * @return {@link Map} + */ public static Map> getPtObjects() { return ptObjects; } - + + /** + * 获取当前登陆用户的性能测试任务列表 + * @author xuwangcheng + * @date 2019/8/30 15:53 + * @param userId userId + * @return {@link Map} + */ public static Map getPtObjectsByUserId (Integer userId) { Map ptos = ptObjects.get(userId); if (ptos == null) { - ptos = new HashMap(); + ptos = new HashMap(5); ptObjects.put(userId, ptos); } return ptos; } - + + /** + * 新增性能测试任务 + * @author xuwangcheng + * @date 2019/8/30 15:53 + * @param userId userId + * @param ptObject ptObject + */ public static void addPtObject (Integer userId, PerformanceTestObject ptObject) { Map pts = getPtObjectsByUserId(userId); pts.put(ptObject.getObjectId(), ptObject); } - + + /** + * 设置SocketMock服务集合 + * @author xuwangcheng + * @date 2019/8/30 15:54 + * @param socketServers socketServers + */ public static void setSocketServers( Map socketServers) { CacheUtil.socketServers = socketServers; } - + + /** + * 获取SocketMock服务集合 + * @author xuwangcheng + * @date 2019/8/30 15:54 + * @param + * @return {@link Map} + */ public static Map getSocketServers() { return socketServers; } diff --git a/src/main/java/yi/master/util/upload/Upload.java b/src/main/java/yi/master/util/upload/Upload.java index a3df54e..c6899fa 100644 --- a/src/main/java/yi/master/util/upload/Upload.java +++ b/src/main/java/yi/master/util/upload/Upload.java @@ -25,7 +25,7 @@ public class Upload { /** * 上传单个文件 - * @param Object 要上传的文件或者文件输入流 + * @param file 要上传的文件或者文件输入流 * @param fileName 文件原名 * @return 保存的文件路径 */ diff --git a/src/main/webapp/img/code.png b/src/main/webapp/img/code.png new file mode 100644 index 0000000000000000000000000000000000000000..65c55c247864d5ee128a4543f86615349acb5b80 GIT binary patch literal 5520 zcmV;B6>sW^P)S!D73p7OO#S9NuDb@k<5L!JNR80hMIf$#kP zU)6o@ZS=Td@Q&Xn*+De?9*Cn+!>>RZ0f}xX>X%o?4NY2)I*7+}0&8tQ{{~^~$i(sj zTM&vb+Lkt2#?rKP&i9Db{$NvDM~OPsFpu|8F!B;5jL6HH$C6H;LNJv=Tel^Umt2@8 zHQVBqmvf$PqEnmSs`1k9vFNre1}m#YR|sq1#ZFBuud%^@P=xW*mK5KNJ~#7F$Y(g zg(zFBrLgMdmmpB~LSs^JwskHKbqQlkU8eH#nSDnd?5WFj^`9VwzoRN%0Tt>2FxZ-y|lVew}yHDSLhTh1ZB;DePnYK!U3yYTkQ)?pbL9K4qQS6c`RmqJUxq9m}CL5noc*=L9ewb$xugU!uu@p!4j>>dcNofy*_vgB=y*X}H zQvY#reMZGX^coS{b41(%pY)Xhw@_px$* z(^LuqtR3^7-Wy+5Ub8DKZ^ZP(Uc;}lg!9t0h;s!TPw1<}QSx{`U@3;e8Q7BlFLz%r z=T+~pv@;gi`uSqvkje3kq~u{gCpj*;)W~yEIIBl?0$~wrqLjMiycFq;otF*3n&mi! zgOof%j@&irk8QQ-O)o5BSv0sS0k$+7d?GBgF(DGx#W+tC(wBCI<{4ClBJ}vZ$G^&< z3l`B9H!qa5=<7#H#uCWuS;j)V_8i$LL=^-y_?g)i4Y0UvarE`_YDjGGSxTW0UdmGF z=$b-Q0xkUZeYyXNdjK6hIXxczYq@Vm11y8KxM8X7P%!pb26@$i z6`NQ>^fA}_U{tIZUNof<9(n)C1_U$3$fLOe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l|A=#qv z%1L^K1gpj*TSQ)9i_VK>X!4>j4Eb7nHDRnh7DpyC`fDOx3Vg?@1_}+Z(lqn4CCXHZ3oUiqr+RE*>Mm zD!sn}9q{vrBe*Sryl`8l@?zZ0GO{s&cp1Hw72N&` zhn17`>cfJ7+S+nB;H-T}Mag0FQkO1XrPm6L@Y1zSYJ`_=Sd{^7ASlQ*&*0p73hfNLA%^OWLATMzCd&m#)Fbi!)Mb2QkO1X79KQM<6h~2!aQDbWME6d>p|HA;?2i( z+WF4fpF%+A1q(pp2Y@M}pGL|HaNDc84A`GQ2c_tgWW-vun(;-hj zXtedmOrKn(mcYPP`=Q>sDR0tYrS9#ic4iCMq7N(N#aRl8)I{-;@)p?Y-?uvj*4v$) z-p0vjiz4j9!K?43cc8$!dHOvoObjn%wdd>WtrXUi*5s@gJ%rd&>&eh)EBmwvUAELp zWJT#o=;iOFcgjg_l9TkxlSqCYz!lyZS#r+<-+JI4pFL;-A - + @@ -45,6 +45,7 @@ @@ -96,25 +97,22 @@
  • 关闭当前
  • 关闭全部
  • 关闭其他
  • +
  • 取消操作
  • -
    - -
    + - + - + diff --git a/src/main/webapp/resource/advanced/chooseMessageScene.js b/src/main/webapp/resource/advanced/chooseMessageScene.js index 9ac4d95..ac1d3eb 100644 --- a/src/main/webapp/resource/advanced/chooseMessageScene.js +++ b/src/main/webapp/resource/advanced/chooseMessageScene.js @@ -166,7 +166,7 @@ var mySetting = { df.resolve(); }, listPage:{ - listUrl:top.SCENE_LIST_URL, + listUrl:REQUEST_URL.MESSAGE_SCENE.LIST, tableObj:".table-sort", columnsSetting:columnsSetting, columnsJson:[0, 8, 10, 11], @@ -191,7 +191,7 @@ $(function(){ */ function renderSceneTestPage(flag) { var index = layer.msg('加载中,请稍后...', {icon:16, time:60000, shade:0.35}); - $.get(top.SCENE_GET_TEST_OBJECT_URL, {messageSceneId:messageSceneId}, function(data){ + $.get(REQUEST_URL.MESSAGE_SCENE.GET_TEST_OBJECT, {messageSceneId:messageSceneId}, function(data){ if(data.returnCode == 0){ var $F = $("#message-scene-test-view"); @@ -251,7 +251,7 @@ function sceneTest() { var index = layer.msg('正在进行测试...', {icon:16, time:9999999, shade:0.35}); - $.post(top.TEST_SCENE_URL, {messageSceneId:messageSceneId, dataId:dataId, requestUrl:requestUrl, requestMessage:requestMessage},function(data) { + $.post(REQUEST_URL.AUTO_TEST.TEST_SCENE_URL, {messageSceneId:messageSceneId, dataId:dataId, requestUrl:requestUrl, requestMessage:requestMessage},function(data) { if (data.returnCode == 0) { layer.close(index); renderResultViewPage(data.result, messageSceneId); diff --git a/src/main/webapp/resource/advanced/interfaceProbe.html b/src/main/webapp/resource/advanced/interfaceProbe.html index f95cd6d..785cafe 100644 --- a/src/main/webapp/resource/advanced/interfaceProbe.html +++ b/src/main/webapp/resource/advanced/interfaceProbe.html @@ -42,8 +42,9 @@ + - + diff --git a/src/main/webapp/resource/advanced/interfaceProbe.js b/src/main/webapp/resource/advanced/interfaceProbe.js index b2d97d6..8c2ddea 100644 --- a/src/main/webapp/resource/advanced/interfaceProbe.js +++ b/src/main/webapp/resource/advanced/interfaceProbe.js @@ -137,7 +137,7 @@ var templateParams = { enable:true, formTitle:"探测任务-高级查询", pageOpenSuccessCallback:function (layero, index) { - $.get(top.BUSINESS_SYSTEM_LIST_ALL_URL, function (json) { + $.get(REQUEST_URL.BUSINESS_SYSTEM.LIST_ALL, function (json) { if (json.returnCode == 0) { $.each(json.data, function(i, n){ layero.find("#systemId").append('