Apache JMeter
2.2

org.apache.jmeter.functions
Class AbstractFunction

java.lang.Object
  extended byorg.apache.jmeter.functions.AbstractFunction
All Implemented Interfaces:
Function
Direct Known Subclasses:
BeanShell, CSVRead, IntSum, IterationCounter, JavaScript, JexlFunction, LogFunction, LogFunction2, MachineName, Property, Property2, Random, RegexFunction, SetProperty, SplitFunction, StringFromFile, TimeFunction, XPath

public abstract class AbstractFunction
extends Object
implements Function

Provides common methods for all functions


Constructor Summary
AbstractFunction()
           
 
Method Summary
protected  void checkParameterCount(Collection parameters, int min, int max)
           
 String execute()
           
abstract  String execute(SampleResult previousResult, Sampler currentSampler)
          Given the previous SampleResult and the current Sampler, return a string to use as a replacement value for the function call.
abstract  String getReferenceKey()
          Return the name of your function.
protected  JMeterVariables getVariables()
           
abstract  void setParameters(Collection parameters)
          A collection of the parameters used to configure your function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jmeter.functions.Function
getArgumentDesc
 

Constructor Detail

AbstractFunction

public AbstractFunction()
Method Detail

execute

public abstract String execute(SampleResult previousResult,
                               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
Throws:
InvalidVariableException
See Also:
Function.execute(SampleResult, Sampler)

execute

public String execute()
               throws InvalidVariableException
Throws:
InvalidVariableException

setParameters

public abstract void setParameters(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
Parameters:
parameters -
Throws:
InvalidVariableException
See Also:
Note: This may not be called (e.g. if no parameters are provided)

getReferenceKey

public abstract 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
See Also:
Function.getReferenceKey()

getVariables

protected JMeterVariables getVariables()

checkParameterCount

protected void checkParameterCount(Collection parameters,
                                   int min,
                                   int max)
                            throws InvalidVariableException
Throws:
InvalidVariableException

Apache JMeter
2.2

Copyright © 1998-2006 Apache Software Foundation. All Rights Reserved.