[jbpm-commits] JBoss JBPM SVN: r4557 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/model and 13 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 15 16:01:24 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-04-15 16:01:24 -0400 (Wed, 15 Apr 2009)
New Revision: 4557

Added:
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
Modified:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java
   jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
   jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
   jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
   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/svc/ExecutionServiceImpl.java
   jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java
   jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
   jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableDeclarationTest.java
   jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java
Log:
JBPM-2029 exposing the full execution hierarchy for obtaining wait state executions

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -22,7 +22,13 @@
 package org.jbpm;
 
 import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
 
+import org.jbpm.client.ClientExecution;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.model.ObservableElement;
+
 /** a runtime path of execution.
  * 
  * <h3 id="state">State of an execution</h3>
@@ -160,4 +166,34 @@
    * priority integer value, but then, the UI will have to display it as 
    * an integer and not the named value.*/
   int getPriority();
+  
+  // execution hierarchy access ///////////////////////////////////////////////
+  
+  /** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution 
+   * structure</a>.  Null will be returned in case this execution itself is the 
+   * main execution path.  */
+  Execution getProcessInstance();
+
+  /** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution 
+   * structure</a>.  Null will be returned in case this execution itself is the 
+   * main execution path. */ 
+  Execution getParent();
+
+  /** the child executions in the <a href="package-summary.html#basicexecutionstructure">execution 
+   * structure</a>.  Can be null and can be an empty collection. */ 
+  Collection<Execution> getExecutions();
+  
+  /** maps child execution names to execution objects.  In case multiple executions 
+   * have the same name, the first one is taken.  Can be null or can be an empty 
+   * map.  The first execution without a name is also included with null as the key.
+   */ 
+  Map<String, Execution> getExecutionsMap();
+  
+  /** the child execution for the given name or null in case such execution doesn't exist. */ 
+  Execution getExecution(String name);
+  
+  /** indicates if this execution has a child execution with the given executionName */
+  boolean hasExecution(String executionName);
+  
+  Execution findExecutionIn(String activityName);
 }

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -80,14 +80,11 @@
    *    process versions with the same name. */
   Execution startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables, String processInstanceKey);
 
-  /** the execution that is uniquely defined by the process definition and the business key. */
-  Execution findExecutionByKey(String processDefinitionName, String processInstanceKey);
-
-  /** the execution that is uniquely defined by the process definition and the business key. */
+  /** the execution that is uniquely defined by the process execution id. */
   Execution findExecutionById(String executionId);
 
   /** this method returns this execution and all its child executions recursively. */
-  List<Execution> findExecutionsById(String executionId);
+  List<Execution> findExecutionsById(String processDefinitionId);
 
   /** provides an external trigger to an execution. */
   Execution signalExecutionById(String executionId);
@@ -102,21 +99,6 @@
   Execution signalExecutionById(String executionId, Map<String, Object> parameters);
 
 
-  
-  /** provides a named external trigger to an execution. */
-  Execution signalExecutionByKey(String processDefinitionKey, String executionKey);
-
-  /** provides a named external trigger to an execution. */
-  Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName);
-
-  /** provides a named external trigger to an execution with parameters. */
-  Execution signalExecutionByKey(String processDefinitionKey, String executionKey, Map<String, Object> parameters);
-
-  /** provides a named external trigger to an execution with parameters. */
-  Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName, Map<String, Object> parameters);
-  
-  
-
   /** search for executions with criteria */
   ExecutionQuery createExecutionQuery();
 

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -115,34 +115,6 @@
    * the given type name. */
   void createVariable(String key, Object value, String typeName);
   
-  // execution hierarchy access ///////////////////////////////////////////////
-  
-  /** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution 
-   * structure</a>.  Null will be returned in case this execution itself is the 
-   * main execution path.  */
-  OpenExecution getProcessInstance();
-
-  /** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution 
-   * structure</a>.  Null will be returned in case this execution itself is the 
-   * main execution path. */ 
-  OpenExecution getParent();
-
-  /** the child executions in the <a href="package-summary.html#basicexecutionstructure">execution 
-   * structure</a>.  Can be null and can be an empty collection. */ 
-  Collection<OpenExecution> getExecutions();
-  
-  /** maps child execution names to execution objects.  In case multiple executions 
-   * have the same name, the first one is taken.  Can be null or can be an empty 
-   * map.  The first execution without a name is also included with null as the key.
-   */ 
-  Map<String, OpenExecution> getExecutionsMap();
-  
-  /** the child execution for the given name or null in case such execution doesn't exist. */ 
-  OpenExecution getExecution(String name);
-  
-  /** indicates if this execution has a child execution with the given executionName */
-  boolean hasExecution(String executionName);
-
   // timer access /////////////////////////////////////////////////////////////
 
   /** indicates if this execution scope has timers */
