コード例 #1
0
 public void testCommitAbortedWithNonRetryableCause() throws Exception {
   Exception abortCause = new IllegalArgumentException();
   txn.abort(abortCause);
   try {
     handle.commit();
     fail("Expected TransactionNotActiveException");
   } catch (TransactionNotActiveException e) {
     System.err.println(e);
     assertFalse(retryable(e));
     assertEquals(abortCause, e.getCause());
   }
   assertAborted(abortCause);
 }
コード例 #2
0
 public void testAbortAbortedWithRetryableCause() throws Exception {
   Exception abortCause = new TransactionAbortedException("Aborted");
   txn.abort(abortCause);
   try {
     txn.abort(new IllegalArgumentException());
     fail("Expected TransactionNotActiveException");
   } catch (TransactionNotActiveException e) {
     System.err.println(e);
     assertTrue(retryable(e));
     assertEquals(abortCause, e.getCause());
   }
   assertAborted(abortCause);
 }
コード例 #3
0
 public void testJoinAbortedWithNonRetryableCause() throws Exception {
   DummyTransactionParticipant participant = new DummyTransactionParticipant();
   Exception abortCause = new IllegalArgumentException();
   txn.abort(abortCause);
   try {
     txn.join(participant);
     fail("Expected TransactionNotActiveException");
   } catch (TransactionNotActiveException e) {
     System.err.println(e);
     assertFalse(retryable(e));
     assertEquals(abortCause, e.getCause());
   }
   assertAborted(abortCause);
 }
コード例 #4
0
 public void testAbortSupplyCause() throws Exception {
   Exception abortCause = new Exception("The cause");
   txn.abort(abortCause);
   assertAborted(abortCause);
   try {
     txn.abort(new IllegalArgumentException());
     fail("Expected TransactionNotActiveException");
   } catch (TransactionNotActiveException e) {
     System.err.println(e);
     assertEquals(abortCause, e.getCause());
   }
   assertAborted(abortCause);
   try {
     txn.abort(abortXcp);
     fail("Expected TransactionNotActiveException");
   } catch (TransactionNotActiveException e) {
     System.err.println(e);
     assertEquals(abortCause, e.getCause());
   }
   assertAborted(abortCause);
   handle.getTransaction();
   try {
     handle.commit();
     fail("Expected TransactionNotActiveException");
   } catch (TransactionNotActiveException e) {
     System.err.println(e);
     assertEquals(abortCause, e.getCause());
   }
   assertAborted(abortCause);
 }