mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
78747: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 78624: Merged V4.2.1 (4.2.1.10) to V4.2-BUG-FIX (4.2.4) 77969: MNT-11926: Unable to start a workflow from a taskListener When activity workflow is started suspend CommandContext propogation (if any exists) so that new ProcessInstance could be flushed and correctly converted to WorkflowPath. Add unit test. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82635 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -86,7 +86,7 @@ public abstract class AbstractWorkflowServiceIntegrationTest extends BaseSpringT
|
||||
protected TestPersonManager personManager;
|
||||
protected TestGroupManager groupManager;
|
||||
protected NodeService nodeService;
|
||||
private NodeRef companyHome;
|
||||
protected NodeRef companyHome;
|
||||
protected WorkflowTestHelper wfTestHelper;
|
||||
protected TransactionServiceImpl transactionService;
|
||||
|
||||
|
@@ -28,11 +28,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.repo.workflow.AbstractWorkflowServiceIntegrationTest;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowPath;
|
||||
@@ -382,6 +384,39 @@ public class ActivitiWorkflowServiceIntegrationTest extends AbstractWorkflowServ
|
||||
checkNoTasksFoundUsingQuery(taskQuery);
|
||||
}
|
||||
|
||||
public void testStartWorkflowFromTaskListener() throws Exception
|
||||
{
|
||||
WorkflowDefinition testDefinition = deployDefinition("activiti/testStartWfFromListener.bpmn20.xml");
|
||||
|
||||
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
|
||||
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
|
||||
props.put(ContentModel.PROP_NAME, "MNT-11926-testfile.txt");
|
||||
final ChildAssociationRef childAssoc = nodeService.createNode(companyHome, ContentModel.ASSOC_CONTAINS,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "MNT-11926-test"), ContentModel.TYPE_CONTENT, props);
|
||||
|
||||
try
|
||||
{
|
||||
// Create workflow parameters
|
||||
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
|
||||
Serializable wfPackage = workflowService.createPackage(null);
|
||||
params.put(WorkflowModel.ASSOC_PACKAGE, wfPackage);
|
||||
NodeRef assignee = personManager.get(USER1);
|
||||
params.put(WorkflowModel.ASSOC_ASSIGNEE, assignee); // task instance field
|
||||
|
||||
WorkflowPath path = workflowService.startWorkflow(testDefinition.getId(), params);
|
||||
String instanceId = path.getInstance().getId();
|
||||
|
||||
WorkflowTask startTask = workflowService.getStartTask(instanceId);
|
||||
workflowService.endTask(startTask.getId(), null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// tidy up
|
||||
nodeService.deleteNode(childAssoc.getChildRef());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEngine()
|
||||
{
|
||||
|
Reference in New Issue
Block a user