@@ -159,4 +131,21 @@
    * priority integer value, but then, the UI will have to display it as 
    * an integer and not the named value.*/
   void setPriority(int priority);
+  
+  // execution hierarchy access ///////////////////////////////////////////////
+  
+  /** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution 
+   * structure</a>.  Null will be returned in case this execution itself is the 
+   * main execution path.  */
+  OpenExecution getProcessInstance();
+
+  /** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution 
+   * structure</a>.  Null will be returned in case this execution itself is the 
+   * main execution path. */ 
+  OpenExecution getParent();
+
+  /** the child execution for the given name or null in case such execution doesn't exist. */ 
+  OpenExecution getExecution(String name);
+  
+  OpenExecution findExecutionIn(String activityName);
 }

Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml	2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
 
     <list name="executions" 
           cascade="all-delete-orphan"
-          inverse="false">
+          inverse="false"
+          lazy="false">
       <key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
       <list-index column="PARENT_IDX_" />
       <one-to-many class="ExecutionImpl" />

Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -25,13 +25,15 @@
     
     assertEquals("escalation", processInstance.getActivityName());
   }
-/*
+
   public void testTimerTransitionTakeTransition() {
     deployJpdlResource("org/jbpm/examples/timer/transition/process.jpdl.xml");
     
     Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
+    
+    String executionId = processInstance.findExecutionIn("guardedWait").getId();
 
-    executionService.signalExecutionById(processInstance.getId()+".guardedWait", "go on");
+    executionService.signalExecutionById(executionId, "go on");
     
     processInstance = executionService.findExecutionById(processInstance.getId());
     
@@ -43,5 +45,4 @@
     
     assertEquals(new ArrayList<Job>(), new ArrayList<Job>(jobs));
   }
-*/
 }

Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml	2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
 
     <list name="executions" 
           cascade="all-delete-orphan"
-          inverse="false">
+          inverse="false"
+          lazy="false">
       <key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
       <list-index column="PARENT_IDX_" />
       <one-to-many class="ExecutionImpl" />

Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -31,6 +31,7 @@
 import org.jboss.bpm.console.client.model.ProcessInstanceRef;
 import org.jboss.bpm.console.client.model.TaskRef;
 import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+import org.jbpm.Execution;
 import org.jbpm.ProcessDefinition;
 import org.jbpm.model.OpenExecution;
 import org.jbpm.model.Transition;
@@ -69,10 +70,10 @@
     OpenExecution topLevelExecution = e0.getProcessInstance();
     TokenReference tok = execution2TokenReference(topLevelExecution);
 
