jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1725955 - in /jmeter/trunk: ./ lib/ licenses/bin/ res/maven/ src/functions/org/apache/jmeter/functions/ test/src/org/apache/jmeter/functions/ xdocs/ xdocs/usermanual/
Date Thu, 21 Jan 2016 20:19:10 GMT
On 21 January 2016 at 14:10,  <pmouawad@apache.org> wrote:
> Author: pmouawad
> Date: Thu Jan 21 14:10:43 2016
> New Revision: 1725955
>
> URL: http://svn.apache.org/viewvc?rev=1725955&view=rev
> Log:
> Bug 58903 - Provide __jexl3 function that uses commons-jexl3 and deprecated __jexl (1.1)
function
> Add also JUnit tests for jexl2 and jexl3
> Bugzilla Id: 58903
>
> Added:
>     jmeter/trunk/src/functions/org/apache/jmeter/functions/Jexl3Function.java   (with
props)
>     jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl2Function.java   (contents,
props changed)
>       - copied, changed from r1719809, jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexlFunction.java
>     jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl3Function.java   (with
props)
> Modified:
>     jmeter/trunk/build.properties
>     jmeter/trunk/build.xml
>     jmeter/trunk/eclipse.classpath
>     jmeter/trunk/lib/   (props changed)
>     jmeter/trunk/lib/aareadme.txt
>     jmeter/trunk/licenses/bin/README.txt
>     jmeter/trunk/res/maven/ApacheJMeter_parent.pom
>     jmeter/trunk/xdocs/changes.xml
>     jmeter/trunk/xdocs/usermanual/functions.xml
>
> Modified: jmeter/trunk/build.properties
> URL: http://svn.apache.org/viewvc/jmeter/trunk/build.properties?rev=1725955&r1=1725954&r2=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/build.properties (original)
> +++ jmeter/trunk/build.properties Thu Jan 21 14:10:43 2016
> @@ -110,6 +110,11 @@ commons-jexl2.jar           = commons-je
>  commons-jexl2.loc           = ${maven2.repo}/org/apache/commons/commons-jexl/${commons-jexl2.version}
>  commons-jexl2.md5           = 4ad8f5c161dd3a50e190334555675db9
>
> +commons-jexl3.version       = 3.0
> +commons-jexl3.jar           = commons-jexl3-${commons-jexl3.version}.jar
> +commons-jexl3.loc           = ${maven2.repo}/org/apache/commons/commons-jexl3/${commons-jexl3.version}
> +commons-jexl3.md5           = 81041b5b058a2ccff0046386bc7e23f8
> +
>  commons-lang3.version       = 3.4
>  commons-lang3.jar           = commons-lang3-${commons-lang3.version}.jar
>  commons-lang3.loc           = ${maven2.repo}/org/apache/commons/commons-lang3/${commons-lang3.version}
>
> Modified: jmeter/trunk/build.xml
> URL: http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1725955&r1=1725954&r2=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/build.xml (original)
> +++ jmeter/trunk/build.xml Thu Jan 21 14:10:43 2016
> @@ -370,6 +370,7 @@
>      <include name="${lib.dir}/${commons-io.jar}"/>
>      <include name="${lib.dir}/${commons-jexl.jar}"/>
>      <include name="${lib.dir}/${commons-jexl2.jar}"/>
> +       <include name="${lib.dir}/${commons-jexl3.jar}"/>
>      <include name="${lib.dir}/${commons-lang3.jar}"/>
>      <include name="${lib.dir}/${commons-logging.jar}"/>
>      <include name="${lib.dir}/${commons-math3.jar}"/>
> @@ -444,6 +445,7 @@
>      <pathelement location="${lib.dir}/${commons-io.jar}"/>
>      <pathelement location="${lib.dir}/${commons-jexl.jar}"/>
>      <pathelement location="${lib.dir}/${commons-jexl2.jar}"/>
> +       <pathelement location="${lib.dir}/${commons-jexl3.jar}"/>
>      <pathelement location="${lib.dir}/${commons-lang3.jar}"/>
>      <pathelement location="${lib.dir}/${commons-logging.jar}"/>
>      <pathelement location="${lib.dir}/${commons-math3.jar}"/>
> @@ -2844,6 +2846,7 @@ run JMeter unless all the JMeter jars ar
>          <process_jarfile jarname="commons-io"/>
>          <process_jarfile jarname="commons-jexl"/>
>          <process_jarfile jarname="commons-jexl2"/>
> +       <process_jarfile jarname="commons-jexl3"/>
>          <process_jarfile jarname="commons-lang3"/>
>          <process_jarfile jarname="commons-logging"/>
>          <process_jarfile jarname="commons-math3"/>
>
> Modified: jmeter/trunk/eclipse.classpath
> URL: http://svn.apache.org/viewvc/jmeter/trunk/eclipse.classpath?rev=1725955&r1=1725954&r2=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/eclipse.classpath (original)
> +++ jmeter/trunk/eclipse.classpath Thu Jan 21 14:10:43 2016
> @@ -53,6 +53,7 @@
>         <classpathentry kind="lib" path="lib/commons-io-2.4.jar"/>
>         <classpathentry kind="lib" path="lib/commons-jexl-1.1.jar"/>
>         <classpathentry kind="lib" path="lib/commons-jexl-2.1.1.jar"/>
> +       <classpathentry kind="lib" path="lib/commons-jexl3-3.0.jar"/>
>         <classpathentry kind="lib" path="lib/commons-lang3-3.4.jar"/>
>         <classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
>         <classpathentry kind="lib" path="lib/commons-math3-3.5.jar"/>
>
> Propchange: jmeter/trunk/lib/
> ------------------------------------------------------------------------------
> --- svn:ignore (original)
> +++ svn:ignore Thu Jan 21 14:10:43 2016
> @@ -11,6 +11,7 @@ commons-httpclient-3.1.jar
>  commons-io-2.4.jar
>  commons-jexl-1.1.jar
>  commons-jexl-2.1.1.jar
> +commons-jexl3-3.0.jar
>  commons-lang3-3.4.jar
>  commons-logging-1.2.jar
>  commons-math3-3.5.jar
>
> Modified: jmeter/trunk/lib/aareadme.txt
> URL: http://svn.apache.org/viewvc/jmeter/trunk/lib/aareadme.txt?rev=1725955&r1=1725954&r2=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/lib/aareadme.txt (original)
> +++ jmeter/trunk/lib/aareadme.txt Thu Jan 21 14:10:43 2016
> @@ -51,7 +51,7 @@ commons-io-2.4
>  http://commons.apache.org/downloads/download_io.cgi
>  - FTPSampler
>
> -commons-jexl-1.1
> +commons-jexl-1.1, commons-jexl-2.1.1, commons-jexl3-3.0
>  ----------------
>  http://commons.apache.org/downloads/download_jexl.cgi
>  - Jexl function and BSF test elements
>
> Modified: jmeter/trunk/licenses/bin/README.txt
> URL: http://svn.apache.org/viewvc/jmeter/trunk/licenses/bin/README.txt?rev=1725955&r1=1725954&r2=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/licenses/bin/README.txt (original)
> +++ jmeter/trunk/licenses/bin/README.txt Thu Jan 21 14:10:43 2016
> @@ -12,6 +12,7 @@ commons-httpclient-3.1.jar
>  commons-io-2.4.jar
>  commons-jexl-1.1.jar
>  commons-jexl-2.1.1.jar
> +commons-jexl3-3.0.jar
>  commons-lang3-3.4.jar
>  commons-logging-1.2.jar
>  commons-math3-3.5.jar
>
> Modified: jmeter/trunk/res/maven/ApacheJMeter_parent.pom
> URL: http://svn.apache.org/viewvc/jmeter/trunk/res/maven/ApacheJMeter_parent.pom?rev=1725955&r1=1725954&r2=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/res/maven/ApacheJMeter_parent.pom (original)
> +++ jmeter/trunk/res/maven/ApacheJMeter_parent.pom Thu Jan 21 14:10:43 2016
> @@ -65,6 +65,7 @@ under the License.
>        <commons-io.version>2.4</commons-io.version>
>        <commons-jexl.version>1.1</commons-jexl.version>
>        <commons-jexl2.version>2.1.1</commons-jexl2.version>
> +      <commons-jexl3.version>3.0</commons-jexl3.version>
>        <commons-lang3.version>3.4</commons-lang3.version>
>        <commons-logging.version>1.2</commons-logging.version>
>        <commons-math3.version>3.5</commons-math3.version>
> @@ -177,6 +178,11 @@ under the License.
>        </dependency>
>        <dependency>
>          <groupId>org.apache.commons</groupId>
> +        <artifactId>commons-jexl3</artifactId>
> +        <version>${commons-jexl3.version}</version>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.commons</groupId>
>          <artifactId>commons-lang3</artifactId>
>          <version>${commons-lang3.version}</version>
>        </dependency>
>
> Added: jmeter/trunk/src/functions/org/apache/jmeter/functions/Jexl3Function.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/Jexl3Function.java?rev=1725955&view=auto
> ==============================================================================
> --- jmeter/trunk/src/functions/org/apache/jmeter/functions/Jexl3Function.java (added)
> +++ jmeter/trunk/src/functions/org/apache/jmeter/functions/Jexl3Function.java Thu Jan
21 14:10:43 2016
> @@ -0,0 +1,164 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements.  See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License.  You may obtain a copy of the License at
> + *
> + *      http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.apache.jmeter.functions;
> +
> +import java.util.Collection;
> +import java.util.LinkedList;
> +import java.util.List;
> +
> +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.MapContext;
> +import org.apache.jmeter.engine.util.CompoundVariable;
> +import org.apache.jmeter.samplers.SampleResult;
> +import org.apache.jmeter.samplers.Sampler;
> +import org.apache.jmeter.testelement.ThreadListener;
> +import org.apache.jmeter.threads.JMeterContext;
> +import org.apache.jmeter.threads.JMeterContextService;
> +import org.apache.jmeter.threads.JMeterVariables;
> +import org.apache.jmeter.util.JMeterUtils;
> +import org.apache.jorphan.logging.LoggingManager;
> +import org.apache.log.Logger;
> +
> +/**
> + * A function which understands Commons JEXL3
> + * @since 3.0
> + */
> +// For unit tests, see TestJexlFunction
> +public class Jexl3Function extends AbstractFunction implements ThreadListener {
> +
> +    private static final Logger log = LoggingManager.getLoggerForClass();
> +
> +    private static final String KEY = "__jexl3"; //$NON-NLS-1$
> +
> +    private static final List<String> desc = new LinkedList<>();
> +
> +    private static final ThreadLocal<JexlEngine> threadLocalJexl = new ThreadLocal<>();
> +
> +    static
> +    {
> +        desc.add(JMeterUtils.getResString("jexl_expression")); //$NON-NLS-1$
> +        desc.add(JMeterUtils.getResString("function_name_paropt"));// $NON-NLS1$
> +    }
> +
> +    private Object[] values;
> +
> +    /** {@inheritDoc} */
> +    @Override
> +    public String execute(SampleResult previousResult, Sampler currentSampler)
> +            throws InvalidVariableException
> +    {
> +        String str = ""; //$NON-NLS-1$
> +
> +        CompoundVariable var = (CompoundVariable) values[0];
> +        String exp = var.execute();
> +
> +        String varName = ""; //$NON-NLS-1$
> +        if (values.length > 1) {
> +            varName = ((CompoundVariable) values[1]).execute().trim();
> +        }
> +
> +        JMeterContext jmctx = JMeterContextService.getContext();
> +        JMeterVariables vars = jmctx.getVariables();
> +
> +        try
> +        {
> +            JexlContext jc = new MapContext();
> +            jc.set("log", log); //$NON-NLS-1$
> +            jc.set("ctx", jmctx); //$NON-NLS-1$
> +            jc.set("vars", vars); //$NON-NLS-1$
> +            jc.set("props", JMeterUtils.getJMeterProperties()); //$NON-NLS-1$
> +            // Previously mis-spelt as theadName
> +            jc.set("threadName", Thread.currentThread().getName()); //$NON-NLS-1$
> +            jc.set("sampler", currentSampler); //$NON-NLS-1$ (may be null)
> +            jc.set("sampleResult", previousResult); //$NON-NLS-1$ (may be null)
> +            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);
> +            if (o != null)
> +            {
> +                str = o.toString();
> +            }
> +            if (vars != null && varName.length() > 0) {// vars will be null
on TestPlan
> +                vars.put(varName, str);
> +            }
> +        } catch (Exception e)
> +        {
> +            log.error("An error occurred while evaluating the expression \""
> +                    + exp + "\"\n",e);
> +        }
> +        return str;
> +    }
> +
> +    /**
> +     * Get JexlEngine from ThreadLocal
> +     * @return JexlEngine
> +     */
> +    private static JexlEngine getJexlEngine() {
> +        JexlEngine engine = threadLocalJexl.get();
> +        if(engine == null) {
> +            engine = new JexlBuilder()
> +                    .cache(512)
> +                    .silent(true)
> +                    .strict(true)
> +                    .create();
> +            threadLocalJexl.set(engine);
> +        }
> +        return engine;
> +    }
> +
> +    /** {@inheritDoc} */
> +    @Override
> +    public List<String> getArgumentDesc()
> +    {
> +        return desc;
> +    }
> +
> +    /** {@inheritDoc} */
> +    @Override
> +    public String getReferenceKey()
> +    {
> +        return KEY;
> +    }
> +
> +    /** {@inheritDoc} */
> +    @Override
> +    public void setParameters(Collection<CompoundVariable> parameters)
> +            throws InvalidVariableException
> +    {
> +        checkParameterCount(parameters, 1, 2);
> +        values = parameters.toArray();
> +    }
> +
> +    @Override
> +    public void threadStarted() {
> +    }
> +
> +    @Override
> +    public void threadFinished() {
> +        JexlEngine engine = threadLocalJexl.get();
> +        if(engine != null) {
> +            engine.clearCache();
> +            threadLocalJexl.remove();
> +        }
> +    }
> +
> +}
>
> Propchange: jmeter/trunk/src/functions/org/apache/jmeter/functions/Jexl3Function.java
> ------------------------------------------------------------------------------
>     svn:mime-type = text/plain
>
> Copied: jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl2Function.java (from
r1719809, jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexlFunction.java)
> URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl2Function.java?p2=jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl2Function.java&p1=jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexlFunction.java&r1=1719809&r2=1725955&rev=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexlFunction.java (original)
> +++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl2Function.java Thu Jan
21 14:10:43 2016
> @@ -28,8 +28,8 @@ import org.apache.jmeter.threads.JMeterC
>  import org.apache.jmeter.threads.JMeterContextService;
>  import org.apache.jmeter.threads.JMeterVariables;
>
> -public class TestJexlFunction extends JMeterTestCase {
> -    private JexlFunction function;
> +public class TestJexl2Function extends JMeterTestCase {
> +    protected AbstractFunction function;
>
>      private SampleResult result;
>
> @@ -39,13 +39,13 @@ public class TestJexlFunction extends JM
>
>      private JMeterContext jmctx;
>
> -    public TestJexlFunction(String name) {
> +    public TestJexl2Function(String name) {
>          super(name);
>      }
>
>      @Override
>      public void setUp() {
> -        function = new JexlFunction();
> +        function = new Jexl2Function();
>          result = new SampleResult();
>          jmctx = JMeterContextService.getContext();
>          String data = "The quick brown fox";
>
> Propchange: jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl2Function.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Propchange: jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl2Function.java
> ------------------------------------------------------------------------------
>     svn:keywords = Author Date Id Revision
>
> Added: jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl3Function.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl3Function.java?rev=1725955&view=auto
> ==============================================================================
> --- jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl3Function.java (added)
> +++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl3Function.java Thu Jan
21 14:10:43 2016
> @@ -0,0 +1,33 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements.  See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License.  You may obtain a copy of the License at
> + *
> + *   http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + *
> + */
> +
> +package org.apache.jmeter.functions;
> +
> +
> +public class TestJexl3Function extends TestJexl2Function {
> +
> +    public TestJexl3Function(String name) {
> +        super(name);
> +    }
> +
> +    @Override
> +    public void setUp() {
> +        super.setUp();
> +        function = new Jexl3Function();
> +    }
> +}
>
> Propchange: jmeter/trunk/test/src/org/apache/jmeter/functions/TestJexl3Function.java
> ------------------------------------------------------------------------------
>     svn:mime-type = text/plain
>
> Modified: jmeter/trunk/xdocs/changes.xml
> URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1725955&r1=1725954&r2=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/xdocs/changes.xml (original)
> +++ jmeter/trunk/xdocs/changes.xml Thu Jan 21 14:10:43 2016
> @@ -85,7 +85,8 @@ Summary
>      <li>MongoDB elements (MongoDB Source Config, MongoDB Script) have been deprecated
and will be removed in next version of jmeter. They do not appear anymore in the menu, if
you need them modify <code>not_in_menu</code> property. JMeter team advises not
to use them anymore. See <bugzilla>58772</bugzilla></li>
>      <li>Summariser listener now outputs a formated duration in HH:mm:ss (Hour:Minute:Second),
it previously outputed seconds. See <bugzilla>58776</bugzilla></li>
>      <li>WebService(SOAP) Request and HTML Parameter Mask which were deprecated
in 2.13 version, have now been removed following our <a href="./usermanual/best-practices.html#deprecation">deprecation
strategy</a></li>
> -    <li>org.apache.jmeter.protocol.http.visualizers.RequestViewHTTP.getQueryMap
signature has changed, if you use it ensure you update your code. See <bugzilla>58845</bugzilla></li>
> +    <li>org.apache.jmeter.protocol.http.visualizers.RequestViewHTTP.getQueryMap
signature has changed, if you use it ensure you update your code. See <bugzilla>58845</bugzilla></li>
> +    <li><code>__jexl</code> function has been deprecated and will
be removed in next version. See <bugzilla>58903</bugzilla></li>
>  </ul>
>
>  <!-- =================== Improvements =================== -->
> @@ -148,6 +149,7 @@ Summary
>  <h3>Functions</h3>
>  <ul>
>      <li><bug>58477</bug> __javaScript function : Allow use of Nashorn
engine for Java8 and later versions</li>
> +    <li><bug>58903</bug>Provide __jexl3 function that uses commons-jexl3
and deprecated __jexl (1.1) function</li>
>  </ul>
>
>  <h3>I18N</h3>
>
> Modified: jmeter/trunk/xdocs/usermanual/functions.xml
> URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/functions.xml?rev=1725955&r1=1725954&r2=1725955&view=diff
> ==============================================================================
> --- jmeter/trunk/xdocs/usermanual/functions.xml (original)
> +++ jmeter/trunk/xdocs/usermanual/functions.xml Thu Jan 21 14:10:43 2016
> @@ -125,7 +125,8 @@ Alternatively, just use <code>/</code> i
>          <tr><td>Calculation</td><td> <a href="#__UUID">UUID</a></td><td>generate
a random type 4 UUID</td><td>2.9</td></tr>
>          <tr><td>Scripting</td><td> <a href="#__BeanShell">BeanShell</a></td><td>run
a BeanShell script</td><td>1.X</td></tr>
>          <tr><td>Scripting</td><td> <a href="#__javaScript">javaScript</a></td><td>process
JavaScript (Mozilla Rhino)</td><td>1.9</td></tr>
> -        <tr><td>Scripting</td><td> <a href="#__jexl">jexl,
jexl2</a></td><td>evaluate a Commons Jexl expression</td><td>jexl(2.2),
jexl2(2.6)</td></tr>

-1, this breaks the tests.

The __jexl function must continue to be documented even though it is deprecated.

> +        <tr><td>Scripting</td><td> <a href="#__jexl2">jexl2</a></td><td>evaluate
a Commons Jexl2 expression</td><td>jexl2(2.6)</td></tr>
> +        <tr><td>Scripting</td><td> <a href="#__jexl3">jexl3</a></td><td>evaluate
a Commons Jexl3 expression</td><td>jexl3 (3.0)</td></tr>
>          <tr><td>Properties</td><td> <a href="#__property">property</a>
</td><td>read a property</td><td>2.0</td></tr>
>          <tr><td>Properties</td><td> <a href="#__P">P</a></td><td>read
a property (shorthand method)</td><td>2.0</td></tr>
>          <tr><td>Properties</td><td> <a href="#__setProperty">setProperty</a></td><td>set
a JMeter property</td><td>2.1</td></tr>
> @@ -992,16 +993,16 @@ The following shorthand aliases are prov
>  </p>
>  </component>
>
> -<component index="&sect-num;.5.18" name="__jexl" tag="__jexl2">

-1, the alias must remain until the function is removed entirely

> +<component index="&sect-num;.5.18" name="__jexl2" >
>  <description>
>      <p>The jexl function returns the result of evaluating a
>      <a href="http://commons.apache.org/jexl">Commons JEXL expression</a>.
>      See links below for more information on JEXL expressions.
>      </p>
> -    <p>The <code>__jexl</code> function uses Commons JEXL 1, and the
<code>__jexl2</code> function uses Commons JEXL 2</p>
> +    <p>The <code>__jexl2</code> function uses Commons JEXL 2</p>
>      <ul>
> -    <li><a href="http://commons.apache.org/jexl/reference/syntax.html">JEXL
syntax description</a></li>
> -    <li><a href="http://commons.apache.org/jexl/reference/examples.html#Example_Expressions">JEXL
examples</a></li>
> +    <li><a href="http://commons.apache.org/proper/commons-jexl/reference/syntax.html">JEXL
syntax description</a></li>
> +    <li><a href="http://commons.apache.org/proper/commons-jexl/reference/examples.html#Example_Expressions">JEXL
examples</a></li>
>      </ul>
>      </description>
>
> @@ -1043,7 +1044,58 @@ i.intValue(); // or use i.longValue()
>      <note>JMeter allows the expression to contain multiple statements.</note>
>  </component>
>
> -<component index="&sect-num;.5.19" name="__V">
> +<component index="&sect-num;.5.19" name="__jexl3" >
> +<description>
> +    <p>The jexl function returns the result of evaluating a
> +    <a href="http://commons.apache.org/proper/commons-jexl/">Commons JEXL expression</a>.
> +    See links below for more information on JEXL expressions.
> +    </p>
> +    <p>The <code>__jexl3</code> function uses Commons JEXL 3</p>
> +    <ul>
> +    <li><a href="http://commons.apache.org/proper/commons-jexl/reference/syntax.html">JEXL
syntax description</a></li>
> +    <li><a href="http://commons.apache.org/proper/commons-jexl/reference/examples.html#Example_Expressions">JEXL
examples</a></li>
> +    </ul>
> +    </description>
> +
> +<properties>
> +        <property name="Expression" required="Yes">
> +        The expression to be evaluated. For example, <code>6*(5+2)</code>
> +        </property>
> +        <property name="Name of variable" required="No">The name of the variable
to set.</property>
> +</properties>
> +<p>
> +The following variables are made available to the script:
> +</p>
> +<ul>
> +<li><code>log</code> - the logger for the function</li>
> +<li><code>ctx</code> - JMeterContext object</li>
> +<li><code>vars</code> - JMeterVariables object</li>
> +<li><code>props</code> - JMeter Properties object</li>
> +<li><code>threadName</code> - String containing the current thread
name (in 2.3.2 it was misspelt as "<code>theadName</code>")</li>
> +<li><code>sampler</code> - current Sampler object (if any)</li>
> +<li><code>sampleResult</code> - previous SampleResult object (if any)</li>
> +<li><code>OUT</code> - System.out - e.g. <code>OUT.println("message")</code></li>
> +</ul>
> +    <p>
> +    Jexl can also create classes and call methods on them, for example:
> +    </p>
> +    <p>
> +    <source>
> +Systemclass=log.class.forName("java.lang.System");
> +now=Systemclass.currentTimeMillis();
> +</source>
> +    Note that the Jexl documentation on the web-site wrongly suggests that "<code>div</code>"
does integer division.
> +    In fact "<code>div</code>" and "<code>/</code>" both perform
normal division. One can get the same effect
> +    as follows:
> +    <source>
> +i= 5 / 2;
> +i.intValue(); // or use i.longValue()
> +</source>
> +    </p>
> +    <note>JMeter allows the expression to contain multiple statements.</note>
> +</component>
> +
> +<component index="&sect-num;.5.20" name="__V">
>  <description>
>      <p>The V (variable) function returns the result of evaluating a variable name
expression.
>      This can be used to evaluate nested variable references (which are not currently
supported).
> @@ -1063,7 +1115,7 @@ i.intValue(); // or use i.longValue()
>  </properties>
>  </component>
>
> -<component index="&sect-num;.5.20" name="__evalVar">
> +<component index="&sect-num;.5.21" name="__evalVar">
>  <description>
>      <p>The eval function returns the result of evaluating an expression stored
in a variable.
>      </p>
> @@ -1081,7 +1133,7 @@ i.intValue(); // or use i.longValue()
>          </property>
>  </properties>
>  </component>
> -<component index="&sect-num;.5.21" name="__eval">
> +<component index="&sect-num;.5.22" name="__eval">
>  <description>
>      <p>The eval function returns the result of evaluating a string expression.
>      </p>
> @@ -1110,7 +1162,7 @@ i.intValue(); // or use i.longValue()
>  </properties>
>  </component>
>
> -<component index="&sect-num;.5.22" name="__char">
> +<component index="&sect-num;.5.23" name="__char">
>  <description>
>      <p>
>      The char function returns the result of evaluating a list of numbers as Unicode
characters.
> @@ -1134,7 +1186,7 @@ i.intValue(); // or use i.longValue()
>   </p>
>  </component>
>
> -<component index="&sect-num;.5.23" name="__unescape">
> +<component index="&sect-num;.5.24" name="__unescape">
>  <description>
>      <p>
>      The unescape function returns the result of evaluating a Java-escaped string. See
also <code>__char()</code> above.
> @@ -1157,7 +1209,7 @@ i.intValue(); // or use i.longValue()
>   </p>
>  </component>
>
> -<component index="&sect-num;.5.24" name="__unescapeHtml">
> +<component index="&sect-num;.5.25" name="__unescapeHtml">
>  <description>
>      <p>
>  Function to unescape a string containing HTML entity escapes
> @@ -1184,7 +1236,7 @@ e.g. <code>"&amp;gt;&amp;zzzz;x"</code>
>  </properties>
>  </component>
>
> -<component index="&sect-num;.5.25" name="__escapeHtml">
> +<component index="&sect-num;.5.26" name="__escapeHtml">
>  <description>
>      <p>
>  Function which escapes the characters in a String using HTML entities.
> @@ -1207,7 +1259,7 @@ becomes:
>  </properties>
>  </component>
>
> -<component index="&sect-num;.5.26" name="__urldecode">
> +<component index="&sect-num;.5.27" name="__urldecode">
>  <description>
>      <p>
>  Function to decode a <code>application/x-www-form-urlencoded</code> string.
> @@ -1229,7 +1281,7 @@ For example, the string <code>Word+%22sc
>  </properties>
>  </component>
>
> -<component index="&sect-num;.5.27" name="__urlencode">
> +<component index="&sect-num;.5.28" name="__urlencode">
>  <description>
>      <p>
>  Function to encode a string to a <code>application/x-www-form-urlencoded</code>
string.
> @@ -1250,7 +1302,7 @@ For example, the string <code>Word &quot
>  </properties>
>  </component>
>
> -<component index="&sect-num;.5.28" name="__FileToString">
> +<component index="&sect-num;.5.29" name="__FileToString">
>
>  <description>
>      <p>
> @@ -1274,7 +1326,7 @@ A reference name - <code>refName</code>
>  <p>The file name, encoding and reference name parameters are resolved every time
the function is executed.</p>
>  </component>
>
> -<component index="&sect-num;.5.29" name="__samplerName">
> +<component index="&sect-num;.5.30" name="__samplerName">
>
>  <description>
>      <p>
> @@ -1297,7 +1349,7 @@ A reference name - <code>refName</code>
>  </properties>
>  </component>
>
> -<component index="&sect-num;.5.30" name="__TestPlanName">
> +<component index="&sect-num;.5.31" name="__TestPlanName">
>
>  <description>
>      <p>
> @@ -1310,7 +1362,7 @@ A reference name - <code>refName</code>
>  </p>
>  </component>
>
> -<component index="&sect-num;.5.31" name="__escapeOroRegexpChars">
> +<component index="&sect-num;.5.32" name="__escapeOroRegexpChars">
>  <description>
>      <p>
>  Function which escapes the ORO Regexp meta characters, it is the equivalent of <code>\Q</code>
<code>\E</code> in Java Regexp Engine.
>
>

Mime
View raw message