Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-723

TransactionalWrapper.afterTest() ignores SessionContext.setRollbackOnly()

XMLWordPrintable

      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(); }

            bartosz-1 Bartosz Majsak
            juergen.zimmermann Juergen Zimmermann (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: