Author: sebb
Date: Thu Jan 3 07:20:42 2008
New Revision: 608524
URL: http://svn.apache.org/viewvc?rev=608524&view=rev
Log:
Make machineName variable name parameter optional (bug 44142)
Modified:
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/MachineName.java
jakarta/jmeter/trunk/xdocs/usermanual/functions.xml
Modified:
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/MachineName.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/MachineName.java?rev=608524&r1=608523&r2=608524&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/MachineName.java
(original)
+++
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/MachineName.java
Thu Jan 3 07:20:42 2008
@@ -37,11 +37,9 @@
private static final String KEY = "__machineName"; //$NON-NLS-1$
- // Number of parameters expected - used to reject invalid calls
- private static final int PARAMETER_COUNT = 1;
static {
// desc.add("Use fully qualified host name: TRUE/FALSE (Default
FALSE)");
- desc.add(JMeterUtils.getResString("function_name_param"));
//$NON-NLS-1$
+ desc.add(JMeterUtils.getResString("function_name_paropt"));
//$NON-NLS-1$
}
private Object[] values;
@@ -63,7 +61,6 @@
* .execute() .toLowerCase() .equals("true")) { fullHostName =
true; }
*/
- String varName = ((CompoundVariable) values[values.length -
1]).execute();
String machineName = "";
try {
@@ -81,19 +78,19 @@
} catch (UnknownHostException e) {
}
- vars.put(varName, machineName);
+ if (values.length >= 1){// we have a variable name
+ String varName = ((CompoundVariable)
values[0]).execute();
+ if (varName.length() > 0) {
+ vars.put(varName, machineName);
+ }
+ }
return machineName;
}
public synchronized void setParameters(Collection parameters) throws
InvalidVariableException {
-
+ checkParameterCount(parameters, 0, 1);
values = parameters.toArray();
-
- if (values.length != PARAMETER_COUNT) {
- throw new InvalidVariableException("Parameter Count !=
" + PARAMETER_COUNT);
- }
-
}
public String getReferenceKey() {
Modified: jakarta/jmeter/trunk/xdocs/usermanual/functions.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/functions.xml?rev=608524&r1=608523&r2=608524&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/functions.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/functions.xml Thu Jan 3 07:20:42 2008
@@ -394,7 +394,7 @@
<description><p>The machineName function returns the local host
name</p></description>
<properties>
- <property name="Name of function" required="Yes">A reference name for
reusing the value
+ <property name="Variable Name" required="No">A reference name for
reusing the value
computed by this function.</property>
</properties>
</component>
@@ -436,7 +436,7 @@
<li>"${VAR}"=="abcd"</li>
</ul>
</property>
- <property name="Name of function" required="No">A reference name for
reusing the value
+ <property name="Variable Name" required="No">A reference name for
reusing the value
computed by this function.</property>
</properties>
<note>Remember to include any necessary quotes for text strings and JMeter
variables. Also, if
@@ -453,7 +453,7 @@
<properties>
<property name="Minimum value" required="Yes">A number</property>
<property name="Maximum value" required="Yes">A bigger
number</property>
- <property name="Name of function" required="No">A reference name for
reusing the value
+ <property name="Variable Name" required="No">A reference name for
reusing the value
computed by this function.</property>
</properties>
</component>
@@ -520,7 +520,7 @@
<properties>
<property name="Property Name" required="Yes">The property name to be
retrieved.</property>
- <property name="Name of function" required="No">A reference name for
reusing the value
+ <property name="Variable Name" required="No">A reference name for
reusing the value
computed by this function.</property>
<property name="Default Value" required="No">The default value for the
property.</property>
</properties>
@@ -763,7 +763,7 @@
The format to be passed to SimpleDateFormat.
The function supports various shorthand aliases, see below.
</property>
- <property name="Variable" required="No">The name of the variable to
set.</property>
+ <property name="Name of variable" required="No">The name of the
variable to set.</property>
</properties>
<p>If the format string is omitted, then the function returns the current time
in milliseconds.
Otherwise, the current time is passed to SimpleDateFormat.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]