-
Mar 3rd, 2010, 08:08 PM
#1
Rolling back transactions when testing with embedded container
Hey folks,
My situation is this. The project I am building runs using an embedded Jetty container. I load Jetty and Spring and everything via a 'main' method that does some bootstrap stuff to configure everything properly. Once the main method kicks things off it works pretty much like a typical Spring app.
So my problem comes when I want to create an end to end Integration test. So for this test I fire off the 'main' and let it start the container then I throw some requests at it with HttpClient. What I want is to be able to roll back transactions that happen during this test run. I am using Spring to manage my Hibernate transactions via @Transactional.
I understand that Spring provides this kind of functionality when using the testing framework but the problem there is that I don't want my test to be 'ContextAware'. I want it to let my 'main' method do the loading of contexts and everything but still get some hold on the transaction manager to tell it to roll things back.
I hope that makes some sense.
Is this possible or do I just need to either clean up after myself or get used to test data?
Thanks!
Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules