org.alfresco.repo.transaction
Class RetryingTransactionHelperTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.alfresco.repo.transaction.RetryingTransactionHelperTest
All Implemented Interfaces:
junit.framework.Test

public class RetryingTransactionHelperTest
extends junit.framework.TestCase

Tests the transaction retrying behaviour with various failure modes.

Since:
2.1
See Also:
RetryingTransactionHelper, TransactionService

Constructor Summary
RetryingTransactionHelperTest()
           
 
Method Summary
 void setUp()
           
 void tearDown()
           
 void testConcurrencyRetryingNoFailure()
           
 void testLostConnectionRecovery()
           
 void testNestedWithoutPropogation()
          Checks nesting of two transactions with requiresNew == true
 void testNestedWithoutPropogationConcurrentUntilFailureMySQL()
          Checks nesting of two transactions with requiresNew == true, but where the two transactions get involved in a concurrency struggle.
 void testNestedWithPropogation()
          Checks nesting of two transactions with requiresNew == false
 void testNonRetryingFailure()
          Checks that a non-retrying exception is passed out and that the transaction is rolled back.
 void testNonRetryingSilentRollback()
          Sometimes, exceptions or other states may cause the transaction to be marked for rollback without an exception being generated.
 void testSetUp()
           
 void testSuccessNoRetry()
          Check that it works without complications.
 void testSuccessWithRetry()
          Check that the retries happening for simple concurrency exceptions
 void testTimeLimit()
           
 void testUserTransactionStatus()
          Check that the transaction state can be fetched in and around the transaction.
 void testZeroAndNegativeRetries()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RetryingTransactionHelperTest

public RetryingTransactionHelperTest()
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

testSetUp

public void testSetUp()
               throws java.lang.Exception
Throws:
java.lang.Exception

testSuccessNoRetry

public void testSuccessNoRetry()
Check that it works without complications.


testUserTransactionStatus

public void testUserTransactionStatus()
Check that the transaction state can be fetched in and around the transaction. This also checks that any mischievous attempts to manipulate the transaction (other than setRollback) are detected.


testSuccessWithRetry

public void testSuccessWithRetry()
Check that the retries happening for simple concurrency exceptions


testNonRetryingFailure

public void testNonRetryingFailure()
Checks that a non-retrying exception is passed out and that the transaction is rolled back.


testNonRetryingSilentRollback

public void testNonRetryingSilentRollback()
Sometimes, exceptions or other states may cause the transaction to be marked for rollback without an exception being generated. This tests that the exception stays absorbed and that another isn't generated, but that the transaction was rolled back properly.


testNestedWithPropogation

public void testNestedWithPropogation()
Checks nesting of two transactions with requiresNew == false


testNestedWithoutPropogation

public void testNestedWithoutPropogation()
Checks nesting of two transactions with requiresNew == true


testNestedWithoutPropogationConcurrentUntilFailureMySQL

public void testNestedWithoutPropogationConcurrentUntilFailureMySQL()
                                                             throws java.lang.InterruptedException
Checks nesting of two transactions with requiresNew == true, but where the two transactions get involved in a concurrency struggle. Note: skip test for non-MySQL

Throws:
java.lang.InterruptedException

testConcurrencyRetryingNoFailure

public void testConcurrencyRetryingNoFailure()
                                      throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

testLostConnectionRecovery

public void testLostConnectionRecovery()

testZeroAndNegativeRetries

public void testZeroAndNegativeRetries()

testTimeLimit

public void testTimeLimit()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.