Rational QualityArchitect/Java API
Version 1.0

com.rational.test.vp
Class VerificationPoint

java.lang.Object
  |
  +--com.rational.test.vp.VerificationPoint
Direct Known Subclasses:
DatabaseVP

public abstract class VerificationPoint
extends java.lang.Object

This class contains the verification point's metadata -- that is, the information that determines the data to capture for this verification point. Examples of verification point metadata include the list of properties for a user-defined object properties verification point, or connection information and SELECT statements for the JDBC database verification point that is included in this package.

Don’t confuse metadata with the data being verified. The data being verified is encapsulated by an implementation of the interface VerificationPointData.

A verification point’s metadata can be defined in either of these ways:

This class is also responsible for implementing its own serialization. By requiring your specific verification point implementations to perform their own serialization, all file formats (such as INI, XML, and standard Java serialization) can be supported.

This abstract class defines the metadata for and partially implements the behavior of a verification point. Because the VerificationPoint class is abstract, it cannot be instantiated. Rather, all verification point classes, including the classes you create, extend from this class, implementing the abstract methods necessary to specialize themselves, and inheriting the rest of their behavior from this class.

As the verification point implementer, you must implement all abstract methods.

The VerificationPoint class is part of the verification point framework that you use to implement your own verification point classes. The verification point framework also includes:

Since:
QualityArchitect 0.1
See Also:
Implementing a New Verification Point

Field Summary
protected  boolean bIsDefined
          If true, indicates that the verification point's metadata is fully specified.
protected  boolean bIsValid
          If true, indicates that the verification point was correctly instantiated, successfully captured, and is in a valid state -- otherwise false.
static int COMPARE_CASEINSENSITIVE
          Specifies that the verification should be case insensitive.
static int COMPARE_CASESENSITIVE
          Specifies that the verification should be case sensitive (default).
static int OPTION_EXPECT_FAILURE
          Specifies that the verification point's expected result is failure.
static int OPTION_USER_ACKNOWLEDGE_BASELINE
          Specifies that the first run of a static verification point should display the captured data for the tester to validate before storing it as the expected (baseline) data object.
protected  java.lang.String sFailureDescription
          Specifies the reason for a failure.
static int VERIFICATION_ERROR
          An error occured, and the verification point was not performed.
static int VERIFICATION_FAILED
          The verification point was performed, and the comparison failed.
static int VERIFICATION_NO_RESULT
          The static verification point was run for the first time, and a baseline (expected) data object was successfully captured.
static int VERIFICATION_SUCCEEDED
          The verification point was performed, and the comparison passed.
 
Constructor Summary
VerificationPoint(java.lang.String sVPname, java.lang.Class cVPdataClass, java.lang.Class cVPdataProviderClass, java.lang.Class cVPdataRendererClass, java.lang.Class cVPcompClass)
          This constructor stores the name of the verification point and the classes that provide serialization and comparison services for the verification point.
 
Method Summary
abstract  java.lang.String codeFactory_getConstructorInvocation()
          This code factory method returns a parameterized constructor call.
abstract  java.lang.String codeFactory_getExternalizedInputDecl(int nInput)
           This code factory method returns a variable declaration.
abstract  int codeFactory_getNumExternalizedInputs()
          This code factory method returns the number of responses (inputs) that a tester provided when defining verification point metadata interactively through a UI.
 java.lang.String codeFactory_getPrefix()
          This code factory method retrieves the user-defined prefix that is currently available to prepend to a variable name to make the name unique.
abstract  java.lang.String codeFactory_getStaticInvocation()
          This code factory method sends back a static invocation declaration.
 void codeFactory_setPrefix(java.lang.String sSelfDescribePrefix)
          This code factory method specifies a user-defined prefix to prepend to the current set of variable names created and declared by the codeFactory_getExternalizedInputDecl() method.
abstract  boolean defineVPcallback()
          This method should provide a way to capture the metadata for the verification point -- typically, by presenting the tester with a UI device, such as the Query Builder tool provided with Rational QualityArchitect for use with the database verification point).
 boolean getIsDefined()
          This method retrieves the value of the bIsDefined field.
 TestLog getLog()
           
 java.lang.String getLogActualFile()
          Internal use only.
 java.lang.String getLogBaselineFile()
          Internal use only.
 java.lang.String getLogMetaFile()
          Internal use only.
 java.lang.String getMasterBaselineFile()
          Internal use only.
 java.lang.String getMasterMetaFile()
          Internal use only.
 int getOptions()
          This method retrieves the options associated with the current verification point.
 java.lang.String getVPname()
          This method retrieves the name of the current verification point.
