-
1. Re: Using Envers in transactional Unit Tests
adamw Feb 26, 2010 12:20 PM (in response to flexpert)I normally use a test database for my tests (e.g. an in-memory H2 or sth like that) so I don't use the rollback approach, so I guess I won't be much of a help here.
Considering the way you are doing the tests I don't see any other option than calling the AuditSync explicitly. You could also create your own transaction synchronization, register it before the audit sync (so right a the beginning of the TX), and test/rollback there, but that's essentially the same as your solution. However you won't be able to test more than one revision that way, as it's one revision per transaction
Adam
-
2. Re: Using Envers in transactional Unit Tests
jheintz Mar 23, 2010 11:26 AM (in response to adamw)Dirk, Adam,
How would I go about getting an instance of AuditSync in the unit tests?
The org.hibernate.event.EventSource seems like the most challenging part to get a hold of in the unit test method...
Thanks,
John
-
3. Re: Using Envers in transactional Unit Tests
adamw Mar 24, 2010 4:56 PM (in response to jheintz)Why would you want an AuditSync in unit test?