[jboss-svn-commits] JBL Code SVN: r35074 - in labs/jbossrules/branches/diega_esteban_jpm_integration_r34940: drools-flow-compiler/src/test/resources/org/drools/integrationtests and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 8 16:18:21 EDT 2010


Author: eaa
Date: 2010-09-08 16:18:19 -0400 (Wed, 08 Sep 2010)
New Revision: 35074

Added:
   labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-compiler/src/test/resources/org/drools/integrationtests/ProcessNodeExceptionOccurredEventTest.rf
Modified:
   labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-compiler/src/test/java/org/drools/integrationtests/ProcessNodeExceptionOccurredEventTest.java
   labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-core/src/main/java/org/drools/workflow/instance/impl/NodeInstanceImpl.java
   labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-process/drools-bpmn2/src/test/java/org/drools/bpmn2/SimpleBPMNProcessTest.java
Log:
JBRULES-2595: Extend ProcessEventListener to add support for low-level exceptions occurred in a process execution
	- Merge fixes

Modified: labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-compiler/src/test/java/org/drools/integrationtests/ProcessNodeExceptionOccurredEventTest.java
===================================================================
--- labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-compiler/src/test/java/org/drools/integrationtests/ProcessNodeExceptionOccurredEventTest.java	2010-09-08 19:28:38 UTC (rev 35073)
+++ labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-compiler/src/test/java/org/drools/integrationtests/ProcessNodeExceptionOccurredEventTest.java	2010-09-08 20:18:19 UTC (rev 35074)
@@ -9,25 +9,21 @@
 import org.drools.KnowledgeBase;
 import org.drools.KnowledgeBaseFactory;
 import org.drools.Person;
-import org.drools.RuleBaseFactory;
-import org.drools.WorkingMemory;
 import org.drools.builder.KnowledgeBuilder;
 import org.drools.builder.KnowledgeBuilderFactory;
 import org.drools.builder.ResourceType;
 import org.drools.common.AbstractRuleBase;
-import org.drools.common.InternalWorkingMemory;
 import org.drools.event.process.DefaultProcessEventListener;
 import org.drools.event.process.ProcessNodeExceptionOccurredEvent;
+import org.drools.impl.InternalKnowledgeBase;
 import org.drools.io.ResourceFactory;
 import org.drools.process.instance.impl.Action;
 import org.drools.process.instance.impl.demo.DoNothingWorkItemHandler;
-import org.drools.reteoo.ReteooWorkingMemory;
 import org.drools.ruleflow.core.RuleFlowProcess;
 import org.drools.runtime.StatefulKnowledgeSession;
 import org.drools.runtime.process.WorkItem;
 import org.drools.runtime.process.WorkItemHandler;
 import org.drools.runtime.process.WorkItemManager;
-import org.drools.spi.KnowledgeHelper;
 import org.drools.spi.ProcessContext;
 import org.drools.workflow.core.DroolsAction;
 import org.drools.workflow.core.Node;
@@ -187,7 +183,7 @@
      * a WorkItemHandler too.
      * @throws InterruptedException
      */
-    //@Test
+    @Test
     public void actionAndWorkItemExceptionTest() throws InterruptedException {
 
         //Create a new kbase with the given flow.
@@ -335,7 +331,7 @@
      * of makes use of external .rf files. The result using external flow files
      * would be the same.
      */
-    //@Test
+    @Test
     public void testSubProcess() {
 
         //Create a new Process (with name= "Process") with the following structure:
@@ -366,9 +362,9 @@
             endNode, Node.CONNECTION_DEFAULT_TYPE
         );
 
-        //Add the process to a ruleBase.
-        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
-        ruleBase.addProcess(process);
+        //Add the subprocess to a new kbase.
+        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+        ((AbstractRuleBase) ((InternalKnowledgeBase) kbase).getRuleBase()).addProcess(process);
 
         //Create a new Process (with name= "SubProcess") with the following structure:
         //Start -> Action -> End
@@ -405,20 +401,19 @@
             endNode, Node.CONNECTION_DEFAULT_TYPE
         );
 
