How to rollback two different sessions?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to rollback two different sessions?

David Balažic
Hi!

I have a test case, where I prepare the data base using one username
and then do the test with another.
I use Spring v3.0.5 with JUnit 4.8.2 and dbunit 2.4.8

A @TestExecutionListeners is defined, that extends the Spring
TransactionalTestExecutionListener interface and inits the DB in the
beforeTestMethod() using dbunit.

I there a way clean up the databse after each test to be as before the test?

So:
 - original state
test setup
 - changed state
test
 - optionally more changes to db
cleanup
 - again the original state

Can a transaction be set up to encompass both sessions?
Or is this better asked on Springs forum?

Regards,
David

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: How to rollback two different sessions?

André VICENTE
I use Spring, DBUnit and TestNG.

Generally I setup the data using DBUnit and @BeforeClass.
Execute the Tests and cleanup to original state using @AfterClass.
To use BeforeClass and AfterClass with non-static method and variables I used TestNG.

On Tue, May 24, 2011 at 10:52 AM, David Balažic <[hidden email]> wrote:
Hi!

I have a test case, where I prepare the data base using one username
and then do the test with another.
I use Spring v3.0.5 with JUnit 4.8.2 and dbunit 2.4.8

A @TestExecutionListeners is defined, that extends the Spring
TransactionalTestExecutionListener interface and inits the DB in the
beforeTestMethod() using dbunit.

I there a way clean up the databse after each test to be as before the test?

So:
 - original state
test setup
 - changed state
test
 - optionally more changes to db
cleanup
 - again the original state

Can a transaction be set up to encompass both sessions?
Or is this better asked on Springs forum?

Regards,
David

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user


------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user