Questions tagged [jsr223]

JSR223 (Scripting for the Java Platform) is the Java Specification Request for a common scripting engine abstraction layer.

JSR223 (Scripting for the Java Platform) is the Java Specification Request for a common scripting engine abstraction layer.

As an example (from the Java Scripting Programmer's Guide):

import javax.script.*;
public class EvalScript {
    public static void main(String[] args) throws Exception {
        // create a script engine manager
        ScriptEngineManager factory = new ScriptEngineManager();
        // create a JavaScript engine
        ScriptEngine engine = factory.getEngineByName("JavaScript");
        // evaluate JavaScript code from String
        engine.eval("print('Hello, World')");
    }
}

The interface to instantiate a scripting engine and evaluate a script is language-agnostic; "JavaScript" could be changed to "Python" to evaluate in Python (via Jython) rather than JavaScript (via Rhino).

434 questions
0
votes
1 answer

Java - "safe" scripting

Does anyone know of any scripting for the Java platform that can be forcefully restricted to a provided function set (preferably absolutely no functions unless provided)? I've experimented with several JSR223 compatible languages, but have been…
Luke A. Leber
  • 702
  • 6
  • 17
0
votes
1 answer

Does JRS-223 cover the runtime environment?

Does JSR-223 cover the specs of the interactive interpreter that is common on all kinds of compliant languages from abcl to rhino to jython? If not, then do all these languages make their environments any way they want in Java, or are they mostly…
divs1210
  • 690
  • 1
  • 8
  • 16
0
votes
3 answers

Executing from ant: "Provider com.sun.script.javascript.RhinoScriptEngineFactory not found"

I'm developing an application that use JSR 223. All are ok (unit test and the execution from command line), except when execution is from Ant. In this case, execution through this error: ScriptEngineManager providers.next():…
angelcervera
  • 3,699
  • 1
  • 40
  • 68
0
votes
1 answer

Xquery using XQJ JSR 225

I have the following java code. I am using XQJ to write a test XQuery program using XQJ api. I have downloaded JSR-000225 XQuery API for Java 1.0 Final Release, and added xqjapi.jar to my classpath. The java code is as simple as the following…
Lucy
  • 471
  • 4
  • 12
  • 28
-1
votes
1 answer

how to skip blank values in http post body in Jmeter while reading data from csv?

Below is my sample body in jmeter. I tried using the JSR223 pre processor with below code but its removing the blank values only for the first csv row. How do i remove all blank values coming from my csv file? wham am i doing wrong here? Any help is…
-1
votes
1 answer

Encryption at browser level

I call an external javascript file. Please find below my code in JSR223 Sampler: load('EncryptionLogic.js'); var result1 = encrypt("1087679107122020","password"); var result2 = encrypt("433702216042014","password1"); log.info("encrypted value is…
-1
votes
1 answer

Jmeter logging for API URL+Request+ResponseCode+ResponseBody in csv

I like to save the following parameters in a CSV file in single line for HTTP REST call in Jmeter. Endpoint URL, request body, request header, response code, response body . could someone help with JS code or groovy code. Thanks in advance!
-1
votes
2 answers

Generate json body using groovy in jmeter having array inside an array

I'm trying to generate JSON body dynamically using values in csv file. For this i'm making use of JSR223 PreProcessor with groovy script. I'm expecting the below format to be generate when i run the groovy script { "transactionId": "100", …
Praveen PS
  • 127
  • 2
  • 5
  • 17
-1
votes
1 answer

obtain value from Key/value in map array groovy

I have code like this: def options = JsonPath.read(prev.getResponseDataAsString(), '$.options') def randomOption = options.get(RandomUtils.nextInt(0, options.size())) def code = randomOption.get("code") vars.put('code1', code) def values =…
Siddish
  • 97
  • 3
  • 12
-1
votes
1 answer

Encoding a value with Javascript and providing the dependencies to jMeter

So i want to pass an encoded Username to the successive jMeter steps by using an encryption function provided by developer scripts. The actual function is as below which takes the value to be encrypted (plainText) and returns an encrypted value…
MitSM
  • 21
  • 11
-1
votes
1 answer

Binding script terms using Java scripting API

I am new to JSR 223 (java scripting API), currently I am working on a project to reduce the complexity of writing customization script for application so we are creating an in house scripting to generate the customization script. However it is my…
jaysman
  • 51
  • 5
-2
votes
1 answer

Unable to capture required string from text file using Groovy - Jmeter JSR223

I need to parse a text file testresults.txt and capture serial number and then write the captured serial number onto separate text file called serialno.txt using groovy Jmeter JSR223 post processor. Below code is not working. It didn't get into the…
Selvaraj
  • 3
  • 2
-2
votes
1 answer

Which is the best high performance Jmeter sampler to use for Thrift protocol load testing Beanshell, JSR223 or Java request sampler?

I have a requirement to load test Thrift protocol with very high user load using JMeter. I need to know which is the best and most performant JMeter sampler to use out of Beanshell, JSR223 or Java request with high concurrency load? Appreciate…
user5235510
  • 23
  • 1
  • 8
-4
votes
1 answer

JMeter Compilable JSR223 Usage Precautions

Update - TL'DR: When it comes to the compilable and cacheable JSR223 Elements, I've saw people using all sorts of tactics dancing around it. I had my doubts and I had my answers here, and found that most of tactics I saw are done wrong: If your…
xpt
  • 20,363
  • 37
  • 127
  • 216
1 2 3
28
29