IBM Rational Functional Tester
Version 8.1.1000
IBM Rational Functional Tester API Reference

Project Version 2.3

com.rational.test.ft.script
Class DatapoolScriptSupport

java.lang.Object
  extended by com.rational.test.ft.script.DatapoolScriptSupport
Direct Known Subclasses:
SubitemFactory

public class DatapoolScriptSupport
extends java.lang.Object

Provides methods for accessing rows in a datapool associated with this instance of RationalTestScript. In general if no datapool is associated with this script these methods will return a null value or throw an appropriate exception. You can always use the dpFactory() method to get the singleton object for the active datapool factory.

Refer to the datapool package documentation for a discussion on how to iterate over datapool contents manually.

Since:
RFT2.0

Field Summary
static int DP_ALL
          Flag to iterate over all remaining records in the datapool iterator.
static int DP_DEFAULT_EQUIVALENCE_CLASS
          Flag to use the default equivalence class.
static int DP_SHARE_CURRENT_RECORD
          Flag to share the current record in the datapool iterator.
 
Constructor Summary
DatapoolScriptSupport()
           
 
Method Summary
 boolean dpBoolean(int variableIndex)
          Shortcut to the boolean value in the cell in the current record and the specified variable index is returned.
 boolean dpBoolean(java.lang.String variableName)
          Shortcut to the boolean value in the cell in the current row and the specified variable name is returned.
 boolean dpBoolean(java.lang.String variableName, boolean defaultValue)
          Shortcut to the boolean value in the cell in the current record and the specified variable name is returned.
 byte dpByte(int variableIndex)
          Shortcut to the byte value in the cell in the current record and the specified variable index is returned.
 byte dpByte(java.lang.String variableName)
          Shortcut to the byte value in the cell in the current row and the specified variable name is returned.
 byte dpByte(java.lang.String variableName, byte defaultValue)
          Shortcut to the byte value in the cell in the current record and the specified variable name is returned.
 char dpChar(int variableIndex)
          Shortcut to the int value in the cell in the current record and the specified variable index is returned.
 char dpChar(java.lang.String variableName)
          Shortcut to the char value in the cell in the current row and the specified variable name is returned.
 char dpChar(java.lang.String variableName, char defaultValue)
          Shortcut to the byte value in the cell in the current record and the specified variable name is returned.
 IDatapoolRecord dpCurrent()
          The record currently available from the iterator for the associated instance of the datapool.
 boolean dpDone()
          Returns true if the current iterator value is null.
 double dpDouble(int variableIndex)
          Shortcut to the double value in the cell in the current record and the specified variable index is returned.
 double dpDouble(java.lang.String variableName)
          Shortcut to the double value in the cell in the current row and the specified variable name is returned.
 double dpDouble(java.lang.String variableName, double defaultValue)
          Shortcut to the double value in the cell in the current record and the specified variable name is returned.
 IDatapoolFactory dpFactory()
          Exposes the underlying the factory object so that IDatapool instances can be opened without direct support from the script editor.
 float dpFloat(int variableIndex)
          Shortcut to the float value in the cell in the current record and the specified variable index is returned.
 float dpFloat(java.lang.String variableName)
          Shortcut to the float value in the cell in the current row and the specified variable name is returned.
 float dpFloat(java.lang.String variableName, float defaultValue)
          Shortcut to the float value in the cell in the current record and the specified variable name is returned.
 void dpInitialization(java.io.File datapoolFile, int equivalenceClassIndex, java.lang.String iteratorClassName)
          Initialization of the default datapool iterator used by this instance of RationalTestScript.
 void dpInitialization(java.lang.Object datapool, java.lang.Object iterator)
          Initialization of the default datapool iterator used by this instance of RationalTestScript.
 void dpInitialize(IDatapool datapool, int equivalenceClassIndex, int iterationCount)
          Initialization of the default datapool iterator used by this instance of RationalTestScript.
 int dpInt(int variableIndex)
          Shortcut to the int value in the cell in the current record and the specified variable index is returned.
 int dpInt(java.lang.String variableName)
          Shortcut to the int value in the cell in the current row and the specified variable name is returned.
 int dpInt(java.lang.String variableName, int defaultValue)
          Shortcut to the int value in the cell in the current record and the specified variable name is returned.
 long dpLong(int variableIndex)
          Shortcut to the long value in the cell in the current record and the specified variable index is returned.
 long dpLong(java.lang.String variableName)
          Shortcut to the long value in the cell in the current row and the specified variable name is returned.
 long dpLong(java.lang.String variableName, long defaultValue)
          Shortcut to the Long value in the cell in the current record and the specified variable name is returned.
 void dpNext()
          Increments the iterator associated with an instance of the datapool.
 void dpReset()
          Restart the iterator associated with an instance of the datapool.
 short dpShort(int variableIndex)
          Shortcut to the short value in the cell in the current record and the specified variable index is returned.
 short dpShort(java.lang.String variableName)
          Shortcut to the short value in the cell in the current row and the specified variable name is returned.
 int dpShort(java.lang.String variableName, short defaultValue)
          Shortcut to the short value in the cell in the current record and the specified variable name is returned.
 java.lang.String dpString(int variableIndex)
          Shortcut to the String value in the cell in the current record and the specified variable index is returned.
 java.lang.String dpString(java.lang.String variableName)
          Shortcut to the String value in the cell in the current record and the specified variable name is returned.
 java.lang.String dpString(java.lang.String variableName, java.lang.String defaultValue)
          Shortcut to the String value in the cell in the current record and the specified variable name is returned.
 void dpTermination(boolean terminatedByException)
          Unload the datapool and datapool iterator used by this script.
 java.lang.Object dpValue(int variableIndex)
          Shortcut to the value in the cell in the current record and the specified variable index is returned.
 java.lang.Object dpValue(java.lang.String variableName)
          Shortcut to the value in the cell in the current record and the specified variable name is returned.
 java.lang.Object dpValue(java.lang.String variableName, java.lang.Object value)
          Shortcut to the value in the cell in the current record and the specified variable name is returned.
 IDatapool getDatapool()
          The datapool being iterated over.
 void setCurrentdp(DatapoolScriptSupport current)
          For internal use.
 void setDatapool(java.lang.String variableName, java.lang.Object value)
          This function sets the specified value for the specified column of the current datapool iterator.
 void storeDatapool()
          If the datapool is modified across the run, this can be used to store the changes into the file.
 void unsetDatapool()
          RFT 8.1.1 support multiple datapools.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DP_ALL

