mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fix for asynchronous action test. Authentication context was not set for complete asynchronous action execution transaction, therefore failed in commit processing.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2355 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -673,18 +673,18 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
final NodeService finalNodeService = this.nodeService;
|
final NodeService finalNodeService = this.nodeService;
|
||||||
final NodeRef finalNodeRef = this.nodeRef;
|
final NodeRef finalNodeRef = this.nodeRef;
|
||||||
|
|
||||||
// postAsyncActionTest(
|
postAsyncActionTest(
|
||||||
// this.transactionService,
|
this.transactionService,
|
||||||
// 100000000,
|
1000,
|
||||||
// 10,
|
10,
|
||||||
// new AsyncTest()
|
new AsyncTest()
|
||||||
// {
|
{
|
||||||
// public boolean executeTest()
|
public boolean executeTest()
|
||||||
// {
|
{
|
||||||
// return (
|
return (
|
||||||
// finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE));
|
finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE));
|
||||||
// };
|
};
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -715,19 +715,19 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
final NodeService finalNodeService = this.nodeService;
|
final NodeService finalNodeService = this.nodeService;
|
||||||
final NodeRef finalNodeRef = this.nodeRef;
|
final NodeRef finalNodeRef = this.nodeRef;
|
||||||
|
|
||||||
// postAsyncActionTest(
|
postAsyncActionTest(
|
||||||
// this.transactionService,
|
this.transactionService,
|
||||||
// 1000,
|
1000,
|
||||||
// 10,
|
10,
|
||||||
// new AsyncTest()
|
new AsyncTest()
|
||||||
// {
|
{
|
||||||
// public boolean executeTest()
|
public boolean executeTest()
|
||||||
// {
|
{
|
||||||
// return (
|
return (
|
||||||
// finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE) &&
|
finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE) &&
|
||||||
// finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_LOCKABLE));
|
finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_LOCKABLE));
|
||||||
// };
|
};
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void xtestAsyncLoadTest()
|
public void xtestAsyncLoadTest()
|
||||||
|
@@ -28,8 +28,6 @@ import org.alfresco.service.cmr.action.ActionServiceException;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
|
||||||
import freemarker.log.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The asynchronous action execution queue implementation
|
* The asynchronous action execution queue implementation
|
||||||
*
|
*
|
||||||
@@ -271,30 +269,29 @@ public class AsynchronousActionExecutionQueueImpl extends ThreadPoolExecutor imp
|
|||||||
throw new ActionServiceException("Cannot execute action asynchronously since run as user is 'null'");
|
throw new ActionServiceException("Cannot execute action asynchronously since run as user is 'null'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActionExecutionWrapper.this.authenticationComponent.setCurrentUser(userName);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
TransactionUtil.executeInNonPropagatingUserTransaction(this.transactionService,
|
TransactionUtil.executeInNonPropagatingUserTransaction(this.transactionService,
|
||||||
new TransactionUtil.TransactionWork()
|
new TransactionUtil.TransactionWork()
|
||||||
{
|
{
|
||||||
public Object doWork()
|
public Object doWork()
|
||||||
{
|
|
||||||
ActionExecutionWrapper.this.authenticationComponent
|
|
||||||
.setCurrentUser(userName);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
ActionExecutionWrapper.this.actionService.executeActionImpl(
|
ActionExecutionWrapper.this.actionService.executeActionImpl(
|
||||||
ActionExecutionWrapper.this.action,
|
ActionExecutionWrapper.this.action,
|
||||||
ActionExecutionWrapper.this.actionedUponNodeRef,
|
ActionExecutionWrapper.this.actionedUponNodeRef,
|
||||||
ActionExecutionWrapper.this.checkConditions, true,
|
ActionExecutionWrapper.this.checkConditions, true,
|
||||||
ActionExecutionWrapper.this.actionChain);
|
ActionExecutionWrapper.this.actionChain);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
ActionExecutionWrapper.this.authenticationComponent.clearCurrentSecurityContext();
|
ActionExecutionWrapper.this.authenticationComponent.clearCurrentSecurityContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
catch (Throwable exception)
|
catch (Throwable exception)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user