ALF-4227 - MSSQLServer: fix hang on RetryingTransactionHelperTest (no lock wait timeout)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21608 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2010-08-04 15:33:28 +00:00
parent 3266debfea
commit fa4940d078

View File

@@ -27,6 +27,7 @@ import junit.framework.TestCase;
import org.alfresco.error.ExceptionStackUtil; import org.alfresco.error.ExceptionStackUtil;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.domain.hibernate.dialect.AlfrescoSQLServerDialect;
import org.alfresco.repo.security.authentication.AuthenticationComponent; import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState; import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
@@ -374,17 +375,20 @@ public class RetryingTransactionHelperTest extends TestCase
* Checks nesting of two transactions with <code>requiresNew == true</code>, * Checks nesting of two transactions with <code>requiresNew == true</code>,
* but where the two transactions get involved in a concurrency struggle. * but where the two transactions get involved in a concurrency struggle.
* *
* Note: skip test for PostgreSQL * Note: skip test for PostgreSQL and MS SQL Server
*/ */
public void testNestedWithoutPropogationConcurrentUntilFailureNotPostgreSQL() throws InterruptedException public void testNestedWithoutPropogationConcurrentUntilFailureNotPostgreSQLOrMSSQL() throws InterruptedException
{ {
final RetryingTransactionHelper txnHelperForTest = transactionService.getRetryingTransactionHelper(); final RetryingTransactionHelper txnHelperForTest = transactionService.getRetryingTransactionHelper();
txnHelperForTest.setMaxRetries(1); txnHelperForTest.setMaxRetries(1);
if (dialect instanceof PostgreSQLDialect) if ((dialect instanceof PostgreSQLDialect) || (dialect instanceof AlfrescoSQLServerDialect))
{ {
// NOOP - skip test for PostgreSQL since it does not support lock wait timeout hence will hang if concurrently "nested" (in terms of Spring) since the initial transaction does not complete // NOOP
// skip test for PostgreSQL and MS SQL Server to avoid hang if concurrently "nested" (in terms of Spring) since the initial transaction does not complete
// see testConcurrencyRetryingNoFailure instead // see testConcurrencyRetryingNoFailure instead
// Note: PostgreSQL does not support lock timeout
// Note: MS SQL Server does not support lock wait timeout by default (will wait forever) unless it is overridden on each connection ("set lock_timout")
} }
else else
{ {