protected  void initializeVP(boolean bVPdefined)
          For internal use only.
 int performTest(java.lang.Object objTarget)
          This method performs a static verification point.
 int performTest(java.lang.Object objTarget, VerificationPointData vpsExpected)
          This method performs a dynamic verification point.
 int performTest(java.lang.Object objTarget, VerificationPointData vpsExpected, VerificationPointData vpsActual)
          This method performs a manual verification point.
abstract  void readFile(java.io.InputStream in)
          This method deserializes a verification point object from the specified InputStream.
 void setIsDefined(boolean bIsDefined)
          This method assigns a value to the bIsDefined field.
 void setOptions(int iOptions)
          This method sets the options for the current verification point.
 void setVPname(java.lang.String sVPname)
          This method sets the name of the current verification point.
abstract  void writeFile(java.io.OutputStream out)
          This method serializes the verification point object to the specified OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bIsValid

protected transient boolean bIsValid
If true, indicates that the verification point was correctly instantiated, successfully captured, and is in a valid state -- otherwise false.

bIsDefined

protected transient boolean bIsDefined

If true, indicates that the verification point's metadata is fully specified. If false when a performTest() method is invoked, the framework will call the defineVPcallback() method on behalf of the test script in an attempt to get a complete set of verification point metadata from the tester.

Note that this field applies to the verification point metadata, not to the data itself that is captured in accordance with the metadata.


sFailureDescription

protected transient java.lang.String sFailureDescription
Specifies the reason for a failure.

COMPARE_CASESENSITIVE

public static final int COMPARE_CASESENSITIVE
Specifies that the verification should be case sensitive (default).

COMPARE_CASEINSENSITIVE

public static final int COMPARE_CASEINSENSITIVE
Specifies that the verification should be case insensitive.

OPTION_USER_ACKNOWLEDGE_BASELINE

public static final int OPTION_USER_ACKNOWLEDGE_BASELINE
Specifies that the first run of a static verification point should display the captured data for the tester to validate before storing it as the expected (baseline) data object.

OPTION_EXPECT_FAILURE

public static final int OPTION_EXPECT_FAILURE
Specifies that the verification point's expected result is failure. If the comparison fails and this option is set, the verification point succeeds.

VERIFICATION_ERROR

public static final int VERIFICATION_ERROR
An error occured, and the verification point was not performed.

VERIFICATION_SUCCEEDED

public static final int VERIFICATION_SUCCEEDED
The verification point was performed, and the comparison passed.

VERIFICATION_FAILED

public static final int VERIFICATION_FAILED
The verification point was performed, and the comparison failed.

VERIFICATION_NO_RESULT

public static final int VERIFICATION_NO_RESULT
The static verification point was run for the first time, and a baseline (expected) data object was successfully captured.
Constructor Detail

VerificationPoint

public VerificationPoint(java.lang.String sVPname,
                         java.lang.Class cVPdataClass,
                         java.lang.Class cVPdataProviderClass,
                         java.lang.Class cVPdataRendererClass,
                         java.lang.Class cVPcompClass)

This constructor stores the name of the verification point and the classes that provide serialization and comparison services for the verification point.

This constructor can never be called from a test script because the VerificationPoint class is abstract. A specific verification point implementation (such as the database verification point or any custom verification points that you implement) extends the VerificationPoint class and invokes this constructor from within its own constructor using the super keyword -- for example:

     public MyVerificationPoint( String sVPname )
     {
            super(sVPname, MyVPData.class, MyVPDataProvider.class, MyVPDataRenderer.class, MyVPComparator.class);
            . . .
     }
Parameters:
sVPname - A user-defined name for the verification point. 40 characters maximum.
cVPdataClass - The class responsible for serialization of one set of the verification point's data.
cVPdataProviderClass - The class responsible for capturing the verification point's data and populating a VerificationPointData object with the data.
cVPdataRendererClass - The class responsible for visually rendering the data stored in an object of this verification point's VerificationPointData class.
cVPcompClass - The class responsible for comparing two sets of this verification point's data.

Note: The classes passed in the cVPdataClass, cVPdataProviderClass, cVPdataRendererClass, and cVPcompClass parameters are passed to the constructor to allow late-binding to the methods in the classes.

Method Detail

