[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jmeter-dev
Subject:    svn commit: r672065 - in /jakarta/jmeter/trunk: bin/
From:       sebb () apache ! org
Date:       2008-06-27 1:09:41
Message-ID: 20080627010942.4BB6A238895D () eris ! apache ! org
[Download RAW message or body]

Author: sebb
Date: Thu Jun 26 18:09:41 2008
New Revision: 672065

URL: http://svn.apache.org/viewvc?rev=672065&view=rev
Log:
Add BSF Listener element

Added:
    jakarta/jmeter/trunk/docs/images/screenshots/bsf_listener.png   (with props)
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListener.java \
(with props)  jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerBeanInfo.java \
(with props)  jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerResources.properties \
(with props)  jakarta/jmeter/trunk/xdocs/images/screenshots/bsf_listener.png   (with \
props) Modified:
    jakarta/jmeter/trunk/bin/saveservice.properties
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jakarta/jmeter/trunk/bin/saveservice.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/saveservice.properties?rev=672065&r1=672064&r2=672065&view=diff
 ==============================================================================
--- jakarta/jmeter/trunk/bin/saveservice.properties (original)
+++ jakarta/jmeter/trunk/bin/saveservice.properties Thu Jun 26 18:09:41 2008
@@ -76,6 +76,7 @@
 BeanShellSamplerGui=org.apache.jmeter.protocol.java.control.gui.BeanShellSamplerGui
 BeanShellTimer=org.apache.jmeter.timers.BeanShellTimer
 BSFAssertion=org.apache.jmeter.assertions.BSFAssertion
+BSFListener=org.apache.jmeter.visualizers.BSFListener
 BSFPreProcessor=org.apache.jmeter.modifiers.BSFPreProcessor
 BSFPostProcessor=org.apache.jmeter.extractor.BSFPostProcessor
 BSFSampler=org.apache.jmeter.protocol.java.sampler.BSFSampler

Added: jakarta/jmeter/trunk/docs/images/screenshots/bsf_listener.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/bsf_listener.png?rev=672065&view=auto
 ==============================================================================
Binary file - no diff available.

Propchange: jakarta/jmeter/trunk/docs/images/screenshots/bsf_listener.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListener.java
                
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListener.java?rev=672065&view=auto
 ==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListener.java \
                (added)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListener.java \
Thu Jun 26 18:09:41 2008 @@ -0,0 +1,68 @@
+/*
+ * 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.visualizers;
+
+import org.apache.bsf.BSFException;
+import org.apache.bsf.BSFManager;
+import org.apache.jmeter.samplers.SampleEvent;
+import org.apache.jmeter.samplers.SampleListener;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.testbeans.TestBean;
+import org.apache.jmeter.util.BSFTestElement;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+public class BSFListener extends BSFTestElement 
+    implements Cloneable, SampleListener, TestBean, Visualizer {
+// N.B. Needs to implement Visualizer so that TestBeanGUI can find the correct GUI \
class +
+    private static final Logger log = LoggingManager.getLoggerForClass();
+    
+    private static final long serialVersionUID = 234L;
+    
+    public void sampleOccurred(SampleEvent event) {
+        try {
+            BSFManager mgr = getManager();
+            if (mgr == null) {
+                log.error("Problem creating BSF manager");
+                return; 
+            }
+            mgr.declareBean("sampleEvent", event, SampleEvent.class);
+            SampleResult result = event.getResult();
+            mgr.declareBean("sampleResult", result, SampleResult.class);
+            processFileOrScript(mgr);
+            mgr.terminate();
+        } catch (BSFException e) {
+            log.warn("Problem in BSF script "+e);
+        }
+    }
+
+    public void sampleStarted(SampleEvent e) {
+    }
+
+    public void sampleStopped(SampleEvent e) {
+    }
+
+    public void add(SampleResult sample) {
+    }
+
+    public boolean isStats() {
+        return false;
+    }
+}

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListener.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListener.java
                
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerBeanInfo.java
                
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerBeanInfo.java?rev=672065&view=auto
 ==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerBeanInfo.java \
                (added)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerBeanInfo.java \
Thu Jun 26 18:09:41 2008 @@ -0,0 +1,29 @@
+/*
+ * 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.visualizers;
+
+import org.apache.jmeter.util.BSFBeanInfoSupport;
+
+public class BSFListenerBeanInfo extends BSFBeanInfoSupport {
+
+	public BSFListenerBeanInfo() {
+		super(BSFListener.class);
+	}
+
+}

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerBeanInfo.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerBeanInfo.java
                
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerResources.properties
                
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerResources.properties?rev=672065&view=auto
 ==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerResources.properties \
                (added)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerResources.properties \
Thu Jun 26 18:09:41 2008 @@ -0,0 +1,28 @@
+#   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.
+
+displayName=BSF Listener
+scriptingLanguage.displayName=Script language (e.g. beanshell, javascript, jexl)
+scriptLanguage.displayName=Language
+scriptLanguage.shortDescription=Name of BSF language, e.g. beanshell, javascript, \
jexl +scripting.displayName=Script (variables: ctx vars props sampleResult (aka prev) \
sampleEvent sampler log Label Filename Parameters args[] OUT) \
+script.displayName=Script +script.shortDescription=Script in the appropriate BSF \
language +parameterGroup.displayName=Parameters to be passed to script (=> String \
Parameters and String []args) +parameters.displayName=Parameters
+parameters.shortDescription=Parameters to be passed to the file or script
+filenameGroup.displayName=Script file (overrides script)
+filename.displayName=File Name
+filename.shortDescription=Script file (overrides script)
\ No newline at end of file

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/BSFListenerResources.properties
                
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=672065&r1=672064&r2=672065&view=diff
 ==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Jun 26 18:09:41 2008
@@ -77,6 +77,7 @@
 <li>The "prev" and "sampler" objects are now defined for BSF test elements</li>
 <li>Prompt to overwrite an existing file when first saving a new test plan</li>
 <li>The test element "Save Results to a file" is now shown as a Listener</li>
+<li>Correct TestBeans to show the correct popup menu for Listeners</li>
 </ul>
 
 <h3>Improvements</h3>
@@ -84,6 +85,7 @@
 <li>LDAP result data now formatted with line breaks</li>
 <li>Add OUT variable to jexl function</li>
 <li>Save Responses to a file can save the generated filename(s) to variables.</li>
+<li>Add BSF Listener element</li>
 </ul>
 
 <h3>Non-functional changes</h3>

Added: jakarta/jmeter/trunk/xdocs/images/screenshots/bsf_listener.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/bsf_listener.png?rev=672065&view=auto
 ==============================================================================
Binary file - no diff available.

Propchange: jakarta/jmeter/trunk/xdocs/images/screenshots/bsf_listener.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=672065&r1=672064&r2=672065&view=diff
 ==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Jun 26 18:09:41 \
2008 @@ -2173,6 +2173,44 @@
  </properties>
 </component>
 
+<component name="BSF Listener" index="&sect-num;.3.17"  width="736" height="369" \
screenshot="bsf_listener.png"> +<description>
+<p>
+The BSF Listener allows BSF script code to be applied to sample results.
+</p>
+</description>
+<properties>
+    <property name="Name" required="No">Descriptive name for this element that is \
shown in the tree.</property> +    <property name="Language" required="Yes">The BSF \
language to be used</property> +    <property name="Parameters" \
required="No">Parameters to pass to the script. +    The parameters are stored in the \
following variables: +    <ul>
+        <li>Parameters - string containing the parameters as a single variable</li>
+        <li>args - String array containing parameters, split on white-space</li>
+    </ul></property>
+    <property name="Script file" required="No">A file containing the script to \
run.</property> +    <property name="Script" required="Yes (unless script file is \
provided)">The script to run.</property> +</properties>
+<p>
+The script (or file) is processed using the BSFEngine.exec() method, which does not \
return a value. +</p>
+<p>The following variables are set up for use by the script:</p>
+<ul>
+<li>log - (Logger) - can be used to write to the log file</li>
+<li>Label - the String Label</li>
+<li>Filename - the script file name (if any)</li>
+<li>Parameters - the parameters (as a String)</li>
+<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>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>
+<li>OUT - System.out - e.g. OUT.println("message")</li>
+</ul>
+<p>For details of all the methods available on each of the above variables, please \
check the Javadoc</p> +</component>
 
 <a href="#">^</a>
 
@@ -2932,13 +2970,17 @@
 <p>The following variables are set up for use by the script:</p>
 <ul>
 <li>log - (Logger) - can be used to write to the log file</li>
+<li>Label - the String Label</li>
+<li>Filename - the script file name (if any)</li>
+<li>Parameters - the parameters (as a String)</li>
+<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());</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>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>
-<li>SampleResult - the current sample result</li>
+<li>SampleResult - the current sample result (same as prev)</li>
 <li>AssertionResult - the assertion result</li>
 </ul>
 <p>
@@ -3378,8 +3420,12 @@
 <p>The following variables are set up for use by the script:</p>
 <ul>
 <li>log - (Logger) - can be used to write to the log file</li>
+<li>Label - the String Label</li>
+<li>Filename - the script file name (if any)</li>
+<li>Parameters - the parameters (as a String)</li>
+<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());</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>prev - (SampleResult) - gives access to the \
previous SampleResult (if any)</li>  <li>sampler - (Sampler)- gives access to the \
current sampler</li> @@ -3662,8 +3708,12 @@
 <p>The following variables are set up for use by the script:</p>
 <ul>
 <li>log - (Logger) - can be used to write to the log file</li>
+<li>Label - the String Label</li>
+<li>Filename - the script file name (if any)</li>
+<li>Parameters - the parameters (as a String)</li>
+<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());</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>prev - (SampleResult) - gives access to the \
previous SampleResult (if any)</li>  <li>sampler - (Sampler)- gives access to the \
current sampler</li>



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic