[jbpm-commits] JBoss JBPM SVN: r5392 - in jbpm4/trunk/modules/bpmn/src: main/java/org/jbpm/bpmn/parser and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 30 12:49:05 EDT 2009


Author: kukeltje
Date: 2009-07-30 12:49:05 -0400 (Thu, 30 Jul 2009)
New Revision: 5392

Added:
   jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayInvalidConditionExpression.bpmn.xml
Modified:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
   jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java
   jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java
   jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml
   jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml
Log:
Basic form of conditionExpressions working with juel. Including tests

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -16,7 +16,7 @@
   String gatewayDirection = "unspeficied";
   boolean valid = true;
   
-  protected static final Log log = Log.getLog(ExclusiveGatewayBinding.class.getName());
+  protected static final Log log = Log.getLog(AbstractGatewayBinding.class.getName());
   static ObjectBinding objectBinding = new ObjectBinding();
   static WireParser wireParser = WireParser.getInstance();
 
@@ -48,7 +48,7 @@
             || ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1)));
 
     if (!valid) {
-      parse.addProblem("parallelGateway '" + elementName + "' has the wrong number of incomming (" + incomming + ") and outgoing (" + outgoing
+      parse.addProblem(tagName+ " '" + elementName + "' has the wrong number of incomming (" + incomming + ") and outgoing (" + outgoing
             + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
     }
     return valid;

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -38,7 +38,7 @@
 
   String gatewayDirection = "unspecified"; // is the default behaviour
   String default_ = null;
-
+  
   private static final long serialVersionUID = 1L;
 
   public void execute(ActivityExecution execution) {
@@ -46,28 +46,9 @@
   }
 
   public void execute(ExecutionImpl execution) {
-    Transition transition = findTransition(execution);
-    if (transition == null) {
-      throw new JbpmException("no outgoing transition condition evaluated to true for decision " + execution.getActivity());
-    }
-    if (transition.getName() != null) {
-      execution.historyDecision(transition.getName());
-    }
-    execution.take(transition);
+    leaveBpmnActivitySingle(execution);
   }
 
-  private Transition findTransition(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    for (Transition transition : outgoingTransitions) {
-      Condition condition = transition.getCondition();
-      if ((condition == null) || (condition.evaluate(execution))) {
-        return transition;
-      }
-    }
-    return null;
-  }
-
   public String getGatewayDirection() {
     return gatewayDirection;
   }

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -45,7 +45,10 @@
     super.parse(element);
     
     String default_ = null;
-
+    if (element.hasAttribute("default")) { 
+      default_ = element.getAttribute("default");
+    }
+    
     boolean defaultExists = false;
 
     List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
@@ -60,6 +63,9 @@
       if (elementId.equals(sourceRef)) {
         outgoing++;
         ce = XmlUtil.element(transitionElement, "conditionExpression");
+        
+        //TODO: Warn or error if CE is not of type tFormalExpression?
+        
         if (transitionElement.getAttribute("id").equals(default_)) {
           defaultExists = true;
           if (ce != null) {
@@ -82,7 +88,7 @@
     valid = valid == false ? false : validGatewayDirection;
 
     if (default_ != null && !defaultExists) {
-      parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' default sequenceFlow '" + default_
+      parse.addProblem("exclusiveGateway '" + elementName + "' default sequenceFlow '" + default_
               + "' does not exist or is not related to this node", element);
       valid = false;
     }

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -68,53 +68,9 @@
   }
   
   public void fork(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
 
-    // evaluate the conditions and find the transitions that should be forked
-    List<Transition> forkingTransitions = new ArrayList<Transition>();
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    for (Transition transition: outgoingTransitions) {
-      Condition condition = transition.getCondition();
-      if  ( (condition==null)
-            || (condition.evaluate(execution))
-          ) {
-        forkingTransitions.add(transition);
-      }
-    }
-
-    // if no outgoing transitions should be forked, 
-    if (forkingTransitions.size()==0) {
-      // end this execution
-      execution.end();
-      
-    // if there is exactly 1 transition to be taken, just use the incoming execution
-    } else if (forkingTransitions.size()==1) {
-      execution.take(forkingTransitions.get(0));
-      
-    // if there are more transitions
-    } else {
-      ExecutionImpl concurrentRoot = null;
-      if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
-        concurrentRoot = execution;
-        execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
-        execution.setActivity(null);
-      } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
-        concurrentRoot = execution.getParent();
-      }
-
-      for (Transition transition: forkingTransitions) {
-        // launch a concurrent path of execution
-        String childExecutionName = transition.getName();
-        ExecutionImpl concurrentExecution = concurrentRoot.createExecution(childExecutionName);
-        concurrentExecution.setActivity(activity);
-        concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
-        concurrentExecution.take(transition);
-        
-        if (concurrentRoot.isEnded()) {
-          break;
-        }
-      }
-    }
+    leaveBpmnActivityAll(execution);
+    
   }
   
   private void join(ExecutionImpl execution) {

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -47,6 +47,7 @@
 
 /**
  * @author Tom Baeyens
+ * @author Ronald van Kuijk (kukeltje)
  */
 public class TaskActivity extends BpmnActivity {
 
@@ -61,57 +62,9 @@
   }
 
   public void execute(ExecutionImpl execution) {
-    Activity activity = execution.getActivity();
 
-    // evaluate the conditions and find the transitions that should be forked
-    List<Transition> forkingTransitions = new ArrayList<Transition>();
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    for (Transition transition: outgoingTransitions) {
-      Condition condition = transition.getCondition();
-      if  ( (condition==null)
-            || (condition.evaluate(execution))
-          ) {
-        forkingTransitions.add(transition);
-      }
-    }
-
-    // if no outgoing transitions should be forked, 
-    if (forkingTransitions.size()==0) {
-      // end this execution
-      execution.end();
-      
-    // if there is exactly 1 transition to be taken, just use the incoming execution
-    } else if (forkingTransitions.size()==1) {
-      execution.take(forkingTransitions.get(0));
-      
-    // if there are more transitions
-    } else {
-      log.debug("forking more");
-      ExecutionImpl concurrentRoot = null;
-      if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
-        concurrentRoot = execution;
-        execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
-        execution.setActivity(null);
-      } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
-        concurrentRoot = execution.getParent();
-      }
-
-      for (Transition transition: forkingTransitions) {
-        // launch a concurrent path of execution
-        String childExecutionName = transition.getName();
-        ExecutionImpl concurrentExecution = concurrentRoot.createExecution(childExecutionName);
-        concurrentExecution.setActivity(activity);
-        concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
-        concurrentExecution.take(transition);
-        
-        if (concurrentRoot.isEnded()) {
-          break;
-        }
-      }
-    }
+    leaveBpmnActivity(execution);
     
-    
-    
   }
   
   public TaskDefinitionImpl getTaskDefinition() {

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -55,8 +55,7 @@
   protected Binding instantiateBinding(Element bindingElement, Parse parse) {
     String bindingClassName = XmlUtil.attribute(bindingElement, "binding", true, parse);
     
-    log.trace("1adding bpmn binding "+bindingClassName);
-    log.debug("2adding bpmn binding "+bindingClassName);
+    log.trace("adding bpmn binding "+bindingClassName);
     
     if (bindingClassName!=null) {
       try {

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -29,8 +29,7 @@
 import org.jbpm.api.activity.ActivityBehaviour;
 import org.jbpm.bpmn.flownodes.BpmnBinding;
 import org.jbpm.bpmn.model.BpmnProcessDefinition;
-import org.jbpm.internal.log.Log;
-//import org.jbpm.jpdl.internal.activity.JpdlBinding;
+import org.jbpm.internal.log.Log; //import org.jbpm.jpdl.internal.activity.JpdlBinding;
 //import org.jbpm.jpdl.internal.xml.BindingsParser;
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.model.CompositeElementImpl;
@@ -42,13 +41,16 @@
 import org.jbpm.pvm.internal.util.ReflectUtil;
 import org.jbpm.pvm.internal.util.TagBinding;
 import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
 import org.jbpm.pvm.internal.wire.xml.WireParser;
 import org.jbpm.pvm.internal.xml.Bindings;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
 import org.w3c.dom.Element;
 
-
 /**
  * @author Tom Baeyens
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
@@ -56,7 +58,8 @@
 public class BpmnParser extends Parser {
 
   private static final Log log = Log.getLog(BpmnParser.class.getName());
-  
+
+  static ObjectBinding objectBinding = new ObjectBinding();
   public static final WireParser wireParser = WireParser.getInstance();
 
   // array elements are mutable, even when final
@@ -74,26 +77,25 @@
     setSchemaResources(schemaResources);
   }
 
-
   public Object parseDocumentElement(Element documentElement, Parse parse) {
     List<ProcessDefinitionImpl> processDefinitions = new ArrayList<ProcessDefinitionImpl>();
 
     parseDefinition(documentElement, parse);
-    
-    for (Element processElement: XmlUtil.elements(documentElement, "process")) {
+
+    for (Element processElement : XmlUtil.elements(documentElement, "process")) {
       ProcessDefinitionImpl processDefinition = parseProcess(processElement, parse);
       processDefinitions.add(processDefinition);
     }
-    
+
     return processDefinitions;
   }
 
   public ProcessDefinitionImpl parseProcess(Element processElement, Parse parse) {
     BpmnProcessDefinition processDefinition = new BpmnProcessDefinition();
-    
+
     parse.pushObject(processDefinition);
     try {
-      
+
       // process attribues
       String name = XmlUtil.attribute(processElement, "name", true, parse);
       processDefinition.setName(name);
@@ -116,19 +118,16 @@
 
       // bind activities to their destinations
       parseTransitions(processElement, parse, processDefinition);
-      
+
     } finally {
       parse.popObject();
     }
-    
+
     return processDefinition;
   }
-  
-  
-  ///////////////////////////////////////////////////////////////////////////////////////////
-  
-  
-  
+
+  // /////////////////////////////////////////////////////////////////////////////////////////
+
   protected void parseBindings() {
     Bindings bindings = new Bindings();
     setBindings(bindings);
@@ -139,12 +138,8 @@
         while (resourceUrls.hasMoreElements()) {
           URL resourceUrl = resourceUrls.nextElement();
           log.trace("loading bpmn activities from resource: " + resourceUrl);
-          List<BpmnBinding> activityBindings = (List<BpmnBinding>) bindingsParser
-              .createParse()
-              .setUrl(resourceUrl)
-              .execute()
-              .checkErrors("bpmn activities from " + resourceUrl.toString())
-              .getDocumentObject();
+          List<BpmnBinding> activityBindings = (List<BpmnBinding>) bindingsParser.createParse().setUrl(resourceUrl).execute().checkErrors(
+                  "bpmn activities from " + resourceUrl.toString()).getDocumentObject();
 
           for (TagBinding binding : activityBindings) {
             binding.setCategory(CATEGORY_ACTIVITY);
@@ -211,17 +206,35 @@
       String sourceRef = XmlUtil.attribute(transitionElement, "sourceRef", true, parse);
       String targetRef = XmlUtil.attribute(transitionElement, "targetRef", true, parse);
 
-      log.debug(transitionId + ": " + sourceRef + " -> " + targetRef);      
-      log.debug("    with " + XmlUtil.elements(transitionElement, "conditionExpression").size() + " conditionExpressions");
+      log.trace(transitionId + ": " + sourceRef + " -> " + targetRef);
+      Element conditionElement = XmlUtil.element(transitionElement, "conditionExpression");
+      log.trace("    with " + ((conditionElement == null) ? "0" : "1") + " conditionExpression");
       
       TransitionImpl transition = compositeElement.findActivity(sourceRef).createOutgoingTransition();
+      
+      // 8.2.5 of the spec document
+      if (conditionElement != null) {
+        String type = conditionElement.getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "type");
+        if ("bpmn:tFormalExpression".equals(type)) {
+          
+          String expr = conditionElement.getTextContent();
+          String lang = XmlUtil.attribute(conditionElement, "language");
+          // TODO: add looking up the default language in the document if lang is null.
+          ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
+          transition.setConditionDescriptor(expressionDescriptor);
+          
+        } else {
+          parse.addProblem("Type of the conditionExpression on sequenceFlow with id=" + transitionId + " is of onsupported type 'bpmn:tExpression'", transitionElement);
+        }
+      }
+
+      //compositeElement.findActivity(sourceRef).add
       compositeElement.findActivity(targetRef).addIncomingTransition(transition);
 
       transition.setName(transitionId);
       transition.setDescription(transitionName);
     }
   }
-
   public void parseDefinition(Element documentElement, Parse parse) {
     parseImports(documentElement, parse);
     parseItemDefinitions(documentElement, parse);

Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -21,14 +21,20 @@
  */
 package org.jbpm.bpmn.flownodes;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.TaskQuery;
+import org.jbpm.api.task.Task;
 import org.jbpm.bpmn.parser.BpmnParser;
 import org.jbpm.pvm.internal.xml.Problem;
 import org.jbpm.test.JbpmTestCase;
 
 /**
  * @author Tom Baeyens
+ * @author Ronald van Kuijk (kukeltje)
  */
 public class ExclusiveGatewayTest extends JbpmTestCase {
 
@@ -49,7 +55,45 @@
       fail("No problems should have occured. Problems: " + problems);
     }
   }
+  
+  public void testNormalExecute() {
 
+    String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml").deploy();
+
+    try {
+        Map variables = new HashMap();
+        
+        variables.put("test", "value");
+        
+        ProcessInstance pi = executionService.startProcessInstanceByKey("ExclusiveGateway", variables );
+        
+        String pid = pi.getId();
+        
+                        
+        TaskQuery taskQuery = taskService.createTaskQuery();
+        List<Task> allTasks = taskQuery.list();
+
+        // since the uncontrolled sequence flow OUT of the activity behaves as a fork
+        // we now have two tasks
+        assertEquals(1, allTasks.size());
+        assertEquals("doSomething", allTasks.get(0).getActivityName());
+        //assertEquals("doSomethingElse", allTasks.get(1).getActivityName());
+        
+        // specifying a transition is unnecessary, BPMN has outgoing AND semantic!
+        // TODO: fix
+        // Currently not passing any 'outcome'
+        taskService.completeTask( allTasks.get(0).getId());
+        
+        pi = executionService.findProcessInstanceById(pid);
+        // process instance should be ended
+        assertNull(pi);
+        
+    }
+    finally {
+        repositoryService.deleteDeploymentCascade(deploymentId);
+    }
+  }
+
   public void testNonBoundDefault() {
 
     List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayNonBoundDefault.bpmn.xml");
@@ -93,8 +137,6 @@
     }
   }
   
-  
-  
   public void testConvergingInvalid() {
 
     List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml");
@@ -102,7 +144,7 @@
     if ((problems == null) || (problems.isEmpty())) {
       fail("expected problems during parse");
     } else {
-      assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='converging'", problems.get(0).getMsg());
+      assertTextPresent("Gateway 'Just a gateway' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='converging'", problems.get(0).getMsg());
     }
   }
 
@@ -116,5 +158,16 @@
       assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (2) and outgoing (2) transitions for gatewayDirection='diverging'", problems.get(0).getMsg());
     }
   }
+  
+  public void testInvalidConditionExpression() {
 
+    List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayInvalidConditionExpression.bpmn.xml");
+
+    if ((problems == null) || (problems.isEmpty())) {
+      fail("expected problems during parse");
+    } else {
+      assertTextPresent("Type of the conditionExpression on sequenceFlow with id=flow2 is of onsupported type 'bpmn:tExpression", problems.get(0).getMsg());
+    }
+  }
+
 }

Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java	2009-07-30 16:49:05 UTC (rev 5392)
@@ -25,13 +25,8 @@
 
 import org.jbpm.api.ProcessInstance;
 import org.jbpm.api.TaskQuery;