public static final int DP_ALL
Flag to iterate over all remaining records in the datapool iterator.

See Also:
Constant Field Values

DP_SHARE_CURRENT_RECORD

public static final int DP_SHARE_CURRENT_RECORD
Flag to share the current record in the datapool iterator.

See Also:
Constant Field Values

DP_DEFAULT_EQUIVALENCE_CLASS

public static final int DP_DEFAULT_EQUIVALENCE_CLASS
Flag to use the default equivalence class.

See Also:
Constant Field Values
Constructor Detail

DatapoolScriptSupport

public DatapoolScriptSupport()
Method Detail

dpFactory

public IDatapoolFactory dpFactory()
Exposes the underlying the factory object so that IDatapool instances can be opened without direct support from the script editor.

Returns:
The underlying the factory object
Since:
RFT2.0
See Also:
IDatapoolFactory

dpInitialization

public void dpInitialization(java.io.File datapoolFile,                              int equivalenceClassIndex,                              java.lang.String iteratorClassName)
Initialization of the default datapool iterator used by this instance of RationalTestScript. This is an internal method that should not be directly used by a script.


dpInitialization

public void dpInitialization(java.lang.Object datapool,                              java.lang.Object iterator)
Initialization of the default datapool iterator used by this instance of RationalTestScript. This is an internal method that should not be directly used by a script.


dpTermination

public void dpTermination(boolean terminatedByException)
Unload the datapool and datapool iterator used by this script. Note that if there is no associated datapool that this method has no affect.


dpInitialize