-        //Add the subprocess to ruleBase.
-        ruleBase.addProcess(process);
 
-        //The following 3 steps is the same as creating a new ksession and add
-        //a new instance of CustomListener as process listener.
-        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
-//        ProcessEventListenerWrapper wrapper = new ProcessEventListenerWrapper( new CustomListener() );
-//        workingMemory.addEventListener(wrapper);
-
+        //Add the subprocess to the kbase.        
+        ((AbstractRuleBase) ((InternalKnowledgeBase) kbase).getRuleBase()).addProcess(process);
+        
+        //Create a new ksession and add CustomListener
+        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();        
+        ksession.addEventListener(new CustomListener());
+        
         //We spect the suprocess ("SubProcess") to fail inside action node ("ActionX")
         //because of a IllegalStateException.
         this.expectedResult = new ExpectedResult("SubProcess","ActionX", "java.lang.IllegalStateException");
         try {
-            workingMemory.startProcess("org.drools.process.process");
+            ksession.startProcess("org.drools.process.process");
             fail("An exception should occurr!");
         } catch (RuntimeException ex) {
             //ok

Added: labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-compiler/src/test/resources/org/drools/integrationtests/ProcessNodeExceptionOccurredEventTest.rf
===================================================================
--- labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-compiler/src/test/resources/org/drools/integrationtests/ProcessNodeExceptionOccurredEventTest.rf	                        (rev 0)
+++ labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-compiler/src/test/resources/org/drools/integrationtests/ProcessNodeExceptionOccurredEventTest.rf	2010-09-08 20:18:19 UTC (rev 35074)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<process xmlns="http://drools.org/drools-5.0/process"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
+         type="RuleFlow" name="flow" package-name="org.drools.test.process1" id="org.drools.test.process1">
+
+  <header>
+  
+  	<imports>
+      <import name="org.drools.Person" />
+    </imports>
+    <globals>
+      <global identifier="person" type="org.drools.Person" />
+      <global identifier="list" type="java.util.List" />
+    </globals>
+  
+  </header>
+
+  <nodes>
+    <start id="1" name="Start" x="100" y="100" width="48" height="48" />
+     <actionNode id="2" name="Some Script" x="186" y="97" width="80" height="48" >
+      <action type="expression" dialect="java" >
+        System.out.println("Hello "+person.getName());        
+      </action>
+    </actionNode>
+
+
+
+     <workItem id="3" name="HumanTask" >
+      <work name="Human Task" >
+        <parameter name="ActorId" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>John Doe</value>
+        </parameter>
+        <parameter name="TaskName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>Do something</value>
+        </parameter>
+        <parameter name="Priority" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+        <parameter name="Comment" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+      </work>
+      <onEntry>
+        <action type="expression" name="Print" dialect="mvel" >list.add("Executing on entry action");</action>
+      </onEntry>
+      <onExit>
+        <action type="expression" name="Print" dialect="java" >list.add("Executing on exit action1");</action>
+        <action type="expression" name="Print" dialect="java" >list.add("Executing on exit action2");</action>
+      </onExit>
+    </workItem>
+
+    <end id="4" name="End" x="357" y="92" width="48" height="48" />
+  </nodes>
+
+  <connections>
+    <connection from="1" to="2" />
+    <connection from="2" to="3" />
+    <connection from="3" to="4" />
+  </connections>
+
+</process>
\ No newline at end of file

Modified: labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-core/src/main/java/org/drools/workflow/instance/impl/NodeInstanceImpl.java
===================================================================
--- labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-core/src/main/java/org/drools/workflow/instance/impl/NodeInstanceImpl.java	2010-09-08 19:28:38 UTC (rev 35073)
+++ labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-flow-core/src/main/java/org/drools/workflow/instance/impl/NodeInstanceImpl.java	2010-09-08 20:18:19 UTC (rev 35074)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.drools.workflow.instance.impl;
 
 import java.io.Serializable;
@@ -46,9 +45,8 @@
  */
 public abstract class NodeInstanceImpl implements org.drools.workflow.instance.NodeInstance, Serializable {
 
-	private static final long serialVersionUID = 510l;
-	
-	private long id;
+    private static final long serialVersionUID = 510l;
+    private long id;
     private long nodeId;
     private WorkflowProcessInstance processInstance;
     private org.drools.workflow.instance.NodeInstanceContainer nodeInstanceContainer;
@@ -68,10 +66,10 @@
     public long getNodeId() {
         return this.nodeId;
     }
-    
+
     public String getNodeName() {
-    	Node node = getNode();
-    	return node == null ? "" : node.getName();
+        Node node = getNode();
+        return node == null ? "" : node.getName();
     }
 
     public void setProcessInstance(final WorkflowProcessInstance processInstance) {
@@ -85,7 +83,7 @@
     public NodeInstanceContainer getNodeInstanceContainer() {
         return this.nodeInstanceContainer;
     }
-    
+
     public void setNodeInstanceContainer(NodeInstanceContainer nodeInstanceContainer) {
         this.nodeInstanceContainer = (org.drools.workflow.instance.NodeInstanceContainer) nodeInstanceContainer;
         if (nodeInstanceContainer != null) {
@@ -94,199 +92,184 @@
     }
 
     public Node getNode() {
-        return ((org.drools.workflow.core.NodeContainer)
-    		this.nodeInstanceContainer.getNodeContainer()).internalGetNode( this.nodeId );
+        return ((org.drools.workflow.core.NodeContainer) this.nodeInstanceContainer.getNodeContainer()).internalGetNode(this.nodeId);
     }
-    
+
     public boolean isInversionOfControl() {
         return false;
     }
-    
+
     public void cancel() {
         nodeInstanceContainer.removeNodeInstance(this);
     }
-    
+
     public final void trigger(NodeInstance from, String type) {
-    	boolean hidden = false;
-    	if (getNode().getMetaData().get("hidden") != null) {
-    		hidden = true;
-    	}
-    	InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
+        boolean hidden = false;
+        if (getNode().getMetaData().get("hidden") != null) {
+            hidden = true;
+        }
+        InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
         try {
+            if (!hidden) {
+                ((InternalProcessRuntime) kruntime.getProcessRuntime()).getProcessEventSupport().fireBeforeNodeTriggered(this, kruntime);
+            }
             internalTrigger(from, type);
+            if (!hidden) {
+                ((InternalProcessRuntime) kruntime.getProcessRuntime()).getProcessEventSupport().fireAfterNodeTriggered(this, kruntime);
+            }
         } catch (ProcessNodeExecutionException ex) {
             //We don't want to wrap a ProcessNodeExecutionException again.
             throw ex;
         } catch (Throwable t) {
             if (!hidden) {
-            	((InternalProcessRuntime) kruntime.getProcessRuntime())
-        		.getProcessEventSupport().fireRuleFlowNodeExceptionOccurred(processInstance, this, kruntime, t);
+                ((InternalProcessRuntime) kruntime.getProcessRuntime()).getProcessEventSupport().fireRuleFlowNodeExceptionOccurred(processInstance, this, kruntime, t);
             }
             //The exception is wrapped in a ProcessNodeExecutionException
             throw new ProcessNodeExecutionException(t);
         }
-    	
-    	if (!hidden) {
-    		((InternalProcessRuntime) kruntime.getProcessRuntime())
-    			.getProcessEventSupport().fireBeforeNodeTriggered(this, kruntime);
-    	}
-        internalTrigger(from, type);
-        if (!hidden) {
-        	((InternalProcessRuntime) kruntime.getProcessRuntime())
-        		.getProcessEventSupport().fireAfterNodeTriggered(this, kruntime);
-        }
+
+
     }
-    
+
     public abstract void internalTrigger(NodeInstance from, String type);
-    
+
     protected void triggerCompleted(String type, boolean remove) {
         if (remove) {
-            ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer())
-            	.removeNodeInstance(this);
+            ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this);
         }
         Node node = getNode();
         List<Connection> connections = null;
         if (node != null) {
-        	connections = node.getOutgoingConnections(type);
+            connections = node.getOutgoingConnections(type);
         }
         if (connections == null || connections.isEmpty()) {
-        	((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer())
-        		.nodeInstanceCompleted(this, type);
+            ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).nodeInstanceCompleted(this, type);
         } else {
-	        for (Connection connection: connections) {
-	        	// stop if this process instance has been aborted / completed
-	        	if (getProcessInstance().getState() != ProcessInstance.STATE_ACTIVE) {
-	        		return;
-	        	}
-	    		triggerConnection(connection);
-	        }
+            for (Connection connection : connections) {
+                // stop if this process instance has been aborted / completed
+                if (getProcessInstance().getState() != ProcessInstance.STATE_ACTIVE) {
+                    return;
+                }
+                triggerConnection(connection);
+            }
         }
     }
-    
+
     protected void triggerConnection(Connection connection) {
-    	boolean hidden = false;
-    	if (getNode().getMetaData().get("hidden") != null) {
-    		hidden = true;
-    	}
-    	InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
-    	if (!hidden) {
-    		((InternalProcessRuntime) kruntime.getProcessRuntime())
-    			.getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
-    	}
-    	// check for exclusive group first
-    	NodeInstanceContainer parent = getNodeInstanceContainer();
-    	if (parent instanceof ContextInstanceContainer) {
-    		List<ContextInstance> contextInstances = ((ContextInstanceContainer) parent).getContextInstances(ExclusiveGroup.EXCLUSIVE_GROUP);
-    		if (contextInstances != null) {
-    			for (ContextInstance contextInstance: new ArrayList<ContextInstance>(contextInstances)) {
-    				ExclusiveGroupInstance groupInstance = (ExclusiveGroupInstance) contextInstance;
-    				if (groupInstance.containsNodeInstance(this)) {
-    					for (NodeInstance nodeInstance: groupInstance.getNodeInstances()) {
-    						if (nodeInstance != this) {
-    							((org.drools.workflow.instance.NodeInstance) nodeInstance).cancel();
-    						}
-    					}
-    					((ContextInstanceContainer) parent).removeContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, contextInstance);
-    				}
-    				
-    			}
-    		}
-    	}
-    	// trigger next node
-        ((org.drools.workflow.instance.NodeInstance) ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer())
-        	.getNodeInstance(connection.getTo())).trigger(this, connection.getToType());
+        boolean hidden = false;
+        if (getNode().getMetaData().get("hidden") != null) {
+            hidden = true;
+        }
+        InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
         if (!hidden) {
-        	((InternalProcessRuntime) kruntime.getProcessRuntime())
-        		.getProcessEventSupport().fireAfterNodeLeft(this, kruntime);
+            ((InternalProcessRuntime) kruntime.getProcessRuntime()).getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
         }
+        // check for exclusive group first
+        NodeInstanceContainer parent = getNodeInstanceContainer();
+        if (parent instanceof ContextInstanceContainer) {
+            List<ContextInstance> contextInstances = ((ContextInstanceContainer) parent).getContextInstances(ExclusiveGroup.EXCLUSIVE_GROUP);
+            if (contextInstances != null) {
+                for (ContextInstance contextInstance : new ArrayList<ContextInstance>(contextInstances)) {
+                    ExclusiveGroupInstance groupInstance = (ExclusiveGroupInstance) contextInstance;
+                    if (groupInstance.containsNodeInstance(this)) {
+                        for (NodeInstance nodeInstance : groupInstance.getNodeInstances()) {
+                            if (nodeInstance != this) {
+                                ((org.drools.workflow.instance.NodeInstance) nodeInstance).cancel();
+                            }
+                        }
+                        ((ContextInstanceContainer) parent).removeContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, contextInstance);
+                    }
+
+                }
+            }
+        }
+        // trigger next node
+        ((org.drools.workflow.instance.NodeInstance) ((org.drools.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstance(connection.getTo())).trigger(this, connection.getToType());
+        if (!hidden) {
+            ((InternalProcessRuntime) kruntime.getProcessRuntime()).getProcessEventSupport().fireAfterNodeLeft(this, kruntime);
+        }
     }
-    
+
     public Context resolveContext(String contextId, Object param) {
         return ((NodeImpl) getNode()).resolveContext(contextId, param);
     }
-    
+
     public ContextInstance resolveContextInstance(String contextId, Object param) {
         Context context = resolveContext(contextId, param);
         if (context == null) {
             return null;
         }
-        ContextInstanceContainer contextInstanceContainer
-        	= getContextInstanceContainer(context.getContextContainer());
+        ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer(context.getContextContainer());
         if (contextInstanceContainer == null) {
-        	throw new IllegalArgumentException(
-    			"Could not find context instance container for context");
+            throw new IllegalArgumentException(
+                    "Could not find context instance container for context");
         }
         return contextInstanceContainer.getContextInstance(context);
     }
-    
+
     private ContextInstanceContainer getContextInstanceContainer(ContextContainer contextContainer) {
-    	ContextInstanceContainer contextInstanceContainer = null; 
-		if (this instanceof ContextInstanceContainer) {
-        	contextInstanceContainer = (ContextInstanceContainer) this;
+        ContextInstanceContainer contextInstanceContainer = null;
+        if (this instanceof ContextInstanceContainer) {
+            contextInstanceContainer = (ContextInstanceContainer) this;
         } else {
-        	contextInstanceContainer = getEnclosingContextInstanceContainer(this);
+            contextInstanceContainer = getEnclosingContextInstanceContainer(this);
         }
         while (contextInstanceContainer != null) {
-    		if (contextInstanceContainer.getContextContainer() == contextContainer) {
-    			return contextInstanceContainer;
-    		}
-    		contextInstanceContainer = getEnclosingContextInstanceContainer(
-				(NodeInstance) contextInstanceContainer);
-    	}
+            if (contextInstanceContainer.getContextContainer() == contextContainer) {
+                return contextInstanceContainer;
+            }
+            contextInstanceContainer = getEnclosingContextInstanceContainer(
+                    (NodeInstance) contextInstanceContainer);
+        }
         return null;
     }
-    
+
     private ContextInstanceContainer getEnclosingContextInstanceContainer(NodeInstance nodeInstance) {
-    	NodeInstanceContainer nodeInstanceContainer = nodeInstance.getNodeInstanceContainer();
-    	while (true) {
-    		if (nodeInstanceContainer instanceof ContextInstanceContainer) {
-    			return (ContextInstanceContainer) nodeInstanceContainer;
-    		}
-    		if (nodeInstanceContainer instanceof NodeInstance) {
-    			nodeInstanceContainer = ((NodeInstance) nodeInstanceContainer).getNodeInstanceContainer();
-    		} else {
-    			return null;
-    		}
-    	}
+        NodeInstanceContainer nodeInstanceContainer = nodeInstance.getNodeInstanceContainer();
+        while (true) {
+            if (nodeInstanceContainer instanceof ContextInstanceContainer) {
+                return (ContextInstanceContainer) nodeInstanceContainer;
+            }
+            if (nodeInstanceContainer instanceof NodeInstance) {
+                nodeInstanceContainer = ((NodeInstance) nodeInstanceContainer).getNodeInstanceContainer();
+            } else {
+                return null;
+            }
+        }
     }
-    
+
     public Object getVariable(String variableName) {
-    	VariableScopeInstance variableScope = (VariableScopeInstance)
-    		resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
-    	if (variableScope == null) {
-    		variableScope = (VariableScopeInstance) ((ProcessInstance) 
-    			getProcessInstance()).getContextInstance(VariableScope.VARIABLE_SCOPE);
-    	}
-    	return variableScope.getVariable(variableName);
+        VariableScopeInstance variableScope = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
+        if (variableScope == null) {
+            variableScope = (VariableScopeInstance) ((ProcessInstance) getProcessInstance()).getContextInstance(VariableScope.VARIABLE_SCOPE);
+        }
+        return variableScope.getVariable(variableName);
     }
-    
+
     public void setVariable(String variableName, Object value) {
-    	VariableScopeInstance variableScope = (VariableScopeInstance)
-    		resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
-    	if (variableScope == null) {
-    		variableScope = (VariableScopeInstance) getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE);
-    		if (variableScope.getVariableScope().findVariable(variableName) == null) {
-    			variableScope = null;
-    		}
-    	}
-    	if (variableScope == null) {
-    		System.err.println("Could not find variable " + variableName);
-    		System.err.println("Using process-level scope");
-    		variableScope = (VariableScopeInstance) ((ProcessInstance) 
-    			getProcessInstance()).getContextInstance(VariableScope.VARIABLE_SCOPE);
-    	}
-    	variableScope.setVariable(variableName, value);
+        VariableScopeInstance variableScope = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
+        if (variableScope == null) {
+            variableScope = (VariableScopeInstance) getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE);
+            if (variableScope.getVariableScope().findVariable(variableName) == null) {
+                variableScope = null;
+            }
+        }
+        if (variableScope == null) {
+            System.err.println("Could not find variable " + variableName);
+            System.err.println("Using process-level scope");
+            variableScope = (VariableScopeInstance) ((ProcessInstance) getProcessInstance()).getContextInstance(VariableScope.VARIABLE_SCOPE);
+        }
+        variableScope.setVariable(variableName, value);
     }
 
     public String getUniqueId() {
-    	String result = "" + getId();
-    	NodeInstanceContainer parent = getNodeInstanceContainer();
-    	while (parent instanceof CompositeNodeInstance) {
-    		CompositeNodeInstance nodeInstance = (CompositeNodeInstance) parent;
-    		result = nodeInstance.getId() + ":" + result;
-    		parent = nodeInstance.getNodeInstanceContainer();
-    	}
-    	return result;
+        String result = "" + getId();
+        NodeInstanceContainer parent = getNodeInstanceContainer();
+        while (parent instanceof CompositeNodeInstance) {
+            CompositeNodeInstance nodeInstance = (CompositeNodeInstance) parent;
+            result = nodeInstance.getId() + ":" + result;
+            parent = nodeInstance.getNodeInstanceContainer();
+        }
+        return result;
     }
