[jbpm-commits] JBoss JBPM SVN: r6538 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/activity/subprocess and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 28 21:51:58 EDT 2010


Author: rebody
Date: 2010-07-28 21:51:57 -0400 (Wed, 28 Jul 2010)
New Revision: 6538

Added:
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessEndTest.java
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/mp.jpdl.xml
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/mp.png
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp1.jpdl.xml
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp1.png
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp2.jpdl.xml
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp2.png
Modified:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
Log:
JBPM-2795 move end child execution to the end of the ExecutionImpl.end() as Vic mentioned.

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2010-07-28 22:31:57 UTC (rev 6537)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2010-07-29 01:51:57 UTC (rev 6538)
@@ -351,21 +351,12 @@
       }
     }
 
-    // end all child executions
-   // making a copy of the executions to prevent ConcurrentMoidificationException
-    List<ExecutionImpl> executionsToEnd = new ArrayList<ExecutionImpl>(executions);
-    for (ExecutionImpl child: executionsToEnd) {
-      child.end(state);
-    }
-
     setState(state);
 
     this.propagation = Propagation.EXPLICIT;
 
     DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class, false);
 
-
-
     if (parent!=null) {
 
       if (dbSession!=null) {
@@ -396,6 +387,13 @@
         dbSession.deleteProcessInstance(id, false);
       }
     }
+
+    // end all child executions
+    // making a copy of the executions to prevent ConcurrentMoidificationException
+    List<ExecutionImpl> executionsToEnd = new ArrayList<ExecutionImpl>(executions);
+    for (ExecutionImpl child: executionsToEnd) {
+      child.end(state);
+    }
   }
 
   public void end(OpenExecution executionToEnd) {

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessEndTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessEndTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessEndTest.java	2010-07-29 01:51:57 UTC (rev 6538)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ *
+ */
+package org.jbpm.test.activity.subprocess;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+public class SubProcessEndTest extends JbpmTestCase {
+    private String mpId;
+    private String sp1Id;
+    private String sp2Id;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.sp1Id = repositoryService.createDeployment()
+            .addResourceFromClasspath("org/jbpm/test/activity/subprocess/sp1.jpdl.xml").deploy();
+        this.sp2Id = repositoryService.createDeployment()
+            .addResourceFromClasspath("org/jbpm/test/activity/subprocess/sp2.jpdl.xml").deploy();
+        this.mpId = repositoryService.createDeployment()
+            .addResourceFromClasspath("org/jbpm/test/activity/subprocess/mp.jpdl.xml").deploy();
+    }
+
+    protected void tearDown() throws Exception {
+        repositoryService.deleteDeploymentCascade(this.sp1Id);
+        repositoryService.deleteDeploymentCascade(this.sp2Id);
+        repositoryService.deleteDeploymentCascade(this.mpId);
+        super.tearDown();
+    }
+
+    public void testSubProcessJoinEnd() {
+        ProcessInstance processInstance = executionService.startProcessInstanceByKey("mp");
+
+        List<Task> taskList = taskService.findPersonalTasks("v");
+        Map<String, Object> variables = new HashMap<String, Object>();
+        variables.put("result", "reject");
+        taskService.setVariables(taskList.get(0).getId(), variables);
+        taskService.completeTask(taskList.get(0).getId());
+                this.assertTrue(true);
+    }
+}

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/mp.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/mp.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/mp.jpdl.xml	2010-07-29 01:51:57 UTC (rev 6538)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="mp" xmlns="http://jbpm.org/4.3/jpdl">
+	<start g="100,16,48,48" name="start1">
+		<transition g="-43,-17" name="to fork1" to="fork1"/>
+	</start>
+	<fork g="100,96,48,48" name="fork1">
+		<transition g="-75,-17" name="to Subprocess1" to="Subprocess1"/>
+		<transition g="-75,-17" name="to Subprocess2" to="Subprocess2"/>
+	</fork>
+	<sub-process g="16,176,92,52" name="Subprocess1" outcome="#{result}" sub-process-key="sp1">
+		<transition g="-41,-17" name="accept" to="join1"/>
+		<transition g="-40,-17" name="reject" to="main process end"/>
+	</sub-process>
+	<sub-process g="140,176,92,52" name="Subprocess2" outcome="#{result}" sub-process-key="sp2">
+		<transition g="-41,-17" name="accept" to="join1"/>
+		<transition g="12,-18" name="reject" to="main process end"/>
+	</sub-process>
+	<end g="101,340,48,48" name="main process end"/>
+	<join g="101,260,48,48" name="join1">
+		<transition g="-42,-12" name="to main process end" to="main process end"/>
+	</join>
+</process>
\ No newline at end of file

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/mp.png
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/mp.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp1.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp1.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp1.jpdl.xml	2010-07-29 01:51:57 UTC (rev 6538)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="sp1" xmlns="http://jbpm.org/4.3/jpdl">
+	<start name="start1" g="38,16,48,48">
+		<transition name="to task1" to="sp1 task" g="-41,-17" />
+	</start>
+	<end name="sp1 end" g="38,180,48,48" />
+	<task name="sp1 task" g="16,96,92,52" assignee="v">
+		<transition name="to sp1 end" to="sp1 end" g="-40,-17" />
+	</task>
+</process>
\ No newline at end of file

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp1.png
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp2.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp2.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp2.jpdl.xml	2010-07-29 01:51:57 UTC (rev 6538)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="sp2" xmlns="http://jbpm.org/4.3/jpdl">
+	<start name="start1" g="38,16,48,48">
+		<transition name="to sp2 task" to="sp2 task" g="-41,-17" />
+	</start>
+	<task name="sp2 task" g="16,96,92,52" assignee="jic">
+		<transition name="to sp2 end" to="sp2 end" g="-40,-17" />
+	</task>
+	<end name="sp2 end" g="38,180,48,48" />
+</process>
\ No newline at end of file

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp2.png
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/activity/subprocess/sp2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the jbpm-commits mailing list