| 1 | |
package kg.apc.jmeter.functions; |
| 2 | |
|
| 3 | |
import org.apache.jmeter.engine.util.CompoundVariable; |
| 4 | |
import org.apache.jmeter.functions.AbstractFunction; |
| 5 | |
import org.apache.jmeter.functions.InvalidVariableException; |
| 6 | |
import org.apache.jmeter.samplers.SampleResult; |
| 7 | |
import org.apache.jmeter.samplers.Sampler; |
| 8 | |
|
| 9 | |
import java.util.Collection; |
| 10 | |
import java.util.LinkedList; |
| 11 | |
import java.util.List; |
| 12 | |
|
| 13 | 1 | public class IterationNum extends AbstractFunction { |
| 14 | |
|
| 15 | 1 | private static final List<String> desc = new LinkedList<String>(); |
| 16 | |
private static final String KEY = "__iterationNum"; |
| 17 | |
|
| 18 | |
@Override |
| 19 | |
public synchronized String execute(SampleResult previousResult, Sampler currentSampler) |
| 20 | |
throws InvalidVariableException { |
| 21 | 1 | return String.valueOf(getVariables().getIteration()); |
| 22 | |
|
| 23 | |
} |
| 24 | |
|
| 25 | |
@Override |
| 26 | |
public synchronized void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException { |
| 27 | 0 | } |
| 28 | |
|
| 29 | |
@Override |
| 30 | |
public String getReferenceKey() { |
| 31 | 0 | return KEY; |
| 32 | |
} |
| 33 | |
|
| 34 | |
@Override |
| 35 | |
public List<String> getArgumentDesc() { |
| 36 | 0 | return desc; |
| 37 | |
} |
| 38 | |
} |