I'm wondering what's the best way to replace the transaction manager when running a unit test for a transacted route ?
This is what I did, but can't help think there's a more simple way. 1. I had to specify a TransactionPolicy for my route 2. And then in my test class I used an @TestConfiguration where I created a mock transaction manager, grabbed a reference to my TransactionPolicy and used the setTransactionManager to replace with my mock tx manager. (Without that Camel complains there's more than one Tx managers. Couldn't figure out a way to replace the existing PlatformTransactionManager bean which IMO would have been the more straightfoward approach) My Mock Tx manager is an impl of AbstractPlatformTransactionManager where I put a log message for begin, commit or rollback. All though the tests run as expected, I only see the log message for "being". I don't see the log message for "commit" for the success case OR "rollback" for the failure case where an exception is thrown (all though the logs show that a rollback happened) I was expecting Camel to call commit or rollback methods of my Mock tx manager. -- Regards, Rajith Muditha Attapattu <http://rajith.2rlabs.com/>