ASF Bugzilla – Attachment 36032 Details for
Bug 62541
Allow __Jexl3,__Jexl2 functions to support new syntax (var)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch with using JexlScript over JexlExpression
patch62541.patch (text/plain), 2.75 KB, created by
orimarko
on 2018-07-16 06:35:50 UTC
(
hide
)
Description:
Patch with using JexlScript over JexlExpression
Filename:
MIME Type:
Creator:
orimarko
Created:
2018-07-16 06:35:50 UTC
Size:
2.75 KB
patch
obsolete
>Index: src/functions/org/apache/jmeter/functions/Jexl3Function.java >=================================================================== >--- src/functions/org/apache/jmeter/functions/Jexl3Function.java (revision 1836000) >+++ src/functions/org/apache/jmeter/functions/Jexl3Function.java (working copy) >@@ -23,7 +23,7 @@ > import org.apache.commons.jexl3.JexlBuilder; > import org.apache.commons.jexl3.JexlContext; > import org.apache.commons.jexl3.JexlEngine; >-import org.apache.commons.jexl3.JexlExpression; >+import org.apache.commons.jexl3.JexlScript; > import org.apache.commons.jexl3.MapContext; > import org.apache.jmeter.engine.util.CompoundVariable; > import org.apache.jmeter.samplers.SampleResult; >@@ -91,8 +91,8 @@ > jc.set("OUT", System.out);//$NON-NLS-1$ > > // Now evaluate the script, getting the result >- JexlExpression e = getJexlEngine().createExpression( exp ); >- Object o = e.evaluate(jc); >+ JexlScript e = getJexlEngine().createScript(exp); >+ Object o = e.execute(jc); > if (o != null) > { > str = o.toString(); >Index: test/src/org/apache/jmeter/functions/TestJexl3Function.java >=================================================================== >--- test/src/org/apache/jmeter/functions/TestJexl3Function.java (revision 1836000) >+++ test/src/org/apache/jmeter/functions/TestJexl3Function.java (working copy) >@@ -18,7 +18,11 @@ > > package org.apache.jmeter.functions; > >+import static org.junit.Assert.assertEquals; >+ >+import org.apache.jmeter.engine.util.CompoundVariable; > import org.junit.Before; >+import org.junit.Test; > > public class TestJexl3Function extends TestJexl2Function { > >@@ -28,4 +32,14 @@ > super.setUp(); > function = new Jexl3Function(); > } >+ >+ >+ @Test >+ public void testSum() throws Exception { >+ params.add(new CompoundVariable("var a = 1+2+3")); >+ function.setParameters(params); >+ String ret = function.execute(result, null); >+ assertEquals("6", ret); >+ } >+ > } >Index: xdocs/changes.xml >=================================================================== >--- xdocs/changes.xml (revision 1836000) >+++ xdocs/changes.xml (working copy) >@@ -124,6 +124,7 @@ > <li><bug>62178</bug>Add default value to <code>__V</code> function. Contributed by orimarko at gmail.com</li> > <li><bug>62178</bug>Add function <code>__threadGroupName</code> function to obtain ThreadGroup name. Mainly contributed by orimarko at gmail.com</li> > <li><bug>62533</bug>Allow use epoch time as Date String value in function <code>__dateTimeConvert</code> </li> >+ <li><bug>62541</bug>Fix <code>__jexl3</code> function to support new syntax as 'var x;'. Contributed by orimarko at gmail.com</li> > </ul> > <h3>I18N</h3> > <ul>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 62541
: 36032