From 23b28d11b52fdf0e04acccf5c98be6c2c73e2636 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 23 Jun 2021 17:34:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=84=9A=E6=9C=AC=E6=96=AD=E8=A8=80=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E5=90=8D=E7=A7=B0=E6=89=BE=E4=B8=8D=E5=88=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/definition/request/assertions/MsAssertions.java | 9 ++++++++- .../definition/request/processors/MsJSR223Processor.java | 2 +- .../request/processors/post/MsJSR223PostProcessor.java | 2 +- .../request/processors/pre/MsJSR223PreProcessor.java | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java index b9d28f7cc4..97510aec1c 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java @@ -142,7 +142,14 @@ public class MsAssertions extends MsTestElement { assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName()); assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); assertion.setProperty("cacheKey", "true"); - assertion.setProperty("scriptLanguage", assertionJSR223.getScriptLanguage()); + String scriptLanguage = assertionJSR223.getScriptLanguage(); + if (StringUtils.equals(scriptLanguage, "nashornScript")) { + scriptLanguage = "nashorn"; + } + if (StringUtils.equals(scriptLanguage, "rhinoScript")) { + scriptLanguage = "rhino"; + } + assertion.setProperty("scriptLanguage", scriptLanguage); assertion.setProperty("script", assertionJSR223.getScript()); return assertion; } 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 66bfed1007..ee2a15aa6d 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 @@ -84,7 +84,7 @@ public class MsJSR223Processor extends MsTestElement { processor.setProperty("scriptLanguage", "nashorn"); } if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) { - processor.setProperty("scriptLanguage", "javascript"); + processor.setProperty("scriptLanguage", "rhino"); } processor.setProperty("script", this.getScript()); 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 ebd57596a0..ed667e79be 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 @@ -71,7 +71,7 @@ public class MsJSR223PostProcessor extends MsTestElement { processor.setProperty("scriptLanguage", "nashorn"); } if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) { - processor.setProperty("scriptLanguage", "javascript"); + processor.setProperty("scriptLanguage", "rhino"); } processor.setProperty("script", this.getScript()); 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 109ca2049e..edf1ab8a28 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 @@ -81,7 +81,7 @@ public class MsJSR223PreProcessor extends MsTestElement { processor.setProperty("scriptLanguage", "nashorn"); } if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) { - processor.setProperty("scriptLanguage", "javascript"); + processor.setProperty("scriptLanguage", "rhino"); } processor.setProperty("script", this.getScript());