-    Collection<OpenExecution> childExecutions = topLevelExecution.getExecutions();
+    Collection<Execution> childExecutions = topLevelExecution.getExecutions();
     if(childExecutions!=null)
     {
-      for(OpenExecution childExecution : childExecutions)
+      for(Execution childExecution : childExecutions)
       {
         TokenReference childTok = execution2TokenReference(childExecution);
         tok.getChildren().add(childTok);
@@ -84,7 +85,7 @@
     return ref;
   }
 
-  private static TokenReference execution2TokenReference(OpenExecution topLevelExecution)
+  private static TokenReference execution2TokenReference(Execution topLevelExecution)
   {
     TokenReference tok = new TokenReference();
     tok.setName(topLevelExecution.getName());
@@ -93,7 +94,9 @@
 
     // transitions
     List<String> availableSignals = new ArrayList<String>();
-    for(Transition t : topLevelExecution.getActivity().getOutgoingTransitions())
+
+    OpenExecution openTopLevelExecution = (OpenExecution) topLevelExecution;
+    for(Transition t : openTopLevelExecution.getActivity().getOutgoingTransitions())
     {
       availableSignals.add(t.getName());
     }

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -72,7 +72,7 @@
   
   List<OpenExecution> findJoinedExecutions(OpenExecution execution, Activity join) {
     List<OpenExecution> joinedExecutions = new ArrayList<OpenExecution>();
-    scanRecursive(execution.getProcessInstance(), join, joinedExecutions);
+    scanRecursive((OpenExecution)execution.getProcessInstance(), join, joinedExecutions);
     return joinedExecutions;
   }
 
@@ -81,7 +81,7 @@
     if (join.equals(execution.getActivity())) {
       joinedExecutions.add(execution);
     }
-    Collection<OpenExecution> childExecutions = execution.getExecutions();
+    Collection<OpenExecution> childExecutions = (Collection)execution.getExecutions();
     if (childExecutions!=null) {
       for (OpenExecution childExecution: childExecutions) {
         scanRecursive(childExecution, join, joinedExecutions);

Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml	2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
 
     <list name="executions" 
           cascade="all-delete-orphan"
-          inverse="false">
+          inverse="false"
+          lazy="false">
       <key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
       <list-index column="PARENT_IDX_" />
       <one-to-many class="ExecutionImpl" />

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -28,10 +28,7 @@
 import org.jbpm.Execution;
 import org.jbpm.JbpmException;
 import org.jbpm.client.ClientExecution;
-import org.jbpm.cmd.Command;
 import org.jbpm.env.Environment;
-import org.jbpm.model.Activity;
-import org.jbpm.model.OpenExecution;
 import org.jbpm.session.PvmDbSession;
 
 
@@ -62,20 +59,13 @@
     return executions;
   }
 
-  public void scanExecutions(OpenExecution execution, List<Execution> executions) {
+  public void scanExecutions(Execution execution, List<Execution> executions) {
 
     executions.add(execution);
     
-    // initialize activity relation.  this is necessary for the method  
-    // Execution.getActivityName()
-    Activity activity = execution.getActivity();
-    if (activity!=null) {
-      activity.getName();
-    }
-    
-    Collection<OpenExecution> childExecutions = execution.getExecutions();
+    Collection<Execution> childExecutions = execution.getExecutions();
     if (childExecutions!=null) {
-      for (OpenExecution childExecution: childExecutions) {
+      for (Execution childExecution: childExecutions) {
         scanExecutions(childExecution, executions);
       }
     }

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	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -157,7 +157,7 @@
    * that not all executions are forced to have a name and duplicates are allowed.
    * In case the {@link #executions} change, the executionsMap can be nulled or
    * also updated (but a check needs to be added whether it exists). */
-  protected transient Map<String, OpenExecution> executionsMap = null;
+  protected transient Map<String, Execution> executionsMap = null;
 
   /** the queue of atomic operations to be performed for this execution. */
   protected Queue<AtomicOperation> atomicOperations;
@@ -809,7 +809,7 @@
 
   /** @see Execution#getExecution(String) */
   public ExecutionImpl getExecution(String name) {
-    Map<String, OpenExecution> executionsMap = getExecutionsMap();
+    Map<String, Execution> executionsMap = getExecutionsMap();
     return (ExecutionImpl) (executionsMap!=null ? executionsMap.get(name) : null);
   }
 
@@ -838,12 +838,12 @@
     ((ExecutionImpl)parent).removeExecution(child);
   }
 
-  public Map<String, OpenExecution> getExecutionsMap() {
+  public Map<String, Execution> getExecutionsMap() {
     if ( (executionsMap==null)
          && (executions!=null)
         ) {
       // initialize executionsMap cache
-      executionsMap = new HashMap<String, OpenExecution>();
+      executionsMap = new HashMap<String, Execution>();
       for(ExecutionImpl execution: executions) {
         String executionName = execution.getName();
         // the next test makes sure that the first execution wins
@@ -861,7 +861,25 @@
              && executionsMap.containsKey(name)
            );
   }
-  
+
+  public ExecutionImpl findExecutionIn(String activityName) {
+    if ( activityName.equals(this.activityName)
+         && state.equals(STATE_ACTIVE)) {
+      return this;
+    }
+
+    if (executions!=null) {
+      for (ExecutionImpl childExecution: executions) {
+        ExecutionImpl found = childExecution.findExecutionIn(activityName);
+        if (found!=null) {
+          return found;
+        }
+      }
+    }
+
+    return null;
+  }
+
   // sub process creation /////////////////////////////////////////////////////
 
   public ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition) {
@@ -1056,7 +1074,7 @@
   public ObservableElement getEventSource() {
     return eventSource;
   }
-  public Collection<OpenExecution> getExecutions() {
+  public Collection<Execution> getExecutions() {
     return (Collection) executions;
   }
   public String getName() {

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -97,29 +97,7 @@
     return commandService.execute(new SignalCmd(executionId, null, parameters));
   }
 
-
-  public Execution signalExecutionByKey(String processDefinitionKey, String executionKey) {
-    return signalExecutionById(processDefinitionKey+"."+executionKey, null, null);
-  }
-
-  public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName) {
-    return signalExecutionById(processDefinitionKey+"."+executionKey, signalName, null);
-  }
-
-  public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName, Map<String, Object> parameters) {
-    return signalExecutionById(processDefinitionKey+"."+executionKey, signalName, parameters);
-  }
-
-  public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, Map<String, Object> parameters) {
-    return signalExecutionById(processDefinitionKey+"."+executionKey, null, parameters);
-  }
-
-
  
-  public Execution findExecutionByKey(String processDefinitionName, String key) {
-    return commandService.execute(new FindExecutionCmd(processDefinitionName, key));
-  }
-  
   public Execution findExecutionById(String executionId) {
     return commandService.execute(new FindExecutionCmd(executionId));
   }

Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml	2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
 
     <list name="executions" 
           cascade="all-delete-orphan"
-          inverse="false">
+          inverse="false"
+          lazy="false">
       <key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
       <list-index column="PARENT_IDX_" />
       <one-to-many class="ExecutionImpl" />

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -0,0 +1,81 @@
+/*
+ * 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.execution;
+
+import java.util.HashMap;
+
+import org.jbpm.Execution;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExecutionEagerLoadingTest extends JbpmTestCase {
+
+  public void testEagerLoading() {
+    deployJpdlXmlString(
+      "<process name='p'>" +
+      "  <start>" +
+      "    <transition to='f' />" +
+      "  </start>" +
+      "  <fork name='f'>" +
+      "    <transition to='f1' />" +
+      "    <transition to='f2' />" +
+      "  </fork>" +
+      "  <fork name='f1'>" +
+      "    <transition to='s11' />" +
+      "    <transition to='s12' />" +
+      "  </fork>" +
+      "  <fork name='f2'>" +
+      "    <transition to='s21' />" +
+      "    <transition to='s22' />" +
+      "  </fork>" +
+      "  <state name ='s11' />" +
+      "  <state name ='s12' />" +
+      "  <state name ='s21' />" +
+      "  <state name ='s22' />" +
+      "</process>"
+    );
+  
+    Execution processInstance = executionService.startProcessInstanceByKey("p");
+   
+    processInstance = executionService.findExecutionById(processInstance.getId());
+    
+    assertNotNull(processInstance.findExecutionIn("s11"));
+    assertNotNull(processInstance.findExecutionIn("s12"));
+    assertNotNull(processInstance.findExecutionIn("s21"));
+    assertNotNull(processInstance.findExecutionIn("s22"));
+
+    processInstance = executionService.findExecutionById(processInstance.getId());
+
+    assertEquals(6, processInstance.getExecutions().size());
+
+    processInstance = executionService.findExecutionById(processInstance.getId());
+
+    assertEquals(1, processInstance.getExecutionsMap().size());
+
+    processInstance = executionService.findExecutionById(processInstance.getId());
+
+    assertNotNull(processInstance.getExecution(null));
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -35,35 +35,6 @@
  */
 public class SignalExecutionTest extends JbpmTestCase {
   
-  public void testSignalExecutionByKey() {
-    deployJpdlXmlString(
-      "<process name='Insurance claim' key='ICL'>" +
-      "  <start>" +
-      "    <transition to='a' />" +
-      "  </start>" +
-      "  <state name='a'>" +
-      "    <transition to='b' />" +
-      "  </state>" +
-      "  <state name='b'>" +
-      "    <transition to='c' />" +
-      "  </state>" +
-      "  <state name='c' />" +
-      "</process>"
-    );
-
-    Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
-    
-    assertEquals("a", execution.getActivityName());
-    
-    execution = executionService.signalExecutionByKey("ICL", "82436");
-
-    assertEquals("b", execution.getActivityName());
-
-    execution = executionService.signalExecutionByKey("ICL", "82436");
-
-    assertEquals("c", execution.getActivityName());
-  }
-
   public void testSignalExecutionById() {
     deployJpdlXmlString(
       "<process name='Insurance claim' key='ICL'>" +

Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml	2009-04-15 20:01:24 UTC (rev 4557)
@@ -69,7 +69,8 @@
 
     <list name="executions" 
           cascade="all-delete-orphan"
-          inverse="false">
+          inverse="false"
+          lazy="false">
       <key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
       <list-index column="PARENT_IDX_" />
       <one-to-many class="ExecutionImpl" />

Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableDeclarationTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableDeclarationTest.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableDeclarationTest.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -126,7 +126,7 @@
     expectedVariables.put("flight", "B52");
     assertEquals(expectedVariables, processInstance.getVariables());
     
-    OpenExecution outerExecution = processInstance.getExecution("outer");
+    OpenExecution outerExecution = (OpenExecution) processInstance.getExecution("outer");
     expectedVariables.put("duration", "22 minutes");
     assertEquals(expectedVariables, outerExecution.getVariables());
 

Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java	2009-04-15 12:43:05 UTC (rev 4556)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java	2009-04-15 20:01:24 UTC (rev 4557)
@@ -94,7 +94,7 @@
       if (join.equals(execution.getActivity())) {
         joinedExecutions.add(execution);
       }
-      Collection<OpenExecution> childExecutions = execution.getExecutions();
+      Collection<OpenExecution> childExecutions = (List)execution.getExecutions();
       if (childExecutions!=null) {
         for (OpenExecution childExecution: childExecutions) {
           scanRecursive(childExecution, join, joinedExecutions);




More information about the jbpm-commits mailing list