Class jala.Test.DatabaseMgr
Object
|
+--jala.Test.DatabaseMgr
- class
jala.Test.DatabaseMgr
Instances of this class allow managing test databases
and switching a running application to an in-memory test
database to use within a unit test.
Defined in Global/jala.Test.js
Field Summary |
Object |
databases
Map containing all test databases |
Object |
dbSourceProperties
Map containing the original datasource
properties that were temporarily deactivated
by activating a test database |
Method Summary |
jala.db.RamDatabase
|
startDatabase(<String> dbSourceName, <Boolean> copyTables, <Array> tables)
Switches the application datasource with the given name
to a newly created in-memory database.
|
void
|
stopAll()
Stops all registered test databases and and reverts the application
to its original datasource(s) as defined in db.properties file.
|
Object
|
toString()
|
databases
Object databases
Map containing all test databases
dbSourceProperties
Object dbSourceProperties
Map containing the original datasource
properties that were temporarily deactivated
by activating a test database
jala.Test.DatabaseMgr
jala.Test.DatabaseMgr()
Returns a newly created DatabaseMgr instance
Returns:
A newly created instance of DatabaseMgr
startDatabase
jala.db.RamDatabase startDatabase(<String> dbSourceName, <Boolean> copyTables, <Array> tables)
Switches the application datasource with the given name
to a newly created in-memory database. In addition this method
also clears the application cache and invalidates the root
object to ensure that everything is re-retrieved from the
test database.
This method can be called with a second boolean argument indicating
that tables used by the application should be created in the in-memory
database (excluding any data).
Parameters:
dbSourceName
- The name of the application database source as defined in db.properties
copyTables
- If true this method also copies all tables in the source database to the test database (excluding indexes).
tables
- An optional array containing table names that should be created in the test database. If not specified this method collects all tables that are mapped in the application.
stopAll
void stopAll()
Stops all registered test databases and and reverts the application
to its original datasource(s) as defined in db.properties file.
In addition this method commits all pending changes within the request,
cleares the application cache and invalidates the root object
to ensure no traces of the test database are left behind.
toString
Object toString()
Documentation generated by
JSDoc on Tue Jan 8 15:50:17 2008