refactor: 去掉 nashorn, 采用rhino作为默认的javascript

--story=1007265 --user=刘瑞斌 脚本语言去掉nashornScript https://www.tapd.cn/55049933/s/1144562
This commit is contained in:
CaptainB 2022-04-22 18:41:47 +08:00 committed by 刘瑞斌
parent e667020a28
commit bbf5117d87
9 changed files with 21 additions and 8 deletions

View File

@ -213,6 +213,9 @@ public class MsAssertions extends MsTestElement {
if (StringUtils.equals(scriptLanguage, "rhinoScript")) {
scriptLanguage = "rhino";
}
if (StringUtils.equals(scriptLanguage, "javascript")) {
scriptLanguage = "rhino";
}
assertion.setProperty("scriptLanguage", scriptLanguage);
assertion.setProperty("script", assertionJSR223.getScript());
return assertion;

View File

@ -87,6 +87,9 @@ public class MsJSR223Processor extends MsTestElement {
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) {
processor.setProperty("scriptLanguage", "rhino");
}
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("javascript")) {
processor.setProperty("scriptLanguage", "rhino");
}
processor.setProperty("script", this.getScript());
final HashTree jsr223PreTree = tree.add(processor);

View File

@ -83,6 +83,9 @@ public class MsJSR223PostProcessor extends MsTestElement {
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) {
processor.setProperty("scriptLanguage", "rhino");
}
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("javascript")) {
processor.setProperty("scriptLanguage", "rhino");
}
processor.setProperty("script", this.getScript());
final HashTree jsr223PostTree = tree.add(processor);

View File

@ -96,6 +96,9 @@ public class MsJSR223PreProcessor extends MsTestElement {
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) {
processor.setProperty("scriptLanguage", "rhino");
}
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("javascript")) {
processor.setProperty("scriptLanguage", "rhino");
}
processor.setProperty("script", this.getScript());
return processor;

View File

@ -93,7 +93,7 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
if (StringUtils.isNotBlank(scriptStr)) {
MsJSR223PreProcessor jsr223PreProcessor = new MsJSR223PreProcessor();
jsr223PreProcessor.setName("JSR223PreProcessor");
jsr223PreProcessor.setScriptLanguage("nashornScript");
jsr223PreProcessor.setScriptLanguage("rhino");
jsr223PreProcessor.setScript(parseVariable(scriptStr.toString()));
LinkedList<MsTestElement> hashTree = new LinkedList<>();
hashTree.add(jsr223PreProcessor);

View File

@ -140,7 +140,7 @@ export default {
],
isCodeEditAlive: true,
languages: [
'beanshell', "python", "groovy", "nashornScript", "rhinoScript"
'beanshell', "python", "groovy", "javascript"
],
codeEditModeMap: {
beanshell: 'java',
@ -148,6 +148,7 @@ export default {
groovy: 'java',
nashornScript: 'javascript',
rhinoScript: 'javascript',
javascript: 'javascript',
},
codeSpan: 20,
menuSpan: 4,

View File

@ -104,8 +104,7 @@ export default {
{text: 'beanshell', value: 'beanshell'},
{text: 'python', value: 'python'},
{text: 'groovy', value: 'groovy'},
{text: 'nashornScript', value: 'nashornScript'},
{text: 'rhinoScript', value: 'rhinoScript'},
{text: 'javascript', value: 'javascript'},
],
}
},

View File

@ -150,8 +150,7 @@ export default {
'beanshell',
"python",
"groovy",
"nashornScript",
"rhinoScript"
"javascript"
],
codeEditModeMap: {
beanshell: 'java',
@ -159,6 +158,7 @@ export default {
groovy: 'java',
nashornScript: 'javascript',
rhinoScript: 'javascript',
javascript: 'javascript',
},
response: {},
request: {},

View File

@ -2,8 +2,7 @@ export const FUNC_TEMPLATE = {
beanshell: "",
groovy: "",
python: "",
nashornScript: "",
rhinoScript: ""
javascript: ""
}
export function getCodeTemplate(language, requestObj) {
@ -18,6 +17,8 @@ export function getCodeTemplate(language, requestObj) {
return jsCode(requestObj);
case "rhinoScript":
return jsCode(requestObj);
case "javascript":
return jsCode(requestObj);
default:
return "";
}