Since Java does not allow multiple annotations of the same type for each element, you must find a different way to configure it. @TransactionConfiguration interpreted by TransactionalTestExecutionListener , getTransactionManager returns only one PlatformTransactionManager. He looks at @Transactional, but seems to ignore the value qualifier that was added in Seam 3.0.
@Transactional supports only one transaction manager. How is the application configured? You should use @Transactional("<qualifier>") (as in the docs ), right?
If you just use @Transactional with different tx managers using different methods, then the simplest solution is to simply split the test class.
Do you invest in transactions? That is, you have @Transactional ("tm1") using one method that calls the nested method that has @Transactional ("tm2")? It sounds a little unusual. You can try to set up your test in the same way - to have two test @Services, each of which contains the corresponding @Transactional annotations, which are proxied using tx: advice as usual. An external service installs an external txn; the internal service installs the internal txn and contains the actual test code. You cannot use @Rollback, but hey, hacks are not very.
Another option is to create your own PlatformTransactionManager, which delegates to two other managers (for testing only).
Perhaps it would be better to simply refuse and manually manage two transactions in the test @ Before / @ After methods.
It would be best to use JTA global transactions. I hope that you do not actually nest separate operations and all this is debatable;)
source share