View | Details | Raw Unified | Return to bug 62541
Collapse All | Expand All

(-)src/functions/org/apache/jmeter/functions/Jexl3Function.java (-3 / +3 lines)
Lines 23-29 Link Here
23
import org.apache.commons.jexl3.JexlBuilder;
23
import org.apache.commons.jexl3.JexlBuilder;
24
import org.apache.commons.jexl3.JexlContext;
24
import org.apache.commons.jexl3.JexlContext;
25
import org.apache.commons.jexl3.JexlEngine;
25
import org.apache.commons.jexl3.JexlEngine;
26
import org.apache.commons.jexl3.JexlExpression;
26
import org.apache.commons.jexl3.JexlScript;
27
import org.apache.commons.jexl3.MapContext;
27
import org.apache.commons.jexl3.MapContext;
28
import org.apache.jmeter.engine.util.CompoundVariable;
28
import org.apache.jmeter.engine.util.CompoundVariable;
29
import org.apache.jmeter.samplers.SampleResult;
29
import org.apache.jmeter.samplers.SampleResult;
Lines 91-98 Link Here
91
            jc.set("OUT", System.out);//$NON-NLS-1$
91
            jc.set("OUT", System.out);//$NON-NLS-1$
92
92
93
            // Now evaluate the script, getting the result
93
            // Now evaluate the script, getting the result
94
            JexlExpression e = getJexlEngine().createExpression( exp );
94
            JexlScript e = getJexlEngine().createScript(exp);
95
            Object o = e.evaluate(jc);
95
            Object o = e.execute(jc);
96
            if (o != null)
96
            if (o != null)
97
            {
97
            {
98
                str = o.toString();
98
                str = o.toString();
(-)test/src/org/apache/jmeter/functions/TestJexl3Function.java (+14 lines)
Lines 18-24 Link Here
18
18
19
package org.apache.jmeter.functions;
19
package org.apache.jmeter.functions;
20
20
21
import static org.junit.Assert.assertEquals;
22
23
import org.apache.jmeter.engine.util.CompoundVariable;
21
import org.junit.Before;
24
import org.junit.Before;
25
import org.junit.Test;
22
26
23
public class TestJexl3Function extends TestJexl2Function {
27
public class TestJexl3Function extends TestJexl2Function {
24
28
Lines 28-31 Link Here
28
        super.setUp();
32
        super.setUp();
29
        function = new Jexl3Function();
33
        function = new Jexl3Function();
30
    }
34
    }
35
    
36
37
    @Test
38
    public void testSum() throws Exception {
39
        params.add(new CompoundVariable("var a = 1+2+3"));
40
        function.setParameters(params);
41
        String ret = function.execute(result, null);
42
        assertEquals("6", ret);
43
    }
44
31
}
45
}
(-)xdocs/changes.xml (+1 lines)
Lines 124-129 Link Here
124
    <li><bug>62178</bug>Add default value to <code>__V</code> function. Contributed by orimarko at gmail.com</li>
124
    <li><bug>62178</bug>Add default value to <code>__V</code> function. Contributed by orimarko at gmail.com</li>
125
    <li><bug>62178</bug>Add function <code>__threadGroupName</code> function to obtain ThreadGroup name. Mainly contributed by orimarko at gmail.com</li>
125
    <li><bug>62178</bug>Add function <code>__threadGroupName</code> function to obtain ThreadGroup name. Mainly contributed by orimarko at gmail.com</li>
126
    <li><bug>62533</bug>Allow use epoch time as Date String value in function <code>__dateTimeConvert</code> </li>
126
    <li><bug>62533</bug>Allow use epoch time as Date String value in function <code>__dateTimeConvert</code> </li>
127
    <li><bug>62541</bug>Fix <code>__jexl3</code> function to support new syntax as 'var x;'. Contributed by orimarko at gmail.com</li>
127
</ul>
128
</ul>
128
<h3>I18N</h3>
129
<h3>I18N</h3>
129
<ul>
130
<ul>

Return to bug 62541