On 5/23/07, GojiraDeMonstah <[EMAIL PROTECTED]> wrote:
Hi All, I've got an AppFuse 1.9.4-based project, and I'm writing some DAO tests that extend BaseDaoTestCase. In a couple of tests I want the transaction to not roll back. According to the Spring docs (and this thread), one way to do that is call setDefaultRollback(false) in the test class' constructor. I've done this, and now when I run ant test-dao -Dtestcase=FooDao I see that the message changes from: [junit] [Foo] INFO [main] FooDaoTest.endTransaction(275) | Rolled back transaction after test execution to [junit] [Foo] INFO [main] FooDaoTest.endTransaction(275) | Committed transaction after test execution So far so good. However the data is unchanged in the database. I added setComplete() to the methods in my test as well with the same results. In another non-Appfuse project I have that also has DAO tests that extend AbstractTransactionalDataSourceSpringContextTests, calling setDefaultRollback(false) definitely causes the transactions to commit, and I can see the changes in the database. (In those DAOs it isn't necessary to add setComplete() to the methods, simply setting defaultRollback to false does the trick.) I don't see anything special in Appfuse that should cause it to behave differently. Is there something I'm missing?
There's nothing I know of that's different, unless it's DbUnit repopulating the database after tests run. Matt
Thanks for any insight. -- View this message in context: http://www.nabble.com/Commiting-transaction-in-dao-testcase-tf1158283s2369.html#a10772974 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- http://raibledesigns.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
