Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)

71628: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud)
      71467: Merged V4.1-BUG-FIX (4.1.9) to V4.2-BUG-FIX (4.2.3)
         71466: MNT-9899 : Change default value for db.pool.max to 275
         Fixed the test hanging if db.pool.wait.max=-1 and disabled the test as it is not necessary until valid configuration is discovered.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74711 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Will Abson
2014-06-25 15:33:19 +00:00
parent af2f93dc17
commit bfc837b9d7
2 changed files with 22 additions and 6 deletions

View File

@@ -376,7 +376,7 @@ public class Repository01TestSuite extends TestSuite
suite.addTestSuite(org.alfresco.repo.transaction.RetryingTransactionHelperTest.class);
suite.addTestSuite(org.alfresco.repo.transaction.TransactionAwareSingletonTest.class);
suite.addTestSuite(org.alfresco.repo.transaction.TransactionServiceImplTest.class);
suite.addTestSuite(org.alfresco.repo.transaction.ConnectionPoolOverloadTest.class);
suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.transaction.ConnectionPoolOverloadTest.class));
suite.addTestSuite(org.alfresco.repo.transfer.NodeCrawlerTest.class);
suite.addTestSuite(org.alfresco.repo.transfer.RepoTransferReceiverImplTest.class);
suite.addTestSuite(org.alfresco.repo.transfer.TransferServiceCallbackTest.class);

View File

@@ -18,6 +18,8 @@
*/
package org.alfresco.repo.transaction;
import static org.junit.Assert.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
@@ -31,13 +33,13 @@ import org.alfresco.util.transaction.ConnectionPoolException;
import org.apache.commons.lang.mutable.MutableInt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import com.sun.star.auth.InvalidArgumentException;
import junit.framework.TestCase;
/**
* A test designed to catch ConnectionPoolException
*
@@ -45,7 +47,7 @@ import junit.framework.TestCase;
* @since 4.1.9
*/
public class ConnectionPoolOverloadTest extends TestCase
public class ConnectionPoolOverloadTest
{
private static Log logger = LogFactory.getLog(ConnectionPoolOverloadTest.class);
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
@@ -56,8 +58,9 @@ public class ConnectionPoolOverloadTest extends TestCase
private Properties properties;
private int dbPoolMax;
private int dbPoolWaitMax;
@Override
@Before
public void setUp() throws Exception
{
failCount = new MutableInt(0);
@@ -73,9 +76,22 @@ public class ConnectionPoolOverloadTest extends TestCase
{
throw new InvalidArgumentException("The db.pool.max property is not valid.");
}
String dbPoolWaitMaxProp = properties.getProperty("db.pool.wait.max");
if (PropertyCheck.isValidPropertyString(dbPoolWaitMaxProp))
{
dbPoolWaitMax = Integer.parseInt(dbPoolWaitMaxProp);
}
else
{
throw new InvalidArgumentException("The db.pool.wait.max property is not valid.");
}
dbPoolWaitMax = dbPoolWaitMax == -1 ? 100 : dbPoolWaitMax;
}
@Test
@Ignore("The test will fail if db.pool.wait.max=-1 as all the threads will successfully open the transactions.")
public void testOverload() throws Exception
{
List<Thread> threads = new LinkedList<Thread>();
@@ -100,7 +116,7 @@ public class ConnectionPoolOverloadTest extends TestCase
{
try
{
thread.join();
thread.join(dbPoolWaitMax);
}
catch (Exception e)
{