fix(接口定义): 修复加载外部js问题,增加 Nashorn JavaScript引擎切换到GraalVM 选择
This commit is contained in:
parent
13adca8f57
commit
3f1da24143
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue