1 18 19 package org.apache.jmeter.functions; 20 21 import java.util.Collection ; 23 27 import org.apache.jmeter.samplers.SampleResult; 28 import org.apache.jmeter.samplers.Sampler; 29 import org.apache.jmeter.threads.JMeterContext; 30 import org.apache.jmeter.threads.JMeterContextService; 31 import org.apache.jmeter.threads.JMeterVariables; 32 34 37 public abstract class AbstractFunction implements Function 38 { 39 40 43 abstract public String execute( 44 SampleResult previousResult, 45 Sampler currentSampler) 46 throws InvalidVariableException; 47 48 public String execute() throws InvalidVariableException 49 { 50 JMeterContext context = JMeterContextService.getContext(); 51 SampleResult previousResult = context.getPreviousResult(); 52 Sampler currentSampler = context.getCurrentSampler(); 53 return execute(previousResult, currentSampler); 54 } 55 56 57 60 abstract public void setParameters(Collection parameters) 61 throws InvalidVariableException; 62 63 66 abstract public String getReferenceKey(); 67 68 107 113 151 152 protected JMeterVariables getVariables() 153 { 154 return JMeterContextService.getContext().getVariables(); 155 } 156 } 157 | Popular Tags |