- We are using wildfly 8.2.0 Final along with Arquillian setup.
- We are writing Arquillian tests using transaction extension.
- We want to create the data using business methods using JPA code, and not using UnitDB(XML, JSON etc).
- We want the data created for the tests to be rolled back automatically without writing any code to manage the deletions
We found a critical issue when we were trying to create tests with the option @Transactional(TransactionMode.ROLLBACK) using the transaction extension.
It is quite common in our code to find some EJB methods marked with TransactionAttributeType.REQUIRES_NEW.
These methods may called by other EJB methods which may have other TransactionAttributeTypes.
So, Coming back to our test, If a EJB method to be tested in-turn calls another EJB method that’s marked with TransactionAttributeType.REQUIRES_NEW then the data created by this method is stored in the DB and is not rolled back at the end of the test.
It is similar to the issue described in this SO question: http://stackoverflow.com/questions/32348359/arquillian-and-transactionattributetype-requires-new
Do you have a recommendation to solve it? Or is it a known issue?