IBM Rational Functional Tester
Version 6.1
IBM Rational Functional Tester API Reference

Project Version 2.0

com.rational.test.ft.script
Class DatapoolScriptSupport

java.lang.Object
  extended bycom.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 int 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.
 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.
 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.
 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.
 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.
 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 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.
 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.
 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.
 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.
 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.
 IDatapool getDatapool()
          The datapool being iterated over.
 
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.


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.


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)

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)

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)

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)

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)

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)

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)

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)

dpBoolean

public boolean dpBoolean(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 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)

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)