[arquillian-issues] [JBoss JIRA] (ARQ-1473) JUnit @Before and @After cause nested transaction

Bartosz Majsak (JIRA) jira-events at lists.jboss.org
Mon Oct 28 18:20:02 EDT 2013


    [ https://issues.jboss.org/browse/ARQ-1473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12825383#comment-12825383 ] 

Bartosz Majsak commented on ARQ-1473:
-------------------------------------

By looking at events invocation calls this is what happens with the current implementation
(E) Before
	(I) TestContextHandler.createSuiteContext
	(I) TestContextHandler.createClassContext
	(E) TestClass
	(I) TestContextHandler.createTestContext
	(I) ContainerEventController.createBeforeContext
	(O) TransactionHandler.startTransactionBeforeTest
----------------------------> Starting transactiontestInject1
	(E) BeforeTransactionStarted
	(E) OpenEJBRuntimeException
	(E) OpenEJBRuntimeException
(E) After
	(I) TestContextHandler.createSuiteContext
	(I) TestContextHandler.createClassContext
	(E) TestClass
	(I) TestContextHandler.createTestContext
	(I) ContainerEventController.createAfterContext
	(O) ClientBeforeAfterLifecycleEventExecuter.on
	(E) NullPointerException
	(E) NullPointerException

And end transaction is never called. Here's the [root cause of NPE|https://gist.github.com/bartoszmajsak/7205691] (most likely constraints on the data).

After changing precedence of the events (to have transactions start early enough) tests are green again. Side note: don't really like the idea of testing for EJBException but at least that shows us the problem :)

Fix on the way.
                
> JUnit @Before and @After cause nested transaction
> -------------------------------------------------
>
>                 Key: ARQ-1473
>                 URL: https://issues.jboss.org/browse/ARQ-1473
>             Project: Arquillian
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Extension - Transaction
>    Affects Versions: 1.0.0.Alpha3
>            Reporter: jieryn jieryn
>            Assignee: Bartosz Majsak
>            Priority: Minor
>
> @Before and @After methods on embedded containers cause a nested transaction, which are often not supported, leading to an exception.
> I confirmed this bug with aslak on IRC.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the arquillian-issues mailing list