codeFactory_getConstructorInvocation

public abstract java.lang.String codeFactory_getConstructorInvocation()

This code factory method returns a parameterized constructor call.

This method is never called from the test script. This method is called during the following Rational code generation operations:

This method returns a parameterized constructor call. This call plus the variables declared by codeFactory_getExternalizedInputDecl() allow the code generators listed above to create a fully specified verification point in the generated test script code.


codeFactory_getExternalizedInputDecl

public abstract java.lang.String codeFactory_getExternalizedInputDecl(int nInput)

This code factory method returns a variable declaration.

This method is never called from the test script. This method is called during the following Rational code generation operations:

The Rational code generators (the Rational QualityArchitect Session Recorder and the Rational Rose scenario test generator) call this code factory method in a loop that iterates as many times as there are variables to declare (that is, the number returned from codeFactory_getNumExternalizedInputs()).

The code returned by codeFactory_getConstructorInvocation() use the variables declared with codeFactory_getExternalizedInputDecl().

Parameters:
nInput - A number that indicates the current variable to declare. The number should be initialized to 0 and incremented by 1 in the loop.
Returns:
A line of code that declares the specified variable.

codeFactory_getNumExternalizedInputs

public abstract int codeFactory_getNumExternalizedInputs()

This code factory method returns the number of responses (inputs) that a tester provided when defining verification point metadata interactively through a UI. The UI was presented to the tester through the defineVPcallback() method.

This method is never called from the test script. This method is called during the following Rational code generation operations:

Returns:
The number of inputs that require variable declarations.


codeFactory_getPrefix

public java.lang.String codeFactory_getPrefix()

This code factory method retrieves the user-defined prefix that is currently available to prepend to a variable name to make the name unique. Use the prefix whenever you are constructing a set of variable names for use with the codeFactory_getConstructorInvocation() and codeFactory_getExternalizedInputDecl() methods.

Call this method only if you are implementing a new verification point.

Returns:
A prefix for a variable name.

codeFactory_getStaticInvocation

public abstract java.lang.String codeFactory_getStaticInvocation()

This code factory method sends back a static invocation declaration.

This method is never called from the test script. This method is called during the following Rational code generation operations:

This method returns a static invocation line. This line of code is required to capture the baseline data for the Verification Point when the test script is first run and then to validate that baseline data with each subsequent execution of the test script.


codeFactory_setPrefix

public void codeFactory_setPrefix(java.lang.String sSelfDescribePrefix)

This code factory method specifies a user-defined prefix to prepend to the current set of variable names created and declared by the codeFactory_getExternalizedInputDecl() method.

The variable-name prefix is used to ensure that variable names are unique when the Rational code generator features (the Rational QualityArchitect Session Recorder) and the Rational Rose scenario test generator) insert more than one verification point into a given scope.

This method is called by the Rational QualityArchitect code generators.

Parameters:
sSelfDescribePrefix - The prefix to prepend to the variable names.

defineVPcallback

public abstract boolean defineVPcallback()

This method should provide a way to capture the metadata for the verification point -- typically, by presenting the tester with a UI device, such as the Query Builder tool provided with Rational QualityArchitect for use with the database verification point).

Implement this method only if you are implementing a new verification point.

The framework automatically invokes this method if the verification point's metadata is not fully defined when the performTest() method is invoked.

When defineVPcallback() is invoked, it should capture, presumably through some UI, any information necessary to fully define the metadata for the verification point, and then populate the verification point's attributes with the captured metadata. For example, the defineVPcallback() method included with the database verification point provided with Rational QualityArchitect invokes the Query Builder software. Query Builder captures JDBC connection information and a SQL statement, and then populates the database verification point object with the captured metadata, resulting in a fully defined verification point.

This method applies to the verification point metadata, not to the data itself that is captured in accordance with the metadata. The metadata is used by the specialized Verification Point Data Provider class to determine the data to capture.

If the verification point is being recorded through the Rational QualityArchitect Session Recorder, or if it being generated through a Rational Rose model, this method will be invoked at script generation time. The resulting verification point metadata will automatically be provided to the test script. As a result, the defineVPcallback() method will not be invoked at script playback time.

Returns:
true if the verification point metadata was captured, false otherwise. If the metadata was not captured, the verification point will be in an invalid state, and it will log an error if its performTest() method is called.

getIsDefined

public boolean getIsDefined()
This method retrieves the value of the bIsDefined field.

getLog

