Author: sebb
Date: Fri Jan 7 03:30:04 2011
New Revision: 1056181
URL: http://svn.apache.org/viewvc?rev=1056181&view=rev
Log:
All BeansShell test elements now have the script variables "prev" and "Label"
defined.
Modified:
jakarta/jmeter/trunk/docs/images/screenshots/beanshell_listener.png
jakarta/jmeter/trunk/docs/images/screenshots/timers/beanshell_timer.png
jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/BeanShellAssertion.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/BeanShellPreProcessor.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimer.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimerResources.properties
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListener.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListenerResources.properties
jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellTestElement.java
jakarta/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
jakarta/jmeter/trunk/xdocs/changes.xml
jakarta/jmeter/trunk/xdocs/images/screenshots/beanshell_listener.png
jakarta/jmeter/trunk/xdocs/images/screenshots/timers/beanshell_timer.png
jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
Modified: jakarta/jmeter/trunk/docs/images/screenshots/beanshell_listener.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/beanshell_listener.png?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
Binary files - no diff available.
Modified:
jakarta/jmeter/trunk/docs/images/screenshots/timers/beanshell_timer.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/timers/beanshell_timer.png?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
Binary files - no diff available.
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/BeanShellAssertion.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/BeanShellAssertion.java?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/BeanShellAssertion.java
(original)
+++
jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/BeanShellAssertion.java
Fri Jan 7 03:30:04 2011
@@ -19,13 +19,9 @@
package org.apache.jmeter.assertions;
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.BeanShellTestElement;
import org.apache.jorphan.logging.LoggingManager;
-import org.apache.jorphan.util.JOrphanUtils;
import org.apache.log.Logger;
/**
@@ -87,14 +83,6 @@ public class BeanShellAssertion extends
return result;
}
try {
- String request = getScript();
- String fileName = getFilename();
-
- bshInterpreter.set("FileName", getFilename());//$NON-NLS-1$
- // Set params as a single line
- bshInterpreter.set("Parameters", getParameters()); // $NON-NLS-1$
- bshInterpreter.set("bsh.args",//$NON-NLS-1$
- JOrphanUtils.split(getParameters(), " "));//$NON-NLS-1$
// Add SamplerData for consistency with BeanShell Sampler
bshInterpreter.set("SampleResult", response); //$NON-NLS-1$
@@ -113,21 +101,7 @@ public class BeanShellAssertion extends
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) {
- // bshOut =
- bshInterpreter.eval(request);
- } else {
- // bshOut =
- bshInterpreter.source(fileName);
- }
+ processFileOrScript(bshInterpreter);
result.setFailureMessage(bshInterpreter.get("FailureMessage").toString());//$NON-NLS-1$
result.setFailure(Boolean.valueOf(bshInterpreter.get("Failure")
//$NON-NLS-1$
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java
(original)
+++
jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/BeanShellPostProcessor.java
Fri Jan 7 03:30:04 2011
@@ -23,7 +23,6 @@ import org.apache.jmeter.samplers.Sample
import org.apache.jmeter.testbeans.TestBean;
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.BeanShellTestElement;
import org.apache.jorphan.logging.LoggingManager;
@@ -50,7 +49,7 @@ public class BeanShellPostProcessor exte
SampleResult prev = jmctx.getPreviousResult();
if (prev == null) {
- return;
+ return; // TODO - should we skip processing here?
}
final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();
if (bshInterpreter == null) {
@@ -58,12 +57,8 @@ public class BeanShellPostProcessor exte
return;
}
- JMeterVariables vars = jmctx.getVariables();
try {
// Add variables for access to context and variables
- bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$
- bshInterpreter.set("vars", vars);//$NON-NLS-1$
- bshInterpreter.set("prev", prev);//$NON-NLS-1$
bshInterpreter.set("data", prev.getResponseData());//$NON-NLS-1$
processFileOrScript(bshInterpreter);
} catch (JMeterException e) {
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/BeanShellPreProcessor.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/BeanShellPreProcessor.java?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/BeanShellPreProcessor.java
(original)
+++
jakarta/jmeter/trunk/src/components/org/apache/jmeter/modifiers/BeanShellPreProcessor.java
Fri Jan 7 03:30:04 2011
@@ -19,12 +19,10 @@
package org.apache.jmeter.modifiers;
import org.apache.jmeter.processor.PreProcessor;
-import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.testbeans.TestBean;
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.BeanShellTestElement;
import org.apache.jorphan.logging.LoggingManager;
@@ -53,16 +51,10 @@ public class BeanShellPreProcessor exten
return;
}
JMeterContext jmctx = JMeterContextService.getContext();
- JMeterVariables vars = jmctx.getVariables();
Sampler sam = jmctx.getCurrentSampler();
- SampleResult prev = jmctx.getPreviousResult();
try {
// Add variables for access to context and variables
- bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$
- bshInterpreter.set("vars", vars);//$NON-NLS-1$
bshInterpreter.set("sampler", sam);//$NON-NLS-1$
- bshInterpreter.set("prev", prev);//$NON-NLS-1$
-
processFileOrScript(bshInterpreter);
} catch (JMeterException e) {
log.warn("Problem in BeanShell script "+e);
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimer.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimer.java?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimer.java
(original)
+++
jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimer.java
Fri Jan 7 03:30:04 2011
@@ -19,9 +19,6 @@
package org.apache.jmeter.timers;
import org.apache.jmeter.testbeans.TestBean;
-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.BeanShellTestElement;
import org.apache.jorphan.logging.LoggingManager;
@@ -51,12 +48,7 @@ public class BeanShellTimer extends Bean
log.error("BeanShell not found");
return 0;
}
- JMeterContext jmctx = JMeterContextService.getContext();
- JMeterVariables vars = jmctx.getVariables();
try {
- // Add variables for access to context and variables
- bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$
- bshInterpreter.set("vars", vars);//$NON-NLS-1$
Object o = processFileOrScript(bshInterpreter);
if (o != null) { ret=o.toString(); }
} catch (JMeterException e) {
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimerResources.properties
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimerResources.properties?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimerResources.properties
(original)
+++
jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BeanShellTimerResources.properties
Fri Jan 7 03:30:04 2011
@@ -14,7 +14,7 @@
# limitations under the License.
displayName=BeanShell Timer
-scripting.displayName=Script (variables: ctx vars props log)
+scripting.displayName=Script (variables: ctx vars props log prev)
script.displayName=
script.shortDescription=Beanshell script to generate delay
resetGroup.displayName=Reset bsh.Interpreter before each call
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListener.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListener.java?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListener.java
(original)
+++
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListener.java
Fri Jan 7 03:30:04 2011
@@ -23,9 +23,6 @@ import org.apache.jmeter.samplers.Sample
import org.apache.jmeter.samplers.SampleListener;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testbeans.TestBean;
-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.BeanShellTestElement;
import org.apache.jorphan.logging.LoggingManager;
@@ -56,13 +53,8 @@ public class BeanShellListener extends B
return;
}
- JMeterContext jmctx = JMeterContextService.getContext();
- JMeterVariables vars = jmctx.getVariables();
SampleResult samp=se.getResult();
try {
- // Add variables for access to context and variables
- bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$
- bshInterpreter.set("vars", vars);//$NON-NLS-1$
bshInterpreter.set("sampleEvent", se);//$NON-NLS-1$
bshInterpreter.set("sampleResult", samp);//$NON-NLS-1$
processFileOrScript(bshInterpreter);
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListenerResources.properties
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListenerResources.properties?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListenerResources.properties
(original)
+++
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BeanShellListenerResources.properties
Fri Jan 7 03:30:04 2011
@@ -14,7 +14,7 @@
# limitations under the License.
displayName=BeanShell Listener
-scripting.displayName=Script (variables: ctx vars props sampleEvent
sampleResult log)
+scripting.displayName=Script (variables: ctx vars props sampleEvent
sampleResult log prev)
script.displayName=
script.shortDescription=Beanshell script
resetGroup.displayName=Reset bsh.Interpreter before each call
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellTestElement.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellTestElement.java?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellTestElement.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellTestElement.java
Fri Jan 7 03:30:04 2011
@@ -24,6 +24,9 @@ import org.apache.jmeter.engine.event.Lo
import org.apache.jmeter.testelement.AbstractTestElement;
import org.apache.jmeter.testelement.TestListener;
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.BeanShellInterpreter;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
@@ -60,6 +63,19 @@ public abstract class BeanShellTestEleme
protected abstract String getInitFileProperty();
+ /**
+ * Get the interpreter and set up standard script variables.
+ * <p>
+ * Sets the following script variables:
+ * <ul>
+ * <li>ctx</li>
+ * <li>Label</li>
+ * <li>prev</li>
+ * <li>props</li>
+ * <li>vars</li>
+ * </ul>
+ * @return the interpreter
+ */
protected BeanShellInterpreter getBeanShellInterpreter() {
if (isResetInterpreter()) {
try {
@@ -69,10 +85,17 @@ public abstract class BeanShellTestEleme
}
}
+ JMeterContext jmctx = JMeterContextService.getContext();
+ JMeterVariables vars = jmctx.getVariables();
+
try {
+ bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$
+ bshInterpreter.set("Label", getName()); //$NON-NLS-1$
+ bshInterpreter.set("prev", jmctx.getPreviousResult());//$NON-NLS-1$
bshInterpreter.set("props", JMeterUtils.getJMeterProperties());
+ bshInterpreter.set("vars", vars);//$NON-NLS-1$
} catch (JMeterException e) {
- log.error("Cannot set 'props' object: "+e.toString());
+ log.warn("Problem setting one or more BeanShell variables "+e);
}
return bshInterpreter;
}
@@ -102,15 +125,30 @@ public abstract class BeanShellTestEleme
return o;
}
+ /**
+ * Process the file or script from the test element.
+ * <p>
+ * Sets the following script variables:
+ * <ul>
+ * <li>FileName</li>
+ * <li>Parameters</li>
+ * <li>bsh.args</li>
+ * </ul>
+ * @param bsh the interpreter, not {...@code null}
+ * @return the result of the script, may be {...@code null}
+ *
+ * @throws JMeterException
+ */
protected Object processFileOrScript(BeanShellInterpreter bsh) throws
JMeterException{
String fileName = getFilename();
+ String params = getParameters();
- bsh.set("FileName", getFilename());//$NON-NLS-1$
+ bsh.set("FileName", fileName);//$NON-NLS-1$
// Set params as a single line
- bsh.set("Parameters", getParameters()); // $NON-NLS-1$
+ bsh.set("Parameters", params); // $NON-NLS-1$
// and set as an array
bsh.set("bsh.args",//$NON-NLS-1$
- JOrphanUtils.split(getParameters(), " "));//$NON-NLS-1$
+ JOrphanUtils.split(params, " "));//$NON-NLS-1$
if (fileName.length() == 0) {
return bsh.eval(getScript());
@@ -216,6 +254,7 @@ public abstract class BeanShellTestEleme
}
}
+ // Overridden by non-TestBean implementations to return the property value
instead
public String getParameters() {
return parameters;
}
@@ -224,6 +263,7 @@ public abstract class BeanShellTestEleme
parameters = s;
}
+ // Overridden by non-TestBean implementations to return the property value
instead
public String getFilename() {
return filename;
}
Modified:
jakarta/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
Fri Jan 7 03:30:04 2011
@@ -21,13 +21,9 @@ package org.apache.jmeter.protocol.java.
import org.apache.jmeter.samplers.Entry;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
-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.BeanShellTestElement;
import org.apache.jorphan.logging.LoggingManager;
-import org.apache.jorphan.util.JOrphanUtils;
import org.apache.log.Logger;
/**
@@ -55,16 +51,6 @@ public class BeanShellSampler extends Be
return INIT_FILE;
}
- /**
- * Returns a formatted string label describing this sampler
- *
- * @return a formatted string label describing this sampler
- */
-
- public String getLabel() {
- return getName();
- }
-
@Override
public String getScript() {
return this.getPropertyAsString(SCRIPT);
@@ -90,7 +76,7 @@ public class BeanShellSampler extends Be
// log.info(getLabel()+" "+getFilename());
SampleResult res = new SampleResult();
boolean isSuccessful = false;
- res.setSampleLabel(getLabel());
+ res.setSampleLabel(getName());
res.sampleStart();
final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();
if (bshInterpreter == null) {
@@ -109,35 +95,16 @@ public class BeanShellSampler extends Be
res.setSamplerData(fileName);
}
- bshInterpreter.set("Label", getLabel()); //$NON-NLS-1$
- bshInterpreter.set("FileName", getFilename()); //$NON-NLS-1$
bshInterpreter.set("SampleResult", res); //$NON-NLS-1$
- // Save parameters as single line and as string array
- bshInterpreter.set("Parameters", getParameters());//$NON-NLS-1$
- bshInterpreter.set("bsh.args", //$NON-NLS-1$
- JOrphanUtils.split(getParameters(), " "));//$NON-NLS-1$
-
// Set default values
bshInterpreter.set("ResponseCode", "200"); //$NON-NLS-1$
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$
-
res.setDataType(SampleResult.TEXT); // assume text output - script
can override if necessary
- Object bshOut;
-
- if (fileName.length() == 0) {
- bshOut = bshInterpreter.eval(request);
- } else {
- bshOut = bshInterpreter.source(fileName);
- }
+ Object bshOut = processFileOrScript(bshInterpreter);
if (bshOut != null) {// Set response data
String out = bshOut.toString();
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Fri Jan 7 03:30:04 2011
@@ -181,6 +181,7 @@ Also enable reversion to using System.cu
<li>Bug 30563 - Thread Group should have a start next loop option on Sample
Error</li>
<li>Bug 50347 - Eclipse setup instructions should remind user to download
dependent jars</li>
<li>Bug 50490 - Setup and Post Thread Group enhancements for better test
flow.</li>
+<li>All BeansShell test elements now have the script variables "prev" and
"Label" defined.</li>
</ul>
<h2>Non-functional changes</h2>
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/beanshell_listener.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/beanshell_listener.png?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
Binary files - no diff available.
Modified:
jakarta/jmeter/trunk/xdocs/images/screenshots/timers/beanshell_timer.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/timers/beanshell_timer.png?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1056181&r1=1056180&r2=1056181&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Fri Jan 7
03:30:04 2011
@@ -883,7 +883,8 @@ See the file BeanShellListeners.bshrc fo
</p>
</description>
<properties>
- <property name="Name" required="No">Descriptive name for this
controller that is shown in the tree.</property>
+ <property name="Name" required="No">Descriptive name for this
controller that is shown in the tree.
+ The name is stored in the script variable Label</property>
<property name="Reset bsh.Interpreter before each call" required="Yes">
If this option is selected, then the interpreter will be recreated for
each sample.
This may be necessary for some long running scripts.
@@ -897,7 +898,8 @@ See the file BeanShellListeners.bshrc fo
<li>Parameters - string containing the parameters as a single
variable</li>
<li>bsh.args - String array containing parameters, split on
white-space</li>
</ul></property>
- <property name="Script file" required="No">A file containing the BeanShell
script to run.</property>
+ <property name="Script file" required="No">A file containing the BeanShell
script to run.
+ The file name is stored in the script variable FileName</property>
<property name="Script" required="Yes (unless script file is
provided)">The BeanShell script to run.
The return value (if not null) is stored as the sampler result.</property>
</properties>
@@ -929,7 +931,7 @@ If a script file is supplied, that will
<li>IsSuccess = true</li>
<li>ctx - JMeterContext</li>
<li>vars - JMeterVariables - e.g. vars.get("VAR1");
vars.put("VAR2","value"); vars.remove("VAR3"); vars.putObject("OBJ1",new
Object());</li>
- <li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+ <li>props - JMeterProperties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</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>
@@ -1013,7 +1015,7 @@ Note that these are BSF variables - i.e.
<li>sampler - pointer to current Sampler</li>
<li>ctx - JMeterContext</li>
<li>vars - JMeterVariables - e.g. vars.get("VAR1"); vars.put("VAR2","value");
vars.remove("VAR3"); vars.putObject("OBJ1",new Object());</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - JMeterProperties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
<li>OUT - System.out - e.g. OUT.println("message")</li>
</ul>
<p>
@@ -2528,7 +2530,7 @@ failed responses from the server.</p></d
</properties>
</component>
-<component name="BeanShell Listener" index="§-num;.3.14" width="597"
height="303" screenshot="beanshell_listener.png">
+<component name="BeanShell Listener" index="§-num;.3.14" width="553"
height="382" screenshot="beanshell_listener.png">
<description>
<p>
The BeanShell Listener allows the use of BeanShell for processing samples for
saving etc.
@@ -2543,7 +2545,8 @@ See the file BeanShellListeners.bshrc fo
</p>
</description>
<properties>
- <property name="Name" required="">Descriptive name for this element that
is shown in the tree.</property>
+ <property name="Name" required="">Descriptive name for this element that
is shown in the tree.
+ The name is stored in the script variable Label</property>
<property name="Reset bsh.Interpreter before each call" required="Yes">
If this option is selected, then the interpreter will be recreated for
each sample.
This may be necessary for some long running scripts.
@@ -2555,7 +2558,8 @@ See the file BeanShellListeners.bshrc fo
<li>Parameters - string containing the parameters as a single
variable</li>
<li>bsh.args - String array containing parameters, split on
white-space</li>
</ul></property>
- <property name="Script file" required="No">A file containing the BeanShell
script to run</property>
+ <property name="Script file" required="No">A file containing the BeanShell
script to run.
+ The file name is stored in the script variable FileName</property>
<property name="Script" required="Yes (unless script file is
provided)">The BeanShell script to run. The return value is ignored.</property>
</properties>
<p>Before invoking the script, some variables are set up in the BeanShell
interpreter:</p>
@@ -2563,8 +2567,8 @@ See the file BeanShellListeners.bshrc fo
<li>log - (Logger) - can be used to write to the log file</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
-<li>sampleResult - (SampleResult) - gives access to the previous
SampleResult</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>sampleResult, prev - (SampleResult) - gives access to the previous
SampleResult</li>
<li>sampleEvent (SampleEvent) gives access to the current sample event</li>
</ul>
<p>For details of all the methods available on each of the above variables,
please check the Javadoc</p>
@@ -2689,7 +2693,7 @@ Note that these are BSF variables - i.e.
<li>args[] - the parameters as a String array (split on whitespace)</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
vars.getObject("OBJ2");</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
<li>sampleResult, prev - (SampleResult) - gives access to the SampleResult</li>
<li>sampleEvent - (SampleEvent) - gives access to the SampleEvent</li>
<li>sampler - (Sampler)- gives access to the last sampler</li>
@@ -3602,7 +3606,8 @@ See the file BeanShellListeners.bshrc fo
</description>
<properties>
- <property name="Name" required="">Descriptive name for this element that
is shown in the tree.</property>
+ <property name="Name" required="">Descriptive name for this element that
is shown in the tree.
+ The name is stored in the script variable Label</property>
<property name="Reset bsh.Interpreter before each call" required="Yes">
If this option is selected, then the interpreter will be recreated for
each sample.
This may be necessary for some long running scripts.
@@ -3614,7 +3619,8 @@ See the file BeanShellListeners.bshrc fo
<li>Parameters - string containing the parameters as a single
variable</li>
<li>bsh.args - String array containing parameters, split on
white-space</li>
</ul></property>
- <property name="Script file" required="No">A file containing the BeanShell
script to run. This overrides the script.</property>
+ <property name="Script file" required="No">A file containing the BeanShell
script to run. This overrides the script.
+ The file name is stored in the script variable FileName</property>
<property name="Script" required="Yes (unless script file is
provided)">The BeanShell script to run. The return value is ignored.</property>
</properties>
<p>There's a <a href="../demos/BeanShellAssertion.bsh">sample script</a> you
can try.</p>
@@ -3636,7 +3642,7 @@ These are strings unless otherwise noted
<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"); vars.putObject("OBJ1",new Object());</li>
- <li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+ <li>props - JMeterProperties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
</ul>
</p>
<p>The following methods of the Response object may be useful:
@@ -3738,7 +3744,7 @@ The script (or file) is processed using
<li>args[] - the parameters as a String array (split on whitespace)</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
vars.getObject("OBJ2");</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
<li>SampleResult, prev - (SampleResult) - gives access to the previous
SampleResult (if any)</li>
<li>sampler - (Sampler)- gives access to the current sampler</li>
<li>OUT - System.out - e.g. OUT.println("message")</li>
@@ -3927,7 +3933,7 @@ points of the test plan.
</component>
-<component name="BeanShell Timer" index="§-num;.6.6" width="597"
height="303" screenshot="timers/beanshell_timer.png">
+<component name="BeanShell Timer" index="§-num;.6.6" width="553"
height="382" screenshot="timers/beanshell_timer.png">
<description>
<p>
The BeanShell Timer can be used to generate a delay.
@@ -3942,7 +3948,8 @@ See the file BeanShellListeners.bshrc fo
</p>
</description>
<properties>
- <property name="Name" required="No">Descriptive name for this element that
is shown in the tree.</property>
+ <property name="Name" required="No">Descriptive name for this element that
is shown in the tree.
+ The name is stored in the script variable Label</property>
<property name="Reset bsh.Interpreter before each call" required="Yes">
If this option is selected, then the interpreter will be recreated for
each sample.
This may be necessary for some long running scripts.
@@ -3957,6 +3964,7 @@ See the file BeanShellListeners.bshrc fo
</property>
<property name="Script file" required="No">
A file containing the BeanShell script to run.
+ The file name is stored in the script variable FileName
The return value is used as the number of milliseconds to wait.
</property>
<property name="Script" required="Yes (unless script file is provided)">
@@ -3968,7 +3976,8 @@ See the file BeanShellListeners.bshrc fo
<li>log - (Logger) - can be used to write to the log file</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>prev - (SampleResult) - gives access to the previous SampleResult (if
any)</li>
</ul>
<p>For details of all the methods available on each of the above variables,
please check the Javadoc</p>
<p>If the property <b>beanshell.timer.init</b> is defined, this is used to
load an initialisation file, which can be used to define methods etc for use in
the BeanShell script.</p>
@@ -4006,7 +4015,7 @@ The BSF Timer can be used to generate a
<li>log - (Logger) - can be used to write to the log file</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
<li>sampler - the current Sampler</li>
<li>Label - the name of the Timer</li>
<li>Filename - the file name (if any)</li>
@@ -4200,7 +4209,8 @@ See the file BeanShellListeners.bshrc fo
</p>
</description>
<properties>
- <property name="Name" required="No">Descriptive name for this element that
is shown in the tree.</property>
+ <property name="Name" required="No">Descriptive name for this element that
is shown in the tree.
+ The name is stored in the script variable Label</property>
<property name="Reset bsh.Interpreter before each call" required="Yes">
If this option is selected, then the interpreter will be recreated for
each sample.
This may be necessary for some long running scripts.
@@ -4212,7 +4222,8 @@ See the file BeanShellListeners.bshrc fo
<li>Parameters - string containing the parameters as a single
variable</li>
<li>bsh.args - String array containing parameters, split on
white-space</li>
</ul></property>
- <property name="Script file" required="No">A file containing the BeanShell
script to run.</property>
+ <property name="Script file" required="No">A file containing the BeanShell
script to run.
+ The file name is stored in the script variable FileName</property>
<property name="Script" required="Yes (unless script file is
provided)">The BeanShell script. The return value is ignored.</property>
</properties>
<p>Before invoking the script, some variables are set up in the BeanShell
interpreter:</p>
@@ -4220,7 +4231,7 @@ See the file BeanShellListeners.bshrc fo
<li>log - (Logger) - can be used to write to the log file</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
<li>prev - (SampleResult) - gives access to the previous SampleResult (if
any)</li>
<li>sampler - (Sampler)- gives access to the current sampler</li>
</ul>
@@ -4258,7 +4269,7 @@ The script (or file) is processed using
<li>args[] - the parameters as a String array (split on whitespace)</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
vars.getObject("OBJ2");</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
<li>sampler - (Sampler)- gives access to the current sampler</li>
<li>OUT - System.out - e.g. OUT.println("message")</li>
</ul>
@@ -4519,7 +4530,8 @@ See the file BeanShellListeners.bshrc fo
</p>
</description>
<properties>
- <property name="Name" required="No">Descriptive name for this element that
is shown in the tree.</property>
+ <property name="Name" required="No">Descriptive name for this element that
is shown in the tree.
+ The name is stored in the script variable Label</property>
<property name="Reset bsh.Interpreter before each call" required="Yes">
If this option is selected, then the interpreter will be recreated for
each sample.
This may be necessary for some long running scripts.
@@ -4531,7 +4543,8 @@ See the file BeanShellListeners.bshrc fo
<li>Parameters - string containing the parameters as a single
variable</li>
<li>bsh.args - String array containing parameters, split on
white-space</li>
</ul></property>
- <property name="Script file" required="No">A file containing the BeanShell
script to run.</property>
+ <property name="Script file" required="No">A file containing the BeanShell
script to run.
+ The file name is stored in the script variable FileName</property>
<property name="Script" required="Yes (unless script file is
provided)">The BeanShell script. The return value is ignored.</property>
</properties>
<p>The following BeanShell variables are set up for use by the script:</p>
@@ -4539,7 +4552,7 @@ See the file BeanShellListeners.bshrc fo
<li>log - (Logger) - can be used to write to the log file</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
<li>prev - (SampleResult) - gives access to the previous SampleResult</li>
<li>data - (byte [])- gives access to the current sample data</li>
</ul>
@@ -4580,7 +4593,7 @@ Note that these are BSF variables - i.e.
<li>args[] - the parameters as a String array (split on whitespace)</li>
<li>ctx - (JMeterContext) - gives access to the context</li>
<li>vars - (JMeterVariables) - gives read/write access to variables:
vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
vars.getObject("OBJ2");</li>
-<li>props - JMeter Properties - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
+<li>props - (JMeterProperties) - e.g. props.get("START.HMS");
props.put("PROP1","1234");</li>
<li>prev - (SampleResult) - gives access to the previous SampleResult (if
any)</li>
<li>sampler - (Sampler)- gives access to the current sampler</li>
<li>OUT - System.out - e.g. OUT.println("message")</li>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]