Thanks for this Jason - one step closer to a truly parameterised test
suite! Wahey!
On 4 Oct 2007, at 16:59, Jason T. Greene wrote:
Everyone,
I have added support for JBoss JTA standalone in Core Cache. To
enable it simply define transactionManagerLookupClass to be
"JBossStandalone JTAManagerLookup".
I have also modified our testsuite to support a pluggable TM. This
includes a new testing profile for JBossJTA. When adding future
tests that you would like to be included in this profile, make sure
you put them in the "transaction" group. This can be ran as follows:
mvn -Ptransaction-jbossjta
It is very important that all new tests be TM portable (I have
already fixed the existing ones). So, unless you are explictly
testing a specific TM, you should use the following techniques when
using transactions:
1. Configure the transaction manager using
TransactionSetup.getManagerLookup like so:
cache.getConfiguration().setTransactionManagerLookupClass
(TransactionSetup.getManagerLookup());
2. Obtain UserTransaction from TransactionSetup.getUserTransaction();
3. Obtain the transaction manager, if you need it, from the cache:
cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Alternatively, if there is no cache in your test, you can use
TransactionSetup:
TransactionSetup.getTransactionManager();
4. Always use TransactionManager.commit()/setRollbackOnly()/rollback
() where possible. Calling Transaction.commit() and
Transaction.rollback() does _not_ clear the Transaction associated
with the current thread. According to the spec future begin() calls
must fail, so if you do this it becomes your job to clear the
thread (using suspend). Alot of test code did not do this properly,
which was fine with DummyTransactionManager, but broke any spec
compliant TM.
-Jason
_______________________________________________
jbosscache-dev mailing list
jbosscache-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosscache-dev
--
Manik Surtani
Lead, JBoss Cache
JBoss, a division of Red Hat