net.sf.jameleon
Class VariableMappingTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by net.sf.jameleon.VariableTag
          extended by net.sf.jameleon.VariableMappingTag
All Implemented Interfaces:
Tag

public class VariableMappingTag
extends VariableTag

Used to map the value in one variable over to the value of another variable. sThis is useful when the same functional point is being used more than once or when the same variable name is used between different functional points that are in the same test-case. The following is an example of creating a list and using it in a tag.


 <testcase xmlns="jelly:jameleon">
       <map-variable toVariable="resultsText" variableType="list">
           <variable-value>value 1</variable-value>
           <variable-value>value 2</variable-value>
           <variable-value>value 3</variable-value>
           <variable-value>value 4</variable-value>
       </map-variable/>

   <some-session application="someApp" beginSession="true">
       <some-tag-that-uses-context-variables
           functionId="Verify successful navigation, using a different variable."
           someVariable="${resultsText}/>
   </some-session>
 </testcase>
 
The following is an example of mapping one value of a variable to another variable (pretty much useless).

 <testcase xmlns="jelly:jameleon">

   <some-session application="someApp" beginSession="true">
       <some-tag-that-uses-context-variables
           functionId="Verify successful navigation, using a different variable.">
           <map-variable
                 fromVariable="resultsText1"
                 toVariable="resultsText"/>
       </some-tag-that-uses-context-variables>
   </some-session>
 </testcase>
 
The following is an example of using the ${varName} notation (recommended)

 <testcase xmlns="jelly:jameleon">

   <some-session application="someApp" beginSession="true">
       <some-tag-that-uses-context-variables
           functionId="Verify successful navigation, using a different variable."
           resultsText="${resultsText1"/>
   </some-session>
 </testcase>
 
The following is an example of mapping multiple variable values to a single variable. Notice it's variableType is set to "list":

 <testcase xmlns="jelly:jameleon">

   <some-session application="someApp" beginSession="true">
       <some-tag-that-uses-context-variables
           functionId="Verify successful navigation, using a different variable.">
           <map-variable
                 fromVariable="resultsText1"
                 toVariable="resultsText"
                 variableType="list"/>
           <map-variable
                 fromVariable="resultsText2"
                 toVariable="resultsText"
                 variableType="list"/>
           <map-variable
                 fromVariable="resultsText3"
                 toVariable="resultsText"
                 variableType="list"/>
       </some-tag-that-uses-context-variables>
   </some-session>
 </testcase>
 
The value(s) can be entered directly like so:

 <testcase xmlns="jelly:jameleon">

   <some-session application="someApp" beginSession="true">
       <some-tag-that-uses-context-variables
           functionId="Verify successful navigation, using a different variable.">
           <map-variable toVariable="resultsText" variableType="list">
               <variable-value>value 1</variable-value>
               <variable-value>value 2</variable-value>
               <variable-value>value 3</variable-value>
               <variable-value>value 4</variable-value>
           </map-variable/>
       </some-tag-that-uses-context-variables>
   </some-session>
 </testcase>
 

Tag Name: <map-variable>

Field Summary
protected  boolean childExecuted
           
 
Fields inherited from class net.sf.jameleon.VariableTag
fromVariable, LIST, STRING, tct, toVariable, value, variableType
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
VariableMappingTag()
           
 
Method Summary
 void doTag(XMLOutput out)
          An implementation of the doTag method provided by the TagSupport class.
 String getFromVariable()
          Gets the variable name in the CSV file being mapped to the officially supported function tag variable name..
 String getToVariable()
           
 String getVariableType()
          Gets the type of the variable being stored.
protected  void setChildExecuted(boolean childExecuted)
           
 void setFromVariable(String fromVariable)
          Sets the variable name in the CSV file being mapped to the officially supported function tag variable name method.
 void setToVariable(String toVariable)
          Sets the variable name to map the fromVariable to.
 void setVariableType(String variableType)
          Sets the type of the variable being stored.
protected  void validate()
          Used to validate everything is set up correctly.
 
Methods inherited from class net.sf.jameleon.VariableTag
init, setVariable, setVariableValue
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

childExecuted

protected boolean childExecuted
Constructor Detail

VariableMappingTag

public VariableMappingTag()
Method Detail

doTag

public void doTag(XMLOutput out)
           throws MissingAttributeException,
                  JellyTagException
An implementation of the doTag method provided by the TagSupport class. Maps the value in the fromVariable over to the original variable name, toVariable.

Specified by:
doTag in interface Tag
Overrides:
doTag in class VariableTag
Throws:
MissingAttributeException
JellyTagException

validate

protected void validate()
                 throws MissingAttributeException,
                        JellyTagException
Used to validate everything is set up correctly.

Overrides:
validate in class VariableTag
Throws:
MissingAttributeException - - When a required attribute isn't set.
JellyTagException - - When this tag is used out of context.

getFromVariable

public String getFromVariable()
Gets the variable name in the CSV file being mapped to the officially supported function tag variable name..

Returns:
the variable name to map from or the variable that does not a set method for in the function point.

setFromVariable

public void setFromVariable(String fromVariable)
Sets the variable name in the CSV file being mapped to the officially supported function tag variable name method. This variable does not a set method for in the function point.

Parameters:
fromVariable - - The variable name to map from.

getToVariable

public String getToVariable()
Returns:
The variable name to be mapped to the fromVariable or the originally supported variable name that has a set method for it in the function point.

setToVariable

public void setToVariable(String toVariable)
Sets the variable name to map the fromVariable to. This is the originally supported variable name that has a set method for it in the function point.

Parameters:
toVariable - - the variable name to be mapped to the fromVariable.

getVariableType

public String getVariableType()
Gets the type of the variable being stored. Currently, this only supports List.

Returns:
The type of the variable being stored. Currently, this only supports List.

setVariableType

public void setVariableType(String variableType)
Sets the type of the variable being stored. Currently, this only supports List.

Parameters:
variableType - - The type of the variable being stored. Currently, this only supports List.

setChildExecuted

protected void setChildExecuted(boolean childExecuted)


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.