|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.opensubsystems.core.persist.db.DatabaseTest
org.opensubsystems.patterns.listdata.persist.db.ListDatabaseFactoryTest
public abstract class ListDatabaseFactoryTest
Base class for classes that test functionality of classes that implement ListDatabaseFactory interface and ListDatabaseFactoryImpl class. This class implements tests for all list related functionality provided by the mentioned interface. Once you derive your test from this class, just add test that tests the functionality you have implemented in your derived database factory class, the base class functionality will be tested automatically.
| Field Summary | |
|---|---|
static int |
DEFAULT_LOADTEST_LIST_SIZE
How many items to use for load testing. |
static int |
DEFAULT_LOADTEST_LOADTIME
What time to retrieve page should be considered too slow and will cause given test to fail? 4 sec to load one page of list is considered slow. |
static int |
DEFAULT_LOADTEST_PAGE_SIZE
What page size should be used for load testing. |
protected ListDatabaseTestUtils |
m_listTestUtils
Utility class to implement helper methods for list functionality. |
protected static int |
s_iLoadtestListSize
Value telling us list size for loadtests |
protected static int |
s_iLoadtestLoadTime
Value telling us predetermined time the data in the list should be retrieved in |
protected static int |
s_iLoadtestPageSize
Value telling us page size for loadtests |
| Fields inherited from class org.opensubsystems.core.persist.db.DatabaseTest |
|---|
DEFAULT_DB_PASSWORD, DEFAULT_DB_USER, DEFAULT_PROPERTY_FILE, m_connection, m_iRequestedConnectionCount, m_transaction |
| Constructor Summary | |
|---|---|
ListDatabaseFactoryTest(java.lang.String strTestName,
ListDatabaseTestUtils listTestUtils)
Constructor with data object specific parameters |
|
| Method Summary | |
|---|---|
protected long |
doLoadTestGet(java.lang.Object parent,
int iListSize,
int iPageSize,
int iBeginPos,
boolean bCountLastPageSize,
int[] arrColumns,
int iOrderColumn,
boolean bOrderDirectionAsc,
boolean bTestDataValues)
Helper method to test get method of ListFactory. |
protected void |
doTestGet(java.lang.Object parent,
int pageSize,
int beginPos,
int[] columns)
Helper method to test get(ListOptions) method of List using the modified default list options. |
protected void |
doTestGetColumns(int[] columns)
Helper method to test getColumns method of ListDatabaseSchema. |
protected void |
doTestLoadPagesFromFirstToLast(java.lang.Object parent,
java.lang.String strExtraText)
Load test for data performance. |
protected void |
doTestLoadPagesFromLastToFirst(java.lang.Object parent,
java.lang.String strExtraText,
int iOrderColumn,
boolean bOrderDirectionAsc,
boolean bTestDataValues)
Load test for data performance. |
protected void |
doTestLoadPagesRandom(java.lang.Object parent,
java.lang.String strExtraText)
Load test for data performance. |
protected void |
setUp()
Set up environment for the test case. |
protected void |
tearDown()
Restore original environment after the test case. |
void |
testGet()
Test of get(ListOptions) method of the ListFactory accessing data in database. |
void |
testGetColumns()
Test implementation of the getColumns method in the database schema. |
void |
testGetColumnsUsingId()
Some controllers needs to know the code for the ID column so they can operate properly. |
void |
testLoadPagesFromFirstToLast()
Test loading pages by browsing through the whole list page by page from the first to the last therefore retrieving every page of the list in sequential order. |
void |
testLoadPagesFromLastToFirst()
Test loading pages by browsing through the whole list page by page from the last to the first therefore retrieving every page of the list in sequential order and testing the retrieved data to make sure that we have retrieved the correct data. |
void |
testLoadPagesFromLastToFirstMoreSortableColumns()
Test loading pages by browsing through the whole list page by page from the last to the first therefore retrieving every page of the list in sequential order. |
void |
testLoadPagesRandom()
Test loading pages from the list by randomly selecting a page and then retrieving it. |
| Methods inherited from class org.opensubsystems.core.persist.db.DatabaseTest |
|---|
addDataSource, addDataSource, getDataSourceName, setDataSourceName |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_LOADTEST_LIST_SIZE
public static final int DEFAULT_LOADTEST_PAGE_SIZE
public static final int DEFAULT_LOADTEST_LOADTIME
protected ListDatabaseTestUtils m_listTestUtils
protected static int s_iLoadtestListSize
protected static int s_iLoadtestPageSize
protected static int s_iLoadtestLoadTime
| Constructor Detail |
|---|
public ListDatabaseFactoryTest(java.lang.String strTestName,
ListDatabaseTestUtils listTestUtils)
strTestName - - name of the testlistTestUtils - - utilities used during test| Method Detail |
|---|
protected void setUp()
throws java.lang.Exception
setUp in class org.opensubsystems.core.persist.db.DatabaseTestjava.lang.Exception - - an error has occured during setting up test
protected void tearDown()
throws java.lang.Exception
tearDown in class org.opensubsystems.core.persist.db.DatabaseTestjava.lang.Exception - - an error has occured during tearing down up test
public void testGetColumnsUsingId()
throws java.lang.Exception
java.lang.Exception - - an error has occured
public void testGetColumns()
throws java.lang.Exception
java.lang.Exception - - an error has occured
public void testGet()
throws java.lang.Exception
java.lang.Exception - - an error has occured during test
public void testLoadPagesFromFirstToLast()
throws java.lang.Exception
java.lang.Exception - - an error has occured
public void testLoadPagesFromLastToFirst()
throws java.lang.Exception
java.lang.Exception - - an error has occured
public void testLoadPagesFromLastToFirstMoreSortableColumns()
throws java.lang.Exception
java.lang.Exception - - an error has occured
public void testLoadPagesRandom()
throws java.lang.Exception
java.lang.Exception - - an error has occured
protected void doTestGetColumns(int[] columns)
throws org.opensubsystems.core.error.OSSException
columns - - columns to test
org.opensubsystems.core.error.OSSException - - an error has occured
protected void doTestGet(java.lang.Object parent,
int pageSize,
int beginPos,
int[] columns)
throws java.lang.Exception
parent - - parent object to which the items in the list belongs to
it can be null if those items do not have any parentpageSize - - how many items to retrieve at oncebeginPos - - what should be the first parameter retrievedcolumns - - columns to retrieve
java.lang.Exception - - an error has occured
protected long doLoadTestGet(java.lang.Object parent,
int iListSize,
int iPageSize,
int iBeginPos,
boolean bCountLastPageSize,
int[] arrColumns,
int iOrderColumn,
boolean bOrderDirectionAsc,
boolean bTestDataValues)
throws java.lang.Exception
parent - - parent object, to which items in the list should belong toiListSize - - the total list sizeiPageSize - - the page size to retrieveiBeginPos - - where to retrieve the pagebCountLastPageSize - - flag specifying if the retrieved page is the
last and its size needs to be computedarrColumns - - columns to retrieveiOrderColumn - - column code that will be used for sorting (in clause
order by). Use -1 if no sorting should be done.bOrderDirectionAsc - - true, if the list should be sorted in
ascending order
- false, if the list should be sorted in
descending orderbTestDataValues - - true, if the test will actually test the
retrieved values (1st and last record)
- false, if the test will not test the
retrieved values and just retrieve the data
java.lang.Exception - - an error has occured
protected void doTestLoadPagesFromFirstToLast(java.lang.Object parent,
java.lang.String strExtraText)
throws java.lang.Exception
parent - - parent object containing all data using which to execute
the teststrExtraText - - text to use in reporting of performance
java.lang.Exception - - an error has occured
protected void doTestLoadPagesFromLastToFirst(java.lang.Object parent,
java.lang.String strExtraText,
int iOrderColumn,
boolean bOrderDirectionAsc,
boolean bTestDataValues)
throws java.lang.Exception
parent - - parent object containing all data using which to execute
the teststrExtraText - - text to use in reporting of performanceiOrderColumn - - column code that will be used for sorting (in clause
order by)bOrderDirectionAsc - - true, if there will be used ASC direction
- false, if there will be used DESC directionbTestDataValues - - true, if there will be tested retrieved values
(1st and last record)
- false, if there will be not tested retrieved values
java.lang.Exception - - an error has occured during test
protected void doTestLoadPagesRandom(java.lang.Object parent,
java.lang.String strExtraText)
throws java.lang.Exception
parent - - parent object containing all data using which to execute
the teststrExtraText - - text to use in reporting of performance
java.lang.Exception - - an error has occured
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||