net.sf.jbenchmark.sql
Class AbstractSQLCallTest

java.lang.Object
  extended bynet.sf.jbenchmark.TestFeature
      extended bynet.sf.jbenchmark.Test
          extended bynet.sf.jbenchmark.sql.AbstractSQLCallTest
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
SQLQueryTest, StoredProcedureTest

public abstract class AbstractSQLCallTest
extends Test

Anything associated with a benchmark test for DB interactions can extend this class.

Version:
$Id: AbstractSQLCallTest.java,v 1.1 2004/07/02 02:40:23 twpatkua Exp $
Author:
Patrick Kua

Field Summary
protected  java.sql.Connection connection
          Connection initialised in doInitialise().
protected static java.util.logging.Logger LOG
          Standard logger.
protected  java.util.List sqlArguments
          List of arguments for the prepared statement.
 
Constructor Summary
AbstractSQLCallTest()
           
 
Method Summary
 void addSqlCallArgument(SQLCallArgument argument)
          Add a stored procedure argument.
protected  void doCleanup()
          Close the connection at the end of the test.
protected  void doInitialise()
          Initialise the connection that is used in the test.
protected  TestResult doRun()
          If there are any requirements to report on the stored procedure, one may create an SQLTestResult that extends TestResult and report on more than just basics, but for now, just return a new result.
protected abstract  void doValidate()
          Validation is performed just before initialisation occurs and should validate that all of the required attributes for subclasses have been specified.
 void executeResult()
          Exceutes the stored procedure and returns the result.
protected abstract  java.sql.PreparedStatement getPreparedStatement()
          Implementing classes should return a prepared statement.
 java.util.List getSqlArguments()
          List of all the arguments for the stored procedure.
 void setSqlArguments(java.util.List sqlArguments)
          List of all the arguments for the stored procedure.
 
Methods inherited from class net.sf.jbenchmark.Test
addAssertion, addFeature, addResource, finish, getFeatureContext, getResource, run, setContext
 
Methods inherited from class net.sf.jbenchmark.TestFeature
getContext, getName, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

protected static final java.util.logging.Logger LOG
Standard logger.


sqlArguments

protected java.util.List sqlArguments
List of arguments for the prepared statement.


connection

protected java.sql.Connection connection
Connection initialised in doInitialise().

Constructor Detail

AbstractSQLCallTest

public AbstractSQLCallTest()
Method Detail

getSqlArguments

public java.util.List getSqlArguments()
List of all the arguments for the stored procedure.


setSqlArguments

public void setSqlArguments(java.util.List sqlArguments)
List of all the arguments for the stored procedure.


addSqlCallArgument

public void addSqlCallArgument(SQLCallArgument argument)
Add a stored procedure argument.


doValidate

protected abstract void doValidate()
Validation is performed just before initialisation occurs and should validate that all of the required attributes for subclasses have been specified.


doRun

protected TestResult doRun()
                    throws java.lang.Exception
If there are any requirements to report on the stored procedure, one may create an SQLTestResult that extends TestResult and report on more than just basics, but for now, just return a new result. The super class will calculate the duration.

Specified by:
doRun in class Test
Throws:
java.lang.Exception

executeResult

public void executeResult()
                   throws java.lang.Exception
Exceutes the stored procedure and returns the result. If there is no result to be had it will return null. If the result is a single value, it will be returned as a single value.

Throws:
java.lang.Exception

getPreparedStatement

protected abstract java.sql.PreparedStatement getPreparedStatement()
                                                            throws java.sql.SQLException
Implementing classes should return a prepared statement.

Throws:
java.sql.SQLException

doInitialise

protected void doInitialise()
                     throws java.lang.Exception
Initialise the connection that is used in the test.

Overrides:
doInitialise in class Test
Throws:
java.lang.Exception

doCleanup

protected void doCleanup()
                  throws java.lang.Exception
Close the connection at the end of the test.

Overrides:
doCleanup in class Test
Throws:
java.lang.Exception