Re: Rollback transactions in unit testing

2008-10-09 Thread David Blevins
On Sep 29, 2008, at 8:39 AM, Glauber Ferreira wrote: Hi all. I need to rollback transactions in order to revert all data modified (deleted, updated, created) by my tests. How can I do that in the test code listed in this link: http://openejb.apache.org/3.0/unit-testing-transactions.html

RE: Rollback transactions in unit testing

2008-10-02 Thread Marcin Kwapisz
Marcin, the strategy you suggest should also work and is especially good for prototyping or smaller projects. In our case where we have a huge application with (1.5 Mio LoC, 1000 EJBs, 100 database tables with complex relationships) we cannot drop (or empty) and create tables in junit

RE: Rollback transactions in unit testing

2008-09-30 Thread Marcin Kwapisz
[Marcin Kwapisz] I do not understand why you want to rollback committed transaction, especially in unit test. Even, I do not know how to do it in JEE application. Maybe our way will suit you: 1. set drop and create strategy in persistence.xml (property name depends on JPA provider, we have

RE: Rollback transactions in unit testing

2008-09-30 Thread Andreas Karalus
Marcin, the strategy you suggest should also work and is especially good for prototyping or smaller projects. In our case where we have a huge application with (1.5 Mio LoC, 1000 EJBs, 100 database tables with complex relationships) we cannot drop (or empty) and create tables in junit tests.

Re: Rollback transactions in unit testing

2008-09-29 Thread Andreas Karalus
We are also using openejb for junit testing. In our tests we are using UserTransaction to control the test data. Maybe this approach might also work for you. Below is the basic code, the startup and shutdown of the container, as well as starting/stopping transaction could also be moved to a