Function
BeanShell
, CharFunction
, CSVRead
, EscapeHtml
, EscapeOroRegexpChars
, EvalFunction
, EvalVarFunction
, FileToString
, IntSum
, IterationCounter
, JavaScript
, Jexl2Function
, JexlFunction
, LogFunction
, LogFunction2
, LongSum
, MachineIP
, MachineName
, Property
, Property2
, Random
, RandomString
, RegexFunction
, SamplerName
, SetProperty
, SplitFunction
, StringFromFile
, TestPlanName
, ThreadNumber
, TimeFunction
, UnEscape
, UnEscapeHtml
, UrlDecode
, UrlEncode
, Uuid
, Variable
, XPath
public abstract class AbstractFunction extends Object implements Function
Constructor | Description |
---|---|
AbstractFunction() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
checkMinParameterCount(Collection<CompoundVariable> parameters,
int minimum) |
Utility method to check parameter counts.
|
protected void |
checkParameterCount(Collection<CompoundVariable> parameters,
int count) |
Utility method to check parameter counts.
|
protected void |
checkParameterCount(Collection<CompoundVariable> parameters,
int min,
int max) |
Utility method to check parameter counts.
|
String |
execute() |
|
abstract String |
execute(SampleResult previousResult,
Sampler currentSampler) |
N.B. execute() should be synchronized if function is operating with non-thread-safe
objects (e.g. operates with files).
|
abstract String |
getReferenceKey() |
Return the name of your function.
|
protected JMeterVariables |
getVariables() |
Gives access to the JMeter variables for the current thread.
|
abstract void |
setParameters(Collection<CompoundVariable> parameters) |
Note: This is always called even if no parameters are provided
(versions of JMeter after 2.3.1)
|
getArgumentDesc
public abstract String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException
N.B. execute() should be synchronized if function is operating with non-thread-safe objects (e.g. operates with files).
JMeter ensures setParameters() happens-before execute(): setParameters is executed in main thread, and worker threads are started after that.execute
in interface Function
previousResult
- The previous SampleResult
currentSampler
- The current Sampler
InvalidVariableException
- - when the variables for the function call can't be evaluatedFunction.execute(SampleResult, Sampler)
public String execute() throws InvalidVariableException
InvalidVariableException
public abstract void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException
setParameters
in interface Function
parameters
- The parameters for the function callInvalidVariableException
- - when the variables for the function call can't be evaluatedFunction.setParameters(Collection)
public abstract String getReferenceKey()
Function
getReferenceKey
in interface Function
Function.getReferenceKey()
protected JMeterVariables getVariables()
protected void checkParameterCount(Collection<CompoundVariable> parameters, int min, int max) throws InvalidVariableException
parameters
- collection of parametersmin
- minimum number of parameters allowedmax
- maximum number of parameters allowedInvalidVariableException
- if the number of parameters is incorrectprotected void checkParameterCount(Collection<CompoundVariable> parameters, int count) throws InvalidVariableException
parameters
- collection of parameterscount
- number of parameters expectedInvalidVariableException
- if the number of parameters is incorrectprotected void checkMinParameterCount(Collection<CompoundVariable> parameters, int minimum) throws InvalidVariableException
parameters
- collection of parametersminimum
- number of parameters expectedInvalidVariableException
- if the number of parameters is incorrectCopyright © 1998-2018 Apache Software Foundation. All Rights Reserved.