Author: sebb
Date: Tue May 13 05:53:39 2008
New Revision: 655843

URL: http://svn.apache.org/viewvc?rev=655843&view=rev
Log:
Give BeanShell, Javascript and Jexl functions access to JMeter properties via 
the "props" object

Modified:
    jakarta/jmeter/trunk/docs/changes.html
    jakarta/jmeter/trunk/docs/usermanual/functions.html
    
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/BeanShell.java
    
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java
    
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JexlFunction.java
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/usermanual/functions.xml

Modified: jakarta/jmeter/trunk/docs/changes.html
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/changes.html?rev=655843&r1=655842&r2=655843&view=diff
==============================================================================
--- jakarta/jmeter/trunk/docs/changes.html (original)
+++ jakarta/jmeter/trunk/docs/changes.html Tue May 13 05:53:39 2008
@@ -663,6 +663,11 @@
                                                </li>
                                                                        
 
+                                                                               
                <li     >
+                                                               Give BeanShell, 
Javascript and Jexl functions access to JMeter properties via the "props" object
+                                               </li>
+                                                                       
+
                                                </ul>
                                                                                
                                                                                
<h4     >
                                                                Non-functional 
changes

Modified: jakarta/jmeter/trunk/docs/usermanual/functions.html
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/usermanual/functions.html?rev=655843&r1=655842&r2=655843&view=diff
==============================================================================
--- jakarta/jmeter/trunk/docs/usermanual/functions.html (original)
+++ jakarta/jmeter/trunk/docs/usermanual/functions.html Tue May 13 05:53:39 2008
@@ -1577,7 +1577,7 @@
 
                                                                                
                <p      >
                                                                
-Versions of JMeter after 2.3 make the following variables available to the 
script:
+The following variables are made available to the script:
 
                                                </p>
                                                                        
@@ -1610,6 +1610,11 @@
                                                </li>
                                                                        
 
+                                                                               
                <li     >
+                                                               props - JMeter 
Properties object
+                                               </li>
+                                                                       
+
                                                </ul>
                                                                        
 
@@ -2288,6 +2293,11 @@
                                                                        
 
                                                                                
                <li     >
+                                                               props - JMeter 
Properties object
+                                               </li>
+                                                                       
+
+                                                                               
                <li     >
                                                                threadName - 
the threadName
                                                </li>
                                                                        
@@ -2772,7 +2782,7 @@
        </p>
                                                                                
                                                                                
<p      >
                                                                
-JMeter 2.3 (and later versions) make the following variables available to the 
script:
+The following variables are made available to the script:
 
                                                </p>
                                                                                
                                                                                
<ul     >
@@ -2789,6 +2799,11 @@
                                                                        
 
                                                                                
                <li     >
+                                                               props - JMeter 
Properties object
+                                               </li>
+                                                                       
+
+                                                                               
                <li     >
                                                                threadName - 
String
                                                </li>
                                                                        

Modified: 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/BeanShell.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/BeanShell.java?rev=655843&r1=655842&r2=655843&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/BeanShell.java 
(original)
+++ 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/BeanShell.java 
Tue May 13 05:53:39 2008
@@ -106,6 +106,7 @@
                        // Allow access to context and variables directly
                        bshInterpreter.set("ctx", jmctx); //$NON-NLS-1$
                        bshInterpreter.set("vars", vars); //$NON-NLS-1$
+            bshInterpreter.set("props", JMeterUtils.getJMeterProperties()); 
//$NON-NLS-1$
                        bshInterpreter.set("threadName", 
Thread.currentThread().getName()); //$NON-NLS-1$
 
                        // Execute the script

Modified: 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java?rev=655843&r1=655842&r2=655843&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java 
(original)
+++ 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JavaScript.java 
Tue May 13 05:53:39 2008
@@ -86,6 +86,7 @@
                        // Set up some objects for the script to play with
                        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$
                        scope.put("sampler", scope, currentSampler); 
//$NON-NLS-1$
                        scope.put("sampleResult", scope, previousResult); 
//$NON-NLS-1$

Modified: 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JexlFunction.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JexlFunction.java?rev=655843&r1=655842&r2=655843&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JexlFunction.java
 (original)
+++ 
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/JexlFunction.java
 Tue May 13 05:53:39 2008
@@ -20,6 +20,7 @@
 import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.jexl.Expression;
 import org.apache.commons.jexl.ExpressionFactory;
@@ -77,11 +78,13 @@
         {
             Expression e = ExpressionFactory.createExpression(exp);
             JexlContext jc = JexlHelper.createContext();
-            jc.getVars().put("ctx", jmctx); //$NON-NLS-1$                
-            jc.getVars().put("vars", vars); //$NON-NLS-1$
-            jc.getVars().put("theadName", Thread.currentThread().getName()); 
//$NON-NLS-1$
-            jc.getVars().put("sampler", currentSampler); //$NON-NLS-1$ (may be 
null)
-            jc.getVars().put("sampleResult", previousResult); //$NON-NLS-1$ 
(may be null)
+            final Map jexlVars = jc.getVars();
+            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$
+            jexlVars.put("sampler", currentSampler); //$NON-NLS-1$ (may be 
null)
+            jexlVars.put("sampleResult", previousResult); //$NON-NLS-1$ (may 
be null)
 
             // Now evaluate the expression, getting the result
             Object o = e.evaluate(jc);

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=655843&r1=655842&r2=655843&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Tue May 13 05:53:39 2008
@@ -199,6 +199,7 @@
 <li>Bug 19128 - Added multiple file POST support to HTTP Samplers</li>
 <li>Allow use of special name LAST to mean the last test run; applies to -t, 
-l, -j flags</li>
 <li>Bug 44418/42178 - CSV Dataset file handling improvements</li>
+<li>Give BeanShell, Javascript and Jexl functions access to JMeter properties 
via the "props" object</li>
 </ul>
 
 <h4>Non-functional changes</h4>

Modified: jakarta/jmeter/trunk/xdocs/usermanual/functions.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/functions.xml?rev=655843&r1=655842&r2=655843&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/functions.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/functions.xml Tue May 13 05:53:39 2008
@@ -460,7 +460,7 @@
 For details of the language, please see <a 
href="http://www.mozilla.org/rhino/overview.html";>Mozilla Rhino Overview</a>
 </p>
 <p>
-Versions of JMeter after 2.3 make the following variables available to the 
script:
+The following variables are made available to the script:
 </p>
 <ul>
 <li>ctx - JMeterContext object</li>
@@ -468,6 +468,7 @@
 <li>threadName - String</li>
 <li>sampler - current Sampler object (if any)</li>
 <li>sampleResult - previous SampleResult object (if any)</li>
+<li>props - JMeter Properties object</li>
 </ul>
 <note>
 JMeter is not a browser, and does not interpret the JavaScript in downloaded 
pages.
@@ -704,6 +705,7 @@
 <li>log - the logger for the BeanShell function (*)</li>
 <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>Sampler the current Sampler, if any</li>
 <li>SampleResult - the current SampleResult, if any</li>
@@ -865,11 +867,12 @@
         <property name="Name of variable" required="No">The name of the 
variable to set.</property>
 </properties>
 <p>
-JMeter 2.3 (and later versions) make the following variables available to the 
script:
+The following variables are made available to the script:
 </p>
 <ul>
 <li>ctx - JMeterContext object</li>
 <li>vars - JMeterVariables object</li>
+<li>props - JMeter Properties object</li>
 <li>threadName - String</li>
 <li>sampler - current Sampler object (if any)</li>
 <li>sampleResult - previous SampleResult object (if any)</li>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to