You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2005/05/02 14:35:23 UTC
cvs commit: jakarta-jmeter/src/core/org/apache/jmeter/resources messages.properties
sebb 2005/05/02 05:35:22
Modified: xdocs changes.xml
xdocs/usermanual functions.xml
src/core/org/apache/jmeter/resources messages.properties
Added: src/functions/org/apache/jmeter/functions SetProperty.java
Log:
New function - setProperty
Revision Changes Path
1.20 +18 -1 jakarta-jmeter/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-jmeter/xdocs/changes.xml,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- changes.xml 18 Mar 2005 15:27:01 -0000 1.19
+++ changes.xml 2 May 2005 12:35:22 -0000 1.20
@@ -27,6 +27,23 @@
<b>Changes: for more info, contact <a href="mailto:mstover1@apache.org">Michael Stover</a></b>
+<h3>Version 2.1</h3>
+<h4>New functionality:</h4>
+<ul>
+<li>XSchema Assertion</li>
+<li>XML Tree display</li>
+<li>New JMX and Results format. Previous formats still available.</li>
+<li>CSV DataSet Config item</li>
+<li>Synchronisation Timer</li>
+<li>setProperty function</li>
+</ul>
+<h4>Bug fixes:</h4>
+<ul>
+<li>Bug 34586 - XPath always remained as /</li>
+<li>BeanShellInterpreter did not handle null objects properly</li>
+<li>Fix Chinese resource bundle names</li>
+</ul>
+
<h3>Version 2.0.3</h3>
<h4>New functionality:</h4>
<ul>
1.19 +20 -2 jakarta-jmeter/xdocs/usermanual/functions.xml
Index: functions.xml
===================================================================
RCS file: /home/cvs/jakarta-jmeter/xdocs/usermanual/functions.xml,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- functions.xml 18 Mar 2005 15:26:56 -0000 1.18
+++ functions.xml 2 May 2005 12:35:22 -0000 1.19
@@ -43,9 +43,10 @@
<li><a href="#__machineName">machineName - get the local machine name</a></li>
<li><a href="#__javaScript">JavaScript (Apache Rhino)</a></li>
<li><a href="#__Random">random number</a></li>
- <li><a href="#__CSVRead">CSVRead -read from CSV delimited file</a></li>
+ <li><a href="#__CSVRead">CSVRead - read from CSV delimited file</a></li>
<li><a href="#__property">read a property</a></li>
- <li><a href="#__P">P -read a property</a></li>
+ <li><a href="#__P">P - read a property</a></li>
+ <li><a href="#__setProperty">setProperty - set a property</a></li>
<li><a href="#__log">log - log a message</a></li>
<li><a href="#__logn">logn - log a message</a></li>
<li><a href="#__BeanShell">BeanShell - run BeanShell</a></li>
@@ -553,6 +554,23 @@
<property name="XPath" required="Yes"> a XPath expression to match nodes in the XML file</property>
</properties>
</component>
+
+<component index="16.5.16" name="__setProperty">
+<description>
+ <p>The setProperty function sets the value of a JMeter property.
+ The return value from the function is the empty string,
+ so the function call can be used anywhere functions are valid.</p>
+ <p>Properties are global to JMeter,
+ so can be used to communicate between threads and thread groups</p>
+ </description>
+
+<properties>
+ <property name="Property Name" required="Yes">The property name to be set.</property>
+ <property name="Property Value" required="Yes">The value for the property.</property>
+</properties>
+</component>
+
+
</subsection>
</section>
1.1 jakarta-jmeter/src/functions/org/apache/jmeter/functions/SetProperty.java
Index: SetProperty.java
===================================================================
// $Header$
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed 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.functions;
import java.io.Serializable;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import org.apache.jmeter.engine.util.CompoundVariable;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.util.JMeterUtils;
/**
* Function to set a JMeter property
*
* Parameters:
* - property name
* - value
*
* Usage:
*
* Set the property value in the appropriate GUI by using the string:
* ${__setProperty(propname,propvalue)}
*
* Returns:
* nothing
*
* @version $Revision$ Updated: $Date$
*/
public class SetProperty extends AbstractFunction implements Serializable
{
private static final List desc = new LinkedList();
private static final String KEY = "__setProperty";
// Number of parameters expected - used to reject invalid calls
private static final int MIN_PARAMETER_COUNT = 2;
private static final int MAX_PARAMETER_COUNT = 2;
static {
desc.add(JMeterUtils.getResString("property_name_param"));
desc.add(JMeterUtils.getResString("property_value_param"));
}
private Object[] values;
public SetProperty()
{
}
public Object clone()
{
return new SetProperty();
}
public synchronized String execute(
SampleResult previousResult,
Sampler currentSampler)
throws InvalidVariableException
{
String propertyName = ((CompoundVariable) values[0]).execute();
String propertyValue = ((CompoundVariable) values[1]).execute();
JMeterUtils.setProperty(propertyName, propertyValue);
return propertyValue;
}
public void setParameters(Collection parameters)
throws InvalidVariableException
{
values = parameters.toArray();
if ((values.length < MIN_PARAMETER_COUNT)
|| (values.length > MAX_PARAMETER_COUNT))
{
throw new InvalidVariableException(
"Parameter Count not between "
+ MIN_PARAMETER_COUNT
+ " & "
+ MAX_PARAMETER_COUNT);
}
}
public String getReferenceKey()
{
return KEY;
}
public List getArgumentDesc()
{
return desc;
}
}
1.143 +1 -0 jakarta-jmeter/src/core/org/apache/jmeter/resources/messages.properties
Index: messages.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages.properties,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -r1.142 -r1.143
--- messages.properties 24 Apr 2005 17:42:59 -0000 1.142
+++ messages.properties 2 May 2005 12:35:22 -0000 1.143
@@ -426,6 +426,7 @@
property_editor.value_is_invalid_message=The text you just entered is not a valid value for this property.\nThe property will be reverted to its previous value.
property_editor.value_is_invalid_title=Invalid input
property_name_param=Name of property
+property_value_param=Value of property
property_tool_tip={0}\: {1}
property_undefined=Undefined
protocol=Protocol\:
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org