JBoss JBPM SVN: r5394 - projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/src/main/java/org/jbpm/jsf/core/action.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-30 13:33:24 -0400 (Thu, 30 Jul 2009)
New Revision: 5394
Modified:
projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/src/main/java/org/jbpm/jsf/core/action/DeployProcessActionListener.java
Log:
[JBPM-2460] sub-process name is not resolved upon deployment with the jbpm-console
retrieve jbpm context before parsing process definition
Modified: projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/src/main/java/org/jbpm/jsf/core/action/DeployProcessActionListener.java
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/src/main/java/org/jbpm/jsf/core/action/DeployProcessActionListener.java 2009-07-30 16:50:20 UTC (rev 5393)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/jbpm4jsf/src/main/java/org/jbpm/jsf/core/action/DeployProcessActionListener.java 2009-07-30 17:33:24 UTC (rev 5394)
@@ -55,14 +55,14 @@
try {
ZipInputStream zis = new ZipInputStream(inputStream);
try {
+ final JbpmContext jbpmContext = context.getJbpmContext();
processDefinition = ProcessDefinition.parseParZipInputStream(zis);
- final JbpmContext jbpmContext = context.getJbpmContext();
jbpmContext.deployProcessDefinition(processDefinition);
} finally {
try {
zis.close();
} catch (IOException e) {
- log.warning("Error closing zip Ninput stream after deploy: " + e.getMessage());
+ log.warning("Error closing zip input stream after deploy: " + e.getMessage());
}
}
} finally {
14 years, 9 months
JBoss JBPM SVN: r5393 - jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-30 12:50:20 -0400 (Thu, 30 Jul 2009)
New Revision: 5393
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
Log:
Basic form of conditionExpressions working with juel. Including tests
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-07-30 16:49:05 UTC (rev 5392)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-07-30 16:50:20 UTC (rev 5393)
@@ -25,7 +25,10 @@
import java.util.List;
import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.bpmn.parser.BindingsParser;
+import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.model.Activity;
import org.jbpm.pvm.internal.model.Condition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -35,72 +38,108 @@
* Basic activity for BPMN activities (tasks, gateways and event)
*
* @author bernd.ruecker(a)camunda.com
+ * @author Ronald van Kuijk (kukeltje)
*/
public abstract class BpmnActivity implements ActivityBehaviour {
- private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(BindingsParser.class.getName());
+
+ private static final long serialVersionUID = 1L;
- public void leaveBpmnActivity(ExecutionImpl execution) {
- // TODO: Move to AbstractTask? Different in Gateway...
- // TODO: must be used!
- proceedForked(execution);
+ private static final boolean FORK_ALLOWED = true;
+ private static final boolean FORK_DISALLOWED = !FORK_ALLOWED;
+ private static final boolean CONDITIONS_CHECKED = true;
+ private static final boolean CONDITIONS_IGNORED = !CONDITIONS_CHECKED;
+
+ protected void leaveBpmnActivity(ExecutionImpl execution) {
+
+ proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_CHECKED);
+
+ }
+
+ protected void leaveBpmnActivitySingle(ExecutionImpl execution) {
+
+ proceedForkedIfAllowed(execution, FORK_DISALLOWED, CONDITIONS_CHECKED);
+
+ }
+
+ protected void leaveBpmnActivityAll(ExecutionImpl execution) {
+
+ proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_IGNORED);
+
+ }
+
+ /**
+ * In BPMN multiple outgoing sequence flows behave like a fork.
+ *
+ * Code copied basically from jPDL fork.
+ */
+ private void proceedForkedIfAllowed(ExecutionImpl execution, boolean forkAllowed, boolean checkConditions) {
+ 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) || (!checkConditions) || (condition.evaluate(execution)) ) {
+ forkingTransitions.add(transition);
+ }
}
+ log.debug(forkingTransitions.size() + " out of "+ outgoingTransitions.size() + " selected for " + activity.getName());
+
+ // if no outgoing transitions should be forked,
+ if (forkingTransitions.size() == 0) {
+ // end this execution
+ execution.end();
- /**
- * In BPMN multiple outgoing sequence flows behave like a fork.
- *
- * Code copied basically from jPDL fork.
- */
- public void proceedForked(ExecutionImpl execution) {
- Activity activity = execution.getActivity();
+ // if there is exactly 1 transition to be taken, just use the incoming
+ // execution
+ } else if (forkingTransitions.size() == 1) {
+ execution.take(forkingTransitions.get(0));
- // 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 there are more transitions
+ } else {
+ if (forkAllowed) {
+ 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();
+ }
- // if no outgoing transitions should be forked,
- if (forkingTransitions.size() == 0) {
- // end this execution
- execution.end();
+ 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 there is exactly 1 transition to be taken, just use the
- // incoming execution
- }
- else if (forkingTransitions.size() == 1) {
- execution.take(forkingTransitions.get(0));
+ if (concurrentRoot.isEnded()) {
+ break;
+ }
+ }
+ } else {
+ throw new JbpmException("To many outgoing transition conditions evaluated to true for " + execution.getActivity());
+ }
+ }
- // 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);
+ protected List<Transition> findTransitions(ExecutionImpl execution, Activity activity) {
- if (concurrentRoot.isEnded()) {
- break;
- }
- }
- }
+ 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);
+ }
}
-}
+ return forkingTransitions;
+
+ }
+}
\ No newline at end of file
14 years, 9 months
JBoss JBPM SVN: r5392 - in jbpm4/trunk/modules/bpmn/src: main/java/org/jbpm/bpmn/parser and 2 other directories.
by do-not-reply@jboss.org
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(a)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>
14 years, 9 months
JBoss JBPM SVN: r5391 - jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes.
by do-not-reply@jboss.org
Author: camunda
Date: 2009-07-30 08:33:46 -0400 (Thu, 30 Jul 2009)
New Revision: 5391
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java
Log:
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java 2009-07-30 12:32:04 UTC (rev 5390)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java 2009-07-30 12:33:46 UTC (rev 5391)
@@ -1,10 +1,27 @@
package org.jbpm.bpmn.flownodes;
-public abstract class AbstractTaskBinding extends BpmnBinding {
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
-
- public AbstractTaskBinding(String tag) {
- super(tag);
+/**
+ * The AbstractTask is the task superclass and doesn't define own
+ * Behavior.
+ *
+ * Spec: A Task which is not further specified is called Abstract
+ * Task (this was referred to as the None Task in BPMN 1.2).
+ *
+ * @author bernd.ruecker(a)camunda.com
+ */
+public class AbstractTaskBinding extends BpmnBinding {
+
+ public AbstractTaskBinding(String tagName) {
+ super(tagName);
}
-
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ManualTaskActivity();
+ }
+
+
}
\ No newline at end of file
14 years, 9 months
JBoss JBPM SVN: r5390 - in jbpm4/trunk/modules/bpmn/src: test/java/org/jbpm/bpmn/flownodes and 1 other directories.
by do-not-reply@jboss.org
Author: camunda
Date: 2009-07-30 08:32:04 -0400 (Thu, 30 Jul 2009)
New Revision: 5390
Added:
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.java.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.ws.bpmn.xml
Removed:
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.bpmn.xml
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java
Log:
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-07-30 11:51:09 UTC (rev 5389)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-07-30 12:32:04 UTC (rev 5390)
@@ -21,13 +21,86 @@
*/
package org.jbpm.bpmn.flownodes;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.api.Execution;
import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.Condition;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
/**
- * @author Tom Baeyens
+ * Basic activity for BPMN activities (tasks, gateways and event)
+ *
+ * @author bernd.ruecker(a)camunda.com
*/
public abstract class BpmnActivity implements ActivityBehaviour {
-
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+
+ public void leaveBpmnActivity(ExecutionImpl execution) {
+ // TODO: Move to AbstractTask? Different in Gateway...
+ // TODO: must be used!
+ proceedForked(execution);
+ }
+
+ /**
+ * In BPMN multiple outgoing sequence flows behave like a fork.
+ *
+ * Code copied basically from jPDL fork.
+ */
+ public void proceedForked(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;
+ }
+ }
+ }
+ }
}
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 11:51:09 UTC (rev 5389)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java 2009-07-30 12:32:04 UTC (rev 5390)
@@ -111,40 +111,4 @@
}
}
- public void testUncontrolledSequenceFlowAsFork() {
- String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml").deploy();
-
- try {
- ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowProcess");
-
- 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(2, allTasks.size());
- assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
- assertEquals("UserTaskLeg2", 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());
- taskService.completeTask( allTasks.get(1).getId());
-
- assertEquals(0, taskQuery.list().size());
-
- pi = executionService.findProcessInstanceById(pid);
- // process instance is ended
- assertNull(pi);
-
-
- }
- finally {
- repositoryService.deleteDeploymentCascade(deploymentId);
- }
-
- }
}
Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java 2009-07-30 11:51:09 UTC (rev 5389)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java 2009-07-30 12:32:04 UTC (rev 5390)
@@ -31,7 +31,6 @@
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;
/**
@@ -79,14 +78,57 @@
// TODO: fix
taskService.completeTask( allTasks.get(0).getId(), "flow2" );
+ assertEquals(0, taskQuery.list().size());
+
+ // process instance is ended
pi = executionService.findProcessInstanceById(pi.getId());
+ assertEquals(true, pi.isEnded());
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+ /**
+ * check that multiple outgoing sequence flows will be handled as fork, like specified in BPMN
+ *
+ * Check with user tasks, sicne the engine stops there for sure.
+ */
+ public void testUncontrolledSequenceFlowAsFork() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml").deploy();
+
+ try {
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowProcess");
+ 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(2, allTasks.size());
+ assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
+ assertEquals("UserTaskLeg2", 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()); // define output / flow?
+ taskService.completeTask( allTasks.get(1).getId());
+
+ assertEquals(0, taskQuery.list().size());
+
+ pi = executionService.findProcessInstanceById(pid);
// process instance is ended
assertNull(pi);
+
+
}
finally {
repositoryService.deleteDeploymentCascade(deploymentId);
}
- }
+ }
+
}
Deleted: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.bpmn.xml 2009-07-30 11:51:09 UTC (rev 5389)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.bpmn.xml 2009-07-30 12:32:04 UTC (rev 5390)
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions id="ShipmentDefinitions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\BPMN20.xsd" xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" xmlns:sample="http://sample.bpmn.camunda.com/" xmlns:xbpmn="http://bpmn.camunda.com/" xmlns:tns="http://sample.bpmn.camunda.com/" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
-
- <!-- imports -->
- <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
- <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
- <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\ShipmentProcessService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
-
- <!-- definition structures for process variables -->
- <bpmn:itemDefinition id="lieferungDef" itemKind="Information" structureRef="sample:shipment"/>
-
- <!-- definition structures for messages -->
- <bpmn:itemDefinition id="ProzessStartenDef" itemKind="Information" structureRef="sample:startShipmentProces"/>
- <bpmn:itemDefinition id="LieferungAnlegenDef" itemKind="Information" structureRef="sample:createShipment"/>
- <bpmn:itemDefinition id="KommissioniertDef" itemKind="Information" structureRef="sample:notifyShipmentConsigned"/>
-
- <!-- messages -->
- <bpmn:message name="ProzessStarten" id="ProzessStartenNachricht" structureRef="tns:ProzessStartenDef"/>
- <bpmn:message name="LieferungAnlegen" id="LieferungAnlegenNachricht" structureRef="tns:LieferungAnlegenDef"/>
- <bpmn:message name="Kommissioniert" id="KommissioniertNachricht" structureRef="tns:KommissioniertDef"/>
-
- <!-- Services -->
- <!-- serivceReference ?? -->
- <!-- conversation? Participant? -->
-
- <bpmn:endPoint id="ProzessEndpoint">
- <xbpmn:url/>
- </bpmn:endPoint>
- <bpmn:endPoint id="LiefersystemEndpoint">
- <xbpmn:url/>
- </bpmn:endPoint>
-
- <!-- interfaces -->
- <bpmn:interface id="ProzessInterface" name="Lieferprozess Schnittstelle">
- <bpmn:operation name="startShipmentProcess">
- <bpmn:inMessageRef>tns:ProzessStartenNachricht</bpmn:inMessageRef>
- </bpmn:operation>
- <bpmn:operation name="notifyShipmentConsigned">
- <bpmn:inMessageRef>tns:KommissioniertNachricht</bpmn:inMessageRef>
- </bpmn:operation>
- </bpmn:interface>
- <bpmn:interface id="LiefersystemInterface" name="Liefersystem Schnittstelle">
- <bpmn:operation name="createShiptment">
- <bpmn:inMessageRef>tns:LieferungAnlegenNachricht</bpmn:inMessageRef>
- </bpmn:operation>
- </bpmn:interface>
- <!-- Resources / Performers -->
- <bpmn:resource id="VertriebResource" name="Vertrieb"/>
- <!-- process definition -->
- <bpmn:process id="Shipment" name="Shipment">
- <bpmn:documentation id="doc1">Teilprozess der Lieferung</bpmn:documentation>
-
- <!-- process variables -->
- <bpmn:dataObject id="lieferungVariable" name="Lieferung" itemSubjectRef="tns:lieferungDef"/>
-
- <!-- Start-Event -->
- <bpmn:startEvent id="Start">
- <bpmn:dataOutput id="ProzessStartOutput" itemSubjectRef="tns:ProzessStartenNachricht"/>
- <bpmn:dataOutputAssociation>
- <bpmn:assignment>
- <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('ProzessStartOutput')/shipment</bpmn:from>
- <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
- </bpmn:assignment>
- <bpmn:sourceRef>ProzessStartOutput</bpmn:sourceRef>
- <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
- </bpmn:dataOutputAssociation>
- <bpmn:messageEventDefinition messageRef="tns:ProzessStartenNachricht">
- <bpmn:operationRef>tns:startShipmentProcess</bpmn:operationRef>
- </bpmn:messageEventDefinition>
- </bpmn:startEvent>
-
- <!-- Activity 1: Service Task -->
- <bpmn:serviceTask id="LieferungBuchen" name="Lieferung buchen" implementation="WebService" operationRef="createShipment">
- <xbpmn:url/>
- <bpmn:ioSpecification>
- <bpmn:dataInput id="LieferungBuchenInput" isCollection="false" itemSubjectRef="tns:LieferungAnlegenNachricht"/>
- <bpmn:inputSet>
- <bpmn:dataInputRefs>LieferungBuchenInput</bpmn:dataInputRefs>
- </bpmn:inputSet>
- <bpmn:outputSet/>
- </bpmn:ioSpecification>
- <bpmn:dataInputAssociation>
- <bpmn:assignment>
- <bpmn:from xsi:type="bpmn:tFormalExpression">bpmn:getDataObject('lieferungVariable')</bpmn:from>
- <bpmn:to xsi:type="bpmn:tFormalExpression">bpmn:getDataInput('LieferungBuchenInput'/shipment/</bpmn:to>
- </bpmn:assignment>
- <bpmn:sourceRef>tns:lieferungVariable</bpmn:sourceRef>
- <bpmn:targetRef>LieferungBuchenInput</bpmn:targetRef>
- </bpmn:dataInputAssociation>
- </bpmn:serviceTask>
-
- <!-- Activity 2: Receive Task -->
- <bpmn:receiveTask id="WartenAufLieferung" name="Warten auf Lieferung" instantiate="false" implementation="WebService" operationRef="notifyShipmentConsigned" messageRef="tns:Kommissioniert">
- <bpmn:ioSpecification>
- <bpmn:dataOutput id="KommissioniertOutput" itemSubjectRef="tns:KommissioniertNachricht"/>
- <bpmn:inputSet/>
- <bpmn:outputSet>
- <bpmn:dataOutputRefs>KommissioniertOutput</bpmn:dataOutputRefs>
- </bpmn:outputSet>
- </bpmn:ioSpecification>
-
- <bpmn:dataOutputAssociation>
- <bpmn:assignment>
- <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('KommissioniertOutput')/shipment</bpmn:from>
- <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
- </bpmn:assignment>
- <bpmn:sourceRef>KommissioniertOutput</bpmn:sourceRef>
- <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
- </bpmn:dataOutputAssociation>
- </bpmn:receiveTask>
-
- <!-- Gateway -->
- <bpmn:exclusiveGateway id="PruefeAvisierung" name="Avisierung benoetigt?"/>
-
- <!-- Activity 3: User Task -->
- <bpmn:userTask id="LieferterminAvisieren" name="Liefertermin avisieren" implementation="other">
- <!-- <bpmn:humanPerformer resourceRef="tns:Vertrieb"></bpmn:humanPerformer>-->
- <bpmn:potentialOwner resourceRef="tns:VertriebResource"/>
- </bpmn:userTask>
-
- <!-- End Events -->
- <bpmn:endEvent id="End" name="End"/>
-
- <!-- Sequence Flow -->
- <bpmn:sequenceFlow id="flow1" sourceRef="Start" targetRef="LieferungBuchen" name="Start->LieferungBuchen"/>
- <bpmn:sequenceFlow id="flow2" sourceRef="LieferungBuchen" targetRef="WartenAufLieferung"/>
- <bpmn:sequenceFlow id="flow3" sourceRef="WartenAufLieferung" targetRef="PruefeAvisierung"/>
- <bpmn:sequenceFlow id="flow4" sourceRef="PruefeAvisierung" targetRef="LieferterminAvisieren">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')/confirmationRequired=true</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="flow5" sourceRef="PruefeAvisierung" targetRef="End">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not( getDataObject('lieferungVariable')/confirmationRequired=true )</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="flow6" sourceRef="LieferterminAvisieren" targetRef="End"/>
- </bpmn:process>
-
-<!--
- <bpmn:correlationSubscription>
- </bpmn:correlationSubscription>
--->
-
- <!-- TODO: Correlation / Conversation -->
- <bpmn:conversation>
- <bpmn:correlationKey>
- <bpmn:correlationPropertyRef>test</bpmn:correlationPropertyRef>
- </bpmn:correlationKey>
- </bpmn:conversation>
-</bpmn:definitions>
Copied: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.java.bpmn.xml (from rev 5381, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.java.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.java.bpmn.xml 2009-07-30 12:32:04 UTC (rev 5390)
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ShipmentDefinitions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\BPMN20.xsd" xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" xmlns:sample="http://sample.bpmn.camunda.com/" xmlns:xbpmn="http://bpmn.camunda.com/" xmlns:tns="http://sample.bpmn.camunda.com/" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <!-- imports -->
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\ShipmentProcessService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
+
+ <!-- definition structures for process variables -->
+ <bpmn:itemDefinition id="lieferungDef" itemKind="Information" structureRef="sample:shipment"/>
+
+ <!-- definition structures for messages -->
+ <bpmn:itemDefinition id="ProzessStartenDef" itemKind="Information" structureRef="sample:startShipmentProces"/>
+ <bpmn:itemDefinition id="LieferungAnlegenDef" itemKind="Information" structureRef="sample:createShipment"/>
+ <bpmn:itemDefinition id="KommissioniertDef" itemKind="Information" structureRef="sample:notifyShipmentConsigned"/>
+
+ <!-- messages -->
+ <bpmn:message name="ProzessStarten" id="ProzessStartenNachricht" structureRef="tns:ProzessStartenDef"/>
+ <bpmn:message name="LieferungAnlegen" id="LieferungAnlegenNachricht" structureRef="tns:LieferungAnlegenDef"/>
+ <bpmn:message name="Kommissioniert" id="KommissioniertNachricht" structureRef="tns:KommissioniertDef"/>
+
+ <!-- Services -->
+ <!-- serivceReference ?? -->
+ <!-- conversation? Participant? -->
+
+ <bpmn:endPoint id="ProzessEndpoint">
+ <xbpmn:url/>
+ </bpmn:endPoint>
+ <bpmn:endPoint id="LiefersystemEndpoint">
+ <xbpmn:url/>
+ </bpmn:endPoint>
+
+ <!-- interfaces -->
+ <bpmn:interface id="ProzessInterface" name="Lieferprozess Schnittstelle">
+ <bpmn:operation name="startShipmentProcess">
+ <bpmn:inMessageRef>tns:ProzessStartenNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ <bpmn:operation name="notifyShipmentConsigned">
+ <bpmn:inMessageRef>tns:KommissioniertNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+ <bpmn:interface id="LiefersystemInterface" name="Liefersystem Schnittstelle">
+ <bpmn:operation name="createShiptment">
+ <bpmn:inMessageRef>tns:LieferungAnlegenNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+ <!-- Resources / Performers -->
+ <bpmn:resource id="VertriebResource" name="Vertrieb"/>
+ <!-- process definition -->
+ <bpmn:process id="Shipment" name="Shipment">
+ <bpmn:documentation id="doc1">Teilprozess der Lieferung</bpmn:documentation>
+
+ <!-- process variables -->
+ <bpmn:dataObject id="lieferungVariable" name="Lieferung" itemSubjectRef="tns:lieferungDef"/>
+
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start">
+ <bpmn:dataOutput id="ProzessStartOutput" itemSubjectRef="tns:ProzessStartenNachricht"/>
+ <bpmn:dataOutputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('ProzessStartOutput')/shipment</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>ProzessStartOutput</bpmn:sourceRef>
+ <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
+ </bpmn:dataOutputAssociation>
+ <bpmn:messageEventDefinition messageRef="tns:ProzessStartenNachricht">
+ <bpmn:operationRef>tns:startShipmentProcess</bpmn:operationRef>
+ </bpmn:messageEventDefinition>
+ </bpmn:startEvent>
+
+ <!-- Activity 1: Service Task -->
+ <bpmn:serviceTask id="LieferungBuchen" name="Lieferung buchen" implementation="WebService" operationRef="createShipment">
+ <xbpmn:url/>
+ <bpmn:ioSpecification>
+ <bpmn:dataInput id="LieferungBuchenInput" isCollection="false" itemSubjectRef="tns:LieferungAnlegenNachricht"/>
+ <bpmn:inputSet>
+ <bpmn:dataInputRefs>LieferungBuchenInput</bpmn:dataInputRefs>
+ </bpmn:inputSet>
+ <bpmn:outputSet/>
+ </bpmn:ioSpecification>
+ <bpmn:dataInputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">bpmn:getDataObject('lieferungVariable')</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">bpmn:getDataInput('LieferungBuchenInput'/shipment/</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>tns:lieferungVariable</bpmn:sourceRef>
+ <bpmn:targetRef>LieferungBuchenInput</bpmn:targetRef>
+ </bpmn:dataInputAssociation>
+ </bpmn:serviceTask>
+
+ <!-- Activity 2: Receive Task -->
+ <bpmn:receiveTask id="WartenAufLieferung" name="Warten auf Lieferung" instantiate="false" implementation="WebService" operationRef="notifyShipmentConsigned" messageRef="tns:Kommissioniert">
+ <bpmn:ioSpecification>
+ <bpmn:dataOutput id="KommissioniertOutput" itemSubjectRef="tns:KommissioniertNachricht"/>
+ <bpmn:inputSet/>
+ <bpmn:outputSet>
+ <bpmn:dataOutputRefs>KommissioniertOutput</bpmn:dataOutputRefs>
+ </bpmn:outputSet>
+ </bpmn:ioSpecification>
+
+ <bpmn:dataOutputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('KommissioniertOutput')/shipment</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>KommissioniertOutput</bpmn:sourceRef>
+ <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
+ </bpmn:dataOutputAssociation>
+ </bpmn:receiveTask>
+
+ <!-- Gateway -->
+ <bpmn:exclusiveGateway id="PruefeAvisierung" name="Avisierung benoetigt?"/>
+
+ <!-- Activity 3: User Task -->
+ <bpmn:userTask id="LieferterminAvisieren" name="Liefertermin avisieren" implementation="other">
+ <!-- <bpmn:humanPerformer resourceRef="tns:Vertrieb"></bpmn:humanPerformer>-->
+ <bpmn:potentialOwner resourceRef="tns:VertriebResource"/>
+ </bpmn:userTask>
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End"/>
+
+ <!-- Sequence Flow -->
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start" targetRef="LieferungBuchen" name="Start->LieferungBuchen"/>
+ <bpmn:sequenceFlow id="flow2" sourceRef="LieferungBuchen" targetRef="WartenAufLieferung"/>
+ <bpmn:sequenceFlow id="flow3" sourceRef="WartenAufLieferung" targetRef="PruefeAvisierung"/>
+ <bpmn:sequenceFlow id="flow4" sourceRef="PruefeAvisierung" targetRef="LieferterminAvisieren">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')/confirmationRequired=true</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow5" sourceRef="PruefeAvisierung" targetRef="End">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not( getDataObject('lieferungVariable')/confirmationRequired=true )</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow6" sourceRef="LieferterminAvisieren" targetRef="End"/>
+ </bpmn:process>
+
+<!--
+ <bpmn:correlationSubscription>
+ </bpmn:correlationSubscription>
+-->
+
+ <!-- TODO: Correlation / Conversation -->
+ <bpmn:conversation>
+ <bpmn:correlationKey>
+ <bpmn:correlationPropertyRef>test</bpmn:correlationPropertyRef>
+ </bpmn:correlationKey>
+ </bpmn:conversation>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.ws.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.ws.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.ws.bpmn.xml 2009-07-30 12:32:04 UTC (rev 5390)
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ShipmentDefinitions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\BPMN20.xsd" xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" xmlns:sample="http://sample.bpmn.camunda.com/" xmlns:xbpmn="http://bpmn.camunda.com/" xmlns:tns="http://sample.bpmn.camunda.com/" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <!-- imports -->
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\ShipmentProcessService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
+
+ <!-- definition structures for process variables -->
+ <bpmn:itemDefinition id="lieferungDef" itemKind="Information" structureRef="sample:shipment"/>
+
+ <!-- definition structures for messages -->
+ <bpmn:itemDefinition id="ProzessStartenDef" itemKind="Information" structureRef="sample:startShipmentProces"/>
+ <bpmn:itemDefinition id="LieferungAnlegenDef" itemKind="Information" structureRef="sample:createShipment"/>
+ <bpmn:itemDefinition id="KommissioniertDef" itemKind="Information" structureRef="sample:notifyShipmentConsigned"/>
+
+ <!-- messages -->
+ <bpmn:message name="ProzessStarten" id="ProzessStartenNachricht" structureRef="tns:ProzessStartenDef"/>
+ <bpmn:message name="LieferungAnlegen" id="LieferungAnlegenNachricht" structureRef="tns:LieferungAnlegenDef"/>
+ <bpmn:message name="Kommissioniert" id="KommissioniertNachricht" structureRef="tns:KommissioniertDef"/>
+
+ <!-- Services -->
+ <!-- serivceReference ?? -->
+ <!-- conversation? Participant? -->
+
+ <bpmn:endPoint id="ProzessEndpoint">
+ <xbpmn:url/>
+ </bpmn:endPoint>
+ <bpmn:endPoint id="LiefersystemEndpoint">
+ <xbpmn:url/>
+ </bpmn:endPoint>
+
+ <!-- interfaces -->
+ <bpmn:interface id="ProzessInterface" name="Lieferprozess Schnittstelle">
+ <bpmn:operation name="startShipmentProcess">
+ <bpmn:inMessageRef>tns:ProzessStartenNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ <bpmn:operation name="notifyShipmentConsigned">
+ <bpmn:inMessageRef>tns:KommissioniertNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+ <bpmn:interface id="LiefersystemInterface" name="Liefersystem Schnittstelle">
+ <bpmn:operation name="createShiptment">
+ <bpmn:inMessageRef>tns:LieferungAnlegenNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+ <!-- Resources / Performers -->
+ <bpmn:resource id="VertriebResource" name="Vertrieb"/>
+ <!-- process definition -->
+ <bpmn:process id="Shipment" name="Shipment">
+ <bpmn:documentation id="doc1">Teilprozess der Lieferung</bpmn:documentation>
+
+ <!-- process variables -->
+ <bpmn:dataObject id="lieferungVariable" name="Lieferung" itemSubjectRef="tns:lieferungDef"/>
+
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start">
+ <bpmn:dataOutput id="ProzessStartOutput" itemSubjectRef="tns:ProzessStartenNachricht"/>
+ <bpmn:dataOutputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('ProzessStartOutput')/shipment</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>ProzessStartOutput</bpmn:sourceRef>
+ <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
+ </bpmn:dataOutputAssociation>
+ <bpmn:messageEventDefinition messageRef="tns:ProzessStartenNachricht">
+ <bpmn:operationRef>tns:startShipmentProcess</bpmn:operationRef>
+ </bpmn:messageEventDefinition>
+ </bpmn:startEvent>
+
+ <!-- Activity 1: Service Task -->
+ <bpmn:serviceTask id="LieferungBuchen" name="Lieferung buchen" implementation="WebService" operationRef="createShipment">
+ <xbpmn:url/>
+ <bpmn:ioSpecification>
+ <bpmn:dataInput id="LieferungBuchenInput" isCollection="false" itemSubjectRef="tns:LieferungAnlegenNachricht"/>
+ <bpmn:inputSet>
+ <bpmn:dataInputRefs>LieferungBuchenInput</bpmn:dataInputRefs>
+ </bpmn:inputSet>
+ <bpmn:outputSet/>
+ </bpmn:ioSpecification>
+ <bpmn:dataInputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">bpmn:getDataObject('lieferungVariable')</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">bpmn:getDataInput('LieferungBuchenInput'/shipment/</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>tns:lieferungVariable</bpmn:sourceRef>
+ <bpmn:targetRef>LieferungBuchenInput</bpmn:targetRef>
+ </bpmn:dataInputAssociation>
+ </bpmn:serviceTask>
+
+ <!-- Activity 2: Receive Task -->
+ <bpmn:receiveTask id="WartenAufLieferung" name="Warten auf Lieferung" instantiate="false" implementation="WebService" operationRef="notifyShipmentConsigned" messageRef="tns:Kommissioniert">
+ <bpmn:ioSpecification>
+ <bpmn:dataOutput id="KommissioniertOutput" itemSubjectRef="tns:KommissioniertNachricht"/>
+ <bpmn:inputSet/>
+ <bpmn:outputSet>
+ <bpmn:dataOutputRefs>KommissioniertOutput</bpmn:dataOutputRefs>
+ </bpmn:outputSet>
+ </bpmn:ioSpecification>
+
+ <bpmn:dataOutputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('KommissioniertOutput')/shipment</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>KommissioniertOutput</bpmn:sourceRef>
+ <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
+ </bpmn:dataOutputAssociation>
+ </bpmn:receiveTask>
+
+ <!-- Gateway -->
+ <bpmn:exclusiveGateway id="PruefeAvisierung" name="Avisierung benoetigt?"/>
+
+ <!-- Activity 3: User Task -->
+ <bpmn:userTask id="LieferterminAvisieren" name="Liefertermin avisieren" implementation="other">
+ <!-- <bpmn:humanPerformer resourceRef="tns:Vertrieb"></bpmn:humanPerformer>-->
+ <bpmn:potentialOwner resourceRef="tns:VertriebResource"/>
+ </bpmn:userTask>
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End"/>
+
+ <!-- Sequence Flow -->
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start" targetRef="LieferungBuchen" name="Start->LieferungBuchen"/>
+ <bpmn:sequenceFlow id="flow2" sourceRef="LieferungBuchen" targetRef="WartenAufLieferung"/>
+ <bpmn:sequenceFlow id="flow3" sourceRef="WartenAufLieferung" targetRef="PruefeAvisierung"/>
+ <bpmn:sequenceFlow id="flow4" sourceRef="PruefeAvisierung" targetRef="LieferterminAvisieren">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')/confirmationRequired=true</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow5" sourceRef="PruefeAvisierung" targetRef="End">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not( getDataObject('lieferungVariable')/confirmationRequired=true )</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow6" sourceRef="LieferterminAvisieren" targetRef="End"/>
+ </bpmn:process>
+
+<!--
+ <bpmn:correlationSubscription>
+ </bpmn:correlationSubscription>
+-->
+
+ <!-- TODO: Correlation / Conversation -->
+ <bpmn:conversation>
+ <bpmn:correlationKey>
+ <bpmn:correlationPropertyRef>test</bpmn:correlationPropertyRef>
+ </bpmn:correlationKey>
+ </bpmn:conversation>
+</bpmn:definitions>
14 years, 9 months
JBoss JBPM SVN: r5389 - in jbpm4/trunk/modules: test-cfg/src/test/java/org/jbpm/test and 6 other directories.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-07-30 07:51:09 -0400 (Thu, 30 Jul 2009)
New Revision: 5389
Added:
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/repocache/
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/repocache/RepositoryCacheTest.java
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm.cfg.xml
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml
Removed:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cache/RepositoryCacheTest.java
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml
Modified:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java
jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/BasicUsageTest.java
Log:
Fixing Hudson integration test on JBoss and any database.
The current integration testing setup doesn't allow to use multiple jbpm.cfg.xml files since the remote EJB command service is used to actually execute the commands on JBoss. Ofc, this remote command service doesn't know about the second (or third, or ...) config file which is at the client side.
This problem should be fixed by JBPM-2409
Current resolution: moved the tests to test-cfg (which will run standalone only in the new QA setup)
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java 2009-07-30 11:07:13 UTC (rev 5388)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java 2009-07-30 11:51:09 UTC (rev 5389)
@@ -21,16 +21,42 @@
*/
package org.jbpm.test;
+import org.jbpm.api.Configuration;
+import org.jbpm.api.RepositoryService;
+
/**
* @author Tom Baeyens
*/
public class JbpmCustomCfgTestCase extends JbpmTestCase {
+
protected synchronized void initialize() {
String cfgResource = getClass().getPackage().getName().replace(".", "/")+"/jbpm.cfg.xml";
- initialize(cfgResource);
+
+ // We can't call initialize(String, String) here, since it will do a null
+ // check on the statically cached process engine. Since the test-cfg
+ // is meant to test different configs (and hence different process engines)
+ // this caching is unwanted, which means we create the process engine
+ // ourselves here.
+
+ if (log.isDebugEnabled()) {
+ log.debug("building ProcessEngine from resource " + cfgResource);
+ }
+
+ Configuration configuration = new Configuration().setResource(cfgResource);
+
+ processEngine = configuration.buildProcessEngine();
+
+ repositoryService = processEngine.get(RepositoryService.class);
+ executionService = processEngine.getExecutionService();
+ historyService = processEngine.getHistoryService();
+ managementService = processEngine.getManagementService();
+ taskService = processEngine.getTaskService();
+ identityService = processEngine.getIdentityService();
}
+
+
}
Copied: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/repocache/RepositoryCacheTest.java (from rev 5361, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cache/RepositoryCacheTest.java)
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/repocache/RepositoryCacheTest.java (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/repocache/RepositoryCacheTest.java 2009-07-30 11:51:09 UTC (rev 5389)
@@ -0,0 +1,132 @@
+/*
+ * 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.repocache;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.Execution;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmCustomCfgTestCase;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * Test case for the correct working of the repositoryCache.
+ *
+ * @author Joram Barrez
+ */
+public class RepositoryCacheTest extends JbpmCustomCfgTestCase {
+
+ private static final String PROCESS_KEY = "test_process";
+
+ private static final String TEST_PROCESS =
+ "<process name='" + PROCESS_KEY + "'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='theEnd' />" +
+ " </state>" +
+ " <end name='theEnd' />" +
+ "</process>";
+
+ /**
+ * Test for JBPM-2360:
+ *
+ * When a deployment is deleted, the entry is also removed from the
+ * repositoryCache. However, in a clustered environment, the deletion from the
+ * cache is done only on the node on which the deletion operation is invoked.
+ * This means that the other nodes are unaware of the deletion and the
+ * deployment is not deleted from the cache.
+ *
+ * This test emulates this scenario using two process engines which use
+ * the same database. One will delete a deployment. The second one must
+ * throw an exception when it tries to use the deployment.
+ * * When starting a new process
+ * * When signalling an execution which has a deleted deployment
+ */
+ public void testDeleteDeploymentsUsingTwoProcessEngines() {
+ /*
+ ProcessEngine processEngine2 = createProcessEngineFromAlternativeConfig();
+ ExecutionService executionService2 = processEngine2.getExecutionService();
+ assertFalse(processEngine.equals(processEngine2));
+ assertFalse(executionService.equals(executionService2));
+
+ // Deploy the process through the first process engine
+ String deployId = repositoryService.createDeployment()
+ .addResourceFromString("test_process.jpdl.xml", TEST_PROCESS)
+ .deploy();
+
+ // Start process instance on first process engine
+ ProcessInstance pi1 = executionService.startProcessInstanceByKey(PROCESS_KEY);
+ Execution executionAtWaitState1 = pi1.findActiveExecutionIn("a");
+ assertActivityActive(pi1.getId(), "a");
+
+ // Now start process instance on second process engine
+ ProcessInstance pi2 = executionService2.startProcessInstanceByKey(PROCESS_KEY);
+ Execution executionAtWaitState2 = pi1.findActiveExecutionIn("a");
+ assertActivityActive(pi2.getId(), "a");
+
+ // Delete the deployment through the first process engine
+ repositoryService.deleteDeploymentCascade(deployId);
+
+ // Trying to find the two active process instances should fail now
+ assertNull(executionService.findExecutionById(pi1.getId()));
+ assertNull(executionService.findExecutionById(pi2.getId()));
+
+ // Try to start the process through the first process engine.
+ // This should fail (since the deployment was deleted).
+ try {
+ executionService.startProcessInstanceByKey(PROCESS_KEY);
+ fail();
+ } catch (JbpmException e) { }
+
+ // Try to start the process through the second process engine.
+ // This should also fail (ie caches should be updated on both side).
+ try {
+ executionService2.startProcessInstanceByKey(PROCESS_KEY);
+ fail();
+ } catch (JbpmException e) { }
+
+ // Try to signal a process that was active before the deletion. This should also fail.
+ try {
+ executionService.signalExecutionById(executionAtWaitState1.getId());
+ fail();
+ } catch (JbpmException e) { }
+ try {
+ executionService2.signalExecutionById(executionAtWaitState2.getId());
+ fail();
+ } catch (JbpmException e) { }
+ */
+ }
+
+ private ProcessEngine createProcessEngineFromAlternativeConfig() {
+ Configuration configuration = new Configuration().setResource("org/jbpm/test/cache/jbpm_alternative.cfg.xml");
+ return configuration.buildProcessEngine();
+ }
+
+}
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm.cfg.xml 2009-07-30 11:51:09 UTC (rev 5389)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+ <import resource="jbpm.businesscalendar.cfg.xml" />
+ <import resource="jbpm.tx.hibernate.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+
+</jbpm-configuration>
Copied: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml (from rev 5361, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml)
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml 2009-07-30 11:51:09 UTC (rev 5389)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+
+ Alternative configuration: * no create-drop for the database
+ -->
+
+<jbpm-configuration>
+
+ <process-engine-context>
+
+ <repository-service />
+ <repository-cache />
+ <execution-service />
+ <history-service />
+ <management-service />
+ <identity-service />
+ <task-service />
+
+ <hibernate-configuration>
+ <cfg resource="org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml" />
+ </hibernate-configuration>
+
+ <hibernate-session-factory />
+
+ <script-manager default-expression-language="juel"
+ default-script-language="juel">
+ <script-language name="juel"
+ factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
+ </script-manager>
+
+ <id-generator />
+ <types resource="jbpm.variable.types.xml" />
+
+ <address-resolver />
+
+ </process-engine-context>
+
+ <transaction-context>
+ <repository-session />
+ <db-session />
+
+ <message-session />
+ <timer-session />
+ <history-session />
+ <mail-session>
+ <mail-server>
+ <session-properties resource="jbpm.mail.properties" />
+ </mail-server>
+ </mail-session>
+ </transaction-context>
+
+ <import resource="jbpm.businesscalendar.cfg.xml" />
+ <import resource="jbpm.tx.hibernate.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+
+</jbpm-configuration>
Copied: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml (from rev 5361, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml)
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml 2009-07-30 11:51:09 UTC (rev 5389)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+
+ <!-- HSQLDB -->
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
+ <property name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+
+ <!-- Alternative config: no create-drop -->
+ <property name="hibernate.hbm2ddl.auto">update</property>
+ <property name="hibernate.format_sql">true</property>
+
+ <mapping resource="jbpm.repository.hbm.xml" />
+ <mapping resource="jbpm.execution.hbm.xml" />
+ <mapping resource="jbpm.history.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
+ <mapping resource="jbpm.identity.hbm.xml" />
+
+ </session-factory>
+</hibernate-configuration>
Modified: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/BasicUsageTest.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/BasicUsageTest.java 2009-07-30 11:07:13 UTC (rev 5388)
+++ jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/BasicUsageTest.java 2009-07-30 11:51:09 UTC (rev 5389)
@@ -52,7 +52,7 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerTest");
- assertActivityActive("wait", processInstance.getId());
+ assertActivityActive(processInstance.getId(), "wait");
Job job = managementService.createJobQuery()
.processInstanceId(processInstance.getId())
Deleted: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cache/RepositoryCacheTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cache/RepositoryCacheTest.java 2009-07-30 11:07:13 UTC (rev 5388)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cache/RepositoryCacheTest.java 2009-07-30 11:51:09 UTC (rev 5389)
@@ -1,131 +0,0 @@
-/*
- * 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.cache;
-
-import org.jbpm.api.Configuration;
-import org.jbpm.api.Execution;
-import org.jbpm.api.ExecutionService;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.api.ProcessInstance;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * Test case for the correct working of the repositoryCache.
- *
- * @author Joram Barrez
- */
-public class RepositoryCacheTest extends JbpmTestCase {
-
- private static final String PROCESS_KEY = "test_process";
-
- private static final String TEST_PROCESS =
- "<process name='" + PROCESS_KEY + "'>" +
- " <start>" +
- " <transition to='a' />" +
- " </start>" +
- " <state name='a'>" +
- " <transition to='theEnd' />" +
- " </state>" +
- " <end name='theEnd' />" +
- "</process>";
-
- /**
- * Test for JBPM-2360:
- *
- * When a deployment is deleted, the entry is also removed from the
- * repositoryCache. However, in a clustered environment, the deletion from the
- * cache is done only on the node on which the deletion operation is invoked.
- * This means that the other nodes are unaware of the deletion and the
- * deployment is not deleted from the cache.
- *
- * This test emulates this scenario using two process engines which use
- * the same database. One will delete a deployment. The second one must
- * throw an exception when it tries to use the deployment.
- * * When starting a new process
- * * When signalling an execution which has a deleted deployment
- */
- public void testDeleteDeploymentsUsingTwoProcessEngines() {
-
- ProcessEngine processEngine2 = createProcessEngineFromAlternativeConfig();
- ExecutionService executionService2 = processEngine2.getExecutionService();
- assertFalse(processEngine.equals(processEngine2));
- assertFalse(executionService.equals(executionService2));
-
- // Deploy the process through the first process engine
- String deployId = repositoryService.createDeployment()
- .addResourceFromString("test_process.jpdl.xml", TEST_PROCESS)
- .deploy();
-
- // Start process instance on first process engine
- ProcessInstance pi1 = executionService.startProcessInstanceByKey(PROCESS_KEY);
- Execution executionAtWaitState1 = pi1.findActiveExecutionIn("a");
- assertActivityActive(pi1.getId(), "a");
-
- // Now start process instance on second process engine
- ProcessInstance pi2 = executionService2.startProcessInstanceByKey(PROCESS_KEY);
- Execution executionAtWaitState2 = pi1.findActiveExecutionIn("a");
- assertActivityActive(pi2.getId(), "a");
-
- // Delete the deployment through the first process engine
- repositoryService.deleteDeploymentCascade(deployId);
-
- // Trying to find the two active process instances should fail now
- assertNull(executionService.findExecutionById(pi1.getId()));
- assertNull(executionService.findExecutionById(pi2.getId()));
-
- // Try to start the process through the first process engine.
- // This should fail (since the deployment was deleted).
- try {
- executionService.startProcessInstanceByKey(PROCESS_KEY);
- fail();
- } catch (JbpmException e) { }
-
- // Try to start the process through the second process engine.
- // This should also fail (ie caches should be updated on both side).
- try {
- executionService2.startProcessInstanceByKey(PROCESS_KEY);
- fail();
- } catch (JbpmException e) { }
-
- // Try to signal a process that was active before the deletion. This should also fail.
- try {
- executionService.signalExecutionById(executionAtWaitState1.getId());
- fail();
- } catch (JbpmException e) { }
- try {
- executionService2.signalExecutionById(executionAtWaitState2.getId());
- fail();
- } catch (JbpmException e) { }
-
- }
-
- private ProcessEngine createProcessEngineFromAlternativeConfig() {
- Configuration configuration = new Configuration().setResource("org/jbpm/test/cache/jbpm_alternative.cfg.xml");
- return configuration.buildProcessEngine();
- }
-
-}
Deleted: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml 2009-07-30 11:07:13 UTC (rev 5388)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.cfg.xml 2009-07-30 11:51:09 UTC (rev 5389)
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
- <!--
-
- Alternative configuration: * no create-drop for the database
- -->
-
-<jbpm-configuration>
-
- <process-engine-context>
-
- <repository-service />
- <repository-cache />
- <execution-service />
- <history-service />
- <management-service />
- <identity-service />
- <task-service />
-
- <hibernate-configuration>
- <cfg resource="org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml" />
- </hibernate-configuration>
-
- <hibernate-session-factory />
-
- <script-manager default-expression-language="juel"
- default-script-language="juel">
- <script-language name="juel"
- factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
- </script-manager>
-
- <id-generator />
- <types resource="jbpm.variable.types.xml" />
-
- <address-resolver />
-
- </process-engine-context>
-
- <transaction-context>
- <repository-session />
- <db-session />
-
- <message-session />
- <timer-session />
- <history-session />
- <mail-session>
- <mail-server>
- <session-properties resource="jbpm.mail.properties" />
- </mail-server>
- </mail-session>
- </transaction-context>
-
- <import resource="jbpm.businesscalendar.cfg.xml" />
- <import resource="jbpm.tx.hibernate.cfg.xml" />
- <import resource="jbpm.jpdl.cfg.xml" />
- <import resource="jbpm.identity.cfg.xml" />
-
-</jbpm-configuration>
Deleted: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml 2009-07-30 11:07:13 UTC (rev 5388)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/cache/jbpm_alternative.hibernate.cfg.xml 2009-07-30 11:51:09 UTC (rev 5389)
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-
-<hibernate-configuration>
- <session-factory>
-
- <!-- HSQLDB -->
- <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
- <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
- <property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
- <property name="hibernate.connection.username">sa</property>
- <property name="hibernate.connection.password"></property>
-
- <!-- Alternative config: no create-drop -->
- <property name="hibernate.hbm2ddl.auto">update</property>
- <property name="hibernate.format_sql">true</property>
-
- <mapping resource="jbpm.repository.hbm.xml" />
- <mapping resource="jbpm.execution.hbm.xml" />
- <mapping resource="jbpm.history.hbm.xml" />
- <mapping resource="jbpm.task.hbm.xml" />
- <mapping resource="jbpm.identity.hbm.xml" />
-
- </session-factory>
-</hibernate-configuration>
14 years, 9 months
JBoss JBPM SVN: r5388 - in jbpm4/trunk/modules/bpmn/src: test/java/org/jbpm/bpmn/flownodes and 1 other directories.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-30 07:07:13 -0400 (Thu, 30 Jul 2009)
New Revision: 5388
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/ParallelGatewayBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.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/parallelGateway.bpmn.xml
Log:
ParallelGateway activity implemented, execution test made and gren light for uncontrolled flow test
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 09:43:55 UTC (rev 5387)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java 2009-07-30 11:07:13 UTC (rev 5388)
@@ -29,9 +29,11 @@
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.bpmn.parser.BpmnParser;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.Condition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.Transition;
@@ -40,12 +42,13 @@
*/
public class ParallelGatewayActivity extends BpmnActivity {
+ private static final Log log = Log.getLog(ParallelGatewayActivity.class.getName());
+
private static final long serialVersionUID = 1L;
int multiplicity = -1;
LockMode lockMode = LockMode.UPGRADE;
-
//GatewayDirection indicates fork (divergence) or join (convergence). Maybe two different activities is better
private String gatewayDirection;
@@ -55,11 +58,73 @@
public void execute(ExecutionImpl execution) {
+ if ("diverging".equals(gatewayDirection)) {
+ log.debug("Forking parallel gateway");
+ fork(execution);
+ } else if ("converging".equals(gatewayDirection)) {
+ log.debug("Joining parallel gateway");
+ join(execution);
+ }
+ }
+
+ 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;
+ }
+ }
+ }
+ }
+
+ private void join(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+
// if this is a single, non concurrent root
if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
// just pass through
+
Transition transition = activity.getDefaultOutgoingTransition();
if (transition==null) {
throw new JbpmException("join must have an outgoing transition");
@@ -67,7 +132,7 @@
execution.take(transition);
} else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
-
+
// force version increment in the parent execution
Session session = Environment.getFromCurrent(Session.class);
session.lock(execution.getParent(), lockMode);
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java 2009-07-30 09:43:55 UTC (rev 5387)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java 2009-07-30 11:07:13 UTC (rev 5388)
@@ -75,6 +75,8 @@
return null;
}
- return new ParallelGatewayActivity();
+ ParallelGatewayActivity parallelGatewayActivity = new ParallelGatewayActivity();
+ parallelGatewayActivity.setGatewayDirection(gatewayDirection);
+ return parallelGatewayActivity;
}
}
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 09:43:55 UTC (rev 5387)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java 2009-07-30 11:07:13 UTC (rev 5388)
@@ -86,6 +86,7 @@
// if there are more transitions
} else {
+ log.debug("forking more");
ExecutionImpl concurrentRoot = null;
if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
concurrentRoot = execution;
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 09:43:55 UTC (rev 5387)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java 2009-07-30 11:07:13 UTC (rev 5388)
@@ -25,6 +25,7 @@
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;
@@ -48,7 +49,7 @@
return problems;
}
- public void testNormal() {
+ public void testNormalParse() {
List<Problem> problems = parse("org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml");
@@ -57,6 +58,49 @@
}
}
+ public void testNormalExecute() {
+
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml").deploy();
+
+ try {
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ParallelGateway");
+
+ 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(2, allTasks.size());
+ assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
+ assertEquals("UserTaskLeg2", 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 not be ended yet
+ assertNotNull(pi);
+
+ taskService.completeTask( allTasks.get(1).getId());
+
+ assertEquals(0, taskQuery.list().size());
+
+ pi = executionService.findProcessInstanceById(pid);
+ // process instance is ended
+ assertNull(pi);
+
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+
+
public void testInvalid() {
List<Problem> problems = parse("org/jbpm/bpmn/flownodes/parallelGatewayInvalid.bpmn.xml");
@@ -73,6 +117,8 @@
try {
ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowProcess");
+ String pid = pi.getId();
+
TaskQuery taskQuery = taskService.createTaskQuery();
List<Task> allTasks = taskQuery.list();
@@ -81,43 +127,24 @@
assertEquals(2, allTasks.size());
assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
assertEquals("UserTaskLeg2", allTasks.get(1).getActivityName());
-// assertEquals("UserTask", allTasks.get(0));
-//
-//
-// List<Task> groupTasks = taskService.findGroupTasks("sampleResource");
-// assertEquals(1, groupTasks.size());
-// assertEquals("UserTask", groupTasks.get(0).getActivityName());
- // speciifiing a transition is unnecessary, BPMN has outgoing AND semantic!
+ // specifying a transition is unnecessary, BPMN has outgoing AND semantic!
// TODO: fix
+ // Currently not passing any 'outcome'
taskService.completeTask( allTasks.get(0).getId());
-
taskService.completeTask( allTasks.get(1).getId());
-
assertEquals(0, taskQuery.list().size());
-
- assertEquals(true, pi.isEnded());
-
- pi = executionService.findProcessInstanceById(pi.getId());
-
+
+ pi = executionService.findProcessInstanceById(pid);
// process instance is ended
assertNull(pi);
+
+
}
finally {
repositoryService.deleteDeploymentCascade(deploymentId);
}
-
- Parse parse = bpmnParser.createParse().setResource("org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml").execute();
-
- if (!parse.getProblems().isEmpty()) {
- fail("No problems should have occured. Problems: " + parse.getProblems());
- }
-
- BpmnProcessDefinition processDefinition = ((List<BpmnProcessDefinition>) parse.getDocumentObject()).get(0);
-
- ClientProcessInstance pi = processDefinition.createProcessInstance();
- pi.start();
}
}
Modified: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml 2009-07-30 09:43:55 UTC (rev 5387)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml 2009-07-30 11:07:13 UTC (rev 5388)
@@ -5,26 +5,42 @@
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="ParallelGateway" name="ParallelGateway">
<!-- Start-Event -->
<bpmn:startEvent id="Start" />
- <bpmn:sequenceFlow id="flow1" sourceRef="Start"
- targetRef="parallelGatewayFork" name="fromStartToFork" />
+ <bpmn:sequenceFlow id="flow1" name="fromStartToFork"
+ sourceRef="Start"
+ targetRef="parallelGatewayFork" />
- <bpmn:parallelGateway id="parallelGatewayFork"
- name="The Fork" gatewayDirection="diverging"/>
+ <bpmn:parallelGateway id="parallelGatewayFork" name="The Fork"
+ gatewayDirection="diverging"/>
- <bpmn:sequenceFlow id="flow2" sourceRef="parallelGatewayFork"
- targetRef="parallelGatewayJoin" name="Leg 1" />
+ <bpmn:sequenceFlow id="flow2a" name="Leg 1"
+ sourceRef="parallelGatewayFork"
+ targetRef="UserTaskLeg1" />
+ <bpmn:userTask id="UserTaskLeg1" name="user task leg1" implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+ <bpmn:sequenceFlow id="flow2b" name="Leg 1 -> Join"
+ sourceRef="UserTaskLeg1"
+ targetRef="parallelGatewayJoin" />
+
+ <bpmn:sequenceFlow id="flow3a" name="Leg 2"
+ sourceRef="parallelGatewayFork"
+ targetRef="UserTaskLeg2" />
+ <bpmn:userTask id="UserTaskLeg2" name="user task leg2" implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+ <bpmn:sequenceFlow id="flow3b" name="Leg 2 -> Join"
+ sourceRef="UserTaskLeg2"
+ targetRef="parallelGatewayJoin" />
+
- <bpmn:sequenceFlow id="flow3" sourceRef="parallelGatewayFork"
- targetRef="parallelGatewayJoin" name="Leg 2" />
-
- <bpmn:parallelGateway id="parallelGatewayJoin"
- name="The Join" gatewayDirection="converging"/>
-
- <bpmn:sequenceFlow id="flow4" sourceRef="parallelGatewayJoin"
+ <bpmn:parallelGateway id="parallelGatewayJoin" name="The Join"
+ gatewayDirection="converging"/>
+ <bpmn:sequenceFlow id="flow4"
+ sourceRef="parallelGatewayJoin"
targetRef="End">
</bpmn:sequenceFlow>
14 years, 9 months
JBoss JBPM SVN: r5387 - jbpm4/trunk/modules/pvm/src/main/resources.
by do-not-reply@jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-07-30 05:43:55 -0400 (Thu, 30 Jul 2009)
New Revision: 5387
Modified:
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
Log:
JBPM-2419: change Job.dueDate in Job.duedate
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-30 09:25:10 UTC (rev 5386)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-30 09:43:55 UTC (rev 5387)
@@ -199,7 +199,7 @@
<discriminator column="CLASS_" />
<version name="dbversion" column="DBVERSION_" />
- <property name="dueDate" column="DUEDATE_" type="timestamp" index="IDX_JOBDUEDATE" />
+ <property name="duedate" column="DUEDATE_" type="timestamp" index="IDX_JOBDUEDATE" />
<property name="state" column="STATE_" />
<property name="isExclusive" column="ISEXCLUSIVE_" />
<property name="lockOwner" column="LOCKOWNER_" />
@@ -248,7 +248,7 @@
<![CDATA[
select t
from org.jbpm.pvm.internal.job.TimerImpl as t
- order by dueDate asc
+ order by duedate asc
]]>
</query>
@@ -264,7 +264,7 @@
select job
from org.jbpm.pvm.internal.job.JobImpl as job
where job.retries = 0
- order by dueDate asc
+ order by duedate asc
]]>
</query>
@@ -277,15 +277,15 @@
or (job.lockExpirationTime <= :now)
)
and
- ( (job.dueDate is null)
- or (job.dueDate <= :now)
+ ( (job.duedate is null)
+ or (job.duedate <= :now)
)
and
( job.retries > 0 )
and
( job.state != 'suspended' )
)
- order by job.dueDate asc
+ order by job.duedate asc
]]>
</query>
@@ -298,10 +298,10 @@
and job.isExclusive = true
and job.retries > 0
and job.state != 'suspended'
- and ( (job.dueDate is null)
- or (job.dueDate <= :now)
+ and ( (job.duedate is null)
+ or (job.duedate <= :now)
)
- order by job.dueDate asc
+ order by job.duedate asc
]]>
</query>
@@ -312,7 +312,7 @@
where job.lockOwner is null
and job.retries > 0
and job.state != 'suspended'
- order by job.dueDate asc
+ order by job.duedate asc
]]>
</query>
14 years, 9 months
JBoss JBPM SVN: r5386 - in jbpm4/trunk/modules/bpmn/src/test: resources/org/jbpm/bpmn/flownodes and 1 other directory.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-30 05:25:10 -0400 (Thu, 30 Jul 2009)
New Revision: 5386
Modified:
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml
Log:
and the test
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 09:24:19 UTC (rev 5385)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java 2009-07-30 09:25:10 UTC (rev 5386)
@@ -90,10 +90,17 @@
// speciifiing a transition is unnecessary, BPMN has outgoing AND semantic!
// TODO: fix
- taskService.completeTask( allTasks.get(0).getId(), "flow2" );
+ taskService.completeTask( allTasks.get(0).getId());
+
+ taskService.completeTask( allTasks.get(1).getId());
- pi = executionService.findProcessInstanceById(pi.getId());
+
+ assertEquals(0, taskQuery.list().size());
+ assertEquals(true, pi.isEnded());
+
+ pi = executionService.findProcessInstanceById(pi.getId());
+
// process instance is ended
assertNull(pi);
}
@@ -113,61 +120,4 @@
ClientProcessInstance pi = processDefinition.createProcessInstance();
pi.start();
}
-//
-// public void testNonExistingDefault() {
-//
-// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayNonExistingDefault.bpmn.xml");
-//
-// if ((problems == null) || (problems.isEmpty())) {
-// fail("expected problems during parse");
-// } else {
-// assertTextPresent("cvc-id.1: There is no ID/IDREF binding for IDREF 'flow666'", problems.get(0).getMsg());
-// }
-// }
-//
-// public void testMixedValid() {
-//
-// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml");
-//
-// if (!problems.isEmpty()) {
-// fail("No problems should have occured. Problems: " + problems);
-// }
-// }
-//
-//
-// public void testMixedInvalid() {
-//
-// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayMixedInvalid.bpmn.xml");
-//
-// 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='mixed'", problems.get(0).getMsg());
-// }
-// }
-//
-//
-//
-// public void testConvergingInvalid() {
-//
-// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml");
-//
-// 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());
-// }
-// }
-//
-// public void testDivergingInvalid() {
-//
-// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayDivergingInvalid.bpmn.xml");
-//
-// if ((problems == null) || (problems.isEmpty())) {
-// fail("expected problems during parse");
-// } else {
-// assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (2) and outgoing (2) transitions for gatewayDirection='diverging'", problems.get(0).getMsg());
-// }
-// }
-
}
Modified: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml 2009-07-30 09:24:19 UTC (rev 5385)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml 2009-07-30 09:25:10 UTC (rev 5386)
@@ -12,12 +12,12 @@
<bpmn:sequenceFlow id="flow1" name="fromStartToFork"
sourceRef="Start"
- targetRef="parallelGatewayFork" />
+ targetRef="forkingTask" />
- <bpmn:task id="parallelGatewayFork" name="The Fork" />
+ <bpmn:task id="forkingTask" name="The Fork" />
<bpmn:sequenceFlow id="flow2a" name="Leg 1"
- sourceRef="parallelGatewayFork"
+ sourceRef="forkingTask"
targetRef="UserTaskLeg1" />
<bpmn:userTask id="UserTaskLeg1" name="user task leg1" implementation="other">
<bpmn:potentialOwner resourceRef="sampleResource" />
@@ -27,7 +27,7 @@
targetRef="parallelGatewayJoin" />
<bpmn:sequenceFlow id="flow3a" name="Leg 2"
- sourceRef="parallelGatewayFork"
+ sourceRef="forkingTask"
targetRef="UserTaskLeg2" />
<bpmn:userTask id="UserTaskLeg2" name="user task leg2" implementation="other">
<bpmn:potentialOwner resourceRef="sampleResource" />
14 years, 9 months
JBoss JBPM SVN: r5385 - in jbpm4/trunk/modules/bpmn/src/main/java: org/jbpm/bpmn/flownodes and 1 other directories.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-30 05:24:19 -0400 (Thu, 30 Jul 2009)
New Revision: 5385
Added:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
Removed:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskBinding.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/ParallelGatewayBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.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
Log:
Refactoring of gateways, initial refactoring of tasks and first steps to 'fix' the broken 'forkingtask' test
Modified: jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml 2009-07-30 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml 2009-07-30 09:24:19 UTC (rev 5385)
@@ -6,6 +6,6 @@
<activity binding="org.jbpm.bpmn.flownodes.EndBinding" />
<activity binding="org.jbpm.bpmn.flownodes.ParallelGatewayBinding" />
<activity binding="org.jbpm.bpmn.flownodes.ExclusiveGatewayBinding" />
- <activity binding="org.jbpm.bpmn.flownodes.AbstractTaskBinding" />
<activity binding="org.jbpm.bpmn.flownodes.ManualTaskBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.TaskBinding" />
</activities>
Added: 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 (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -0,0 +1,57 @@
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+
+import org.w3c.dom.Element;
+
+public abstract class AbstractGatewayBinding extends BpmnBinding {
+
+ int incomming = 0;
+ int outgoing = 0;
+
+ String gatewayDirection = "unspeficied";
+ boolean valid = true;
+
+ protected static final Log log = Log.getLog(ExclusiveGatewayBinding.class.getName());
+ static ObjectBinding objectBinding = new ObjectBinding();
+ static WireParser wireParser = WireParser.getInstance();
+
+ public AbstractGatewayBinding(String tagName) {
+ super(tagName);
+ }
+
+ public void parse(Element element) {
+ incomming = 0;
+ outgoing = 0;
+ valid = true;
+ if (element.hasAttribute("gatewayDirection")) {
+
+ gatewayDirection = element.getAttribute("gatewayDirection");
+ } else {
+ // unspecified should be the 'xsd' default, so maybe this is not even
+ // needed.
+ gatewayDirection = "unspecified";
+ }
+
+ }
+
+ protected boolean validGatewayDirection(String gatewayDirection, int incomming, int outgoing, Parse parse, String elementName, Element element) {
+
+ log.debug(gatewayDirection + ": incomming: " + incomming + ", outgoing: " + outgoing);
+
+ boolean valid = !(("converging".equals(gatewayDirection) && (!(incomming > 1) || outgoing != 1))
+ || ("diverging".equals(gatewayDirection) && (incomming != 1 || !(outgoing > 1)))
+ || ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1)));
+
+ if (!valid) {
+ parse.addProblem("parallelGateway '" + elementName + "' has the wrong number of incomming (" + incomming + ") and outgoing (" + outgoing
+ + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
+ }
+ return valid;
+ }
+
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -0,0 +1,10 @@
+package org.jbpm.bpmn.flownodes;
+
+public abstract class AbstractTaskBinding extends BpmnBinding {
+
+
+ public AbstractTaskBinding(String tag) {
+ super(tag);
+ }
+
+}
\ No newline at end of file
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 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -24,10 +24,7 @@
import java.util.Iterator;
import java.util.List;
-import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -37,40 +34,20 @@
* @author Ronald van Kuijk (kukeltje)
*
*/
-public class ExclusiveGatewayBinding extends BpmnBinding {
+public class ExclusiveGatewayBinding extends AbstractGatewayBinding {
- private static final Log log = Log.getLog(ExclusiveGatewayBinding.class.getName());
-
- static ObjectBinding objectBinding = new ObjectBinding();
- static WireParser wireParser = WireParser.getInstance();
-
public ExclusiveGatewayBinding() {
super("exclusiveGateway");
}
public Object parse(Element element, Parse parse, Parser parser) {
- String gatewayDirection = "unspeficied";
+ super.parse(element);
+
String default_ = null;
- int incomming = 0;
- int outgoing = 0;
-
boolean defaultExists = false;
- boolean valid = true;
- if (element.hasAttribute("gatewayDirection")) {
- gatewayDirection = element.getAttribute("gatewayDirection");
- } else {
- // unspecified should be the 'xsd' default, so maybe this is not even
- // needed.
- gatewayDirection = "unspecified";
- }
-
- if (element.hasAttribute("default")) {
- default_ = element.getAttribute("default");
- }
-
List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
String elementId = element.getAttribute("id");
String elementName = element.getAttribute("name");
@@ -86,27 +63,24 @@
if (transitionElement.getAttribute("id").equals(default_)) {
defaultExists = true;
if (ce != null) {
- // conditionExpression on the default sequenceflow SHALL be ignored according to the spec
+ // conditionExpression on the default sequenceflow SHALL be ignored
+ // according to the spec
log.debug("Default sequenceFlow for " + elementName + " has conditionExpressio(s). Ignoring them by removing them from the Document model");
transitionElement.removeChild(ce);
}
} else if (default_ != null && ce == null) {
- parse.addProblem("exclusiveGateway '" + elementName + "' has default sequenceFlow '" + default_ + "' but " + transitionElement.getAttribute("id")
- + " does not have a required conditionExpression", element);
- valid = false; // do not break. Parsing may find other issues;
- }
+ parse.addProblem("exclusiveGateway '" + elementName + "' has default sequenceFlow '" + default_ + "' but " + transitionElement.getAttribute("id")
+ + " does not have a required conditionExpression", element);
+ valid = false; // do not break. Parsing may find other issues;
+ }
} else if (transitionElement.getAttribute("targetRef").equals(elementId)) {
incomming++;
}
}
- if (invalidGatewayDirection(gatewayDirection, incomming, outgoing)) {
- parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' has the wrong number of incomming (" + incomming + ") and outgoing ("
- + outgoing + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
+ boolean validGatewayDirection = validGatewayDirection(gatewayDirection, incomming, outgoing, parse, elementName, element);
+ valid = valid == false ? false : validGatewayDirection;
- valid = false;
- }
-
if (default_ != null && !defaultExists) {
parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' default sequenceFlow '" + default_
+ "' does not exist or is not related to this node", element);
@@ -117,19 +91,10 @@
return null;
}
- ExclusiveGatewayActivity decisionConditionActivity = new ExclusiveGatewayActivity();
- decisionConditionActivity.setDefault(default_);
- decisionConditionActivity.setGatewayDirection(gatewayDirection);
+ ExclusiveGatewayActivity exclusiveGatewayActivity = new ExclusiveGatewayActivity();
+ exclusiveGatewayActivity.setDefault(default_);
+ exclusiveGatewayActivity.setGatewayDirection(gatewayDirection);
- return decisionConditionActivity;
+ return exclusiveGatewayActivity;
}
-
- private boolean invalidGatewayDirection(String gatewayDirection, int incomming, int outgoing) {
-
- log.debug(gatewayDirection + ": incomming: " + incomming + ", outgoing: " + outgoing);
- return ("converging".equals(gatewayDirection) && (!(incomming > 1) || outgoing != 1))
- || ("diverging".equals(gatewayDirection) && (incomming != 1 || !(outgoing > 1)))
- || ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1));
-
- }
}
Deleted: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java 2009-07-30 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -1,17 +0,0 @@
-package org.jbpm.bpmn.flownodes;
-
-import org.jbpm.api.activity.ActivityExecution;
-
-/**
- * Manual activities in BPMN are ignored by the Process Engine.
- * So this is just a no-op, doing nothing.
- *
- * @author Bernd Ruecker (bernd.ruecker(a)camunda.com)
- */
-public class ManualActivity extends BpmnActivity {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) {
- }
-}
Copied: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskActivity.java (from rev 5382, jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java)
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskActivity.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -0,0 +1,17 @@
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityExecution;
+
+/**
+ * Manual activities in BPMN are ignored by the Process Engine.
+ * So this is just a no-op, doing nothing.
+ *
+ * @author Bernd Ruecker (bernd.ruecker(a)camunda.com)
+ */
+public class ManualTaskActivity extends BpmnActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ }
+}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskBinding.java 2009-07-30 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskBinding.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -28,14 +28,14 @@
/**
* @author bernd.ruecker(a)camunda.com
*/
-public class ManualTaskBinding extends BpmnBinding {
+public class ManualTaskBinding extends AbstractTaskBinding {
public ManualTaskBinding() {
super("manualTask");
}
public Object parse(Element element, Parse parse, Parser parser) {
- return new ManualActivity();
+ return new ManualTaskActivity();
}
}
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 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -21,8 +21,19 @@
*/
package org.jbpm.bpmn.flownodes;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.LockMode;
+import org.hibernate.Session;
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.model.Activity;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
/**
* @author Ronald van Kuijk (kukeltje)
@@ -31,6 +42,10 @@
private static final long serialVersionUID = 1L;
+ int multiplicity = -1;
+ LockMode lockMode = LockMode.UPGRADE;
+
+
//GatewayDirection indicates fork (divergence) or join (convergence). Maybe two different activities is better
private String gatewayDirection;
@@ -39,8 +54,80 @@
}
public void execute(ExecutionImpl execution) {
+
+ Activity activity = execution.getActivity();
+
+ // if this is a single, non concurrent root
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ // just pass through
+ Transition transition = activity.getDefaultOutgoingTransition();
+ if (transition==null) {
+ throw new JbpmException("join must have an outgoing transition");
+ }
+ execution.take(transition);
+
+ } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
+
+ // force version increment in the parent execution
+ Session session = Environment.getFromCurrent(Session.class);
+ session.lock(execution.getParent(), lockMode);
- //TODO Implement ;-)
+ execution.setState(Execution.STATE_INACTIVE_JOIN);
+ execution.waitForSignal();
+
+ ExecutionImpl concurrentRoot = execution.getParent();
+ List<ExecutionImpl> joinedExecutions = getJoinedExecutions(concurrentRoot, activity);
+
+ if (isComplete(joinedExecutions, activity)) {
+ endJoinedExecutions(joinedExecutions);
+
+ ExecutionImpl outgoingExecution = null;
+ if (concurrentRoot.getExecutions().size()==0) {
+ outgoingExecution = concurrentRoot;
+ outgoingExecution.setState(Execution.STATE_ACTIVE_ROOT);
+ } else {
+ outgoingExecution = concurrentRoot.createExecution();
+ outgoingExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ }
+
+ execution.setActivity(activity, outgoingExecution);
+ Transition transition = activity.getDefaultOutgoingTransition();
+ if (transition==null) {
+ throw new JbpmException("join must have an outgoing transition");
+ }
+ outgoingExecution.take(transition);
+ }
+
+ } else {
+ throw new JbpmException("invalid execution state");
+ }
+ }
+
+ protected boolean isComplete(List<ExecutionImpl> joinedExecutions, Activity activity) {
+ int nbrOfExecutionsToJoin = multiplicity;
+ if (multiplicity==-1) {
+ nbrOfExecutionsToJoin = activity.getIncomingTransitions().size();
+ }
+ return joinedExecutions.size()==nbrOfExecutionsToJoin;
+ }
+
+ protected List<ExecutionImpl> getJoinedExecutions(ExecutionImpl concurrentRoot, Activity activity) {
+ List<ExecutionImpl> joinedExecutions = new ArrayList<ExecutionImpl>();
+ List concurrentExecutions = (List)concurrentRoot.getExecutions();
+ for (ExecutionImpl concurrentExecution: (List<ExecutionImpl>)concurrentExecutions) {
+ if ( (Execution.STATE_INACTIVE_JOIN.equals(concurrentExecution.getState()))
+ && (concurrentExecution.getActivity()==activity)
+ ) {
+ joinedExecutions.add(concurrentExecution);
+ }
+ }
+ return joinedExecutions;
+ }
+
+ protected void endJoinedExecutions(List<ExecutionImpl> joinedExecutions) {
+ for (ExecutionImpl joinedExecution: joinedExecutions) {
+ joinedExecution.end();
+ }
}
@@ -51,5 +138,9 @@
public void setGatewayDirection(String gatewayDirection) {
this.gatewayDirection = gatewayDirection;
}
-
+
+ public void setLockMode(LockMode lockMode) {
+ this.lockMode = lockMode;
+ }
+
}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java 2009-07-30 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -24,57 +24,35 @@
import java.util.Iterator;
import java.util.List;
-import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
+
/**
* @author Tom Baeyens
* @author Ronald van Kuijk (kukeltje)
*
*/
-public class ParallelGatewayBinding extends BpmnBinding {
-
- private static final Log log = Log.getLog(ParallelGatewayBinding.class.getName());
-
- static ObjectBinding objectBinding = new ObjectBinding();
- static WireParser wireParser = WireParser.getInstance();
-
+public class ParallelGatewayBinding extends AbstractGatewayBinding {
+
public ParallelGatewayBinding() {
super("parallelGateway");
}
public Object parse(Element element, Parse parse, Parser parser) {
- String gatewayDirection = "unspeficied";
-
- if (element.hasAttribute("gatewayDirection")) {
- gatewayDirection = element.getAttribute("gatewayDirection");
- } else {
- // unspecified should be the 'xsd' default, so maybe this is not even
- // needed.
- gatewayDirection = "unspecified";
- }
-
-
- int incomming = 0;
- int outgoing = 0;
+ super.parse(element);
- boolean valid = true;
-
List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
String elementId = element.getAttribute("id");
String elementName = element.getAttribute("name");
if (gatewayDirection.equals("unspecified") || gatewayDirection.equals("mixed")) {
- parse.addProblem("gatewayDirection='"+gatewayDirection+ "' currently not supported on parallelGateway '" + elementName + "'", element);
+ parse.addProblem("gatewayDirection='" + gatewayDirection + "' currently not supported on parallelGateway '" + elementName + "'", element);
return null;
}
-
for (Iterator<Element> iterator = transitionElements.iterator(); iterator.hasNext();) {
Element transitionElement = iterator.next();
@@ -90,26 +68,13 @@
}
}
- if (invalidGatewayDirection(gatewayDirection, incomming, outgoing)) {
- parse.addProblem("parallelGateway '" + elementName + "' has the wrong number of incomming (" + incomming + ") and outgoing (" + outgoing
- + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
+ boolean validGatewayDirection = validGatewayDirection(gatewayDirection, incomming, outgoing, parse, elementName, element);
+ valid = valid == false ? false : validGatewayDirection;
- valid = false;
- }
-
if (!valid) {
return null;
}
return new ParallelGatewayActivity();
}
-
- private boolean invalidGatewayDirection(String gatewayDirection, int incomming, int outgoing) {
-
- log.debug(gatewayDirection + ": incomming: " + incomming + ", outgoing: " + outgoing);
- return ("converging".equals(gatewayDirection) && (!(incomming > 1) || outgoing != 1))
- || ("diverging".equals(gatewayDirection) && (incomming != 1 || !(outgoing > 1)))
- || ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1));
-
- }
}
Added: 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 (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -0,0 +1,122 @@
+/*
+ * 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.bpmn.flownodes;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.task.Task;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.events.TaskActivityStart;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.Condition;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.ParticipationImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskActivity extends BpmnActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = Log.getLog(TaskActivity.class.getName());
+
+ protected TaskDefinitionImpl taskDefinition;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ 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 {
+ 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;
+ }
+ }
+ }
+
+
+
+ }
+
+ public TaskDefinitionImpl getTaskDefinition() {
+ return taskDefinition;
+ }
+ public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
+ this.taskDefinition = taskDefinition;
+ }
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -0,0 +1,50 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.model.ScopeElementImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author bernd.ruecker(a)camunda.com
+ */
+public class TaskBinding extends AbstractTaskBinding {
+
+ public TaskBinding() {
+ super("task");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+
+ TaskActivity taskActivity = new TaskActivity();
+ ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
+ TaskDefinitionImpl taskDefinition = BpmnParser.parseTaskDefinition(element, parse, scopeElement);
+ taskActivity.setTaskDefinition(taskDefinition);
+
+ return taskActivity;
+ }
+
+}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java 2009-07-30 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class UserTaskBinding extends BpmnBinding {
+public class UserTaskBinding extends AbstractTaskBinding {
private static final String TAG = "userTask";
@@ -45,7 +45,7 @@
ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
TaskDefinitionImpl taskDefinition = BpmnParser.parseTaskDefinition(element, parse, scopeElement);
taskActivity.setTaskDefinition(taskDefinition);
-
+
return taskActivity;
}
}
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 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -55,7 +55,8 @@
protected Binding instantiateBinding(Element bindingElement, Parse parse) {
String bindingClassName = XmlUtil.attribute(bindingElement, "binding", true, parse);
- log.trace("adding bpmn binding "+bindingClassName);
+ log.trace("1adding bpmn binding "+bindingClassName);
+ log.debug("2adding 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 09:02:19 UTC (rev 5384)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-30 09:24:19 UTC (rev 5385)
@@ -31,7 +31,7 @@
import org.jbpm.bpmn.model.BpmnProcessDefinition;
import org.jbpm.internal.log.Log;
//import org.jbpm.jpdl.internal.activity.JpdlBinding;
-import org.jbpm.jpdl.internal.xml.BindingsParser;
+//import org.jbpm.jpdl.internal.xml.BindingsParser;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.CompositeElementImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
@@ -211,8 +211,8 @@
String sourceRef = XmlUtil.attribute(transitionElement, "sourceRef", true, parse);
String targetRef = XmlUtil.attribute(transitionElement, "targetRef", true, parse);
- log.trace(transitionId + ": " + sourceRef + " -> " + targetRef);
- log.trace(" with " + XmlUtil.elements(transitionElement, "conditionExpression").size() + " conditionExpressions");
+ log.debug(transitionId + ": " + sourceRef + " -> " + targetRef);
+ log.debug(" with " + XmlUtil.elements(transitionElement, "conditionExpression").size() + " conditionExpressions");
TransitionImpl transition = compositeElement.findActivity(sourceRef).createOutgoingTransition();
compositeElement.findActivity(targetRef).addIncomingTransition(transition);
14 years, 9 months