Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

94232: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud)
      94116: MNT-13089 Reinstate the tests that had been disabled on SQLServer, before we understood the problem was with transaction isolation
      Reverted following commits:
         93292: Disabled org.alfresco.repo.admin.RepoAdminServiceImplTest#testConcurrentDynamicModelCreate in case of SQL Server
         93342: Disabled org.alfresco.repo.admin.RepoAdminServiceImplTest#testConcurrentDynamicModelDelete in case of MS SQl Server.
         93522: Disabled org.alfresco.repo.node.archive.ArchiveAndRestoreTest#testInTransactionRestore and org.alfresco.repo.node.archive.ArchiveAndRestoreTest#testInTransactionPurge in case of MS SQL Server.
         93680: Disabled org.alfresco.repo.rendition.RenditionServiceIntegrationTest.testCompositeReformatAndResizeRendition in case of SQL Server
         93772: Disabled for MS SQL Server AuthenticationTest.testLoginNotExistingTenant, RenditionServiceIntegrationTest.testALF3733, RenditionServiceIntegrationTest.testJavascriptAPI.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@95059 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 15:35:56 +00:00
parent 1811553da1
commit 3929596255
5 changed files with 91 additions and 140 deletions

View File

@@ -53,7 +53,6 @@ import org.alfresco.test_category.OwnJVMTestsCategory;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.hibernate.dialect.*;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@@ -76,8 +75,7 @@ public class RepoAdminServiceImplTest extends TestCase
private ContentService contentService; private ContentService contentService;
private SearchService searchService; private SearchService searchService;
private NamespaceService namespaceService; private NamespaceService namespaceService;
private Dialect dialect;
final String modelPrefix = "model-"; final String modelPrefix = "model-";
final static String MKR = "{MKR}"; final static String MKR = "{MKR}";
@@ -119,7 +117,7 @@ public class RepoAdminServiceImplTest extends TestCase
protected void setUp() throws Exception protected void setUp() throws Exception
{ {
super.setUp(); super.setUp();
dialect = (Dialect) ctx.getBean("dialect");
repoAdminService = (RepoAdminService) ctx.getBean("RepoAdminService"); repoAdminService = (RepoAdminService) ctx.getBean("RepoAdminService");
dictionaryService = (DictionaryService) ctx.getBean("DictionaryService"); dictionaryService = (DictionaryService) ctx.getBean("DictionaryService");
transactionService = (TransactionService) ctx.getBean("TransactionService"); transactionService = (TransactionService) ctx.getBean("TransactionService");
@@ -581,87 +579,77 @@ public class RepoAdminServiceImplTest extends TestCase
public void testConcurrentDynamicModelCreate() throws Exception public void testConcurrentDynamicModelCreate() throws Exception
{ {
// disable in case of SQL Server final int n = 2;
// see MNT-13089
if (!(dialect instanceof SQLServerDialect)) undeployModels(n);
int deployedModelCount = repoAdminService.getModels().size();
logger.info("Before deploy: deployed custom model count: "+deployedModelCount);
int dictModelCount = getModelCount();
logger.info("Before deploy: dictionary model count: "+dictModelCount);
// concurrently deploy N models
runConcurrentOps(n, 1);
int newDeployedModelCount = repoAdminService.getModels().size();
logger.info("After deploy: deployed custom model count: "+newDeployedModelCount);
assertEquals(deployedModelCount+n, newDeployedModelCount);
for (int i = 1; i <= n; i++)
{ {
final int n = 2; assertTrue(isModelDeployed(modelPrefix+i));
undeployModels(n);
int deployedModelCount = repoAdminService.getModels().size();
logger.info("Before deploy: deployed custom model count: "+deployedModelCount);
int dictModelCount = getModelCount();
logger.info("Before deploy: dictionary model count: "+dictModelCount);
// concurrently deploy N models
runConcurrentOps(n, 1);
int newDeployedModelCount = repoAdminService.getModels().size();
logger.info("After deploy: deployed custom model count: "+newDeployedModelCount);
assertEquals(deployedModelCount+n, newDeployedModelCount);
for (int i = 1; i <= n; i++)
{
assertTrue(isModelDeployed(modelPrefix+i));
}
int newDictModelCount = getModelCount();
logger.info("After deploy: dictionary model count: "+newDictModelCount);
assertEquals(dictModelCount+n, newDictModelCount);
undeployModels(n);
newDeployedModelCount = repoAdminService.getModels().size();
logger.info("After undeploy: deployed custom model count: "+newDeployedModelCount);
assertEquals(deployedModelCount, newDeployedModelCount);
newDictModelCount = getModelCount();
logger.info("After undeploy: dictionary model count: "+newDictModelCount);
assertEquals(dictModelCount, newDictModelCount);
} }
int newDictModelCount = getModelCount();
logger.info("After deploy: dictionary model count: "+newDictModelCount);
assertEquals(dictModelCount+n, newDictModelCount);
undeployModels(n);
newDeployedModelCount = repoAdminService.getModels().size();
logger.info("After undeploy: deployed custom model count: "+newDeployedModelCount);
assertEquals(deployedModelCount, newDeployedModelCount);
newDictModelCount = getModelCount();
logger.info("After undeploy: dictionary model count: "+newDictModelCount);
assertEquals(dictModelCount, newDictModelCount);
} }
public void testConcurrentDynamicModelDelete() throws Exception public void testConcurrentDynamicModelDelete() throws Exception
{ {
// disable in case of SQL Server final int n = 2;
// see MNT-13089
if (!(dialect instanceof SQLServerDialect)) undeployModels(n);
int deployedModelCount = repoAdminService.getModels().size();
logger.info("Existing deployed custom model count: "+deployedModelCount);
int dictModelCount = getModelCount();
logger.info("Existing dictionary model count: "+dictModelCount);
deployModels(n);
assertEquals("assert A: deployed model count not equal to the repoAdminService", deployedModelCount+n, repoAdminService.getModels().size());
for (int i = 1; i <= n; i++)
{ {
final int n = 2; assertTrue(isModelDeployed(modelPrefix+i));
undeployModels(n);
int deployedModelCount = repoAdminService.getModels().size();
logger.info("Existing deployed custom model count: "+deployedModelCount);
int dictModelCount = getModelCount();
logger.info("Existing dictionary model count: "+dictModelCount);
deployModels(n);
assertEquals("assert A: deployed model count not equal to the repoAdminService", deployedModelCount+n, repoAdminService.getModels().size());
for (int i = 1; i <= n; i++)
{
assertTrue(isModelDeployed(modelPrefix+i));
}
assertEquals(dictModelCount+n, getModelCount());
// concurrently undeploy N models
runConcurrentOps(n, 2);
assertEquals("assert after concurrent undeploy", deployedModelCount, repoAdminService.getModels().size());
for (int i = 1; i <= n; i++)
{
assertFalse(isModelDeployed(modelPrefix+i));
}
assertEquals(dictModelCount, getModelCount());
} }
assertEquals(dictModelCount+n, getModelCount());
// concurrently undeploy N models
runConcurrentOps(n, 2);
assertEquals("assert after concurrent undeploy", deployedModelCount, repoAdminService.getModels().size());
for (int i = 1; i <= n; i++)
{
assertFalse(isModelDeployed(modelPrefix+i));
}
assertEquals(dictModelCount, getModelCount());
} }
private int getModelCount() private int getModelCount()

View File

@@ -58,8 +58,6 @@ import org.alfresco.test_category.OwnJVMTestsCategory;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.ScriptPagingDetails; import org.alfresco.util.ScriptPagingDetails;
import org.alfresco.util.TestWithUserUtils; import org.alfresco.util.TestWithUserUtils;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@@ -91,8 +89,7 @@ public class ArchiveAndRestoreTest extends TestCase
private MutableAuthenticationService authenticationService; private MutableAuthenticationService authenticationService;
private OwnableService ownableService; private OwnableService ownableService;
private TransactionService transactionService; private TransactionService transactionService;
private Dialect dialect;
private UserTransaction txn; private UserTransaction txn;
private StoreRef workStoreRef; private StoreRef workStoreRef;
private NodeRef workStoreRootNodeRef; private NodeRef workStoreRootNodeRef;
@@ -115,7 +112,7 @@ public class ArchiveAndRestoreTest extends TestCase
private NodeRef bb_; private NodeRef bb_;
ChildAssociationRef childAssocAtoAA_; ChildAssociationRef childAssocAtoAA_;
ChildAssociationRef childAssocBtoBB_; ChildAssociationRef childAssocBtoBB_;
@Override @Override
public void setUp() throws Exception public void setUp() throws Exception
{ {
@@ -127,8 +124,7 @@ public class ArchiveAndRestoreTest extends TestCase
authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent"); authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
ownableService = (OwnableService) ctx.getBean("ownableService"); ownableService = (OwnableService) ctx.getBean("ownableService");
transactionService = serviceRegistry.getTransactionService(); transactionService = serviceRegistry.getTransactionService();
dialect = (Dialect) ctx.getBean("dialect");
// Start a transaction // Start a transaction
txn = transactionService.getUserTransaction(); txn = transactionService.getUserTransaction();
txn.begin(); txn.begin();
@@ -615,28 +611,18 @@ public class ArchiveAndRestoreTest extends TestCase
public void testInTransactionRestore() throws Exception public void testInTransactionRestore() throws Exception
{ {
// disable in case of SQL Server RestoreNodeReport report = nodeArchiveService.restoreArchivedNode(a_);
// see MNT-13089 // expect a failure due to missing archive node
if (!(dialect instanceof SQLServerDialect)) assertEquals("Expected failure", RestoreStatus.FAILURE_INVALID_ARCHIVE_NODE, report.getStatus());
{ // check that our transaction was not affected
RestoreNodeReport report = nodeArchiveService.restoreArchivedNode(a_); assertEquals("Transaction should still be valid", Status.STATUS_ACTIVE, txn.getStatus());
// expect a failure due to missing archive node
assertEquals("Expected failure", RestoreStatus.FAILURE_INVALID_ARCHIVE_NODE, report.getStatus());
// check that our transaction was not affected
assertEquals("Transaction should still be valid", Status.STATUS_ACTIVE, txn.getStatus());
}
} }
public void testInTransactionPurge() throws Exception public void testInTransactionPurge() throws Exception
{ {
// disable in case of SQL Server nodeArchiveService.purgeArchivedNode(a_);
// see MNT-13089 // the node should still be there (it was not available to the purge transaction)
if (!(dialect instanceof SQLServerDialect)) assertEquals("Transaction should still be valid", Status.STATUS_ACTIVE, txn.getStatus());
{
nodeArchiveService.purgeArchivedNode(a_);
// the node should still be there (it was not available to the purge transaction)
assertEquals("Transaction should still be valid", Status.STATUS_ACTIVE, txn.getStatus());
}
} }
private void commitAndBeginNewTransaction() throws Exception private void commitAndBeginNewTransaction() throws Exception

View File

@@ -2002,12 +2002,9 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
public void testALF3733() throws Exception public void testALF3733() throws Exception
{ {
// disable in case of SQL Server setComplete();
// see MNT-13089 endTransaction();
if (dialect instanceof SQLServerDialect)
{
return;
}
// ALF-3733 was caused by ${cwd} evaluating to the empty string and a path "//sourceNodeName" // ALF-3733 was caused by ${cwd} evaluating to the empty string and a path "//sourceNodeName"
// being passed to the FileFolderService for creation. This then splits the string using '/' as // being passed to the FileFolderService for creation. This then splits the string using '/' as
// a delimiter which leads to the attempted creation of nodes with the empty string as a name, // a delimiter which leads to the attempted creation of nodes with the empty string as a name,
@@ -2469,12 +2466,8 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
public void testJavascriptAPI() throws Exception public void testJavascriptAPI() throws Exception
{ {
// disable in case of SQL Server setComplete();
// see MNT-13089 endTransaction();
if (dialect instanceof SQLServerDialect)
{
return;
}
Map<String, Object> model = new HashMap<String, Object>(); Map<String, Object> model = new HashMap<String, Object>();
model.put("testSourceNode", this.nodeWithImageContent); model.put("testSourceNode", this.nodeWithImageContent);

View File

@@ -384,32 +384,18 @@ public class RenditionServicePermissionsTest
testSiteInfo.doclib, testSiteInfo.doclib,
"quick.jpg", "quick.jpg",
AuthenticationUtil.getFullyAuthenticatedUser()); AuthenticationUtil.getFullyAuthenticatedUser());
return imgNode;
} // This is what ScriptNode.createThumbnail does
}); ThumbnailDefinition details = thumbnailRegistry.getThumbnailDefinition("doclib");
Action action = ThumbnailHelper.createCreateThumbnailAction(details, services);
// This is what ScriptNode.createThumbnail does
final ThumbnailDefinition details = thumbnailRegistry.getThumbnailDefinition("doclib");
final Action action = transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Action>()
{
@Override
public Action execute() throws Throwable
{
return ThumbnailHelper.createCreateThumbnailAction(details, services);
}
});
transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
// Creation of thumbnail // Creation of thumbnail
services.getActionService().executeAction(action, imgNode, true, false); services.getActionService().executeAction(action, imgNode, true, false);
// The node in question should now have a thumbnail/rendition. // The node in question should now have a thumbnail/rendition.
assertEquals(1, renditionService.getRenditions(imgNode).size()); assertEquals(1, renditionService.getRenditions(imgNode).size());
return null; return imgNode;
} }
}); });

View File

@@ -72,7 +72,6 @@ import org.alfresco.test_category.OwnJVMTestsCategory;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.SQLServerDialect;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.extensions.webscripts.GUID; import org.springframework.extensions.webscripts.GUID;
@@ -1733,12 +1732,11 @@ public class AuthenticationTest extends TestCase
public void testLoginNotExistingTenant() throws Exception public void testLoginNotExistingTenant() throws Exception
{ {
// disable in case of SQL Server // split the transactions to pass on SQL Server
// see MNT-13089 // see MNT-13089
if (dialect instanceof SQLServerDialect) userTransaction.commit();
{ userTransaction = transactionService.getUserTransaction();
return; userTransaction.begin();
}
boolean wasEnabled = AuthenticationUtil.isMtEnabled(); boolean wasEnabled = AuthenticationUtil.isMtEnabled();
try try