-    
 }

Modified: labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-process/drools-bpmn2/src/test/java/org/drools/bpmn2/SimpleBPMNProcessTest.java
===================================================================
--- labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-process/drools-bpmn2/src/test/java/org/drools/bpmn2/SimpleBPMNProcessTest.java	2010-09-08 19:28:38 UTC (rev 35073)
+++ labs/jbossrules/branches/diega_esteban_jpm_integration_r34940/drools-process/drools-bpmn2/src/test/java/org/drools/bpmn2/SimpleBPMNProcessTest.java	2010-09-08 20:18:19 UTC (rev 35074)
@@ -45,6 +45,7 @@
 import org.drools.compiler.xml.XmlProcessReader;
 import org.drools.event.process.ProcessCompletedEvent;
 import org.drools.event.process.ProcessEventListener;
+import org.drools.event.process.ProcessNodeExceptionOccurredEvent;
 import org.drools.event.process.ProcessNodeLeftEvent;
 import org.drools.event.process.ProcessNodeTriggeredEvent;
 import org.drools.event.process.ProcessStartedEvent;
@@ -785,6 +786,9 @@
 			}
 			public void afterNodeLeft(ProcessNodeLeftEvent event) {
 			}
+
+                        public void processNodeExceptionOccurred(ProcessNodeExceptionOccurredEvent event) {
+                        }
 		});
 		Thread.sleep(250);
 		assertEquals(0, list.size());
@@ -817,6 +821,9 @@
 			}
 			public void afterNodeLeft(ProcessNodeLeftEvent event) {
 			}
+
+                        public void processNodeExceptionOccurred(ProcessNodeExceptionOccurredEvent event) {
+                        }
 		});
         ksession.signalEvent("MyStartSignal", "NewValue");
 		assertEquals(1, list.size());



More information about the jboss-svn-commits mailing list