01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.jmeter.functions;
20:
21: import java.util.Collection;
22: import java.util.List;
23:
24: import org.apache.jmeter.samplers.SampleResult;
25: import org.apache.jmeter.samplers.Sampler;
26:
27: /**
28: * @author mstover
29: * @version $Revision: 493779 $
30: */
31: public interface Function {
32: /**
33: * Given the previous SampleResult and the current Sampler, return a string
34: * to use as a replacement value for the function call. Assume
35: * "setParameter" was previously called.
36: *
37: * This method must be threadsafe - multiple threads will be using the same
38: * object.
39: */
40: public String execute(SampleResult previousResult,
41: Sampler currentSampler) throws InvalidVariableException;
42:
43: /**
44: * A collection of the parameters used to configure your function. Each
45: * parameter is a CompoundFunction and can be resolved by calling the
46: * execute() method of the CompoundFunction (which should be done at
47: * execution.)
48: *
49: * @param parameters
50: * @throws InvalidVariableException
51: */
52: public void setParameters(Collection parameters)
53: throws InvalidVariableException;
54:
55: /**
56: * Return the name of your function. Convention is to prepend "__" to the
57: * name (ie "__regexFunction")
58: */
59: public String getReferenceKey();
60:
61: /**
62: * Return a list of strings briefly describing each parameter your function
63: * takes. Please use JMeterUtils.getResString(resource_name) to grab a
64: * resource string. Otherwise, your help text will be difficult to
65: * internationalize. Add your strings to all
66: * org.apache.jmeter.resources.*.properties files. Do not worry about
67: * translating - that's someone else's responsibility.
68: *
69: * This list is not optional. If you don't wish to write help, you must at
70: * least return a List containing the correct number of blank strings, one
71: * for each argument.
72: */
73: public List getArgumentDesc();
74: }
|