public void dpInitialize(IDatapool datapool,                          int equivalenceClassIndex,                          int iterationCount)
Initialization of the default datapool iterator used by this instance of RationalTestScript. This is an internal method that should not be directly used by a script.


setCurrentdp

public void setCurrentdp(DatapoolScriptSupport current)
For internal use. Should not be directly used by a script.

Parameters:
current -

unsetDatapool

public void unsetDatapool()
RFT 8.1.1 support multiple datapools. In Simplified script a datapool can be associated with each group. This function can be used to unset the datapool that was set using the setDatapool() Method. Once the datapool is unset it will use the default datapool associated with the script.
 
 Example:
 
 setDatapool("Script3.dp2",false,3);
 for (int i=0; i<3; i++)
 {                                                               
         password().click(atPoint(40,14));
         password().setText(dpString("Password"));
         nameCombo().select(dpString("nameCombo"));

         dpNext();                                      
 }
 unsetDatapool(); 
  
  
  

See Also:
RationalTestScript.setDatapool(String, boolean, int)

getDatapool

public IDatapool getDatapool()
The datapool being iterated over. If the iterator has not been initialized then null is returned.

Returns:
The datapool being iterated over.
Since:
RFT2.0

dpCurrent

public IDatapoolRecord dpCurrent()
The record currently available from the iterator for the associated instance of the datapool. This method will return the same value repeatedly until the iterator is incremented by a call to the next method. A value of null is returned when the iterator is out of values.

Returns:
The current record in the itertion sequence or null.
Since:
RFT2.0
See Also:
dpNext(), dpDone(), dpReset()

dpDone

public boolean dpDone()
Returns true if the current iterator value is null.

See Also:
dpCurrent(), dpNext(), dpReset()

dpNext

public void dpNext()
Increments the iterator associated with an instance of the datapool. Calling this method after the iteration sequence has been exhausted has no effect.

See Also:
dpCurrent(), dpDone(), dpReset()

dpReset

public void dpReset()
Restart the iterator associated with an instance of the datapool. It does not matter if the iterator has been exhausted of entries or not, the iterator simply resets to the initial start state.

See Also:
dpCurrent(), dpDone(), dpNext()

dpValue

public java.lang.Object dpValue(int variableIndex)
Shortcut to the value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The value in the cell in the current record and at the specified index.
See Also:
dpValue(String)

dpValue

public java.lang.Object dpValue(java.lang.String variableName)
Shortcut to the value in the cell in the current record and the specified variable name is returned.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The value in the cell in the current record and the specified variable name.
See Also:
dpValue(int)

dpValue

public java.lang.Object dpValue(java.lang.String variableName,                                 java.lang.Object value)
Shortcut to the value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The value in the cell in the current record and the specified variable name.
See Also:
dpValue(int)

dpString

public java.lang.String dpString(int variableIndex)
Shortcut to the String value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The value in the cell in the current record and at the specified index.
See Also:
dpString(String)

dpString

public java.lang.String dpString(java.lang.String variableName)
Shortcut to the String value in the cell in the current record and the specified variable name is returned. If the value in the cell is not a String value then it is converted to a String before being returned.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The valiable name to locate the cell by.
Returns:
The String value in the cell in the current record and the specified variable name.
See Also:
dpString(int)

dpString

public java.lang.String dpString(java.lang.String variableName,                                  java.lang.String defaultValue)
Shortcut to the String value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a String value then it is converted to a String before being returned.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The value in the cell in the current record and the specified variable name.

dpLong

public long dpLong(int variableIndex)
Shortcut to the long value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The value in the cell in the current record and at the specified index.
See Also:
dpLong(String)

dpLong

public long dpLong(java.lang.String variableName)
Shortcut to the long value in the cell in the current row and the specified variable name is returned. If the value in the cell is not a long value then an attempt is made to convert the value to a long. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The long value in the cell in the current row and the specified variable name.
See Also:
dpLong(int)

dpLong

public long dpLong(java.lang.String variableName,                    long defaultValue)
Shortcut to the Long value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a long value then an attempt is made to convert the value to a long before being returned. If the value can not be converted a java.lang.NumberFormatException will be thrown.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The value in the cell in the current record and the specified variable name.

