jsr223

Cannot call bundle by jruby-complete-1.7.21.jar

喜夏-厌秋 提交于 2019-12-24 02:57:14
问题 I've read http://spin.atomicobject.com/2013/04/24/bundler-jruby-complete/ and installed faraday, rspec and bundler gems with commands like: export GEM_HOME=/var/lib/tomcat6/shared/gems export GEM_PATH=/var/lib/tomcat6/shared/gems java -jar jruby-complete-1.7.21.jar -S gem install bundler And I see these gems in the list provided by java -jar jruby-complete-1.7.21.jar -S gem list I also can require files from these gems in inline jruby script, called through JSR223 from Activiti BPM, which is

How to load external js library in Jmeter?

自闭症网瘾萝莉.ら 提交于 2019-12-23 16:19:09
问题 I have the following code in a jsr223 sampler: var key = "key"; var dateStamp = "20160329T134359Z"; var regionName = "us-east-1"; var serviceName = "execute-api"; var kDate= Crypto.HMAC(Crypto.SHA256, dateStamp, "AWS4" + key, { asBytes: true}) var kRegion= Crypto.HMAC(Crypto.SHA256, regionName, kDate, { asBytes: true }); var kService=Crypto.HMAC(Crypto.SHA256, serviceName, kRegion, { asBytes: true }); var kSigning= Crypto.HMAC(Crypto.SHA256, "aws4_request", kService, { asBytes: true }); vars

reasonable handling of ScriptException thrown by JSR223 Rhino

寵の児 提交于 2019-12-22 04:56:11
问题 I'm starting to run into the dirty little secrets of what is an otherwise very useful JSR223 scripting environment. I'm using the builtin version of Rhino shipped with Java 6 SE, accessing it through JSR223's ScriptingEngine et al. When I get an exception caused by a Java object I've exported into the Javascript environment, it is a ScriptingException that wraps a sun.org.mozilla.javascript.internal.WrappedException that wraps my real exception (e.g. UnsupportedOperationException or whatever)

JMeter JSR 223 language js Vs javascript

放肆的年华 提交于 2019-12-20 02:16:53
问题 About JSR 223 Sampler languages, I can choose between javascript (ECMAScript ECMA 262 Edition 51 / Oracle Nashorn 1.8.0_144) and js (ECMAScript ECMA 262 Edition 51 / Oracle Nashorn 1.8.0_144) and nashorn (ECMAScript ECMA 262 Edition 51 / Oracle Nashorn 1.8.0_144) What's the difference? it seems that they are the same as JavaScript. Can I edit the list somehow? remove unused script languages? (There's also ecmascript language with same properties) 回答1: I don't think you will be able to remove

Debugging Groovy scripts running in a ScriptEngine from Eclipse

妖精的绣舞 提交于 2019-12-19 19:40:06
问题 I have a Groovy script which is run like this: File scriptFile = ...; ScriptEngine engine = ...; String script = FileUtils.readFileToString(scriptFile); Object evalResult = engine.eval(script, bindings); Unsurprisingly, breakpoint set in the script file doesn't trigger. What can I change to make it work? The script needs to be run in the context of the larger program (no separate launch configuration), and through a ScriptEngine , and the file is only known at runtime. 回答1: I'm using this

Is there a language-independent way to add a function to JSR223 scripting bindings?

流过昼夜 提交于 2019-12-19 09:57:21
问题 The JSR223 Bindings class allows you to expose arbitrary Java objects to scripting languages. But they have to be objects. I would like to define a function quit() that can be called from the scripting environment that turns into quitObject.run() in Java. But JSR223 doesn't define the concept of a function object. Is there a language-independent way to do the following in Javascript, namely to take a Runnable() and create a function in the scripting environment? static private Object

JMeter Script Engine which allow caching and compilation

北城余情 提交于 2019-12-18 07:16:47
问题 JSR223 Sampler have a statement that Groovy is implementing Compilable interface different than other scripting languages and therefore is recommended To benefit from caching and compilation, the language engine used for scripting must implement JSR223 Compilable interface (Groovy is one of these, java, beanshell and javascript are not) I tried to check it using similar code in JSR223 Sampler. I tried to check all available languages with Compilable: import javax.script.Compilable; import

Get data back from Jython scripts using JSR-223

爱⌒轻易说出口 提交于 2019-12-12 18:32:34
问题 I am using Jython 2.5.1 with JSR-223 (i.e. javax.script package) and I expect the last line of the Python script to be returned. For example, after evaluating this script: class Multiplier: def multiply(self, x, y): return x * y Multiplier().multiply(5, 7) I should get back 35, but I get null instead. In other hand it works with this other test: 5 * 7 What am I doing wrong? Here's the Java code: public static void main(String[] args) throws Exception { ScriptEngine engine = new

How do I set up jsr223 scripting with scala as scripting language

拥有回忆 提交于 2019-12-12 08:47:08
问题 So far I have tried the sling implementation for jsr223 scripting for scala, but was not able to get it set up correctly. when I do this: public static void main(String[] args) { try { new ScriptEngineManager().getEngineByName("scala"). eval("object HelloWorld {def main(args: Array[String]) { println(\"Hello, world!\") }}"); } catch (ScriptException e) { e.printStackTrace(); } } I got nothing but: javax.script.ScriptException: ERROR org.apache.sling.scripting.scala.Script line 13 : not found:

How to pass types and functions to a JSR-223 script?

走远了吗. 提交于 2019-12-12 04:29:44
问题 A typical JSR-223 script would begin with a series of surrogate imports like this (JavaScript+Nashorn chosen for example purposes): // "import" classes and static methods var Foo = Java.type("my.package.Foo"); // application classes require Java.type() use var bar = Foo.bar; // static method var Logger = java.util.logging.Logger; // system classes can be accessed directly var sin = java.lang.Math.sin; // the same for static methods // use them var foo = new Foo(); print(bar()); var log =