|
|||||||||
| 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.osesb.utilities.junit.OSESBTestCase
org.osesb.utilities.junit.OSESBDBUnitTestCase
org.osesb.scheduledjobs.databasepoller.test.DatabasePollerTest
public class DatabasePollerTest
JUnit Tests for the org.osesb.scheduledjobs.databasepoller package.
Tests a database poller that is configured by the ScheduledJobConfiguration file specified by the 'testConfiguration' property Test.properties. Tests can be configured to run against different database applications using the</scheduled-job/job-configuration/database-poller-configuration/tableset-configuration/jdbc-configuration>
element in the ScheduledJobConfiguration file and the 'databasePollerTestDriverConfiguration'
property in Test.properties.
The target database application must be up and available for the tests to
run. The JDBCTEST test tables must be created in the target database application.
See org/osesb/utilities/jdbc/test/testdata for .sql files that create the
test database.
The test DatabasePollerConfiguration(s) in the example folders (example1, example2,...)
are configured to use the Customer table in the JDBC test database.
DatabasePollerTest uses a test driver, DatabasePollerTestDriver, which runs
in a Thread that periodically inserts a random number of rows into the
table(s) which are being scanned by the database poller. The update period
is a random interval between (1 times) and (5 times) the repeatInterval
that is configured for the database poller and the maximum number of rows
that are inserted during each run is given by MAX_ROWS_TO_INSERT.
DatabasePollerTestDriver is configured using the DataSetConfiguration file
specified in Test.properties. The DataSetConfiguration includes at least
a SQLStatement that is used to update the database table(s) configured for the
database poller that is being tested.
DatabasePollerTestDriver gets its database connection using the JDBCConfiguration that
is configured for the TableSet that the database poller uses. The SQL statement
configured for DatabasePollerTestDriver must update the databse table(s) configured
for the database poller that is being tested. The tester should make sure that the
DataSetConfiguration for DatabasePollerTestDriver is consistent with the
<jdbc-configuration> element in the ScheduledJobConfiguration file.
The test succeeds if the number of rows processed by the database poller is equal to
'the number of rows initially in the target table(s)' + 'the number of rows added by DatabasePollerTestDriver'.
The number of rows initially in the target table(s) is given by the 'initialNumberOfTestRows'
property in Test.properties.
| Field Summary | |
|---|---|
protected DatabasePollerTestDriver |
databasePollerTestDriver
The DatabasePollerTestDriver for the test. |
protected java.lang.Class |
databsePollerClass
The database poller class that is being tested. |
protected int |
initialNumberOfTestRows
The test succeeds if the number of rows processed by the database poller is equal to 'the number of rows initially in the target table(s)' + 'the number of rows added by DatabasePollerTestDriver'. |
protected int |
testMethodSleepTimeMultiplier
testMethodSleepTimeMultiplier, which determines how long a test is run. |
protected ScheduledJobConfiguration |
testScheduledJobConfiguration
The ScheduledJobConfiguration for the test. |
| Fields inherited from class org.osesb.utilities.junit.OSESBDBUnitTestCase |
|---|
dbunitDataSet, dbunitJDBCConnection |
| Fields inherited from class org.osesb.utilities.junit.OSESBTestCase |
|---|
configFile, log, reader, testDataDirectory, testProperties, thisClassName |
| Constructor Summary | |
|---|---|
DatabasePollerTest(java.lang.String name)
Construct a new instance. |
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
The main method runs all the tests in the text ui |
void |
setUp()
This method is called before a test is executed. |
static junit.framework.Test |
suite()
The suite method runs all the tests |
void |
tearDown()
This method is called after a test is executed. |
void |
testDatabasePollerAsQuartzJob()
Tests a database poller as a Quartz Job. |
void |
testDatabasePollerAsRunnableJob()
Tests a database poller as a Runnable Job. |
| Methods inherited from class org.osesb.utilities.junit.OSESBDBUnitTestCase |
|---|
displayStartupMessage, loadDBUnitDatabaseConnection |
| Methods inherited from class org.osesb.utilities.junit.OSESBTestCase |
|---|
getBooleanTestProperty, getIntTestProperty, getLongTestProperty, getTestResourcesAsStreams, getTestResourcesAsText, getTestResourcesFiles, loadTestProperties, readTestFilesAsStreams |
| 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, format |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ScheduledJobConfiguration testScheduledJobConfiguration
protected DatabasePollerTestDriver databasePollerTestDriver
protected java.lang.Class databsePollerClass
protected int testMethodSleepTimeMultiplier
protected int initialNumberOfTestRows
| Constructor Detail |
|---|
public DatabasePollerTest(java.lang.String name)
| Method Detail |
|---|
public static junit.framework.Test suite()
public void setUp()
throws java.lang.Exception
setUp in class OSESBTestCasejava.lang.Exception
public void tearDown()
throws java.lang.Exception
tearDown in class OSESBDBUnitTestCasejava.lang.Exceptionpublic static void main(java.lang.String[] args)
public void testDatabasePollerAsQuartzJob()
throws java.lang.Exception
java.lang.Exception
public void testDatabasePollerAsRunnableJob()
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||