dpInt

public int dpInt(int variableIndex)
Shortcut to the int value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell. If the value in the cell is not a int value then an attempt is made to convert the value to a int. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The int value in the cell in the current record and at the specified index.
See Also:
dpInt(String)

dpInt

public int dpInt(java.lang.String variableName)
Shortcut to the int value in the cell in the current row and the specified variable name is returned. If the value in the cell is not a int value then an attempt is made to convert the value to a int. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The int value in the cell in the current row and the specified variable name.
See Also:
dpInt(int)

dpInt

public int dpInt(java.lang.String variableName,                  int defaultValue)
Shortcut to the int value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a int value then an attempt is made to convert the value to a int before being returned. If the value can not be converted a java.lang.NumberFormatException will be thrown.

Parameters:
variableName - The variable name to locate the cell by.
defaultValue - The default value that should be returned if the variable doesn't exist in the datapool.
Returns:
The value in the cell in the current record and the specified variable name.

dpShort

public short dpShort(int variableIndex)
Shortcut to the short value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell. If the value in the cell is not a short value then an attempt is made to convert the value to a short. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The short value in the cell in the current record and at the specified index.
See Also:
dpShort(String)

dpShort

public short dpShort(java.lang.String variableName)
Shortcut to the short value in the cell in the current row and the specified variable name is returned. If the value in the cell is not a short value then an attempt is made to convert the value to a short. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The short value in the cell in the current row and the specified variable name.
See Also:
dpShort(int)

dpShort

public int dpShort(java.lang.String variableName,                    short defaultValue)
Shortcut to the short value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a short value then an attempt is made to convert the value to a short before being returned. If the value can not be converted a java.lang.NumberFormatException will be thrown.

Parameters:
variableName - The variable name to locate the cell by.
defaultValue - The default value that should be returned if the variable doesn't exist in the datapool.
Returns:
The value in the cell in the current record and the specified variable name.

dpByte

public byte dpByte(int variableIndex)
Shortcut to the byte value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell. If the value in the cell is not a byte value then an attempt is made to convert the value to a byte. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The byte value in the cell in the current record and at the specified index.
See Also:
dpByte(String)

dpByte

public byte dpByte(java.lang.String variableName)
Shortcut to the byte value in the cell in the current row and the specified variable name is returned. If the value in the cell is not a byte value then an attempt is made to convert the value to a byte. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The byte value in the cell in the current row and the specified variable name.
See Also:
dpByte(int)

dpByte

public byte dpByte(java.lang.String variableName,                    byte defaultValue)
Shortcut to the byte value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a byte value then an attempt is made to convert the value to a byte before being returned. If the value can not be converted a java.lang.NumberFormatException will be thrown.

Parameters:
variableName - The variable name to locate the cell by.
defaultValue - The default value that should be returned if the variable doesn't exist in the datapool.
Returns:
The value in the cell in the current record and the specified variable name.

dpDouble

public double dpDouble(int variableIndex)
Shortcut to the double value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell. If the value in the cell is not a double value then an attempt is made to convert the value to a double. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The double value in the cell in the current record and at the specified index.
See Also:
dpDouble(String)

dpDouble

public double dpDouble(java.lang.String variableName)
Shortcut to the double value in the cell in the current row and the specified variable name is returned. If the value in the cell is not a double value then an attempt is made to convert the value to a double. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The double value in the cell in the current row and the specified variable name.
See Also:
dpDouble(int)

dpDouble

public double dpDouble(java.lang.String variableName,                        double defaultValue)
Shortcut to the double value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a double value then an attempt is made to convert the value to a double before being returned. If the value can not be converted a java.lang.NumberFormatException will be thrown.

Parameters:
variableName - The variable name to locate the cell by.
defaultValue - The default value that should be returned if the variable doesn't exist in the datapool.
Returns:
The value in the cell in the current record and the specified variable name.

dpFloat

