Hi All,
While I play with EPT(entity-persistence-tests), I found some ways to
enhance it and I did some job.
Please review my below enhancements with attached patch.
* Run test with another DB properties without rebuilding
Database properties are separated from build.properties and stored in
test.properties file.
We can modify the test.properties file directly or use another properties
file by -Dtest.properties option for ant.
This makes really easy to run test on different databases.
For example if we would like to run test with another database properties,
do as follows:
$ ant -Dtest.properties=derby.properties test //test on Derby
$ ant -Dtest.properties=oracle.properties test //test on Oracle
To make this possible the properties file is read from testing
framework(JUnitTestCase) in runtime and they override the properties which
is passed to creatEntityManagerFactory(pu, properties).
So we don't need to put these properties in persistence.xml files and
replace it in build time, it is done now in runtime. "ant build" is not any
more dependent on properties file, so it doesn't need to rebuild for another
database properties.
I put derby database properties in test.properties for default
configuration.
This makes beginners quick to run test out of the box with bundled JavaDB.
* Run a single test class
To run a single test class, -Dtest.class option can be used.
For example,
$ ant -
Dtest.class=oracle.toplink.essentials.testing.tests.ejb.ejbqltesting.JUnitEJBQLDateTimeTestSuitetest
* Log level without modifying persistence.xml files
test.properties file can contain toplink.logging.level property and this
will override the persistence.xml property.
This is handy in debugging case.
The junit ant task in build.xml now contains maxmemory="256m" because it
threw OutOfMemoryError if log level is FINEST.
I think that this patch is useful for others as well as for me. What do you
think?
Regards,
-Wonseok