public TestLog getLog()

getLogActualFile

public java.lang.String getLogActualFile()
Internal use only.

getLogBaselineFile

public java.lang.String getLogBaselineFile()
Internal use only.

getLogMetaFile

public java.lang.String getLogMetaFile()
Internal use only.

getMasterBaselineFile

public java.lang.String getMasterBaselineFile()
Internal use only.

getMasterMetaFile

public java.lang.String getMasterMetaFile()
Internal use only.

getOptions

public int getOptions()
This method retrieves the options associated with the current verification point.

getVPname

public java.lang.String getVPname()
This method retrieves the name of the current verification point.

initializeVP

protected void initializeVP(boolean bVPdefined)

For internal use only.


performTest

public int performTest(java.lang.Object objTarget)

This method performs a static verification point.

In this implementation, performTest() performs and logs a regression-style verification. It does so by checking the datastore for an expected (baseline) data object and then comparing the expected data object to the actual data object that is captured in this call.

If there is no expected data object in the datastore, the call creates one and returns a VERIFICATION_NO_RESULT status for this run of the verification point.

However, if there is no expected data, but the test script specifies the OPTION_USER_ACKNOWLEDGE_BASELINE option in the setOptions() method, the framework first invokes an implementer-defined UI that prompts the tester to verifiy that the captured data is correct:

Parameters:
objTarget - The object-under-test. If the verification point operates on an object that is not directly accessible (for example, a remote object or a database), the verification point object must contain the information needed to find the object-under- test, and the value of objTarget is ignored.
Returns:

performTest

public int performTest(java.lang.Object objTarget,
                       VerificationPointData vpsExpected)

This method performs a dynamic verification point.

In this implementation, performTest() captures an actual data object from the component-under-test, compares the actual data object to the expected data object that was passed to the call, and logs the results of the comparison.

Parameters:
objTarget - The object-under-test. If the verification point operates on an object that is not directly accessible (for example, a remote object or a database), the verification point object must contain the information needed to find the object-under- test, and the value of objTarget is ignored.
vpsExpected - An expected data object. The test script can construct the expected data object, or it can deserialize the expected data object from a file that is not managed by the Rational datastore.
Returns:

performTest

public int performTest(java.lang.Object objTarget,
                       VerificationPointData vpsExpected,
                       VerificationPointData vpsActual)

This method performs a manual verification point.

In this implementation, performTest() specifies both the expected data object and the actual data object. This allows a test script to capture or construct the actual data object, rather than relying on the Verification Point Data Provider class to create the actual data object.

This call simply compares the actual and expected data objects that are passed to it and logs the results of the comparison.

Parameters:
objTarget - The object-under-test. If the verification point operates on an object that is not directly accessible (for example, a remote object or a database), the verification point object must contain the information needed to find the object-under- test, and the value of objTarget is ignored.
vpsExpected - An expected data object. The test script can construct the expected data object, or it can deserialize the expected data object from a file that is not managed by the Rational datastore.
vpsActual - The actual data object. This object was captured or constructed by code in the test script.
Returns:

readFile

public abstract void readFile(java.io.InputStream in)
                       throws java.io.IOException
This method deserializes a verification point object from the specified InputStream.
Parameters:
in - The InputStream from which the object is read.
Throws:
java.io.IOException - An error has occurred in attempting to read from the InputStream.

setIsDefined

public void setIsDefined(boolean bIsDefined)
This method assigns a value to the bIsDefined field.

setOptions

public void setOptions(int iOptions)
This method sets the options for the current verification point.
Parameters:
iOptions - One or more options to assign to the verification point. Options can be pre-defined, such as COMPARE_CASESENSITIVE, COMPARE_CASEINSENSITIVE, and OPTION_USER_ACKNOWLEDGE_BASELINE, or any user-defined options.

setVPname

public void setVPname(java.lang.String sVPname)
This method sets the name of the current verification point.
Parameters:
sVPname - The name to assign to the current verification point. 40 characters maximum.

writeFile

public abstract void writeFile(java.io.OutputStream out)
                        throws java.io.IOException
This method serializes the verification point object to the specified OutputStream. Metafile format should be used so that the Rational comparators can read the file.
Parameters:
out - The OutputStream to which the object is written.
Throws:
java.io.IOException - An error has occurred in attempting to write to the OutputStream.

30-Jun-2003

Rational QualityArchitect/Java Support Home Page
Copyright (c) 2000, Rational Software Corporation