test.ojb.broker
Class PerformanceJdbcReferenceTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--test.ojb.broker.PerformanceJdbcReferenceTest
All Implemented Interfaces:
junit.framework.Test

public class PerformanceJdbcReferenceTest
extends junit.framework.TestCase

This TestCase contains the OJB performance benchmarks for the JDBC API. This is the reference for other benchmarks.


Field Summary
(package private) static int articleCount
          the number of PerformanceArticle objects to work with.
(package private)  PersistenceBroker broker
           
(package private) static int iterations
          the number of iterations to perform.
(package private)  int offsetId
          the offset value for PerformanceArticle primary keys
 
Constructor Summary
PerformanceJdbcReferenceTest(java.lang.String name)
          BrokerTests constructor comment.
 
Method Summary
protected  void deleteArticles()
          deletes all PerformanceArticle created by insertNewArticles.
protected  void insertNewArticles()
          create new PerformanceArticle objects and insert them into the RDBMS.
static void main(java.lang.String[] args)
          launches the TestCase.
protected  void readArticles()
          read in all the PerformanceArticles from the RDBMS that have been inserted by insertNewArticles().
protected  void readArticlesByCursor()
          read in all the PerformanceArticles from the RDBMS that have been inserted by insertNewArticles().
 void setUp()
          setting up the test fixture.
 void tearDown()
          tearing down the test fixture.
 void testBenchmark()
          this method is the driver for the complete Benchmark.
protected  void updateExistingArticles()
          updates all PerformanceArticles inserted by insertNewArticles().
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

broker

PersistenceBroker broker

articleCount

static int articleCount
the number of PerformanceArticle objects to work with.


iterations

static int iterations
the number of iterations to perform.


offsetId

int offsetId
the offset value for PerformanceArticle primary keys

Constructor Detail

PerformanceJdbcReferenceTest

public PerformanceJdbcReferenceTest(java.lang.String name)
BrokerTests constructor comment.

Parameters:
name - java.lang.String
Method Detail

main

public static void main(java.lang.String[] args)
launches the TestCase. The number of Objects to work with and the number of iterations to be performed can be adjusted by setting them as commandline parameters.

Parameters:
args - the String[] holding the commandline parameters.

setUp

public void setUp()
setting up the test fixture.

Overrides:
setUp in class junit.framework.TestCase

tearDown

public void tearDown()
tearing down the test fixture.

Overrides:
tearDown in class junit.framework.TestCase

deleteArticles

protected void deleteArticles()
                       throws PersistenceBrokerException
deletes all PerformanceArticle created by insertNewArticles.

PersistenceBrokerException

insertNewArticles

protected void insertNewArticles()
                          throws PersistenceBrokerException
create new PerformanceArticle objects and insert them into the RDBMS. The number of objects to create is defined by articleCount.

PersistenceBrokerException

readArticles

protected void readArticles()
                     throws PersistenceBrokerException
read in all the PerformanceArticles from the RDBMS that have been inserted by insertNewArticles(). The lookup is done one by one, that is: a primary key based lookup is used.

PersistenceBrokerException

readArticlesByCursor

protected void readArticlesByCursor()
                             throws PersistenceBrokerException
read in all the PerformanceArticles from the RDBMS that have been inserted by insertNewArticles(). The lookup is done with a cursor fetch, that is: a between Statement is used to select all inserted PerformanceArticles and Objects are read in by fetching from the cursor (JDBC ResultSet).

PersistenceBrokerException

updateExistingArticles

protected void updateExistingArticles()
                               throws PersistenceBrokerException
updates all PerformanceArticles inserted by insertNewArticles(). All objects are modified and changes are written to the RDBMS with an UPDATE.

PersistenceBrokerException

testBenchmark

public void testBenchmark()
this method is the driver for the complete Benchmark. It performs the following steps: 1.) n objects are created and inserted to the RDBMS. 2.) the created objects are modified. Modifications are written to the RDBMS with updates. 3.) All objects created in 1.) are read in by primary key based SELECT statements. 4.) Step 3.) is repeated to test caching facilities. 5.) All objects created in 1.) are read by iterating over a ResultSet. 6.) All objects created in 1.) are deleted with n separate DELETE Statements.



Authors: Thomas Mahler and others. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.8.375, 2002-04-04