diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java index ba03b6a7a0..10136f6356 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java @@ -46,6 +46,12 @@ public class MsJSR223Processor extends MsTestElement { processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); processor.setProperty("cacheKey", "true"); processor.setProperty("scriptLanguage", this.getScriptLanguage()); + if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) { + processor.setProperty("scriptLanguage", "nashorn"); + } + if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("graalVMScript")) { + processor.setProperty("scriptLanguage", "javascript"); + } processor.setProperty("script", this.getScript()); final HashTree jsr223PreTree = tree.add(processor); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java index cdf5ec9dd9..3172f2855e 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java @@ -40,6 +40,12 @@ public class MsJSR223PostProcessor extends MsTestElement { processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); processor.setProperty("cacheKey", "true"); processor.setProperty("scriptLanguage", this.getScriptLanguage()); + if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) { + processor.setProperty("scriptLanguage", "nashorn"); + } + if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("graalVMScript")) { + processor.setProperty("scriptLanguage", "javascript"); + } processor.setProperty("script", this.getScript()); final HashTree jsr223PostTree = tree.add(processor); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java index 48bb6108d2..9cc8b35e56 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java @@ -12,6 +12,7 @@ import org.apache.jmeter.modifiers.JSR223PreProcessor; import org.apache.jmeter.save.SaveService; import org.apache.jmeter.testelement.TestElement; import org.apache.jorphan.collections.HashTree; +import org.graalvm.polyglot.Context; import java.util.List; @@ -38,6 +39,8 @@ public class MsJSR223PreProcessor extends MsTestElement { } public JSR223PreProcessor getJSR223PreProcessor() { + Context.newBuilder().allowNativeAccess(true).build(); + JSR223PreProcessor processor = new JSR223PreProcessor(); processor.setEnabled(this.isEnable()); if (StringUtils.isNotEmpty(this.getName())) { @@ -49,6 +52,13 @@ public class MsJSR223PreProcessor extends MsTestElement { processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); processor.setProperty("cacheKey", "true"); processor.setProperty("scriptLanguage", this.getScriptLanguage()); + if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) { + processor.setProperty("scriptLanguage", "nashorn"); + } + if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("graalVMScript")) { + processor.setProperty("scriptLanguage", "javascript"); + } + processor.setProperty("script", this.getScript()); return processor; } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 9da3974953..6ac27b6001 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -332,8 +332,10 @@ public class ApiAutomationService { public ApiScenarioDTO getApiScenario(String id) { ApiScenarioDTO apiScenarioDTO = new ApiScenarioDTO(); ApiScenarioWithBLOBs scenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(id); - BeanUtils.copyBean(apiScenarioDTO, scenarioWithBLOBs); - setApiScenarioProjectIds(apiScenarioDTO); + if (scenarioWithBLOBs != null) { + BeanUtils.copyBean(apiScenarioDTO, scenarioWithBLOBs); + setApiScenarioProjectIds(apiScenarioDTO); + } return apiScenarioDTO; } diff --git a/backend/src/main/java/io/metersphere/controller/handler/RestControllerExceptionHandler.java b/backend/src/main/java/io/metersphere/controller/handler/RestControllerExceptionHandler.java index b81d91fafe..3228880f97 100644 --- a/backend/src/main/java/io/metersphere/controller/handler/RestControllerExceptionHandler.java +++ b/backend/src/main/java/io/metersphere/controller/handler/RestControllerExceptionHandler.java @@ -35,7 +35,7 @@ public class RestControllerExceptionHandler { @ExceptionHandler(SQLException.class) public ResultHolder sqlExceptionHandler(HttpServletRequest request, HttpServletResponse response, SQLException e) { response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); - LogUtil.error(e); + LogUtil.error(e.getMessage(), e); return ResultHolder.error("SQL error happened, please check logs."); } diff --git a/backend/src/main/java/io/metersphere/controller/request/LoginRequest.java b/backend/src/main/java/io/metersphere/controller/request/LoginRequest.java index 20c2ab2dd9..78bd20ff87 100644 --- a/backend/src/main/java/io/metersphere/controller/request/LoginRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/LoginRequest.java @@ -20,7 +20,7 @@ public class LoginRequest { try { RsaKey rsaKey = CommonBeanFactory.getBean(RsaKey.class); return RsaUtil.privateDecrypt(username, rsaKey.getPrivateKey()); - } catch (NoSuchAlgorithmException e) { + } catch (Exception e) { return username; } } @@ -29,7 +29,7 @@ public class LoginRequest { try { RsaKey rsaKey = CommonBeanFactory.getBean(RsaKey.class); return RsaUtil.privateDecrypt(password, rsaKey.getPrivateKey()); - } catch (NoSuchAlgorithmException e) { + } catch (Exception e) { return password; } } diff --git a/backend/src/main/java/io/metersphere/ldap/controller/LdapController.java b/backend/src/main/java/io/metersphere/ldap/controller/LdapController.java index 6771d3a87e..abf6b7299b 100644 --- a/backend/src/main/java/io/metersphere/ldap/controller/LdapController.java +++ b/backend/src/main/java/io/metersphere/ldap/controller/LdapController.java @@ -14,7 +14,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.springframework.ldap.core.DirContextOperations; import org.springframework.web.bind.annotation.*; - import javax.annotation.Resource; @RestController diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index 3cff08ec4e..3a6d74178e 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -377,7 +377,7 @@ public class TestCaseReviewService { sqlSession.flushStatements(); //同步添加关联的接口和测试用例 - if(request.getChecked()){ + /* if(request.getChecked()){ if (!testCaseIds.isEmpty()) { testCaseIds.forEach(caseId -> { TestCaseWithBLOBs testDtail=testCaseMapper.selectByPrimaryKey(caseId); @@ -434,7 +434,7 @@ public class TestCaseReviewService { }); } - } + }*/ TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId()); if (StringUtils.equals(testCaseReview.getStatus(), TestCaseReviewStatus.Prepare.name()) || StringUtils.equals(testCaseReview.getStatus(), TestCaseReviewStatus.Completed.name())) { diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index efd6af73b7..adefde265f 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit efd6af73b7c5cc53cd4515772000bc1436c49837 +Subproject commit adefde265ff12d4ea909353c3f46008f8a8e17e7 diff --git a/frontend/src/business/components/api/automation/scenario/common/Jsr233ProcessorContent.vue b/frontend/src/business/components/api/automation/scenario/common/Jsr233ProcessorContent.vue index e00edd4aaa..0fdeff80af 100644 --- a/frontend/src/business/components/api/automation/scenario/common/Jsr233ProcessorContent.vue +++ b/frontend/src/business/components/api/automation/scenario/common/Jsr233ProcessorContent.vue @@ -72,13 +72,14 @@ ], isCodeEditAlive: true, languages: [ - 'beanshell', "python", "groovy", "javascript" + 'beanshell', "python", "groovy", "nashornScript","graalVMScript" ], codeEditModeMap: { beanshell: 'java', python: 'python', groovy: 'java', - javascript: 'javascript', + nashornScript: 'javascript', + graalVMScript: 'javascript', } } }, diff --git a/frontend/src/business/components/api/definition/components/assertion/ApiAssertionXPath2.vue b/frontend/src/business/components/api/definition/components/assertion/ApiAssertionXPath2.vue index c134f9faea..1c686b3afe 100644 --- a/frontend/src/business/components/api/definition/components/assertion/ApiAssertionXPath2.vue +++ b/frontend/src/business/components/api/definition/components/assertion/ApiAssertionXPath2.vue @@ -2,7 +2,7 @@
- diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue index 5318d26e01..be73f0e974 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -222,7 +222,9 @@ } this.result = this.$post("/api/testcase/list", this.condition, response => { - this.apiCaseList = response.data; + if(response.data){ + this.apiCaseList = response.data; + } this.apiCaseList.forEach(apiCase => { if (apiCase.tags && apiCase.tags.length > 0) { apiCase.tags = JSON.parse(apiCase.tags); @@ -236,7 +238,7 @@ } }) - if (!this.useEnvironment && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) { + if (!this.useEnvironment && this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) { this.useEnvironment = this.apiCaseList[0].request.useEnvironment; this.environment = this.useEnvironment; } diff --git a/frontend/src/business/components/api/definition/components/import/ApiImport.vue b/frontend/src/business/components/api/definition/components/import/ApiImport.vue index 9d55688bb7..4a21594921 100644 --- a/frontend/src/business/components/api/definition/components/import/ApiImport.vue +++ b/frontend/src/business/components/api/definition/components/import/ApiImport.vue @@ -1,6 +1,7 @@