[arquillian-issues] [JBoss JIRA] (ARQ-723) TransactionalWrapper.afterTest() ignores SessionContext.setRollbackOnly()

Bartosz Majsak (Commented) (JIRA) jira-events at lists.jboss.org
Mon Jan 9 14:42:09 EST 2012


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

Bartosz Majsak commented on ARQ-723:
------------------------------------

Excellent! Thanks a lot for spotting this problem. Would you mind to file a pull request?

Cheers,
Bartosz
                
> TransactionalWrapper.afterTest() ignores SessionContext.setRollbackOnly()
> -------------------------------------------------------------------------
>
>                 Key: ARQ-723
>                 URL: https://issues.jboss.org/browse/ARQ-723
>             Project: Arquillian
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Extension - Persistence
>    Affects Versions: persistence_1.0.0.Alpha3
>            Reporter: Juergen Zimmermann
>            Assignee: Bartosz Majsak
>
> If a method is being tested that invokes SessionContext.setRollbackOnly(), then the commit mode doesn't work correctly, because doing a commit() after setRollbackOnly() will fail. Therefore, the method TransactionalWrapper.afterTest() should be implemented as follows:
> 	final TransactionMode mode = metadataProvider.get().getTransactionalMode();
> 	final UserTransaction trans = obtainTransaction();
> 	if (TransactionMode.COMMIT.equals(mode)) {
> 		if (Status.STATUS_MARKED_ROLLBACK.equals(trans.getStatus())) {
> 			trans.rollback();
> 		}
> 		else {
> 			trans.commit();
> 		}
> 	}
> 	else {
> 		trans.rollback();
> 	}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the arquillian-issues mailing list