org.objectweb.cjdbc.scenario.tools.testlet
Class AbstractTestLet

java.lang.Object
  extended byTestCase
      extended byorg.objectweb.cjdbc.scenario.tools.testlet.AbstractTestLet
Direct Known Subclasses:
AbstractConnectionTestLet, AbstractVdbTestLet, CopyTestLet

public abstract class AbstractTestLet
extends TestCase

This class defines a AbstractTestLet. A testlet is meant to be a portion of testing. This should be included in a scenario based on a template.

Version:
1.0
Author:
Nicolas Modrzyk
See Also:
Serialized Form

Field Summary
static java.lang.String COLUMN_NAME
          COLUMN_NAME configuration parameter
protected  java.util.Hashtable config
           
static java.lang.String FILE_NAME
          FILE_NAME configuration parameter
static java.lang.String IGNORE_CASE
          IGNORE_CASE configuration parameter
private  long initialMemoryUsage
           
private  long initialTime
           
static java.lang.String ITERATION
          ITERATION configuration parameter
static java.lang.String LIST_FAILOVER_BACKENDS
          LIST_FAILOVER_BACKENDS configuration parameter
static java.lang.String MACRO_NAME
          MACRO_NAME configuration parameter
static java.lang.String NUMBER_OF_UPDATES
          NUMBER_OF_UPDATES configuration parameter
static java.lang.String PROCEDURE_NAME
          PROCEDURE_NAME configuration parameter
static java.lang.String SELECTED_COLUMNS
          SELECTED_COLUMNS configuration parameter
static java.lang.String TABLE_METADATA_COLUMNS
          TABLE_METADATA_COLUMNS configuration parameter
static java.lang.String TABLE_NAME
          TABLE_NAME configuration parameter
static java.lang.String UPDATED_COLUMN_VALUE
          UPDATED_COLUMN_VALUE configuration parameter
static java.lang.String USE_CJDBC_CLASS
          USE_CJDBC_CLASS configuration parameter
static java.lang.String USE_OPTIMIZED_STATEMENT
          USE_OPTIMIZED_STATEMENT configuration parameter
static java.lang.String USE_PREPARED_STATEMENT
          USE_PREPARED_STATEMENT configuration parameter
static java.lang.String USE_TRANSACTIONS
          USE_TRANSACTIONS configuration parameter
static java.lang.String USE_UPDATE_STATEMENT
          USE_UPDATE_STATEMENT configuration parameter
static java.lang.String VIRTUAL_DATABASE
          VIRTUAL_DATABASE configuration parameter
 
Constructor Summary
AbstractTestLet()
          Creates a new AbstractTestLet object
 
Method Summary
 long checkMemoryUsage()
          Collect the current memory usage
 void configure(java.util.Hashtable properties)
          Configure the test with new values.
abstract  void execute()
          Execute the content of the test.
 void executeBatch(int numberOfTimes)
          Execute the same let with the same parameters a couple of times
 void executeBatch(java.lang.String batchCategory, java.lang.Object[] batchValues)
          This calls the execute method multiple times.
 java.util.Hashtable getConfig()
          Get the current test configuration
 boolean getConfigBoolean(java.lang.String key)
          get the boolean value of a configuration value
 long getInitialMemoryUsage()
          Returns the initialMemoryUsage value.
 long getTotalMemoryUsage()
          Gather the total memory usage since the let was instanciated
 long getTotalTimeUsage()
          Get the total time usage in seconds
 boolean ignoreCase()
          Should we ignore case related problems in this let
 void set(java.lang.String key, java.lang.Object value)
          Sets a single test parameter
 void setConfig(java.util.Hashtable config)
          Sets the hashtable of properties for this test
 boolean useCJDBCClass()
          Should we use CJDBC class while we can use generic ones in this let This is useful for blobs and clobs
 boolean usePreparedStatement()
          Shortcut to know if we should use prepare statement in this let
 boolean useTransaction()
          Should we use transactions in this let
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_NAME

public static final java.lang.String TABLE_NAME
TABLE_NAME configuration parameter

See Also:
Constant Field Values

COLUMN_NAME

public static final java.lang.String COLUMN_NAME
COLUMN_NAME configuration parameter

See Also:
Constant Field Values

UPDATED_COLUMN_VALUE

public static final java.lang.String UPDATED_COLUMN_VALUE
UPDATED_COLUMN_VALUE configuration parameter

See Also:
Constant Field Values

SELECTED_COLUMNS

public static final java.lang.String SELECTED_COLUMNS
SELECTED_COLUMNS configuration parameter

See Also:
Constant Field Values

USE_PREPARED_STATEMENT

public static final java.lang.String USE_PREPARED_STATEMENT
USE_PREPARED_STATEMENT configuration parameter

See Also:
Constant Field Values

VIRTUAL_DATABASE

public static final java.lang.String VIRTUAL_DATABASE
VIRTUAL_DATABASE configuration parameter

See Also:
Constant Field Values

IGNORE_CASE

