Merged BRANCHES/DEV/JBPM31UPGRADE to HEAD

14417: MOB-414 Upgrade to jBPM 3.3.1

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14567 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-06-05 17:04:57 +00:00
parent 34cae989d9
commit 1070ddd702
5 changed files with 51 additions and 15 deletions

View File

@@ -129,7 +129,15 @@ public class WorkflowServiceImplTest extends BaseSpringTest
assertNotNull(nodeRef);
assertTrue(nodeService.hasAspect(nodeRef, WorkflowModel.ASPECT_WORKFLOW_PACKAGE));
ChildAssociationRef childAssoc = nodeService.createNode(rootRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "test"), ContentModel.TYPE_CONTENT, null);
nodeService.addChild(nodeRef, childAssoc.getChildRef(), ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "test"));
List<WorkflowInstance> exisingInstances = workflowService.getWorkflowsForContent(childAssoc.getChildRef(), true);
int size = 0;
if (exisingInstances != null)
{
size = exisingInstances.size();
}
nodeService.addChild(nodeRef, childAssoc.getChildRef(), ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "test123"));
// start workflow
List<WorkflowDefinition> workflowDefs = workflowService.getDefinitions();
@@ -154,8 +162,29 @@ public class WorkflowServiceImplTest extends BaseSpringTest
// get workflows for content
List<WorkflowInstance> instances = workflowService.getWorkflowsForContent(childAssoc.getChildRef(), true);
assertNotNull(instances);
assertEquals(1, instances.size());
assertEquals(instances.get(0).id, path.instance.id);
assertEquals(size + 1, instances.size());
for (WorkflowInstance instance : instances)
{
boolean fNew = true;
for (WorkflowInstance exisingInstance : exisingInstances)
{
if (instance.id.equals(exisingInstance.id))
{
fNew = false;
break;
}
fNew = true;
break;
}
if (fNew)
{
assertEquals(instance.id, path.instance.id);
}
}
List<WorkflowInstance> completedInstances = workflowService.getWorkflowsForContent(childAssoc.getChildRef(), false);
assertNotNull(completedInstances);
assertEquals(0, completedInstances.size());

View File

@@ -90,15 +90,6 @@ public class AlfrescoTimer extends Timer
public Boolean doWork() throws Exception
{
boolean deleteTimer = AlfrescoTimer.super.execute(jbpmContext);
// NOTE: there may be an issue in jBPM where a timer that causes a process to
// end is deleted twice (once via specific delete operation and once via
// delete DML statement) which causes a hibernate exception.
// Only delete timer if not at end of process
if (getProcessInstance().getEnd() != null)
{
deleteTimer = false;
}
return deleteTimer;
}
}, (username == null) ? "system" : username);

View File

@@ -100,6 +100,7 @@ public class JBPMSpringTest extends BaseSpringTest
throws Exception
{
theProcessInstanceContinuesWhenAnAsyncMessageIsReceived();
undeployProcessDefinition();
setComplete();
}
@@ -135,6 +136,21 @@ public class JBPMSpringTest extends BaseSpringTest
});
}
private void undeployProcessDefinition()
{
jbpmTemplate.execute(new JbpmCallback()
{
public Object doInJbpm(JbpmContext context)
{
GraphSession graphSession = context.getGraphSession();
ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition("hello world");
graphSession.deleteProcessDefinition(processDefinition.getId());
return null;
}
});
}
private void processInstanceIsCreatedWhenUserSubmitsWebappForm()
{
jbpmTemplate.execute(new JbpmCallback()