-import org.jbpm.api.history.HistoryProcessInstance;
 import org.jbpm.api.task.Task;
-import org.jbpm.bpmn.model.BpmnProcessDefinition;
 import org.jbpm.bpmn.parser.BpmnParser;
-import org.jbpm.pvm.internal.client.ClientProcessInstance;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Problem;
 import org.jbpm.test.JbpmTestCase;
 

Modified: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml	2009-07-30 16:49:05 UTC (rev 5392)
@@ -5,29 +5,25 @@
 	xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
 	expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
 
-	<bpmn:process id="Shipment" name="Shipment">
+	<bpmn:process id="ExclusiveGateway" name="ExclusiveGateway">
 		<!-- Start-Event -->
 		<bpmn:startEvent id="Start" />
 
 		<bpmn:sequenceFlow id="flow1" sourceRef="Start"
-			targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+			targetRef="exclusiveGatewayDecision" name="Start->exclusiveGateway" />
 
-		<bpmn:exclusiveGateway id="exclusiveGateway"
+		<bpmn:exclusiveGateway id="exclusiveGatewayDecision"
 			name="Just a gateway" />
 
 		<!-- Sequence Flow -->
 
-		<bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+		<bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGatewayDecision"
 			targetRef="doSomething">
-			<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
-				getDataObject('lieferungVariable')/confirmationRequired=true
-			</bpmn:conditionExpression>
+			<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${test == 'value'}</bpmn:conditionExpression>
 		</bpmn:sequenceFlow>