public static final java.lang.String IGNORE_CASE
IGNORE_CASE configuration parameter

See Also:
Constant Field Values

TABLE_METADATA_COLUMNS

public static final java.lang.String TABLE_METADATA_COLUMNS
TABLE_METADATA_COLUMNS configuration parameter

See Also:
Constant Field Values

USE_TRANSACTIONS

public static final java.lang.String USE_TRANSACTIONS
USE_TRANSACTIONS configuration parameter

See Also:
Constant Field Values

USE_CJDBC_CLASS

public static final java.lang.String USE_CJDBC_CLASS
USE_CJDBC_CLASS configuration parameter

See Also:
Constant Field Values

FILE_NAME

public static final java.lang.String FILE_NAME
FILE_NAME configuration parameter

See Also:
Constant Field Values

LIST_FAILOVER_BACKENDS

public static final java.lang.String LIST_FAILOVER_BACKENDS
LIST_FAILOVER_BACKENDS configuration parameter

See Also:
Constant Field Values

ITERATION

public static final java.lang.String ITERATION
ITERATION configuration parameter

See Also:
Constant Field Values

PROCEDURE_NAME

public static final java.lang.String PROCEDURE_NAME
PROCEDURE_NAME configuration parameter

See Also:
Constant Field Values

USE_UPDATE_STATEMENT

public static final java.lang.String USE_UPDATE_STATEMENT
USE_UPDATE_STATEMENT configuration parameter

See Also:
Constant Field Values

NUMBER_OF_UPDATES

public static final java.lang.String NUMBER_OF_UPDATES
NUMBER_OF_UPDATES configuration parameter

See Also:
Constant Field Values

USE_OPTIMIZED_STATEMENT

public static final java.lang.String USE_OPTIMIZED_STATEMENT
USE_OPTIMIZED_STATEMENT configuration parameter

See Also:
Constant Field Values

MACRO_NAME

public static final java.lang.String MACRO_NAME
MACRO_NAME configuration parameter

See Also:
Constant Field Values

config

protected java.util.Hashtable config

initialMemoryUsage

private long initialMemoryUsage

initialTime

private long initialTime
Constructor Detail

AbstractTestLet

public AbstractTestLet()
Creates a new AbstractTestLet object

Method Detail

execute

public abstract void execute()
                      throws java.lang.Exception
Execute the content of the test. This method can call JUnit's assert methods and can therefore validate or invalidate the whole test.

Throws:
java.lang.Exception - if fails

checkMemoryUsage

public long checkMemoryUsage()
Collect the current memory usage

Returns:
a value in Kilobytes

executeBatch

public void executeBatch(java.lang.String batchCategory,
                         java.lang.Object[] batchValues)
                  throws java.lang.Exception
This calls the execute method multiple times. The batch method is limited to change values on a single entry of the configuration of this testlet.

Parameters:
batchCategory - the configuration value description to change
batchValues - the different value the parameter will take
Throws:
java.lang.Exception - if any fail

executeBatch

public void executeBatch(int numberOfTimes)
                  throws java.lang.Exception
Execute the same let with the same parameters a couple of times

Parameters:
numberOfTimes - the number of times to repeat the test
Throws:
java.lang.Exception

configure

public void configure(java.util.Hashtable properties)
               throws java.lang.Exception
Configure the test with new values. The values are specific to each test let. If this method is not called before execute, the test will use predefined test properties

Parameters:
properties - set of properties to use for this test
Throws:
java.lang.Exception - if fails

getConfigBoolean

public boolean getConfigBoolean(java.lang.String key)
get the boolean value of a configuration value

Parameters:
key - key name of the value
Returns:
boolean primitive type

getConfig

public java.util.Hashtable getConfig()
Get the current test configuration

Returns:
Hashtable with all the defined properties

setConfig

public void setConfig(java.util.Hashtable config)
Sets the hashtable of properties for this test

Parameters:
config - Hashtable with all the defined properties

set

public void set(java.lang.String key,
                java.lang.Object value)
Sets a single test parameter

Parameters:
key - the key to define
value - the value of the key

usePreparedStatement

public boolean usePreparedStatement()
Shortcut to know if we should use prepare statement in this let

Returns:
true or false

ignoreCase

public boolean ignoreCase()
Should we ignore case related problems in this let

Returns:
true or false

useTransaction

public boolean useTransaction()
Should we use transactions in this let

Returns:
true or false

useCJDBCClass

public boolean useCJDBCClass()
Should we use CJDBC class while we can use generic ones in this let This is useful for blobs and clobs

Returns:
true or false

getInitialMemoryUsage

public long getInitialMemoryUsage()
Returns the initialMemoryUsage value.

Returns:
Returns the initialMemoryUsage.

getTotalMemoryUsage

public long getTotalMemoryUsage()
Gather the total memory usage since the let was instanciated

Returns:
a long value of kilobytes of memory used

getTotalTimeUsage

public long getTotalTimeUsage()
Get the total time usage in seconds

Returns:
a long value of seconds


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.