コード例 #1
0
ファイル: ClientEjb.java プロジェクト: Chaohua/wildfly
 public void testRollbackOnly() throws RemoteException, SystemException, NotSupportedException {
   final IIOPTransactionalStatefulRemote remote = statefulHome.create();
   userTransaction.begin();
   try {
     Assert.assertEquals(Status.STATUS_ACTIVE, remote.transactionStatus());
     remote.rollbackOnly();
     Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, remote.transactionStatus());
   } finally {
     userTransaction.rollback();
   }
   Assert.assertFalse(remote.isBeforeCompletion());
   Assert.assertFalse(remote.getCommitSucceeded());
 }
コード例 #2
0
ファイル: ClientEjb.java プロジェクト: Chaohua/wildfly
 public void testRollbackOnlyBeforeCompletion()
     throws RemoteException, SystemException, NotSupportedException, HeuristicRollbackException,
         HeuristicMixedException {
   final IIOPTransactionalStatefulRemote remote = statefulHome.create();
   userTransaction.begin();
   try {
     Assert.assertEquals(Status.STATUS_ACTIVE, remote.transactionStatus());
     remote.setRollbackOnlyBeforeCompletion(true);
     userTransaction.commit();
   } catch (RollbackException expected) {
   }
   Assert.assertFalse(remote.getCommitSucceeded());
   Assert.assertEquals(Status.STATUS_NO_TRANSACTION, remote.transactionStatus());
 }