Hi,

If I change the injection-of-entitymanager test code to be container-managed and require new transactions for ejb calls, the unit tests fail:

ex:

@Stateful(name = "Movies")
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class MoviesImpl implements Movies {
@PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.TRANSACTION)
 private EntityManager entityManager;

 ...


I'm pretty sure this is a valid case, but the operation's don't seem to be commiting on each call into the bean from the test code:

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.988 sec <<< FAILURE! test(org.superbiz.injection.jpa.MoviesTest) Time elapsed: 3.939 sec <<< FAILURE! junit.framework.AssertionFailedError: Movies.getMovies() expected:<0> but was:<3>
       at junit.framework.Assert.fail(Assert.java:47)
       at junit.framework.Assert.failNotEquals(Assert.java:277)
       at junit.framework.Assert.assertEquals(Assert.java:64)
       at junit.framework.Assert.assertEquals(Assert.java:195)
       at org.superbiz.injection.jpa.MoviesTest.test(MoviesTest.java:61)


Why is this so? Does some other configuration need to change to support this?

Thanks,
Kevin

Reply via email to