sebb 2005/04/14 16:08:41
Modified: src/components/org/apache/jmeter/assertions
BeanShellAssertion.java
src/protocol/java/org/apache/jmeter/protocol/java/sampler
BeanShellSampler.java
xdocs/usermanual component_reference.xml
Log:
Make JMeterContext and JMeterVariables more easily available
Revision Changes Path
1.10 +11 -2
jakarta-jmeter/src/components/org/apache/jmeter/assertions/BeanShellAssertion.java
Index: BeanShellAssertion.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/components/org/apache/jmeter/assertions/BeanShellAssertion.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BeanShellAssertion.java 19 Mar 2005 00:33:37 -0000 1.9
+++ BeanShellAssertion.java 14 Apr 2005 23:08:41 -0000 1.10
@@ -23,6 +23,9 @@
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.AbstractTestElement;
+import org.apache.jmeter.threads.JMeterContext;
+import org.apache.jmeter.threads.JMeterContextService;
+import org.apache.jmeter.threads.JMeterVariables;
import org.apache.jmeter.util.BeanShellInterpreter;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
@@ -121,6 +124,12 @@
bshInterpreter.set("FailureMessage","");//$NON-NLS-1$
//$NON-NLS-2$
bshInterpreter.set("Failure",false);//$NON-NLS-1$
+ // Add variables for access to context and variables
+ JMeterContext jmctx = JMeterContextService.getContext();
+ JMeterVariables vars = jmctx.getVariables();
+ bshInterpreter.set("ctx",jmctx);//$NON-NLS-1$
+ bshInterpreter.set("vars",vars);//$NON-NLS-1$
+
//Object bshOut;
if (fileName.length() == 0){
1.13 +11 -2
jakarta-jmeter/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
Index: BeanShellSampler.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- BeanShellSampler.java 19 Mar 2005 00:33:59 -0000 1.12
+++ BeanShellSampler.java 14 Apr 2005 23:08:41 -0000 1.13
@@ -23,6 +23,9 @@
import org.apache.jmeter.samplers.AbstractSampler;
import org.apache.jmeter.samplers.Entry;
import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.threads.JMeterContext;
+import org.apache.jmeter.threads.JMeterContextService;
+import org.apache.jmeter.threads.JMeterVariables;
import org.apache.jmeter.util.BeanShellInterpreter;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
@@ -124,6 +127,12 @@
bshInterpreter.set("ResponseMessage","OK");//$NON-NLS-1$
bshInterpreter.set("IsSuccess",true);//$NON-NLS-1$
+ // Add variables for access to context and variables
+ JMeterContext jmctx = JMeterContextService.getContext();
+ JMeterVariables vars = jmctx.getVariables();
+ bshInterpreter.set("ctx",jmctx);//$NON-NLS-1$
+ bshInterpreter.set("vars",vars);//$NON-NLS-1$
+
Object bshOut;
if (fileName.length() == 0){
1.106 +5 -1 jakarta-jmeter/xdocs/usermanual/component_reference.xml
Index: component_reference.xml
===================================================================
RCS file: /home/cvs/jakarta-jmeter/xdocs/usermanual/component_reference.xml,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- component_reference.xml 10 Apr 2005 21:23:00 -0000 1.105
+++ component_reference.xml 14 Apr 2005 23:08:41 -0000 1.106
@@ -573,6 +573,8 @@
<li>ResponseCode = 200</li>
<li>ResponseMessage = "OK"</li>
<li>IsSuccess = true</li>
+ <li>ctx - JMeterContext</li>
+ <li>vars - JMeterVariables - e.g. vars.get("VAR1");
vars.put("VAR2","value");</li>
</ul>
<p>When the script completes, control is returned to the
Sampler, and it copies the contents
of the following script variables into the
corresponding variables in the SampleResult:</p>
@@ -1830,6 +1832,8 @@
<li>RequestHeaders - contains the HTTP headers sent to the server</li>
<li>SampleLabel</li>
<li>SamplerData - data that was sent to the server</li>
+ <li>ctx - JMeterContext</li>
+ <li>vars - JMeterVariables - e.g. vars.get("VAR1");
vars.put("VAR2","value");</li>
</ul>
</p>
<p>The following methods of the Response object may be useful:
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]