org.apache.ojb.performance
Class PerfTest

java.lang.Object
  extended by org.apache.ojb.performance.PerfTest
All Implemented Interfaces:
java.lang.Runnable

public abstract class PerfTest
extends java.lang.Object
implements java.lang.Runnable

Derivate this class to implement a test client for the performance test.

Version:
$Id: PerfTest.java 365254 2005-12-30 00:01:42Z arminw $

Constructor Summary
PerfTest()
           
 
Method Summary
abstract  int articleCount()
          Returns the count of all found PerfArticle in database.
abstract  void deleteArticles(PerfArticle[] arr)
          Delete all given article from the database.
abstract  void deleteArticlesStress(PerfArticle[] arr)
          Delete all given article from the database in a really resource sressing way.
abstract  PerfArticle getArticleByIdentity(java.lang.Long articleId)
          Read all stored articles from the database and return the result as collection of PerfArticles.
 PerfArticle getPreparedPerfArticle(java.lang.String articleName)
          Factory method that creates an PerfArticle using the PerfArticleImpl class, override this method if you need your own implementation of the PerfArticle-Interface.
 java.lang.String getTestObjectName()
          The returned name was used as 'articleName' for all created PerfArticles for this thread.
abstract  void init()
          Init the test. do setup stuff here
abstract  void insertNewArticles(PerfArticle[] arr)
          Store the given articles to database.
abstract  void insertNewArticlesStress(PerfArticle[] arr)
          Store the given articles to database.
 PerfArticle newPerfArticle()
          Called to get a new instance class of the PerfArticle interface, override this method if you need your own implementation (with default constructor) of the PerfArticle-Interface.
abstract  java.util.Collection readArticlesByCursor(java.lang.String articleName)
          Read all stored articles from the database and return the result as collection of PerfArticles.
 void run()
          Runnable implementation method.
abstract  void tearDown()
          Do clean up.
abstract  java.lang.String testName()
          Returns the name of the test
abstract  void updateArticles(PerfArticle[] arr)
          Update the given articles.
abstract  void updateArticlesStress(PerfArticle[] arr)
          Update the given articles.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerfTest

public PerfTest()
Method Detail

testName

public abstract java.lang.String testName()
Returns the name of the test


articleCount

public abstract int articleCount()
Returns the count of all found PerfArticle in database. This method is not involved in the performance test methods, thus it's not mandatory to use the api-methods for implementation.


init

public abstract void init()
                   throws java.lang.Exception
Init the test. do setup stuff here

Throws:
java.lang.Exception

tearDown

public abstract void tearDown()
                       throws java.lang.Exception
Do clean up.

Throws:
java.lang.Exception

insertNewArticles

public abstract void insertNewArticles(PerfArticle[] arr)
                                throws java.lang.Exception
Store the given articles to database. Do optimize performance.

Throws:
java.lang.Exception

insertNewArticlesStress

public abstract void insertNewArticlesStress(PerfArticle[] arr)
                                      throws java.lang.Exception
Store the given articles to database. Implement a really resource stressing way.

Throws:
java.lang.Exception

readArticlesByCursor

public abstract java.util.Collection readArticlesByCursor(java.lang.String articleName)
                                                   throws java.lang.Exception
Read all stored articles from the database and return the result as collection of PerfArticles. Do optimize performance.

Parameters:
articleName - article name used for all PerfArticle created by this instance/thread. Use this name in your query to match all belonging articles
Throws:
java.lang.Exception

getArticleByIdentity

public abstract PerfArticle getArticleByIdentity(java.lang.Long articleId)
                                          throws java.lang.Exception
Read all stored articles from the database and return the result as collection of PerfArticles. Do optimize performance.

Parameters:
articleId - the primary key of a PerfArticle instance
Returns:
The matching PerfArticle instance or null if not found.
Throws:
java.lang.Exception

deleteArticles

public abstract void deleteArticles(PerfArticle[] arr)
                             throws java.lang.Exception
Delete all given article from the database. Do optimize performance.

Throws:
java.lang.Exception

deleteArticlesStress

public abstract void deleteArticlesStress(PerfArticle[] arr)
                                   throws java.lang.Exception
Delete all given article from the database in a really resource sressing way.

Throws:
java.lang.Exception

updateArticles

public abstract void updateArticles(PerfArticle[] arr)
                             throws java.lang.Exception
Update the given articles. Do optimize performance.

Throws:
java.lang.Exception

updateArticlesStress

public abstract void updateArticlesStress(PerfArticle[] arr)
                                   throws java.lang.Exception
Update the given articles. Implement a really resource stressing way.

Throws:
java.lang.Exception

newPerfArticle

public PerfArticle newPerfArticle()
Called to get a new instance class of the PerfArticle interface, override this method if you need your own implementation (with default constructor) of the PerfArticle-Interface.
By default this method returns a new instance of the PerfArticleImpl class.


getTestObjectName

public java.lang.String getTestObjectName()
The returned name was used as 'articleName' for all created PerfArticles for this thread. This allows an easy build of the query statement to match the created PerfArticle for this instance/thread.


getPreparedPerfArticle

public PerfArticle getPreparedPerfArticle(java.lang.String articleName)
Factory method that creates an PerfArticle using the PerfArticleImpl class, override this method if you need your own implementation of the PerfArticle-Interface.

Parameters:
articleName - set the 'articleName'
Returns:
the created PerfArticle object

run

public void run()
Runnable implementation method.

Specified by:
run in interface java.lang.Runnable


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30