Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2014-09-01 09:24:59 +0000
committerMarkus Tiede2014-09-01 09:24:59 +0000
commitad659e20ab44d5fbdc6ade4eecb4cc95a2a0f6a2 (patch)
treeb8ad8dc214d70f2a9a6d04cba962a506286b0c1e
parent09499e8831aad1be1d22356c89a719ba89e0f9d1 (diff)
downloadorg.eclipse.jubula.core-ad659e20ab44d5fbdc6ade4eecb4cc95a2a0f6a2.tar.gz
org.eclipse.jubula.core-ad659e20ab44d5fbdc6ade4eecb4cc95a2a0f6a2.tar.xz
org.eclipse.jubula.core-ad659e20ab44d5fbdc6ade4eecb4cc95a2a0f6a2.zip
Non-sprint task - minor enhancement for getAttributeFunction: extended with retrieval of taskId and raw description text.
-rw-r--r--org.eclipse.jubula.client.core.functions/src/org/eclipse/jubula/client/core/functions/NodeAttributeEvaluator.java45
-rw-r--r--org.eclipse.jubula.documentation/manual/en/tex/Tasks/Testdata/functions.tex2
2 files changed, 28 insertions, 19 deletions
diff --git a/org.eclipse.jubula.client.core.functions/src/org/eclipse/jubula/client/core/functions/NodeAttributeEvaluator.java b/org.eclipse.jubula.client.core.functions/src/org/eclipse/jubula/client/core/functions/NodeAttributeEvaluator.java
index c0ea247fe..35c036ce3 100644
--- a/org.eclipse.jubula.client.core.functions/src/org/eclipse/jubula/client/core/functions/NodeAttributeEvaluator.java
+++ b/org.eclipse.jubula.client.core.functions/src/org/eclipse/jubula/client/core/functions/NodeAttributeEvaluator.java
@@ -18,33 +18,42 @@ import org.eclipse.jubula.tools.messagehandling.MessageIDs;
* @author BREDEX GmbH
*/
public class NodeAttributeEvaluator extends AbstractFunctionEvaluator {
- /**
- * the comment attribute name
- */
+ /** the comment attribute name */
private static final String COMMENT_ATTRIBUTE = "comment"; //$NON-NLS-1$
- /**
- * the name attribute name
- */
+ /** the name attribute name */
private static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
+
+ /** the description attribute name */
+ private static final String DESCRIPTION_ATTRIBUTE = "description"; //$NON-NLS-1$
+
+ /** the taskId attribute name */
+ private static final String TASK_ID_ATTRIBUTE = "taskId"; //$NON-NLS-1$
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String evaluate(String[] arguments) throws InvalidDataException {
validateParamCount(arguments, 1);
- String arg0 = arguments[0].toLowerCase();
+ final String attributeName = arguments[0].toLowerCase();
String attributeValue = null;
FunctionContext context = getContext();
if (context != null) {
INodePO node = context.getNode();
- if (NAME_ATTRIBUTE.equals(arg0)) {
- attributeValue = node.getName();
- } else if (COMMENT_ATTRIBUTE.equals(arg0)) {
- attributeValue = node.getComment();
- } else {
- throw new InvalidDataException("Unkown attribute: " //$NON-NLS-1$
- + arg0, MessageIDs.E_FUNCTION_EVAL_ERROR);
+ switch (attributeName) {
+ case NAME_ATTRIBUTE:
+ attributeValue = node.getName();
+ break;
+ case COMMENT_ATTRIBUTE:
+ attributeValue = node.getComment();
+ break;
+ case DESCRIPTION_ATTRIBUTE:
+ attributeValue = node.getDescription();
+ break;
+ case TASK_ID_ATTRIBUTE:
+ attributeValue = node.getTaskId();
+ break;
+ default:
+ throw new InvalidDataException("Unkown attribute: " //$NON-NLS-1$
+ + attributeName, MessageIDs.E_FUNCTION_EVAL_ERROR);
}
} else {
throw new InvalidDataException(
@@ -53,4 +62,4 @@ public class NodeAttributeEvaluator extends AbstractFunctionEvaluator {
}
return attributeValue;
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.documentation/manual/en/tex/Tasks/Testdata/functions.tex b/org.eclipse.jubula.documentation/manual/en/tex/Tasks/Testdata/functions.tex
index 367e7de2e..3e910f0da 100644
--- a/org.eclipse.jubula.documentation/manual/en/tex/Tasks/Testdata/functions.tex
+++ b/org.eclipse.jubula.documentation/manual/en/tex/Tasks/Testdata/functions.tex
@@ -41,7 +41,7 @@ The following functions give their results as decimal numbers, e.g. 1.0, 1.2 etc
\textbf{Test functions}\\
\begin{description}
-\item [getNodeAttribute]{Reads the value on the node (e.g. \gdcase{}, \gdstep{}) on which this function is resolved, and uses this as the data for the \gdstep{}. It has two possible arguments, \bxname{name} reads the name of the node, and \bxname{comment} reads the comment on the node. If the comment is empty, the value used is \bxname{null}. If you have overwritten either the name or the comment at this place of reuse, then these new details are used.}
+\item [getNodeAttribute]{Reads the value on the node (e.g. \gdcase{}, \gdstep{}) on which this function is resolved, and uses this as the data for the \gdstep{}. It has four possible arguments, \bxname{name} reads the name of the node, \bxname{comment} reads the comment on the node, \bxname{description} reads the raw (non-rendered) description on the node, and \bxname{taskId} reads the task ID on the node. If the comment is empty, the value used is \bxname{null}. If you have overwritten either the name or the comment at this place of reuse, then these new details are used.}
\item [getCentralTestDataSetValue]{Use this function to access a value saved in a central data set. This lets you combine values that you have defined centrally with values that you use locally, or lets you combine values from different central data sets in your test. It locates a single cell in a specific central data set based on a value in a column that you define as a key, and a column in which to search for the required value. It requires four arguments: the name of the central data set to search in, the name of the column which you wish to use as a ''key'' (you can name the column KEY if you require), the value in the key column (to specify the line), and the column in which the required data cell is located.}
\end{description}

Back to the top