You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2014/11/13 20:30:02 UTC
svn commit: r1639490 - in
/jmeter/trunk/src/core/org/apache/jmeter/engine/util: ValueReplacer.java
ValueTransformer.java
Author: fschumacher
Date: Thu Nov 13 19:30:02 2014
New Revision: 1639490
URL: http://svn.apache.org/r1639490
Log:
Bug 57193: Add description for @param and @throws in javadoc
Bugzilla Id: 57193
Modified:
jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueReplacer.java
jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueTransformer.java
Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueReplacer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueReplacer.java?rev=1639490&r1=1639489&r2=1639490&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueReplacer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueReplacer.java Thu Nov 13 19:30:02 2014
@@ -48,6 +48,10 @@ public class ValueReplacer {
public ValueReplacer() {
}
+ /**
+ * Constructor which couples the given {@link TestPlan} to this by means of the user defined variables
+ * @param tp {@link TestPlan} from which we will take the user defined variables as variables map
+ */
public ValueReplacer(TestPlan tp) {
setUserDefinedVariables(tp.getUserDefinedVariables());
}
@@ -56,6 +60,10 @@ public class ValueReplacer {
return variables.containsKey(k);
}
+ /**
+ * Set this {@link ValueReplacer}'s variable map
+ * @param variables Map which stores the variables
+ */
public void setUserDefinedVariables(Map<String, String> variables) {
this.variables = variables;
}
@@ -64,8 +72,9 @@ public class ValueReplacer {
* Replaces TestElement StringProperties containing functions with their Function properties equivalent, example:
* ${__time()}_${__threadNum()}_${__machineName()} will become a FunctionProperty of
* a CompoundVariable containing 3 functions
- * @param el
- * @throws InvalidVariableException
+ * @param el {@link TestElement} in which the values should be replaced
+ * @throws InvalidVariableException when transforming of the variables goes awry and
+ * the used transformer throws an {@link InvalidVariableException}
*/
public void replaceValues(TestElement el) throws InvalidVariableException {
Collection<JMeterProperty> newProps = replaceValues(el.propertyIterator(), new ReplaceStringWithFunctions(masterFunction,
@@ -82,8 +91,9 @@ public class ValueReplacer {
/**
* Transforms strings into variable references
- * @param el
- * @throws InvalidVariableException
+ * @param el {@link TestElement} in which the we will look for strings, that can be replaced by variable references
+ * @throws InvalidVariableException when transforming of the strings goes awry and
+ * the used transformer throws an {@link InvalidVariableException}
*/
public void reverseReplace(TestElement el) throws InvalidVariableException {
Collection<JMeterProperty> newProps = replaceValues(el.propertyIterator(), new ReplaceFunctionsWithStrings(masterFunction,
@@ -92,10 +102,11 @@ public class ValueReplacer {
}
/**
- * Transforms strings into variable references using regexp matching if regexMatch is true
- * @param el
- * @param regexMatch
- * @throws InvalidVariableException
+ * Transforms strings into variable references using regexp matching if regexMatch is <code>true</code>
+ * @param el {@link TestElement} in which the we will look for strings, that can be replaced by variable references
+ * @param regexMatch when <code>true</code> variable substitution will be done in regexp matching mode
+ * @throws InvalidVariableException when transforming of the strings goes awry and
+ * the used transformer throws an {@link InvalidVariableException}
*/
public void reverseReplace(TestElement el, boolean regexMatch) throws InvalidVariableException {
Collection<JMeterProperty> newProps = replaceValues(el.propertyIterator(), new ReplaceFunctionsWithStrings(masterFunction,
@@ -105,8 +116,9 @@ public class ValueReplacer {
/**
* Replaces ${key} by value extracted from variables if any
- * @param el
- * @throws InvalidVariableException
+ * @param el {@link TestElement} in which values should be replaced
+ * @throws InvalidVariableException when transforming of the variables goes awry and
+ * the used transformer throws an {@link InvalidVariableException}
*/
public void undoReverseReplace(TestElement el) throws InvalidVariableException {
Collection<JMeterProperty> newProps = replaceValues(el.propertyIterator(), new UndoVariableReplacement(masterFunction,
@@ -114,6 +126,11 @@ public class ValueReplacer {
setProperties(el, newProps);
}
+ /**
+ * Add a variable to this replacer's variables map
+ * @param name Name of the variable
+ * @param value Value of the variable
+ */
public void addVariable(String name, String value) {
variables.put(name, value);
}
@@ -129,13 +146,15 @@ public class ValueReplacer {
}
/**
- * Replaces a StringProperty containing functions with their Function properties equivalent, example:
- * ${__time()}_${__threadNum()}_${__machineName()} will become a FunctionProperty of
- * a CompoundVariable containing 3 functions
- * @param iter {@link PropertyIterator}
- * @param transform {@link ValueTransformer}
- * @return Collection<JMeterProperty>
- * @throws InvalidVariableException
+ * Replaces a {@link StringProperty} containing functions with their Function properties equivalent.
+ * <p>For example:
+ * <code>${__time()}_${__threadNum()}_${__machineName()}</code> will become a
+ * {@link org.apache.jmeter.testelement.property.FunctionProperty} of
+ * a {@link CompoundVariable} containing three functions
+ * @param iter the {@link PropertyIterator} over all properties, in which the values should be replaced
+ * @param transform the {@link ValueTransformer}, that should do transformation
+ * @return a new {@link Collection} with all the transformed {@link JMeterProperty}s
+ * @throws InvalidVariableException when <code>transform</code> throws an {@link InvalidVariableException} while transforming a value
*/
private Collection<JMeterProperty> replaceValues(PropertyIterator iter, ValueTransformer transform) throws InvalidVariableException {
List<JMeterProperty> props = new LinkedList<JMeterProperty>();
Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueTransformer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueTransformer.java?rev=1639490&r1=1639489&r2=1639490&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueTransformer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/util/ValueTransformer.java Thu Nov 13 19:30:02 2014
@@ -30,7 +30,7 @@ interface ValueTransformer {
/**
* Transform the given property and return the new version.
*
- * @param property
+ * @param property Property to be transformed
* @return the transformed property
*/
JMeterProperty transformValue(JMeterProperty property) throws InvalidVariableException;
@@ -39,7 +39,7 @@ interface ValueTransformer {
* Set the master function for the value transformer. This handles
* converting strings to functions.
*
- * @param masterFunction
+ * @param masterFunction Function to be used for the transformation
*/
void setMasterFunction(CompoundVariable masterFunction);
@@ -47,7 +47,7 @@ interface ValueTransformer {
* Set the variable names and values used to reverse replace functions with
* strings, and undo functions to raw values.
*
- * @param vars
+ * @param vars Map of names and values to be used for the transformation
*/
void setVariables(Map<String, String> vars);
}