public float dpFloat(int variableIndex)
Shortcut to the float value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell. If the value in the cell is not a float value then an attempt is made to convert the value to a float. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The float value in the cell in the current record and at the specified index.
See Also:
dpFloat(String)

dpFloat

public float dpFloat(java.lang.String variableName)
Shortcut to the float value in the cell in the current row and the specified variable name is returned. If the value in the cell is not a float value then an attempt is made to convert the value to a float. If the value can not be converted a java.lang.NumberFormatException will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The float value in the cell in the current row and the specified variable name.
See Also:
dpFloat(int)

dpFloat

public float dpFloat(java.lang.String variableName,                      float defaultValue)
Shortcut to the float value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a float value then an attempt is made to convert the value to a float before being returned. If the value can not be converted a java.lang.NumberFormatException will be thrown.

Parameters:
variableName - The variable name to locate the cell by.
defaultValue - The default value that should be returned if the variable doesn't exist in the datapool.
Returns:
The value in the cell in the current record and the specified variable name.

dpBoolean

public boolean dpBoolean(int variableIndex)
Shortcut to the boolean value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell. If the value in the cell is not a boolean value then an attempt is made to convert the value to a boolean. If the value can not be converted an appropriate exception will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The boolean value in the cell in the current record and at the specified index.
See Also:
dpBoolean(String)

dpBoolean

public boolean dpBoolean(java.lang.String variableName)
Shortcut to the boolean value in the cell in the current row and the specified variable name is returned. If the value in the cell is not a boolean value then an attempt is made to convert the value to a boolean. If the value can not be converted an appropriate exception will be thrown.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The boolean value in the cell in the current row and the specified variable name.
See Also:
dpBoolean(int)

dpBoolean

public boolean dpBoolean(java.lang.String variableName,                          boolean defaultValue)
Shortcut to the boolean value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a boolean value then an attempt is made to convert the value to a boolean before being returned. If the value can not be converted a java.lang.NumberFormatException will be thrown.

Parameters:
variableName - The variable name to locate the cell by.
defaultValue - The default value that should be returned if the variable doesn't exist in the datapool.
Returns:
The value in the cell in the current record and the specified variable name.

dpChar

public char dpChar(int variableIndex)
Shortcut to the int value in the cell in the current record and the specified variable index is returned. The variable index is the specified zero based index for the cell. If the value in the cell is not a char value then an attempt is made to convert the value to a char. If more then one character is represented in the value only the first character will be returned.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableIndex - The zero based index of the cell in the record.
Returns:
The char value in the cell in the current record and at the specified index.
See Also:
dpChar(String)

dpChar

public char dpChar(java.lang.String variableName)
Shortcut to the char value in the cell in the current row and the specified variable name is returned. If the value in the cell is not a char value then an attempt is made to convert the value to a char. If more then one character is represented in the value only the first character will be returned.

An exception is thrown if this script does not have an associated datapool.

Parameters:
variableName - The variable name to locate the cell by.
Returns:
The char value in the cell in the current row and the specified variable name.
See Also:
dpChar(int)

dpChar

public char dpChar(java.lang.String variableName,                    char defaultValue)
Shortcut to the byte value in the cell in the current record and the specified variable name is returned. If the specified variable name is not present or the datapool is not present, the default value that is passed is returned. If the value in the cell is not a byte value then an attempt is made to convert the value to a byte before being returned. If the value can not be converted a java.lang.NumberFormatException will be thrown.

Parameters:
variableName - The variable name to locate the cell by.
defaultValue - The default value that should be returned if the variable doesn't exist in the datapool.
Returns:
The value in the cell in the current record and the specified variable name.

setDatapool

public void setDatapool(java.lang.String variableName,                         java.lang.Object value)
This function sets the specified value for the specified column of the current datapool iterator. If the specified column is not there, a new column is created and the value is set accordingly. Note that this doesn't write into the datapool file. storeDatapool can be used for that.

Parameters:
variableName - The column name of the datapool
value - The value that needs to be set for the specified column
See Also:
storeDatapool()

storeDatapool

public void storeDatapool()
If the datapool is modified across the run, this can be used to store the changes into the file.