-		<bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+		<bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGatewayDecision"
 			targetRef="doSomethingElse">
-			<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not(
-				getDataObject('lieferungVariable')/confirmationRequired=true )
-			</bpmn:conditionExpression>
+			<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${test == 'other'}</bpmn:conditionExpression>
 		</bpmn:sequenceFlow>
 
 		<bpmn:userTask id="doSomething" name="Anything at all"

Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayInvalidConditionExpression.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayInvalidConditionExpression.bpmn.xml	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayInvalidConditionExpression.bpmn.xml	2009-07-30 16:49:05 UTC (rev 5392)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+	xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+	expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+	<bpmn:process id="Shipment" name="Shipment">
+		<!-- Start-Event -->
+		<bpmn:startEvent id="Start" />
+
+		<bpmn:sequenceFlow id="flow1" sourceRef="Start"
+			targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+		<bpmn:exclusiveGateway id="exclusiveGateway"
+			name="Just a gateway" />
+
+		<!-- Sequence Flow -->
+
+		<bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+			targetRef="doSomething">
+			<bpmn:conditionExpression xsi:type="bpmn:tExpression">
+				getDataObject('lieferungVariable')/confirmationRequired=true
+			</bpmn:conditionExpression>
+		</bpmn:sequenceFlow>
+		<bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+			targetRef="doSomethingElse">
+			<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression" >not(
+				getDataObject('lieferungVariable')/confirmationRequired=true )
+			</bpmn:conditionExpression>
+		</bpmn:sequenceFlow>
+
+		<bpmn:userTask id="doSomething" name="Anything at all"
+			implementation="other"></bpmn:userTask>
+		<bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+			targetRef="End" />
+
+		<bpmn:userTask id="doSomethingElse" name="But completely different"
+			implementation="other" />
+		<bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+			targetRef="End" />
+
+		<!-- End Events -->
+		<bpmn:endEvent id="End" name="End" />
+	</bpmn:process>
+</bpmn:definitions>

Modified: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml	2009-07-30 12:33:46 UTC (rev 5391)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml	2009-07-30 16:49:05 UTC (rev 5392)
@@ -26,13 +26,13 @@
 
 		<bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
 			targetRef="doSomething">
-			<bpmn:conditionExpression xsi:type="bpmn:tExpression">
+			<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
 				Has to be valid
 			</bpmn:conditionExpression>
 		</bpmn:sequenceFlow>
 		<bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
 			targetRef="doSomethingElse">
-			<bpmn:conditionExpression xsi:type="bpmn:tExpression">
+			<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
 				Otherwise this one
 			</bpmn:conditionExpression>
 		</bpmn:sequenceFlow>



More information about the jbpm-commits mailing list