Author: sebb
Date: Sun Jul 6 16:44:26 2008
New Revision: 674363
URL: http://svn.apache.org/viewvc?rev=674363&view=rev
Log:
Detab
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/Function.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/InvalidVariableException.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentDecoder.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentEncoder.java
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/Function.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/Function.java?rev=674363&r1=674362&r2=674363&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/Function.java
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/Function.java Sun
Jul 6 16:44:26 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.functions;
@@ -28,42 +28,42 @@
* Methods that a function must implement
*/
public 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.
- */
- public String execute(SampleResult previousResult, Sampler
currentSampler) throws InvalidVariableException;
-
- /**
- * 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.)
- *
- * @param parameters
- * @throws InvalidVariableException
- */
- public void setParameters(Collection parameters) throws
InvalidVariableException;
-
- /**
- * Return the name of your function. Convention is to prepend "__" to
the
- * name (ie "__regexFunction")
- */
- public String getReferenceKey();
-
- /**
- * Return a list of strings briefly describing each parameter your
function
- * takes. Please use JMeterUtils.getResString(resource_name) to grab a
- * resource string. Otherwise, your help text will be difficult to
- * internationalize.
- *
- * This list is not optional. If you don't wish to write help, you must
at
- * least return a List containing the correct number of blank strings,
one
- * for each argument.
- */
- public List getArgumentDesc();
+ /**
+ * 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.
+ */
+ public String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException;
+
+ /**
+ * 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.)
+ *
+ * @param parameters
+ * @throws InvalidVariableException
+ */
+ public void setParameters(Collection parameters) throws
InvalidVariableException;
+
+ /**
+ * Return the name of your function. Convention is to prepend "__" to the
+ * name (ie "__regexFunction")
+ */
+ public String getReferenceKey();
+
+ /**
+ * Return a list of strings briefly describing each parameter your function
+ * takes. Please use JMeterUtils.getResString(resource_name) to grab a
+ * resource string. Otherwise, your help text will be difficult to
+ * internationalize.
+ *
+ * This list is not optional. If you don't wish to write help, you must at
+ * least return a List containing the correct number of blank strings, one
+ * for each argument.
+ */
+ public List getArgumentDesc();
}
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/InvalidVariableException.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/InvalidVariableException.java?rev=674363&r1=674362&r2=674363&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/InvalidVariableException.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/InvalidVariableException.java
Sun Jul 6 16:44:26 2008
@@ -13,21 +13,21 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.functions;
/**
* @author mstover
- *
+ *
* @version $Revision$
*/
public class InvalidVariableException extends Exception {
- public InvalidVariableException() {
- }
+ public InvalidVariableException() {
+ }
- public InvalidVariableException(String msg) {
- super(msg);
- }
+ public InvalidVariableException(String msg) {
+ super(msg);
+ }
}
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java?rev=674363&r1=674362&r2=674363&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/gui/FunctionHelper.java
Sun Jul 6 16:44:26 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.functions.gui;
@@ -49,115 +49,115 @@
import org.apache.jorphan.reflect.ClassFinder;
public class FunctionHelper extends JDialog implements ActionListener,
ChangeListener {
- JLabeledChoice functionList;
+ JLabeledChoice functionList;
- ArgumentsPanel parameterPanel;
+ ArgumentsPanel parameterPanel;
- JLabeledTextField cutPasteFunction;
+ JLabeledTextField cutPasteFunction;
- private Map functionMap = new HashMap();
+ private Map functionMap = new HashMap();
- JButton generateButton;
-
- public FunctionHelper() {
- super((JFrame) null,
JMeterUtils.getResString("function_helper_title"), false); //$NON-NLS-1$
- init();
- }
-
- private void init() {
- parameterPanel = new
ArgumentsPanel(JMeterUtils.getResString("function_params")); //$NON-NLS-1$
- initializeFunctionList();
- this.getContentPane().setLayout(new BorderLayout(10, 10));
- JPanel comboPanel = new JPanel(new
FlowLayout(FlowLayout.CENTER));
- comboPanel.add(functionList);
- JButton helpButton = new
JButton(JMeterUtils.getResString("help")); //$NON-NLS-1$
- helpButton.addActionListener(new HelpListener());
- comboPanel.add(helpButton);
- this.getContentPane().add(comboPanel, BorderLayout.NORTH);
- this.getContentPane().add(parameterPanel, BorderLayout.CENTER);
- JPanel resultsPanel = new JPanel(new
FlowLayout(FlowLayout.CENTER));
- cutPasteFunction = new
JLabeledTextField(JMeterUtils.getResString("cut_paste_function"), 35);
//$NON-NLS-1$
- resultsPanel.add(cutPasteFunction);
- generateButton = new
JButton(JMeterUtils.getResString("generate")); //$NON-NLS-1$
- generateButton.addActionListener(this);
- resultsPanel.add(generateButton);
- this.getContentPane().add(resultsPanel, BorderLayout.SOUTH);
- this.pack();
- ComponentUtil.centerComponentInWindow(this);
- }
-
- private void initializeFunctionList() {
- try {
- List functionClasses =
ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(),
- new Class[] { Function.class }, true);
- Iterator iter = functionClasses.iterator();
- String[] functionNames = new
String[functionClasses.size()];
- int count = 0;
- while (iter.hasNext()) {
- Class cl = Class.forName((String) iter.next());
- functionNames[count] = ((Function)
cl.newInstance()).getReferenceKey();
- functionMap.put(functionNames[count], cl);
- count++;
- }
- functionList = new
JLabeledChoice(JMeterUtils.getResString("choose_function"), functionNames);
//$NON-NLS-1$
- functionList.addChangeListener(this);
- } catch (IOException e) {
- } catch (ClassNotFoundException e) {
- } catch (InstantiationException e) {
- } catch (IllegalAccessException e) {
- }
- }
-
- public void stateChanged(ChangeEvent event) {
- try {
- Arguments args = new Arguments();
- Function function = (Function) ((Class)
functionMap.get(functionList.getText())).newInstance();
- List argumentDesc = function.getArgumentDesc();
- Iterator iter = argumentDesc.iterator();
- while (iter.hasNext()) {
- String help = (String) iter.next();
- args.addArgument(help, ""); //$NON-NLS-1$
- }
- parameterPanel.configure(args);
- parameterPanel.revalidate();
- getContentPane().remove(parameterPanel);
- this.pack();
- getContentPane().add(parameterPanel,
BorderLayout.CENTER);
- this.pack();
- this.validate();
- this.repaint();
- } catch (InstantiationException e) {
- } catch (IllegalAccessException e) {
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- StringBuffer functionCall = new StringBuffer("${");
- functionCall.append(functionList.getText());
- Arguments args = (Arguments) parameterPanel.createTestElement();
- if (args.getArguments().size() > 0) {
- functionCall.append("(");
- PropertyIterator iter = args.iterator();
- boolean first = true;
- while (iter.hasNext()) {
- Argument arg = (Argument)
iter.next().getObjectValue();
- if (!first) {
- functionCall.append(",");
- }
- functionCall.append(arg.getValue());
- first = false;
- }
- functionCall.append(")");
- }
- functionCall.append("}");
- cutPasteFunction.setText(functionCall.toString());
- }
-
- private class HelpListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String[] source = new String[] { Help.HELP_FUNCTIONS,
functionList.getText() };
- ActionEvent helpEvent = new ActionEvent(source,
e.getID(), "help"); //$NON-NLS-1$
- ActionRouter.getInstance().actionPerformed(helpEvent);
- }
- }
+ JButton generateButton;
+
+ public FunctionHelper() {
+ super((JFrame) null,
JMeterUtils.getResString("function_helper_title"), false); //$NON-NLS-1$
+ init();
+ }
+
+ private void init() {
+ parameterPanel = new
ArgumentsPanel(JMeterUtils.getResString("function_params")); //$NON-NLS-1$
+ initializeFunctionList();
+ this.getContentPane().setLayout(new BorderLayout(10, 10));
+ JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+ comboPanel.add(functionList);
+ JButton helpButton = new JButton(JMeterUtils.getResString("help"));
//$NON-NLS-1$
+ helpButton.addActionListener(new HelpListener());
+ comboPanel.add(helpButton);
+ this.getContentPane().add(comboPanel, BorderLayout.NORTH);
+ this.getContentPane().add(parameterPanel, BorderLayout.CENTER);
+ JPanel resultsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+ cutPasteFunction = new
JLabeledTextField(JMeterUtils.getResString("cut_paste_function"), 35);
//$NON-NLS-1$
+ resultsPanel.add(cutPasteFunction);
+ generateButton = new JButton(JMeterUtils.getResString("generate"));
//$NON-NLS-1$
+ generateButton.addActionListener(this);
+ resultsPanel.add(generateButton);
+ this.getContentPane().add(resultsPanel, BorderLayout.SOUTH);
+ this.pack();
+ ComponentUtil.centerComponentInWindow(this);
+ }
+
+ private void initializeFunctionList() {
+ try {
+ List functionClasses =
ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(),
+ new Class[] { Function.class }, true);
+ Iterator iter = functionClasses.iterator();
+ String[] functionNames = new String[functionClasses.size()];
+ int count = 0;
+ while (iter.hasNext()) {
+ Class cl = Class.forName((String) iter.next());
+ functionNames[count] = ((Function)
cl.newInstance()).getReferenceKey();
+ functionMap.put(functionNames[count], cl);
+ count++;
+ }
+ functionList = new
JLabeledChoice(JMeterUtils.getResString("choose_function"), functionNames);
//$NON-NLS-1$
+ functionList.addChangeListener(this);
+ } catch (IOException e) {
+ } catch (ClassNotFoundException e) {
+ } catch (InstantiationException e) {
+ } catch (IllegalAccessException e) {
+ }
+ }
+
+ public void stateChanged(ChangeEvent event) {
+ try {
+ Arguments args = new Arguments();
+ Function function = (Function) ((Class)
functionMap.get(functionList.getText())).newInstance();
+ List argumentDesc = function.getArgumentDesc();
+ Iterator iter = argumentDesc.iterator();
+ while (iter.hasNext()) {
+ String help = (String) iter.next();
+ args.addArgument(help, ""); //$NON-NLS-1$
+ }
+ parameterPanel.configure(args);
+ parameterPanel.revalidate();
+ getContentPane().remove(parameterPanel);
+ this.pack();
+ getContentPane().add(parameterPanel, BorderLayout.CENTER);
+ this.pack();
+ this.validate();
+ this.repaint();
+ } catch (InstantiationException e) {
+ } catch (IllegalAccessException e) {
+ }
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ StringBuffer functionCall = new StringBuffer("${");
+ functionCall.append(functionList.getText());
+ Arguments args = (Arguments) parameterPanel.createTestElement();
+ if (args.getArguments().size() > 0) {
+ functionCall.append("(");
+ PropertyIterator iter = args.iterator();
+ boolean first = true;
+ while (iter.hasNext()) {
+ Argument arg = (Argument) iter.next().getObjectValue();
+ if (!first) {
+ functionCall.append(",");
+ }
+ functionCall.append(arg.getValue());
+ first = false;
+ }
+ functionCall.append(")");
+ }
+ functionCall.append("}");
+ cutPasteFunction.setText(functionCall.toString());
+ }
+
+ private class HelpListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ String[] source = new String[] { Help.HELP_FUNCTIONS,
functionList.getText() };
+ ActionEvent helpEvent = new ActionEvent(source, e.getID(),
"help"); //$NON-NLS-1$
+ ActionRouter.getInstance().actionPerformed(helpEvent);
+ }
+ }
}
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentDecoder.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentDecoder.java?rev=674363&r1=674362&r2=674363&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentDecoder.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentDecoder.java
Sun Jul 6 16:44:26 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.functions.util;
@@ -24,18 +24,18 @@
* Decodes an Argument by replacing '\x' with 'x'
*/
public final class ArgumentDecoder {
- private static final Perl5Util util = new Perl5Util();
+ private static final Perl5Util util = new Perl5Util();
- private static final String expression = "s#[\\\\](.)#$1#g"; //
$NON-NLS-1$
+ private static final String expression = "s#[\\\\](.)#$1#g"; // $NON-NLS-1$
// TODO does not appear to be used
- public static String decode(String s) {
- return util.substitute(expression, s);
- }
-
- /**
- * Prevent instantiation of utility class.
- */
- private ArgumentDecoder() {
- }
+ public static String decode(String s) {
+ return util.substitute(expression, s);
+ }
+
+ /**
+ * Prevent instantiation of utility class.
+ */
+ private ArgumentDecoder() {
+ }
}
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentEncoder.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentEncoder.java?rev=674363&r1=674362&r2=674363&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentEncoder.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/functions/util/ArgumentEncoder.java
Sun Jul 6 16:44:26 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.functions.util;
@@ -24,18 +24,18 @@
* Encode an Argument
*/
public final class ArgumentEncoder {
- private static final Perl5Util util = new Perl5Util();
+ private static final Perl5Util util = new Perl5Util();
- private static final String expression = "s#([${}(),\\\\])#\\$1#g";
+ private static final String expression = "s#([${}(),\\\\])#\\$1#g";
- // TODO does not appear to be used
- public static String encode(String s) {
- return util.substitute(expression, s);
- }
-
- /**
- * Prevent instantiation of utility class.
- */
- private ArgumentEncoder() {
- }
+ // TODO does not appear to be used
+ public static String encode(String s) {
+ return util.substitute(expression, s);
+ }
+
+ /**
+ * Prevent instantiation of utility class.
+ */
+ private ArgumentEncoder() {
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]