Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.jmeter.functions
Class Property2  view Property2 download Property2.java

java.lang.Object
  extended byorg.apache.jmeter.functions.AbstractFunction
      extended byorg.apache.jmeter.functions.Property2
All Implemented Interfaces:
Function, java.io.Serializable

public class Property2
extends AbstractFunction
implements java.io.Serializable

Function to get a JMeter property, or a default. Does not offer the option to store the value, as it is just as easy to refetch it. This is a specialisation of the __property() function to make it simpler to use for ThreadGroup GUI etc. The name is also shorter. Parameters: - property name - default value (optional; defaults to "1") Usage: Define the property in jmeter.properties, or on the command-line: java ... -Jpropname=value Retrieve the value in the appropriate GUI by using the string: ${__P(propname)} $(__P(propname,default)} Returns: - the property value, but if not found - the default value, but if not present - "1" (suitable for use in ThreadGroup GUI)

Version:
$Revision: 1.5 $ Updated: $Date: 2005/07/12 20:50:39 $

Field Summary
private static java.util.List desc
           
private static java.lang.String KEY
           
private static int MAX_PARAMETER_COUNT
           
private static int MIN_PARAMETER_COUNT
           
private  java.lang.Object[] values
           
 
Constructor Summary
Property2()
           
 
Method Summary
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 java.lang.String execute(org.apache.jmeter.samplers.SampleResult previousResult, org.apache.jmeter.samplers.Sampler currentSampler)
          Given the previous SampleResult and the current Sampler, return a string to use as a replacement value for the function call.
 java.util.List getArgumentDesc()
          Return a list of strings briefly describing each parameter your function takes.
 java.lang.String getReferenceKey()
          Return the name of your function.
 void setParameters(java.util.Collection parameters)
          A collection of the parameters used to configure your function.
 
Methods inherited from class org.apache.jmeter.functions.AbstractFunction
execute, getVariables
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

desc

private static final java.util.List desc

KEY

private static final java.lang.String KEY
See Also:
Constant Field Values

MIN_PARAMETER_COUNT

private static final int MIN_PARAMETER_COUNT
See Also:
Constant Field Values

MAX_PARAMETER_COUNT

private static final int MAX_PARAMETER_COUNT
See Also:
Constant Field Values

values

private java.lang.Object[] values
Constructor Detail

Property2

public Property2()
Method Detail

clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }
 


execute

public java.lang.String execute(org.apache.jmeter.samplers.SampleResult previousResult,
                                org.apache.jmeter.samplers.Sampler currentSampler)
                         throws InvalidVariableException
Description copied from interface: Function
Given the previous SampleResult and the current Sampler, return a string to use as a replacement value for the function call. Assume "setParameter" was previously called. This method must be threadsafe - multiple threads will be using the same object.

Specified by:
execute in interface Function
Specified by:
execute in class AbstractFunction

setParameters

public void setParameters(java.util.Collection parameters)
                   throws InvalidVariableException
Description copied from interface: Function
A collection of the parameters used to configure your function. Each parameter is a CompoundFunction and can be resolved by calling the execute() method of the CompoundFunction (which should be done at execution.)

Specified by:
setParameters in interface Function
Specified by:
setParameters in class AbstractFunction

getReferenceKey

public java.lang.String getReferenceKey()
Description copied from interface: Function
Return the name of your function. Convention is to prepend "__" to the name (ie "__regexFunction")

Specified by:
getReferenceKey in interface Function
Specified by:
getReferenceKey in class AbstractFunction

getArgumentDesc

public java.util.List getArgumentDesc()
Description copied from interface: Function
Return a list of strings briefly describing each parameter your function takes. Please use JMeterUtils.getResString(resource_name) to grab a resource string. Otherwise, your help text will be difficult to internationalize. Add your strings to all org.apache.jmeter.resources.*.properties files. Do not worry about translating - that's someone else's responsibility. This list is not optional. If you don't wish to write help, you must at least return a List containing the correct number of blank strings, one for each argument.

Specified by:
getArgumentDesc in interface Function