Fix variable name "theadName" => "threadName" in __jexl() and __javaScript() functions

Add variable "log" to __jexl() and __javaScript()

git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/trunk@732569 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-01-08 00:34:52 +00:00
parent 495abb2194
commit 78fcbdcfc4
4 changed files with 18 additions and 6 deletions

View File

@ -77,10 +77,12 @@ public class JavaScript extends AbstractFunction {
Scriptable scope = cx.initStandardObjects(null);
// Set up some objects for the script to play with
scope.put("log", scope, log); //$NON-NLS-1$
scope.put("ctx", scope, jmctx); //$NON-NLS-1$
scope.put("vars", scope, vars); //$NON-NLS-1$
scope.put("props", scope, JMeterUtils.getJMeterProperties()); //$NON-NLS-1$
scope.put("theadName", scope, Thread.currentThread().getName()); //$NON-NLS-1$
// Previously mis-spelt as theadName
scope.put("threadName", scope, Thread.currentThread().getName()); //$NON-NLS-1$
scope.put("sampler", scope, currentSampler); //$NON-NLS-1$
scope.put("sampleResult", scope, previousResult); //$NON-NLS-1$

View File

@ -76,10 +76,12 @@ public class JexlFunction extends AbstractFunction {
Script script = ScriptFactory.createScript(exp);
JexlContext jc = JexlHelper.createContext();
final Map jexlVars = jc.getVars();
jexlVars.put("log", log); //$NON-NLS-1$
jexlVars.put("ctx", jmctx); //$NON-NLS-1$
jexlVars.put("vars", vars); //$NON-NLS-1$
jexlVars.put("props", JMeterUtils.getJMeterProperties()); //$NON-NLS-1$
jexlVars.put("theadName", Thread.currentThread().getName()); //$NON-NLS-1$
// Previously mis-spelt as theadName
jexlVars.put("threadName", Thread.currentThread().getName()); //$NON-NLS-1$
jexlVars.put("sampler", currentSampler); //$NON-NLS-1$ (may be null)
jexlVars.put("sampleResult", previousResult); //$NON-NLS-1$ (may be null)
jexlVars.put("OUT", System.out);//$NON-NLS-1$

View File

@ -105,6 +105,10 @@ The While controller now trims leading and trailing spaces from the condition va
with LAST, blank or false.
</p>
<p>
The "threadName" variable in the _jexl() and __javaScript() functions was previously misspelt as "theadName".
</p>
<p>
The following deprecated methods were removed from JOrphanUtils: booleanToString(boolean) and valueOf(boolean).
Java 1.4+ has these methods in the Boolean class.
@ -174,12 +178,14 @@ These are implemented in the AbstractTestElement class which all elements should
<li>Bug 46423 - I18N of Proxy Recorder</li>
<li>Better handling of Exceptions during test shutdown</li>
<li>Protect against possible NPE in RegexFunction if called during test shutdown.</li>
<li>Correct the variable name "theadName" to "threadName" in the __jexl() and __javaScript() functions</li>
</ul>
<h3>Improvements</h3>
<ul>
<li>LDAP result data now formatted with line breaks</li>
<li>Add OUT variable to jexl function</li>
<li>Add OUT and log variables to __jexl() function</li>
<li>Add log variable to the __javaScript() function</li>
<li>Save Responses to a file can save the generated filename(s) to variables.</li>
<li>Add BSF Listener element</li>
<li>Bug 45200 - MailReaderSampler: store the whole MIME message in the SamplerResult</li>

View File

@ -475,9 +475,10 @@ For details of the language, please see <a href="http://www.mozilla.org/rhino/ov
The following variables are made available to the script:
</p>
<ul>
<li>log - the logger for the function</li>
<li>ctx - JMeterContext object</li>
<li>vars - JMeterVariables object</li>
<li>threadName - String</li>
<li>threadName - String containing the current thread name (in 2.3.2 it was misspelt as "theadName")</li>
<li>sampler - current Sampler object (if any)</li>
<li>sampleResult - previous SampleResult object (if any)</li>
<li>props - JMeter Properties object</li>
@ -724,7 +725,7 @@ The following variables are set before the script is executed:
<li>ctx - the current JMeter context variable</li>
<li>vars - the current JMeter variables</li>
<li>props - JMeter Properties object</li>
<li>threadName - the threadName</li>
<li>threadName - the threadName (String)</li>
<li>Sampler the current Sampler, if any</li>
<li>SampleResult - the current SampleResult, if any</li>
</ul>
@ -888,10 +889,11 @@ time.YMD=yyMMdd
The following variables are made available to the script:
</p>
<ul>
<li>log - the logger for the function</li>
<li>ctx - JMeterContext object</li>
<li>vars - JMeterVariables object</li>
<li>props - JMeter Properties object</li>
<li>threadName - String</li>
<li>threadName - String containing the current thread name (in 2.3.2 it was misspelt as "theadName")</li>
<li>sampler - current Sampler object (if any)</li>
<li>sampleResult - previous SampleResult object (if any)</li>
<li>OUT - System.out - e.g. OUT.println("message")</li>