[jbpm-commits] JBoss JBPM SVN: r5153 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/activities and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jun 29 08:38:49 EDT 2009


Author: jbarrez
Date: 2009-06-29 08:38:48 -0400 (Mon, 29 Jun 2009)
New Revision: 5153

Added:
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/SubProcessTest.java
Modified:
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
Log:
Fix for JBPM-2335: 1-1 relation was only nullified at one side, but nullification is needed at both sides.

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java	2009-06-29 12:21:09 UTC (rev 5152)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java	2009-06-29 12:38:48 UTC (rev 5153)
@@ -106,7 +106,9 @@
     }
 
     try {
+      subProcessInstance.setSuperProcessExecution(null);
       executionImpl.setSubProcessInstance(null);
+      
 
       for (SubProcessOutParameterImpl outParameter: outParameters) {
         outParameter.consume(executionImpl, subProcessInstance);

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/SubProcessTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/SubProcessTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/SubProcessTest.java	2009-06-29 12:38:48 UTC (rev 5153)
@@ -0,0 +1,88 @@
+/*
+ * 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.activities;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Joram Barrez
+ */
+public class SubProcessTest extends JbpmTestCase {
+  
+  private static final String MAIN_PROCESS =
+    "<process name='mainProcess'>" +
+    "  <start>" +
+    "    <transition to='review' />" +
+    "  </start>" +
+    "  <sub-process name='review' sub-process-key='SubProcessReview'>" +
+    "    <transition name='ok' to='next step'/>" +
+    "    <transition name='nok' to='update'/>" +
+    "    <transition name='reject' to='close'/>" +
+    "  </sub-process>" +
+    "  <state name='next step'/>" +
+    "  <state name='update'/>" +
+    "  <end name='close'/>" +
+    "</process>";  
+    
+  private static final String SUB_PROCESS =
+    "<process name='SubProcessReview'>" +
+    "  <start>" +
+    "    <transition to='get approval'/>" +
+    "  </start>" +
+    "  <task name='get approval' assignee='johndoe'>" +
+    "    <transition name='ok' to='ok'/>" +
+    "    <transition name='nok' to='nok'/>" +
+    "    <transition name='reject' to='reject'/>" +
+    "  </task>" +
+    "  <end name='ok' />" +
+    "  <end name='nok' />" +
+    "  <end name='reject' />" +
+    "</process>";  
+  
+  public void testSubProcessOutcomeToState() {
+    deployJpdlXmlString(SUB_PROCESS);
+    deployJpdlXmlString(MAIN_PROCESS);
+    
+    ProcessInstance processInstance = executionService.startProcessInstanceByKey("mainProcess");
+    Task task = taskService.findPersonalTasks("johndoe").get(0);
+    taskService.completeTask(task.getId(), "nok");
+    assertExecutionInActivity(processInstance.getId(), "update");
+  }
+
+  
+  public void testSubProcessOutcomeToEnd() {
+    deployJpdlXmlString(SUB_PROCESS);
+    deployJpdlXmlString(MAIN_PROCESS);
+    
+    ProcessInstance processInstance = executionService.startProcessInstanceByKey("mainProcess");
+    Task task = taskService.findPersonalTasks("johndoe").get(0);
+    taskService.completeTask(task.getId(), "reject");
+    assertProcessInstanceEnded(processInstance); 
+  }
+  
+}




More information about the jbpm-commits mailing list