org.opensubsystems.security.patterns.listdata.persist.db
Class SecureListDatabaseTestUtils

java.lang.Object
  extended by org.opensubsystems.patterns.listdata.persist.db.ListDatabaseTestUtils
      extended by org.opensubsystems.security.patterns.listdata.persist.db.SecureListDatabaseTestUtils
Direct Known Subclasses:
DomainListDatabaseTestUtils, InternalSessionListDatabaseTestUtils, RoleListDatabaseTestUtils, SessionViewListDatabaseTestUtils, UserListDatabaseTestUtils

public abstract class SecureListDatabaseTestUtils
extends org.opensubsystems.patterns.listdata.persist.db.ListDatabaseTestUtils

Class used by JUnit tests derived from SecureListDatabaseFactoryTest class. Each such class should derive its own class from this class and implement all required methods. The functionality provided by the implemented methods it used to execute the generic tests for list pattern functionality. The idea is that the derived class specifies how to constructs the in memory tested data objects using two specified string values (here called column one and column two) and then specifies how to insert them to the database and how to delete them from the database. Then the generic tests using these specific methods as well as other utility methods from this class test list pattern implementation and behavior of the tested data object.

Version:
$Id: SecureListDatabaseTestUtils.java,v 1.2 2007/01/28 06:54:52 bastafidli Exp $
Author:
Julo Legeny
Code reviewer:
Miro Halas
Code reviewed:
Initial revision

Field Summary
protected static int[] EXTRA_TEST_DATA_DISTRIBUTION
          How will be the extra data distributed between the extra domains.
protected static int EXTRA_TEST_DATA_MULTIPLIER
          How much more extra data should be inserted into additional domains to test both performance and correct functionality of list pattern in system with multiple domains.
protected static int UNIT_OF_INSERTION
          Name of the property containing value for number of insertion unit
 
Fields inherited from class org.opensubsystems.patterns.listdata.persist.db.ListDatabaseTestUtils
m_arrAllColumnCodes, m_clsListDatabaseSchemaClass, m_clsListFactoryClass, m_iColumnOneCode, m_iColumnTwoCode, NO_PARENT
 
Constructor Summary
SecureListDatabaseTestUtils(java.lang.Class clsListFactoryClass, java.lang.Class clsListDatabaseSchemaClass, int[] arrAllColumnCodes, int iColumnOneCode, int iColumnTwoCode)
          Constructor
 
Method Summary
protected  void deleteMultiDomainLoadTestData(javax.transaction.UserTransaction transaction, java.lang.Object[] insertedData)
          Delete all data inserted for the load tests using the insertMulti DomainLoadTestData method.
 java.lang.Object[] insertMultiDomainLoadTestData(javax.transaction.UserTransaction transaction, int iLoadTestListSize)
          Insert multiple domain data records for load tests.
 
Methods inherited from class org.opensubsystems.patterns.listdata.persist.db.ListDatabaseTestUtils
analyzeDatabase, constructData, createDataObject, createDataObjects, deleteData, deleteData, deleteDataObject, deleteDataObjects, deleteLoadTestData, deleteLoadTestData, deleteParent, deleteTestData, getAllColumnCodes, getColumnOneCode, getColumnOneValue, getColumnTwoCode, getColumnTwoValue, getDefaultListOptions, getDefaultResultListColumnTwo, getExpectedResultListColumnOne, getListDatabaseSchema, getListDatabaseSchemaClass, getListFactory, getListFactoryClass, insertData, insertLoadTestData, insertLoadTestData, insertMultipleData, insertParent, insertTestData, printDebug, printDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTRA_TEST_DATA_MULTIPLIER

protected static final int EXTRA_TEST_DATA_MULTIPLIER
How much more extra data should be inserted into additional domains to test both performance and correct functionality of list pattern in system with multiple domains. This number will be used as multiplier for the iLoadTestListSize variable.

See Also:
Constant Field Values

EXTRA_TEST_DATA_DISTRIBUTION

protected static final int[] EXTRA_TEST_DATA_DISTRIBUTION
How will be the extra data distributed between the extra domains. The first extra domain will get 60% of all extra data to have quite a sizable record set to manner. Then the rest of the data will be split into units, and number in this array will specify how many unit will each additional domain contain.


UNIT_OF_INSERTION

protected static final int UNIT_OF_INSERTION
Name of the property containing value for number of insertion unit

Constructor Detail

SecureListDatabaseTestUtils

public SecureListDatabaseTestUtils(java.lang.Class clsListFactoryClass,
                                   java.lang.Class clsListDatabaseSchemaClass,
                                   int[] arrAllColumnCodes,
                                   int iColumnOneCode,
                                   int iColumnTwoCode)
Constructor

Parameters:
clsListFactoryClass - - class representing database specific ListFactory interface implementation for the tested data object
arrAllColumnCodes - - array with codes for all columns that stores data for the tested data object
iColumnOneCode - - Code that represents column storing the first value used to generate the tested data object. It is assumed that this code is part of arrAllColumnCodes.
iColumnTwoCode - - Code that represents column storing the second value used to generate the tested data object. It is assumed that this code is part of arrAllColumnCodes.
Method Detail

insertMultiDomainLoadTestData

public final java.lang.Object[] insertMultiDomainLoadTestData(javax.transaction.UserTransaction transaction,
                                                              int iLoadTestListSize)
                                                       throws java.lang.Exception
Insert multiple domain data records for load tests. The data are inserted in given order so that we can test if they are retrieved correctly.

Parameters:
transaction - - transaction to use to insert data or null if no transaction should be used since the caller will control the transaction
iLoadTestListSize - - number of tested data objects to insert
Returns:
Object - index 0 - if this class supports parent then the returned object is the parent to which test data were inserted. If it doesn't support parents, then it is null. - index 1 - the load test data created by this method. The keys are the domains ids and values are the return values from the insertLoadTestData method.
Throws:
java.lang.Exception - - an error has occured

deleteMultiDomainLoadTestData

protected void deleteMultiDomainLoadTestData(javax.transaction.UserTransaction transaction,
                                             java.lang.Object[] insertedData)
                                      throws java.lang.Exception
Delete all data inserted for the load tests using the insertMulti DomainLoadTestData method.

Parameters:
transaction - - transaction to use to delete data or null if no transaction should be used since the caller will control the transaction
insertedData - - data inserted by the insertMultiDomainLoadTestData method that needs to be deleted
Throws:
java.lang.Exception - - an error has occured


Copyright © 2003 - 2006 OpenSubsystems s.r.o.