JBoss JBPM SVN: r6005 - in jbpm4/trunk/modules: test-cfg/src/test/java/org/jbpm/test/hibernatelongid and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-12-21 05:03:33 -0500 (Mon, 21 Dec 2009)
New Revision: 6005
Removed:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/tx/
Modified:
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatelongid/HibernateLongIdTest.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatestringid/HibernateStringIdTest.java
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.cfg.xml
Log:
cleanup: removed dead command code from test-base
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatelongid/HibernateLongIdTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatelongid/HibernateLongIdTest.java 2009-12-21 09:20:53 UTC (rev 6004)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatelongid/HibernateLongIdTest.java 2009-12-21 10:03:33 UTC (rev 6005)
@@ -26,15 +26,11 @@
import java.util.Map;
import org.hibernate.Session;
-import org.hibernate.SessionFactory;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
import org.jbpm.api.cmd.ParamCommand;
import org.jbpm.test.JbpmCustomCfgTestCase;
-import org.jbpm.test.tx.TxCommand;
-import org.jbpm.test.tx.TxTemplate;
-import org.jbpm.test.tx.VoidTxCommand;
/**
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatestringid/HibernateStringIdTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatestringid/HibernateStringIdTest.java 2009-12-21 09:20:53 UTC (rev 6004)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatestringid/HibernateStringIdTest.java 2009-12-21 10:03:33 UTC (rev 6005)
@@ -22,16 +22,13 @@
package org.jbpm.test.hibernatestringid;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.hibernate.Session;
-import org.hibernate.SessionFactory;
import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
import org.jbpm.test.JbpmCustomCfgTestCase;
-import org.jbpm.test.tx.TxCommand;
-import org.jbpm.test.tx.TxTemplate;
-import org.jbpm.test.tx.VoidTxCommand;
/**
@@ -39,49 +36,44 @@
*/
public class HibernateStringIdTest extends JbpmCustomCfgTestCase {
- private TxTemplate txTemplate;
-
- protected void setUp() throws Exception {
- super.setUp();
- SessionFactory sessionFactory = processEngine.get(SessionFactory.class);
- this.txTemplate = new TxTemplate(sessionFactory);
- }
+// protected void setUp() throws Exception {
+// super.setUp();
+// }
+//
+// protected void deleteRegisteredDeployments() {
+// processEngine.execute(new Command<Object>() {
+// public Object execute(Environment environment) {
+// Session session = environment.get(Session.class);
+// for (String deploymentId : registeredDeployments) {
+// repositoryService.deleteDeploymentCascade(deploymentId);
+// }
+//
+// List<Order> orders = session.createQuery("from "+Order.class.getName()).list();
+// for (Order order: orders) {
+// session.delete(order);
+// }
+// return null;
+// }
+// });
+// }
- protected void deleteRegisteredDeployments() {
- txTemplate.execute(new VoidTxCommand() {
- public void execute(Session session) {
- for (String deploymentId : registeredDeployments) {
- repositoryService.deleteDeploymentCascade(deploymentId);
- }
-
- List<Order> orders = session.createQuery("from "+Order.class.getName()).list();
- for (Order order: orders) {
- session.delete(order);
- }
- }
- });
- }
-
public void testHibernateStringId() {
- txTemplate.execute(new VoidTxCommand() {
- public void execute(Session session) {
- deployJpdlXmlString(
- "<process name='HibernateStringId'>" +
- " <start>" +
- " <transition to='a' />" +
- " </start>" +
- " <state name='a' />" +
- "</process>"
- );
- }
- });
+ deployJpdlXmlString(
+ "<process name='HibernateStringId'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
- String processInstanceId = (String) txTemplate.execute(new TxCommand() {
- public Object execute(Session session) {
+ String processInstanceId = (String) processEngine.execute(new Command<String>() {
+ public String execute(Environment environment) {
Order order = new Order("order1");
order.setClient("Contador");
order.setProduct("Shampoo");
+ Session session = environment.get(Session.class);
session.save(order);
session.flush();
@@ -93,15 +85,34 @@
}
});
- txTemplate.execute(new VoidTxCommand() {
- public void execute(Session session) {
- String processInstanceId = (String) params.get("processInstanceId");
+ String orderId = processEngine.execute(new Command<String>() {
+ String processInstanceId;
+ public String execute(Environment environment) {
Order order = (Order) executionService.getVariable(processInstanceId, "order");
assertNotNull(order);
assertEquals("Contador", order.getClient());
assertEquals("Shampoo", order.getProduct());
+ return order.getId();
}
- }.setParam("processInstanceId", processInstanceId)
+ public Command<String> setProcessInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ return this;
+ }
+ }.setProcessInstanceId(processInstanceId)
);
+
+ processEngine.execute(new Command<Object>() {
+ String orderId;
+ public Object execute(Environment environment) {
+ Session session = environment.get(Session.class);
+ Order order = (Order) session.load(Order.class, orderId);
+ session.delete(order);
+ return null;
+ }
+ public Command<Object> setOrderId(String orderId) {
+ this.orderId = orderId;
+ return this;
+ }
+ }.setOrderId(orderId));
}
}
Modified: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.cfg.xml 2009-12-21 09:20:53 UTC (rev 6004)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.cfg.xml 2009-12-21 10:03:33 UTC (rev 6005)
@@ -3,7 +3,6 @@
<jbpm-configuration>
<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" />
@@ -21,6 +20,20 @@
<cfg resource="org/jbpm/test/hibernatestringid/jbpm.hibernate.cfg.xml" />
</hibernate-configuration>
+
+ <command-service name="txRequiredCommandService">
+ <skip-interceptor />
+ <retry-interceptor />
+ <environment-interceptor />
+ <standard-transaction-interceptor />
+ </command-service>
+
+ <command-service name="newTxRequiredCommandService">
+ <retry-interceptor />
+ <environment-interceptor policy="requiresNew" />
+ <standard-transaction-interceptor />
+ </command-service>
+
<hibernate-session-factory />
<object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator" init="eager">
@@ -64,12 +77,15 @@
</process-engine-context>
<transaction-context>
+ <transaction />
+ <hibernate-session />
+
+ <db-session />
<repository-session />
- <db-session />
-
<message-session />
<timer-session />
<history-session />
+
<mail-session>
<mail-server>
<session-properties resource="jbpm.mail.properties" />
16 years, 4 months
JBoss JBPM SVN: r6004 - in jbpm4/trunk/modules: enterprise/src/test and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-12-21 04:20:53 -0500 (Mon, 21 Dec 2009)
New Revision: 6004
Removed:
jbpm4/trunk/modules/enterprise/src/test/java/
jbpm4/trunk/modules/enterprise/src/test/resources/
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/enterprise/
Modified:
jbpm4/trunk/modules/enterprise/.classpath
Log:
cleaning up dead enterprise test code
Modified: jbpm4/trunk/modules/enterprise/.classpath
===================================================================
--- jbpm4/trunk/modules/enterprise/.classpath 2009-12-21 03:07:53 UTC (rev 6003)
+++ jbpm4/trunk/modules/enterprise/.classpath 2009-12-21 09:20:53 UTC (rev 6004)
@@ -1,10 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
16 years, 4 months
JBoss JBPM SVN: r6003 - in jbpm4/trunk/modules/devguide/src/main/docbook/en: modules and 1 other directory.
by do-not-reply@jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-12-20 22:07:53 -0500 (Sun, 20 Dec 2009)
New Revision: 6003
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.jms.png
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.rules.decision.png
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.rules.png
Modified:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
Log:
- jms activity documentation
- rules activity image
- rules decision image
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.jms.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.jms.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.rules.decision.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.rules.decision.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.rules.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.rules.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-12-20 21:27:27 UTC (rev 6002)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-12-21 03:07:53 UTC (rev 6003)
@@ -851,6 +851,268 @@
</para>
</section>
+ <!-- ### JMS ####################################################### -->
+ <section id="jms">
+
+ <title><literal>jms</literal> activity</title>
+ <para>
+ The <literal>jms</literal> activity provides users with convenience for sending JMS messages.
+ At this moment the sending of three different types of JMS messages is possible: text, object
+ and map. Specifying message properties is not yet supported.
+ In the future the functionality may be elaborated to cover this and more of the JMS specification.
+ </para>
+
+ <table><title><literal>jms</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>connection-factory</entry>
+ <entry>jndi name</entry>
+ <entry></entry>
+ <entry>true</entry>
+ <entry>the jndi name of the jms connection factory.
+ </entry>
+ </row>
+ <row>
+ <entry>destination</entry>
+ <entry>jndi name</entry>
+ <entry></entry>
+ <entry>true</entry>
+ <entry>the jndi name of the jms queue or topic.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>
+ The <literal>connection-factory</literal> and <literal>destination</literal> attributes are
+ mandatory and respectively contain the names of the connection factory and destination (queue or topic)
+ that will be used to lookup the corresponding objects in jndi. The specified message will be sent
+ to the destination that was obtained by this lookup.
+ </para>
+
+ <table><title><literal>jms</literal> elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>text</literal></entry>
+ <entry>0..1</entry>
+ <entry>A string of text that will be used as payload for the JMS message.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>object</literal></entry>
+ <entry>0..1</entry>
+ <entry>A serializable object that will be used as payload for the JMS message.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>map</literal></entry>
+ <entry>0..1</entry>
+ <entry>A map of which the key-value entries will be used as payload for the JMS message.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>
+ Exactly one of the elements <literal>text</literal>, <literal>object</literal> or <literal>map</literal>
+ is mandatory. The presence of this element will determine the kind of message that will be sent to the
+ queue obtained in the lookup mentioned above. This message will be a <literal>TextMessage</literal>,
+ <literal>ObjectMessage</literal> or <literal>MapMessage</literal> respectively.
+ </para>
+
+ <para>
+ In the following subsections the different types of supported messages will be explained. The used process
+ is in the three cases similar. The graphical representation of the process is shown below.
+ </para>
+
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.jms.png"/></imageobject></mediaobject>
+
+ <section id="jms.text">
+ <title>Text messages</title>
+
+ <para>
+ The first possibility of sending JMS messages is to use text as its payload. In this case a JMS
+ <literal>TextMessage</literal> will be created and sent to the specified destination.
+ Consider the following process definition:
+ </para>
+
+ <programlisting><process name="JMS_text_queue">
+
+ <start>
+ <transition to="send message"/>
+ </start>
+
+ <emphasis role="bold"><jms name="send message"
+ connection-factory="ConnectionFactory"
+ destination="queue/jbpm-test-queue">
+ <text>This is the body</text>
+ <transition to="wait"/>
+ </jms></emphasis>
+
+ <state name="wait"/>
+
+</process></programlisting>
+
+ <para>
+ As you may expect and as is shown in the following test case starting this process will cause
+ the JMS node to send a message to the queue with the name "queue/jbpm-test-queue".
+ The factory used to create a connection to connect to this queue is named "ConnectionFactory".
+ The payload of the message is the text string "This is the body".
+ </para>
+
+ <programlisting>public void testTextMessage() throws Exception
+{
+ Context context = new InitialContext();
+ Connection connection = (Connection)context.lookup("ConnectionFactory");
+ connection.start();
+ Session session = connection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ Queue queue = (Queue)context.lookup("queue/jbpm-test-queue");
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+
+ <emphasis role="bold">executionService.startProcessInstanceByKey("JMS_text_queue");
+ TextMessage textMessage = (TextMessage)messageConsumer.receive();
+ assertEquals("This is the body", textMessage.getText());</emphasis>
+
+ connection.stop();
+ session.close();
+ connection.close();
+}</programlisting>
+
+ <para>
+ The relevant code is shown above in boldface. The rest of the method is boilerplate code needed to
+ setup a message consumer. We will omit this code in the subsequent examples.
+ </para>
+
+ </section>
+
+ <section id="jms.object">
+
+ <title>Object messages</title>
+
+ <para>
+ The second possibility is to use a serializable object as the payload of the message. In this case a
+ JMS <literal>ObjectMessage</literal> will be created and sent to the specified destination.
+ Consider the following process definition:
+ </para>
+
+ <programlisting><process name="JMS_object_queue">
+
+ <start>
+ <transition to="send message"/>
+ </start>
+
+ <emphasis role="bold"><jms name="send message"
+ connection-factory="ConnectionFactory"
+ destination="queue/jbpm-test-queue">
+ <object expr="${object}"/>
+ <transition to="wait"/>
+ </jms></emphasis>
+
+ <state name="wait"/>
+
+</process></programlisting>
+
+ <para>
+ As in the previous case a message will be sent to the queue with the name "queue/jbpm-test-queue".
+ Also again a factory used to create a connection to connect to this queue is named "ConnectionFactory".
+ But in this case the payload of the message is the serializable object that is obtained by
+ evaluating the expression specified by the <literal>expr</literal> attribute. This is illustrated in the test case below.
+ </para>
+
+ <programlisting>public void testQueueMessage() throws Exception
+{
+ // as before
+ ...
+ <emphasis role="bold">Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("object", "this is the object");
+ executionService.startProcessInstanceByKey("JMS_object_queue", variables);
+ ObjectMessage objectMessage = (ObjectMessage)messageConsumer.receive();
+ assertEquals("this is the object", objectMessage.getObject());</emphasis>
+
+ // as before
+ ...
+}</programlisting>
+
+ </section>
+
+ <section id="jms.map">
+
+ <title>Map messages</title>
+
+ <para>
+ In this third possibility the payload is constituted by the key-value entries of a map. This time a
+ JMS <literal>MapMessage</literal> will be created and sent to the specified destination.
+ Consider the following process definition:
+ </para>
+
+ <programlisting><process name="JMS_map_queue">
+
+ <start>
+ <transition to="send message"/>
+ </start>
+
+ <emphasis role="bold"><jms name="send message"
+ connection-factory="ConnectionFactory"
+ destination="queue/jbpm-test-queue">
+ <map>
+ <entry>
+ <key><string value="x"/></key>
+ <value><string value="foo"/></value>
+ </entry>
+ </map>
+ <transition to="wait"/>
+ </jms></emphasis>
+
+ <state name="wait"/>
+
+</process></programlisting>
+
+ <para>
+ Again a message will be sent to the queue with the name "queue/jbpm-test-queue" and the
+ factory used to create a connection to connect to this queue is named "ConnectionFactory".
+ In this case the payload of the message are the specified key-value pairs of the map.
+ It is illustrated in the test case below.
+ </para>
+
+ <programlisting>public void testMapMessage() throws Exception
+{
+ // as before
+ ...
+ <emphasis role="bold">executionService.startProcessInstanceByKey("JMS_map_queue");
+ MapMessage mapMessage = (MapMessage)messageConsumer.receive();
+ assertTrue(mapMessage.itemExists("x"));
+ assertEquals("foo", mapMessage.getObject("x"));</emphasis>
+
+ // as before
+ ...
+}</programlisting>
+
+ </section>
+
+ </section>
+
+
+
<section>
<title>History session chain</title>
<para>
16 years, 4 months
JBoss JBPM SVN: r6002 - jbpm4/trunk/modules/devguide/src/main/docbook/en/modules.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-12-20 16:27:27 -0500 (Sun, 20 Dec 2009)
New Revision: 6002
Modified:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml
Log:
Added some doc for the BPMN 2.0 root element
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml 2009-12-20 12:44:20 UTC (rev 6001)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml 2009-12-20 21:27:27 UTC (rev 6002)
@@ -221,6 +221,36 @@
</para>
</section>
+
+ <section id="definitionsAndProcess">
+
+ <title>Process root element</title>
+
+ <para>
+ The root of an BPMN 2.0 XML process is the <emphasis role="bold">definitions</emphasis>
+ elements. As the name states, the subelements will contain the actual definitions of
+ the business process(es). Every <emphasis role="bold">process</emphasis> child
+ will be able to have an <emphasis role="bold">id</emphasis>
+ <emphasis role="bold">name</emphasis>. An empty business process in BPMN 2.0
+ looks as follows. Also note that it is handy to have the BPMN2.xsd on the classpath, to
+ enable XML completion.
+ <programlisting>
+<definitions id="myProcesses"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 BPMN20.xsd"
+ xmlns="http://schema.omg.org/spec/BPMN/2.0"
+ typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath"
+ targetNamespace="http://jbpm.org/example/bpmn2">
+
+ <process id="myBusinessProcess" name="My business processs">
+ </programlisting>
+ If an id is defined for a process element, it will be used as business key for that
+ process (ie. starting a process can be done by calling executionService.startProcessInstanceByKey("myBusinessProcess"),
+ otherwise the jBPM engine will create a unique process key (same mechanism as for JPDL).
+ </para>
+
+ </section>
<section id="basicConstructs">
16 years, 4 months
JBoss JBPM SVN: r6001 - in jbpm4/trunk/modules: devguide/src/main/docbook/en/images and 1 other directories.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-12-20 07:44:20 -0500 (Sun, 20 Dec 2009)
New Revision: 6001
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/bpmn2.parallel.gateway.png
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/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/ParallelGatewayBinding.java
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml
Log:
JBPM-2662: parallel gateway
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-12-20 12:42:36 UTC (rev 6000)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java 2009-12-20 12:44:20 UTC (rev 6001)
@@ -1,20 +1,59 @@
+/*
+ * 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.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.w3c.dom.Element;
+/**
+ * Abstract super class for all gateway types.
+ *
+ * @author Ronald Van kuijk
+ * @author Joram Barrez
+ */
public abstract class AbstractGatewayBinding extends BpmnBinding {
- int incomming = 0;
- int outgoing = 0;
+ protected static final Log log = Log.getLog(AbstractGatewayBinding.class.getName());
+
+ protected int incoming;
+ protected List<Element> inSequenceFlows;
- String gatewayDirection = "unspeficied";
+ protected int outgoing;
+ protected List<Element> outSequenceFlows;
+
+ protected String id;
+ protected String name;
+
+ protected String gatewayDirection;
boolean valid = true;
- protected static final Log log = Log.getLog(AbstractGatewayBinding.class.getName());
static ObjectBinding objectBinding = new ObjectBinding();
static WireParser wireParser = WireParser.getInstance();
@@ -22,31 +61,67 @@
super(tagName);
}
- public void parse(Element element) {
- incomming = 0;
- outgoing = 0;
- valid = true;
+ /**
+ * Subclasses should call this method while parsing.
+ * Common attributes and elements will be parsed and stored in the protected member fields.
+ */
+ public void parse(Element element, Parse parse) {
+
+ resetMemberFields();
+ id = element.getAttribute("id");
+ name = element.getAttribute("name");
+
+ // 'gatewayDirection' is a constraint on any gateway type.
+ // Since this is an optional attribute, we can't rely on it at runtime.
+ // As such, it is only used at parsing time to check if the constraints are met.
if (element.hasAttribute("gatewayDirection")) {
-
gatewayDirection = element.getAttribute("gatewayDirection");
} else {
- // unspecified should be the 'xsd' default, so maybe this is not even
- // needed.
gatewayDirection = "unspecified";
}
+ // Count in/out sequence flow to validate gatewaydirection
+ List<Element> allSequenceFlow = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
+ Iterator<Element> iterator = allSequenceFlow.iterator();
+
+ while (iterator.hasNext()) {
+
+ Element sequenceFlowElement = iterator.next();
+ String sourceRef = sequenceFlowElement.getAttribute("sourceRef");
+ if (id.equals(sourceRef)) {
+ outgoing++;
+ outSequenceFlows.add(sequenceFlowElement);
+ } else if (sequenceFlowElement.getAttribute("targetRef").equals(id)) {
+ incoming++;
+ inSequenceFlows.add(sequenceFlowElement);
+ }
+
+ }
+
+ valid = validGatewayDirection(parse, name, element);
+
}
- protected boolean validGatewayDirection(String gatewayDirection, int incomming, int outgoing, Parse parse, String elementName, Element element) {
+ private void resetMemberFields() {
+ incoming = 0;
+ inSequenceFlows = new ArrayList<Element>();
+ outgoing = 0;
+ outSequenceFlows = new ArrayList<Element>();
+ valid = true;
+ }
+
+ protected boolean validGatewayDirection(Parse parse, String elementName, Element element) {
- log.debug(gatewayDirection + ": incomming: " + incomming + ", outgoing: " + outgoing);
+ if (log.isDebugEnabled()) {
+ log.debug(gatewayDirection + ": nr of incomming: " + incoming + ", nr of 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)));
+ boolean valid = !(("converging".equals(gatewayDirection) && (!(incoming > 1) || outgoing != 1))
+ || ("diverging".equals(gatewayDirection) && (incoming != 1 || !(outgoing > 1)))
+ || ("mixed".equals(gatewayDirection) && (incoming <= 1 || outgoing <= 1)));
if (!valid) {
- parse.addProblem(tagName+ " '" + elementName + "' has the wrong number of incomming (" + incomming + ") and outgoing (" + outgoing
+ parse.addProblem(tagName+ " '" + elementName + "' has the wrong number of incomming (" + incoming + ") and outgoing (" + outgoing
+ ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
}
return valid;
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-12-20 12:42:36 UTC (rev 6000)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java 2009-12-20 12:44:20 UTC (rev 6001)
@@ -21,9 +21,6 @@
*/
package org.jbpm.bpmn.flownodes;
-import java.util.Iterator;
-import java.util.List;
-
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
@@ -42,48 +39,38 @@
public Object parse(Element element, Parse parse, Parser parser) {
- super.parse(element);
+ super.parse(element, parse);
String default_ = null;
if (element.hasAttribute("default")) {
default_ = element.getAttribute("default");
}
+ // Check if all outgoing sequence flow have a condition (default excluded)
boolean defaultExists = false;
-
- List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
- String elementId = element.getAttribute("id");
- String elementName = element.getAttribute("name");
-
- Element ce;
-
- for (Iterator<Element> iterator = transitionElements.iterator(); iterator.hasNext();) {
- Element transitionElement = iterator.next();
- String sourceRef = transitionElement.getAttribute("sourceRef");
- 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_)) {
+ for (Element outSeqFlow : outSequenceFlows) {
+
+ String sourceRef = outSeqFlow.getAttribute("sourceRef");
+ Element conditionalExpression = XmlUtil.element(outSeqFlow, "conditionExpression");
+
+ if (id.equals(sourceRef)) {
+
+ if (outSeqFlow.getAttribute("id").equals(default_)) {
defaultExists = true;
- // All but the 'default' sequenceFlow need to have a condition
- } else if (default_ != null && ce == null) {
- parse.addProblem("exclusiveGateway '" + elementName + "' has default sequenceFlow '" + default_ + "' but " + transitionElement.getAttribute("id")
+ } else if (default_ != null && conditionalExpression == null) { // All but the 'default' sequenceFlow need to have a condition
+ parse.addProblem("exclusiveGateway '" + name + "' has default sequenceFlow '" + default_
+ + "' but " + outSeqFlow.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++;
+
}
+
}
- boolean validGatewayDirection = validGatewayDirection(gatewayDirection, incomming, outgoing, parse, elementName, element);
- valid = valid == false ? false : validGatewayDirection;
-
if (default_ != null && !defaultExists) {
- parse.addProblem("exclusiveGateway '" + elementName + "' default sequenceFlow '" + default_ + "' does not exist or is not related to this node", element);
+ parse.addProblem("exclusiveGateway '" + name + "' 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-12-20 12:42:36 UTC (rev 6000)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java 2009-12-20 12:44:20 UTC (rev 6001)
@@ -56,13 +56,21 @@
public void execute(ExecutionImpl execution) {
- if ("diverging".equals(gatewayDirection)) {
- log.debug("Forking parallel gateway");
+ int nrOfIncoming = execution.getActivity().getIncomingTransitions().size();
+ int nrOfOutgoing = execution.getActivity().getOutgoingTransitions().size();
+
+ if (nrOfIncoming == 1 && nrOfOutgoing > 1) {
+ if (log.isDebugEnabled()) {
+ log.debug("Forking parallel gateway");
+ }
fork(execution);
- } else if ("converging".equals(gatewayDirection)) {
- log.debug("Joining parallel gateway");
+ } else if (nrOfIncoming > 1 && nrOfOutgoing == 1) {
+ if (log.isDebugEnabled()) {
+ log.debug("Joining parallel gateway");
+ }
join(execution);
}
+
}
public void fork(ExecutionImpl execution) {
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-12-20 12:42:36 UTC (rev 6000)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java 2009-12-20 12:44:20 UTC (rev 6001)
@@ -21,10 +21,6 @@
*/
package org.jbpm.bpmn.flownodes;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -33,6 +29,7 @@
/**
* @author Tom Baeyens
* @author Ronald van Kuijk (kukeltje)
+ * @author Joram Barrez
*
*/
public class ParallelGatewayBinding extends AbstractGatewayBinding {
@@ -43,34 +40,14 @@
public Object parse(Element element, Parse parse, Parser parser) {
- super.parse(element);
-
- List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
- String elementId = element.getAttribute("id");
- String elementName = element.getAttribute("name");
+ super.parse(element, parse);
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 '" + name + "'", element);
return null;
}
-
- for (Iterator<Element> iterator = transitionElements.iterator(); iterator.hasNext();) {
- Element transitionElement = iterator.next();
- String sourceRef = transitionElement.getAttribute("sourceRef");
- if (elementId.equals(sourceRef)) {
- outgoing++;
- if (XmlUtil.element(transitionElement, "conditionExpression") != null) {
- parse.addProblem("parallelGateway '" + elementName + "' has invalid conditionExpression outgoing transition", element);
- valid = false;
- }
- } else if (transitionElement.getAttribute("targetRef").equals(elementId)) {
- incomming++;
- }
- }
- boolean validGatewayDirection = validGatewayDirection(gatewayDirection, incomming, outgoing, parse, elementName, element);
- valid = valid == false ? false : validGatewayDirection;
-
if (!valid) {
return null;
}
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/bpmn2.parallel.gateway.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/bpmn2.parallel.gateway.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml 2009-12-20 12:42:36 UTC (rev 6000)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml 2009-12-20 12:44:20 UTC (rev 6001)
@@ -436,6 +436,41 @@
Gateways are depicted as a diamond shape, with an icon inside specifying the type
(exclusive, inclusive, etc.).
</para>
+
+ <para>
+ On every gateway type, the attribute <emphasis role="bold">gatewayDirection</emphasis>
+ can be set. following values are possible:
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">unspecificed (default)</emphasis>: the gateway may have multiple
+ incoming and multiple sequence flow.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">mixed</emphasis>: the gateway must have multiple incoming and
+ multiple outgoing sequence flow.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">converging</emphasis>: the gateway must have multiple incoming
+ sequence flow, but can have only one outgoing sequence flow.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">diverging</emphasis>: the gateway must have only one incoming
+ sequence flow and multiple outgoing sequence flow.
+ </listitem>
+ </itemizedlist>
+ Take for example the following example: a parallel gateway that has as gatewayDirection
+ 'converging', will have a join behaviour.
+ <programlisting>
+<parallelGateway id="myJoin" name="My synchronizing join" gatewayDirection="converging" />
+ </programlisting>
+ <emphasis role="bold">Note</emphasis>: the 'gatewayDirection' attribute is optional according
+ to the specification. This means that we cannot rely on this attribute at runtime to
+ know which type of behaviour a certain gateway has (for example for a parallel gateway if
+ we have joining of forking behaviour). However, the 'gatewayDirection' attribute is used at parsing
+ time as a constraint check for the incoming/outgoing sequence flow. So using this
+ attirbute will lower the chance on errors in reference for sequence flow, but is not
+ required.
+ </para>
</section>
@@ -454,7 +489,7 @@
<emphasis role="bold"><decision></emphasis> activity. The full technical name of the
exclusive gateway is the <emphasis role="bold">'exclusive data-based gateway'</emphasis>,
but it is also often called the <emphasis role="bold">XOR Gateway</emphasis>.
- The XOR gateway is depicted as a diamond with a plus icon inside. An empty diamond
+ The XOR gateway is depicted as a diamond with a 'X' icon inside. An empty diamond
without a gateway also signifies an exclusive gateway.
</para>
@@ -528,6 +563,93 @@
</section>
+ <section id="parallelGateway">
+
+ <title>Gateway: parallel Gateway</title>
+
+ <para>
+ A parallel gateway is used to split or synchronize the respectively incoming or outgoing
+ sequence flow.
+ <itemizedlist>
+ <listitem>
+ A parallel gateway with one incoming sequence flow and more than one outgoing sequence
+ flow is called a <emphasis role="bold">'parallel split</emphasis> or an
+ <emphasis role="bold">'AND-split'</emphasis>. All outgoing sequence flow are going to
+ be taken in parallel. <emphasis role="bold">Note: as defined by the specification,
+ conditions on the outgoing sequence flow are ignored.</emphasis>
+ </listitem>
+ <listitem>
+ A parallel gateway with multiple incoming sequence flow and one outgoing sequence flow
+ is called a <emphasis role="bold">'parallel join'</emphasis> or an
+ <emphasis role="bold">AND-join</emphasis>. All incoming sequence flow need to arrive
+ in this parallel joing before the outgoing sequence flow is taken.
+ </listitem>
+ </itemizedlist>
+ A parallel gateway is defined as follows:
+ <programlisting>
+<parallelGateway id="myParallelGateway" name="My Parallel Gateway" />
+ </programlisting>
+ Note that the 'gatewayDirection' attribute can be used to catch modeling errors at parsing
+ time (see above).
+ </para>
+
+ <para>
+ The following diagrom shows how a parallel gateway can be used. After process start,
+ both the 'prepare shipment' and 'bill customer' user tasks will be active.
+ The parallel gateway is depicted as a diamond shape with a plus icon inside, both for the
+ splitting and joining behaviour.
+ <mediaobject><imageobject><imagedata align="center" fileref="images/bpmn2.parallel.gateway.png"/></imageobject></mediaobject>
+ The XML counterpart of this diagram looks as follows:
+ <programlisting>
+ <process id="parallelGateway" name="BPMN2 example parallel gatewar">
+
+ <startEvent id="Start" />
+
+ <sequenceFlow id="flow1" name="fromStartToSplit"
+ sourceRef="Start"
+ targetRef="parallelGatewaySplit" />
+
+ <parallelGateway id="parallelGatewaySplit" name="Split"
+ gatewayDirection="diverging"/>
+
+ <sequenceFlow id="flow2a" name="Leg 1"
+ sourceRef="parallelGatewaySplit"
+ targetRef="prepareShipment" />
+
+ <userTask id="prepareShipment" name="Prepare shipment"
+ implementation="other" />
+
+ <sequenceFlow id="flow2b" name="fromPrepareShipmentToJoin"
+ sourceRef="prepareShipment"
+ targetRef="parallelGatewayJoin" />
+
+ <sequenceFlow id="flow3a" name="Leg 2"
+ sourceRef="parallelGatewaySplit"
+ targetRef="billCustomer" />
+
+ <userTask id="billCustomer" name="Bill customer"
+ implementation="other" />
+
+ <sequenceFlow id="flow3b" name="fromLeg2ToJoin"
+ sourceRef="billCustomer"
+ targetRef="parallelGatewayJoin" />
+
+ <parallelGateway id="parallelGatewayJoin" name="Join"
+ gatewayDirection="converging"/>
+
+ <sequenceFlow id="flow4"
+ sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </sequenceFlow>
+
+ <endEvent id="End" name="End" />
+
+ </process>
+ </programlisting>
+ </para>
+
+ </section>
+
<section id="task">
<title>Tasks</title>
16 years, 4 months
JBoss JBPM SVN: r6000 - in jbpm4/trunk/modules/examples/src/test: java/org/jbpm/examples/bpmn/gateway/parallel and 2 other directories.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-12-20 07:42:36 -0500 (Sun, 20 Dec 2009)
New Revision: 6000
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/gateway/parallel/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/gateway/parallel/ParallelGatewayTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/parallel/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/parallel/parallel_gateway.bpmn.xml
Log:
JBPM-2662: parallel gateway
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/gateway/parallel/ParallelGatewayTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/gateway/parallel/ParallelGatewayTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/gateway/parallel/ParallelGatewayTest.java 2009-12-20 12:42:36 UTC (rev 6000)
@@ -0,0 +1,39 @@
+package org.jbpm.examples.bpmn.gateway.parallel;
+
+import java.util.List;
+
+import org.jbpm.api.NewDeployment;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+public class ParallelGatewayTest extends JbpmTestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ NewDeployment deployment = repositoryService.createDeployment();
+ deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/gateway/parallel/parallel_gateway.bpmn.xml");
+ registerDeployment(deployment.deploy());
+ }
+
+ public void testParallelGateway() {
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("parallelGateway");
+
+ List<Task> tasks = taskService.createTaskQuery().list();
+ assertEquals(2, tasks.size());
+
+ // Complete first task -> 1 still open
+ taskService.completeTask(tasks.get(0).getId());
+ assertProcessInstanceActive(processInstance);
+ Task secondTask = taskService.createTaskQuery().uniqueResult();
+ assertNotNull(secondTask);
+ assertTrue(secondTask.getName().equals("Prepare shipment") || secondTask.getName().equals("Bill customer"));
+
+ // Complete second task -> process ended
+ taskService.completeTask(secondTask.getId());
+ assertProcessInstanceEnded(processInstance);
+ }
+
+}
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/parallel/parallel_gateway.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/parallel/parallel_gateway.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/parallel/parallel_gateway.bpmn.xml 2009-12-20 12:42:36 UTC (rev 6000)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../../../../../bpmn/src/main/resources/BPMN20.xsd"
+ xmlns="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://jbpm.org/example/bpmn2/parallel_gateway">
+
+ <process id="parallelGateway" name="BPMN2 example parallel gatewar">
+
+ <startEvent id="Start" />
+
+ <sequenceFlow id="flow1" name="fromStartToSplit"
+ sourceRef="Start"
+ targetRef="parallelGatewaySplit" />
+
+ <parallelGateway id="parallelGatewaySplit" name="Split"
+ gatewayDirection="diverging"/>
+
+ <sequenceFlow id="flow2a" name="Leg 1"
+ sourceRef="parallelGatewaySplit"
+ targetRef="prepareShipment" />
+
+ <userTask id="prepareShipment" name="Prepare shipment" implementation="other" />
+
+ <sequenceFlow id="flow2b" name="fromPrepareShipmentToJoin"
+ sourceRef="prepareShipment"
+ targetRef="parallelGatewayJoin" />
+
+ <sequenceFlow id="flow3a" name="Leg 2"
+ sourceRef="parallelGatewaySplit"
+ targetRef="billCustomer" />
+
+ <userTask id="billCustomer" name="Bill customer" implementation="other" />
+
+ <sequenceFlow id="flow3b" name="fromLeg2ToJoin"
+ sourceRef="billCustomer"
+ targetRef="parallelGatewayJoin" />
+
+ <parallelGateway id="parallelGatewayJoin" name="Join"
+ gatewayDirection="converging"/>
+
+ <sequenceFlow id="flow4"
+ sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </sequenceFlow>
+
+ <endEvent id="End" name="End" />
+
+ </process>
+</definitions>
16 years, 4 months
JBoss JBPM SVN: r5999 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src: main/java/org/jbpm/job/executor and 6 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-12-18 16:13:44 -0500 (Fri, 18 Dec 2009)
New Revision: 5999
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/BombAction.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/JBPM2691Test.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/gpd.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/processdefinition.xml
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/processdefinition.xml
Log:
JBPM-2691: Save exceptions thrown while executing a job in a separate transaction
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2009-12-18 19:00:53 UTC (rev 5998)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2009-12-18 21:13:44 UTC (rev 5999)
@@ -79,7 +79,8 @@
}
private void ensureCleanDatabase() {
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory("persistence");
+ DbPersistenceServiceFactory persistenceServiceFactory =
+ (DbPersistenceServiceFactory) getJbpmConfiguration().getServiceFactory("persistence");
if (persistenceServiceFactory == null) return;
boolean hasLeftOvers = false;
@@ -91,8 +92,8 @@
Long count = (Long) entry.getValue();
if (count.intValue() != 0) {
hasLeftOvers = true;
- System.err.println("FIXME: " + getClass().getName() + "." + getName() + " left "
- + count + " records in " + entry.getKey());
+ System.err.println("FIXME: " + getClass().getName() + "." + getName()
+ + " left " + count + " records in " + entry.getKey());
}
}
@@ -102,8 +103,10 @@
}
protected String getHibernateDialect() {
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
- return persistenceServiceFactory.getConfiguration().getProperty(Environment.DIALECT);
+ DbPersistenceServiceFactory persistenceServiceFactory =
+ (DbPersistenceServiceFactory) jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ return persistenceServiceFactory.getConfiguration()
+ .getProperty(Environment.DIALECT);
}
protected void beginSessionTransaction() {
@@ -130,7 +133,8 @@
protected TaskInstance saveAndReload(TaskInstance taskInstance) {
jbpmContext.save(taskInstance);
newTransaction();
- return (TaskInstance) session.load(TaskInstance.class, new Long(taskInstance.getId()));
+ return (TaskInstance) session.load(TaskInstance.class, new Long(
+ taskInstance.getId()));
}
protected ProcessDefinition saveAndReload(ProcessDefinition pd) {
@@ -186,7 +190,7 @@
}
protected void waitForJobs(final long timeout) {
- final long startTime = System.currentTimeMillis();
+ long startTime = System.currentTimeMillis();
int previousCount = 0;
long previousTime = 0L;
@@ -194,9 +198,9 @@
long waitPeriod = 500;
for (int currentCount; (currentCount = getNbrOfJobsAvailable()) > 0;) {
- final long currentTime = System.currentTimeMillis();
+ long currentTime = System.currentTimeMillis();
- final long elapsedTime = currentTime - startTime;
+ long elapsedTime = currentTime - startTime;
if (elapsedTime > timeout) {
fail("test execution exceeded threshold of " + timeout + " ms");
}
@@ -214,11 +218,12 @@
waitPeriod = 5000;
}
else {
- final long remainingTime = timeout - elapsedTime;
+ long remainingTime = timeout - elapsedTime;
if (waitPeriod > remainingTime) waitPeriod = remainingTime;
}
- log.debug("waiting " + waitPeriod + " ms for " + currentCount + " jobs to be executed");
+ log.debug("waiting " + waitPeriod + " ms for " + currentCount
+ + " jobs to be executed");
try {
Thread.sleep(waitPeriod);
}
@@ -233,12 +238,12 @@
protected int getNbrOfJobsAvailable() {
if (session != null) {
- return getNbrOfJobsAvailable(session);
+ return getJobCount(session);
}
else {
beginSessionTransaction();
try {
- return getNbrOfJobsAvailable(session);
+ return getJobCount(session);
}
finally {
commitAndCloseSession();
@@ -246,16 +251,15 @@
}
}
- private int getNbrOfJobsAvailable(Session session) {
- Number jobs = (Number) session.createQuery("select count(*) from org.jbpm.job.Job")
- .uniqueResult();
- return jobs.intValue();
+ private int getJobCount(Session session) {
+ Number jobCount = (Number) session.createQuery("select count(*) "
+ + "from org.jbpm.job.Job where retries > 0").uniqueResult();
+ return jobCount.intValue();
}
protected int getTimerCount() {
- Number timerCount = (Number) session.createQuery("select count(*) from org.jbpm.job.Timer")
- .uniqueResult();
- log.debug("there are " + timerCount + " timers in the database");
+ Number timerCount = (Number) session.createQuery("select count(*) "
+ + "from org.jbpm.job.Timer where retries > 0").uniqueResult();
return timerCount.intValue();
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2009-12-18 19:00:53 UTC (rev 5998)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2009-12-18 21:13:44 UTC (rev 5999)
@@ -43,8 +43,8 @@
* @deprecated use {@link #JobExecutorThread(String, JobExecutor)} instead
*/
public JobExecutorThread(String name, JobExecutor jobExecutor,
- JbpmConfiguration jbpmConfiguration, int idleInterval, int maxIdleInterval,
- long maxLockTime, int maxHistory) {
+ JbpmConfiguration jbpmConfiguration, int idleInterval,
+ int maxIdleInterval, long maxLockTime, int maxHistory) {
super(name);
this.jobExecutor = jobExecutor;
this.jbpmConfiguration = jbpmConfiguration;
@@ -60,7 +60,12 @@
Collection acquiredJobs = acquireJobs();
for (Iterator i = acquiredJobs.iterator(); i.hasNext() && isActive;) {
Job job = (Job) i.next();
- executeJob(job);
+ try {
+ executeJob(job);
+ }
+ catch (Exception e) {
+ saveJobException(job, e);
+ }
}
if (isActive) {
long waitPeriod = getWaitPeriod(currentIdleInterval);
@@ -75,21 +80,23 @@
}
catch (RuntimeException e) {
if (isActive) {
- log.error("exception in " + getName() + ", waiting " + currentIdleInterval + " ms", e);
+ log.error("exception in " + getName() + ", waiting "
+ + currentIdleInterval + " ms", e);
try {
synchronized (jobExecutor) {
jobExecutor.wait(currentIdleInterval);
}
+ // after an exception, double the current idle interval to avoid
+ // throwing exceptions continuously during anomalous conditions
+ currentIdleInterval *= 2;
+ if (currentIdleInterval > maxIdleInterval
+ || currentIdleInterval < 0) {
+ currentIdleInterval = maxIdleInterval;
+ }
}
catch (InterruptedException ie) {
log.debug(getName() + " got interrupted: " + e.getMessage());
}
- // after an exception, double the current idle interval to prevent
- // continuous exception throwing while an anomalous condition prevails
- currentIdleInterval *= 2;
- if (currentIdleInterval > maxIdleInterval || currentIdleInterval < 0) {
- currentIdleInterval = maxIdleInterval;
- }
}
}
catch (InterruptedException e) {
@@ -115,7 +122,8 @@
if (job.isExclusive()) {
ProcessInstance processInstance = job.getProcessInstance();
log.debug("finding exclusive jobs for " + processInstance);
- jobsToLock = jobSession.findExclusiveJobs(lockOwner, processInstance);
+ jobsToLock =
+ jobSession.findExclusiveJobs(lockOwner, processInstance);
log.debug("acquiring " + jobsToLock + " for " + processInstance);
}
else {
@@ -157,7 +165,7 @@
return acquiredJobs;
}
- protected void executeJob(Job job) {
+ protected void executeJob(Job job) throws Exception {
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
JobSession jobSession = jbpmContext.getJobSession();
@@ -174,17 +182,13 @@
}
}
catch (Exception e) {
- log.debug("exception while executing " + job, e);
- if (!DbPersistenceService.isPersistenceException(e)) {
- StringWriter memoryWriter = new StringWriter();
- e.printStackTrace(new PrintWriter(memoryWriter));
- job.setException(memoryWriter.toString());
- job.setRetries(job.getRetries() - 1);
- }
- else {
- // prevent unsafe use of the session after an exception occurs
- jbpmContext.setRollbackOnly();
- }
+ // prevent unsafe use of the session after an exception occurs
+ jbpmContext.setRollbackOnly();
+
+ if (!DbPersistenceService.isLockingException(e)) throw e;
+ // if this is a locking exception, keep it quiet
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog()
+ .error("failed to complete " + job);
}
catch (Error e) {
jbpmContext.setRollbackOnly();
@@ -192,7 +196,8 @@
}
// if this job is locked too long
- long totalLockTimeInMillis = System.currentTimeMillis() - job.getLockTime().getTime();
+ long totalLockTimeInMillis =
+ System.currentTimeMillis() - job.getLockTime().getTime();
if (totalLockTimeInMillis > maxLockTime) {
jbpmContext.setRollbackOnly();
}
@@ -204,12 +209,39 @@
catch (RuntimeException e) {
if (!DbPersistenceService.isLockingException(e)) throw e;
// if this is a locking exception, keep it quiet
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error("failed to complete job "
- + job);
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog()
+ .error("failed to complete " + job);
}
}
}
+ private void saveJobException(Job job, Exception exception) {
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try {
+ JobSession jobSession = jbpmContext.getJobSession();
+ // not reattaching existing job as it may contain updates
+ job = jobSession.loadJob(job.getId());
+
+ StringWriter out = new StringWriter();
+ exception.printStackTrace(new PrintWriter(out));
+ job.setException(out.toString());
+ job.setRetries(job.getRetries() - 1);
+ }
+ catch (RuntimeException e) {
+ jbpmContext.setRollbackOnly();
+ log.error("failed to save job exception", exception);
+ throw e;
+ }
+ catch (Error e) {
+ jbpmContext.setRollbackOnly();
+ log.error("failed to save job exception", exception);
+ throw e;
+ }
+ finally {
+ jbpmContext.close();
+ }
+ }
+
protected long getWaitPeriod(int currentIdleInterval) {
long waitPeriod = currentIdleInterval;
@@ -255,7 +287,7 @@
if (!DbPersistenceService.isLockingException(e)) throw e;
// if this is a locking exception, keep it quiet
StaleObjectLogConfigurer.getStaleObjectExceptionsLog()
- .error("failed to determine next due date for job executor thread " + lockOwner);
+ .error("failed to determine next due date");
nextDueDate = null;
}
}
@@ -270,7 +302,8 @@
}
/**
- * Indicates that this thread should stop running. Execution will cease shortly afterwards.
+ * Indicates that this thread should stop running. Execution will cease
+ * shortly afterwards.
*/
public void deactivate() {
if (isActive) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2009-12-18 19:00:53 UTC (rev 5998)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2009-12-18 21:13:44 UTC (rev 5999)
@@ -265,7 +265,7 @@
<![CDATA[
select job
from org.jbpm.job.Job as job
- where ( (job.lockOwner is null) or (job.lockOwner = :lockOwner) )
+ where (job.lockOwner is null or job.lockOwner = :lockOwner)
and job.retries > 0
and job.dueDate <= :now
and job.isSuspended = false
@@ -277,7 +277,7 @@
<![CDATA[
select job
from org.jbpm.job.Job as job
- where ( (job.lockOwner is null) or (job.lockOwner = :lockOwner) )
+ where (job.lockOwner is null or job.lockOwner = :lockOwner)
and job.retries > 0
and job.dueDate <= :now
and job.processInstance = :processInstance
@@ -291,7 +291,7 @@
<![CDATA[
select job
from org.jbpm.job.Job as job
- where ( (job.lockOwner is null) or (job.lockOwner = :lockOwner) )
+ where (job.lockOwner is null or job.lockOwner = :lockOwner)
and job.retries > 0
and job.isSuspended = false
order by job.dueDate asc
@@ -302,8 +302,8 @@
<![CDATA[
select job
from org.jbpm.job.Job as job
- where ( (job.lockOwner is null) or (job.lockOwner = :lockOwner) )
- and job.id not in ( :monitoredJobIds )
+ where (job.lockOwner is null or job.lockOwner = :lockOwner)
+ and job.id not in (:monitoredJobIds)
and job.retries > 0
and job.isSuspended = false
order by job.dueDate asc
@@ -406,7 +406,7 @@
<![CDATA[
select ti
from org.jbpm.taskmgmt.exe.TaskInstance as ti
- where ti.actorId in ( :actorIds )
+ where ti.actorId in (:actorIds)
and ti.isSuspended = false
and ti.isOpen = true
]]>
@@ -429,7 +429,7 @@
select distinct ti.id
from org.jbpm.taskmgmt.exe.TaskInstance ti
join ti.pooledActors pooledActor
- where pooledActor.actorId in ( :actorIds )
+ where pooledActor.actorId in (:actorIds)
and ti.actorId is null
and ti.isSuspended = false
and ti.isOpen = true
@@ -460,7 +460,7 @@
<![CDATA[
select ti
from org.jbpm.taskmgmt.exe.TaskInstance ti
- where ti.id in ( :taskInstanceIds )
+ where ti.id in (:taskInstanceIds)
]]>
</query>
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/BombAction.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/BombAction.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/BombAction.java 2009-12-18 21:13:44 UTC (rev 5999)
@@ -0,0 +1,14 @@
+package org.jbpm.jbpm2691;
+
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+public class BombAction implements ActionHandler {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ExecutionContext executionContext) throws Exception {
+ throw new Exception("boom");
+ }
+
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/BombAction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/JBPM2691Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/JBPM2691Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/JBPM2691Test.java 2009-12-18 21:13:44 UTC (rev 5999)
@@ -0,0 +1,74 @@
+/*
+ * 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.jbpm2691;
+
+import java.util.List;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.exe.Token;
+import org.jbpm.job.Job;
+
+/**
+ * Save exceptions thrown while executing a job in a separate transaction.
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2691">JBPM-2691</a>
+ * @author Alejandro Guizar
+ */
+public class JBPM2691Test extends AbstractDbTestCase {
+
+ private long processDefinitionId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm2691/processdefinition.xml");
+ jbpmContext.deployProcessDefinition(processDefinition);
+ processDefinitionId = processDefinition.getId();
+
+ newTransaction();
+ }
+
+ protected void tearDown() throws Exception {
+ graphSession.deleteProcessDefinition(processDefinitionId);
+ super.tearDown();
+ }
+
+ public void testSaveExceptionInSeparateTx() {
+ ProcessInstance processInstance = jbpmContext.newProcessInstance("jobex");
+ processInstance.signal();
+
+ processJobs(60 * 1000);
+ processInstance = jbpmContext.getProcessInstance(processInstance.getId());
+ Token rootToken = processInstance.getRootToken();
+ List jobs = jobSession.findJobsByToken(rootToken);
+ assertEquals(1, jobs.size());
+
+ Job job = (Job) jobs.get(0);
+ String exception = job.getException();
+ assertNotNull(exception);
+ assert exception.indexOf("boom") != -1 : exception;
+
+ // exception should leave job in its original state
+ assertEquals("async", rootToken.getNode().getName());
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2691/JBPM2691Test.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/processdefinition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/processdefinition.xml 2009-12-18 19:00:53 UTC (rev 5998)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/processdefinition.xml 2009-12-18 21:13:44 UTC (rev 5999)
@@ -1,32 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process-definition xmlns="" name="scripted">
+<process-definition name="scripted" xmlns="urn:jbpm.org:jpdl-3.2">
+ <start-state name="start">
+ <transition to="esb" />
+ </start-state>
- <start-state name="start">
- <transition to="esb"></transition>
- </start-state>
+ <node name="esb">
+ <action class="org.jbpm.mock.EsbActionHandler">
+ <esbServiceName>paybills</esbServiceName>
+ <esbCategoryName>annoyances</esbCategoryName>
+ </action>
+ <transition to="end" />
+ </node>
+ <end-state name="end" />
- <node name="esb">
- <action class="org.jbpm.mock.EsbActionHandler">
- <esbServiceName>
- paybills
- </esbServiceName>
- <esbCategoryName>
- annoyances
- </esbCategoryName>
- </action>
- <transition to="end"></transition>
- </node>
+ <event type="node-enter">
+ <action class="org.jbpm.no.such.Class" />
+ </event>
-
- <end-state name="end"></end-state>
-
-
- <event type="node-enter">
- <action class="org.jbpm.no.such.Class"></action>
- </event>
-
-
</process-definition>
\ No newline at end of file
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/gpd.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/gpd.xml 2009-12-18 21:13:44 UTC (rev 5999)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="jobex" width="862" height="591">
+ <node name="start" x="172" y="42" width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="async" x="172" y="111" width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="bomb" x="172" y="180" width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="end" x="172" y="256" width="132" height="36"/>
+</root-container>
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/gpd.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/processdefinition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/processdefinition.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/processdefinition.xml 2009-12-18 21:13:44 UTC (rev 5999)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition name="jobex" xmlns="urn:jbpm.org:jpdl-3.2">
+ <start-state name="start">
+ <transition to="async" />
+ </start-state>
+
+ <node name="async" async="true">
+ <transition to="bomb" />
+ </node>
+
+ <node name="bomb">
+ <action class="org.jbpm.jbpm2691.BombAction" />
+ <transition to="end" />
+ </node>
+
+ <end-state name="end" />
+</process-definition>
\ No newline at end of file
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2691/processdefinition.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
16 years, 4 months
JBoss JBPM SVN: r5998 - in jbpm4/trunk: qa and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-12-18 14:00:53 -0500 (Fri, 18 Dec 2009)
New Revision: 5998
Modified:
jbpm4/trunk/pom.xml
jbpm4/trunk/qa/hudson-jbpm4-enterprise.sh
Log:
fix for enterprise hudson script: added integration profile
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-12-18 18:22:49 UTC (rev 5997)
+++ jbpm4/trunk/pom.xml 2009-12-18 19:00:53 UTC (rev 5998)
@@ -710,6 +710,7 @@
<profile>
<id>enterprise</id>
<modules>
+ <module>modules/test-cactus</module>
<module>modules/test-enterprise/test-enterprise-ejb</module>
<module>modules/test-enterprise/test-enterprise-suite</module>
</modules>
Modified: jbpm4/trunk/qa/hudson-jbpm4-enterprise.sh
===================================================================
--- jbpm4/trunk/qa/hudson-jbpm4-enterprise.sh 2009-12-18 18:22:49 UTC (rev 5997)
+++ jbpm4/trunk/qa/hudson-jbpm4-enterprise.sh 2009-12-18 19:00:53 UTC (rev 5998)
@@ -6,7 +6,7 @@
ANT_PROPERTIES="-Djboss.version=$JBOSS_VERSION -Djbpm.parent.dir=$WORKSPACE -Djboss.distro.dir=$SOURCE_REPO/jboss"
echo ANT_PROPERTIES=${ANT_PROPERTIES}
-mvn -U -Pdistro,integration,enterprise clean install
+mvn -U -Pdistro,enterprise clean install
ant -f qa/build.xml $ANT_PROPERTIES testsuite.enterprise.setup
cd modules/test-enterprise/test-enterprise-suite
16 years, 4 months
JBoss JBPM SVN: r5997 - jbpm4/trunk/qa.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-12-18 13:22:49 -0500 (Fri, 18 Dec 2009)
New Revision: 5997
Modified:
jbpm4/trunk/qa/hudson-jbpm4-enterprise.sh
Log:
fix for enterprise hudson script: added integration profile
Modified: jbpm4/trunk/qa/hudson-jbpm4-enterprise.sh
===================================================================
--- jbpm4/trunk/qa/hudson-jbpm4-enterprise.sh 2009-12-18 16:52:34 UTC (rev 5996)
+++ jbpm4/trunk/qa/hudson-jbpm4-enterprise.sh 2009-12-18 18:22:49 UTC (rev 5997)
@@ -6,7 +6,7 @@
ANT_PROPERTIES="-Djboss.version=$JBOSS_VERSION -Djbpm.parent.dir=$WORKSPACE -Djboss.distro.dir=$SOURCE_REPO/jboss"
echo ANT_PROPERTIES=${ANT_PROPERTIES}
-mvn -U -Pdistro,enterprise clean install
+mvn -U -Pdistro,integration,enterprise clean install
ant -f qa/build.xml $ANT_PROPERTIES testsuite.enterprise.setup
cd modules/test-enterprise/test-enterprise-suite
16 years, 4 months
JBoss JBPM SVN: r5996 - in jbpm4/trunk: modules/distro/src/main/files/install and 4 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-12-18 11:52:34 -0500 (Fri, 18 Dec 2009)
New Revision: 5996
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.3.xsd
jbpm4/trunk/modules/distro/src/main/files/install/build.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/ejb/EjbTest.java
jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/ejb/process.jpdl.xml
jbpm4/trunk/qa/build.xml
jbpm4/trunk/qa/hudson-jbpm4-enterprise.bat
Log:
JBPM-2300 JBPM-2412 enterprise test fixes
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.3.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.3.xsd 2009-12-18 16:15:40 UTC (rev 5995)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.3.xsd 2009-12-18 16:52:34 UTC (rev 5996)
@@ -959,6 +959,10 @@
<annotation><documentation>The name of the method to invoke.
</documentation></annotation>
</attribute>
+ <attribute name="ejb-jndi-name" type="string">
+ <annotation><documentation>The jndi name of the ejb that needs to be invoked.
+ </documentation></annotation>
+ </attribute>
<attribute name="class" type="string">
<annotation><documentation>The class to instantiate.
</documentation></annotation>
Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-12-18 16:15:40 UTC (rev 5995)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-12-18 16:52:34 UTC (rev 5996)
@@ -229,7 +229,7 @@
<include name="antlr.jar" />
<include name="antlr-runtime.jar" />
<include name="commons-collections.jar" />
- <include name="core.jar" />
+ <!-- include name="core.jar" /-->
<include name="dom4j.jar" />
<include name="drools-api.jar" />
<include name="drools-core.jar" />
@@ -323,7 +323,7 @@
</fileset>
<fileset dir="${jbpm.home}/lib">
<include name="antlr-runtime.jar" />
- <include name="core.jar" />
+ <!-- include name="core.jar" /-->
<include name="drools-api.jar" />
<include name="drools-core.jar" />
<include name="drools-compiler.jar" />
@@ -486,7 +486,7 @@
<include name="bsh.jar" />
<include name="commons-collections.jar" />
<include name="commons-logging.jar" />
- <include name="core.jar" />
+ <!-- include name="core.jar" /-->
<include name="dom4j.jar" />
<include name="drools-api.jar" />
<include name="drools-core.jar" />
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-12-18 16:15:40 UTC (rev 5995)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-12-18 16:52:34 UTC (rev 5996)
@@ -48,7 +48,7 @@
public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
JavaActivity javaActivity = new JavaActivity();
if (XmlUtil.attribute(element, "method", true, parse, null)!=null) {
- String jndiName = XmlUtil.attribute(element, "jndi-name", false, parse, null);
+ String jndiName = XmlUtil.attribute(element, "ejb-jndi-name", false, parse, null);
if (jndiName != null) {
parseEjbInvocation(javaActivity, element, parse, parser);
} else {
@@ -61,7 +61,7 @@
}
private void parseEjbInvocation(JavaActivity javaActivity, Element element, Parse parse, JpdlParser parser) {
- javaActivity.setJndiName(XmlUtil.attribute(element, "jndi-name"));
+ javaActivity.setJndiName(XmlUtil.attribute(element, "ejb-jndi-name"));
javaActivity.setMethodName(XmlUtil.attribute(element, "method"));
List<Element> argElements = XmlUtil.elements(element, "arg");
List<ArgDescriptor> argDescriptors = new WireParser().parseArgs(argElements, parse);
Modified: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/ejb/EjbTest.java
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/ejb/EjbTest.java 2009-12-18 16:15:40 UTC (rev 5995)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/java/org/jbpm/test/ejb/EjbTest.java 2009-12-18 16:52:34 UTC (rev 5996)
@@ -25,6 +25,6 @@
.startProcessInstanceByKey("EJB")
.getProcessInstance()
.getId();
- assertEquals(59, executionService.getVariable(executionId, "answer"));
+ assertEquals(63, executionService.getVariable(executionId, "answer"));
}
}
Modified: jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/ejb/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/ejb/process.jpdl.xml 2009-12-18 16:15:40 UTC (rev 5995)
+++ jbpm4/trunk/modules/test-enterprise/test-enterprise-suite/src/test/resources/org/jbpm/test/ejb/process.jpdl.xml 2009-12-18 16:52:34 UTC (rev 5996)
@@ -7,7 +7,7 @@
</start>
<java name="calculate"
- jndi="CalculatorBean"
+ ejb-jndi-name="CalculatorBean/local"
method="add"
var="answer"
g="96,16,83,52">
Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-12-18 16:15:40 UTC (rev 5995)
+++ jbpm4/trunk/qa/build.xml 2009-12-18 16:52:34 UTC (rev 5996)
@@ -44,7 +44,7 @@
<!-- ####################################### -->
- <!-- ### MAIN SETUP AND TEARDOWN TARGETS ### -->
+ <!-- ### MAIN SETUP AND TEARDOWN TARGETS ### -->
<!-- ####################################### -->
<!-- DB SETUP -->
@@ -61,15 +61,15 @@
<!-- TOMCAT SETUP -->
<target name="testsuite.tomcat.setup"
- depends="reinstall.jbpm">
+ depends="reinstall.jbpm">
<ant antfile="${jbpm.home}/install/build.xml" target="reinstall.tomcat" />
<ant antfile="${jbpm.home}/install/build.xml" target="create.user.webapp" />
<ant antfile="${jbpm.home}/install/build.xml" target="install.hsqldb.server" />
<ant antfile="${jbpm.home}/install/build.xml" target="start.hsqldb.server" />
<ant antfile="${jbpm.home}/install/build.xml" target="create.jbpm.schema" />
- <!-- to build the jbpm test webapp we start by copying the user webapp -->
- <mkdir dir="${tomcat.home}/webapps/jbpm-test-webapp" />
+ <!-- to build the jbpm test webapp we start by copying the user webapp -->
+ <mkdir dir="${tomcat.home}/webapps/jbpm-test-webapp" />
<copy todir="${tomcat.home}/webapps/jbpm-test-webapp">
<fileset dir="${jbpm.home}/install/generated/user-webapp"/>
</copy>
@@ -79,14 +79,14 @@
<fileset dir="cactus.webapp.cfg" />
</copy>
- <!-- add examples.jar -->
- <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
+ <!-- add examples.jar -->
+ <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
<copy file="${jbpm.home}/examples/target/examples.jar" todir="${tomcat.home}/webapps/jbpm-test-webapp/WEB-INF/lib" />
<!-- add junit.jar -->
<copy file="${jbpm.home}/lib/junit.jar" todir="${tomcat.home}/webapps/jbpm-test-webapp/WEB-INF/lib" />
- <!-- add the cactus libs -->
+ <!-- add the cactus libs -->
<copy todir="${tomcat.home}/webapps/jbpm-test-webapp/WEB-INF/lib">
<fileset dir="../modules/test-cactus/target/jbpm.test.webapp.libs" />
</copy>
@@ -96,7 +96,7 @@
<!-- start tomcat -->
<ant antfile="${jbpm.home}/install/build.xml" target="start.tomcat" />
- </target>
+ </target>
<!-- TOMCAT TEARDOWN -->
<target name="testsuite.tomcat.teardown">
@@ -104,7 +104,7 @@
<ant antfile="${jbpm.home}/install/build.xml" target="drop.jbpm.schema" />
<ant antfile="${jbpm.home}/install/build.xml" target="stop.hsqldb.server" />
</target>
-
+
<!-- JBOSS SETUP -->
<target name="testsuite.jboss.setup"
depends="jboss.test.setup.base"
@@ -139,17 +139,24 @@
<target name="testsuite.enterprise.setup"
depends="jboss.test.setup.base"
description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss, starts jboss and then creates the jbpm schema">
-
- <!-- create the test queue -->
- <copy file="../modules/test-enterprise/test-enterprise-suite/src/test/resources/jbpm-test-destinations-service.xml"
- todir="${jboss.home}/server/default/deploy/jbpm-test" />
-
- <!-- deploy the test ejbs -->
- <copy file="../modules/test-enterprise/test-enterprise-ejb/target/jbpm-test-enterprise-ejb-${jbpm.version}.jar"
- todir="${jboss.home}/server/default/deploy/jbpm-test"/>
+
+ <!-- create the test queue -->
+ <copy file="../modules/test-enterprise/test-enterprise-suite/src/test/resources/jbpm-test-destinations-service.xml"
+ todir="${jboss.home}/server/default/deploy/jbpm-test" />
+
+ <!-- deploy the test ejbs -->
+ <copy file="../modules/test-enterprise/test-enterprise-ejb/target/jbpm-test-enterprise-ejb-${jbpm.version}.jar"
+ todir="${jboss.home}/server/default/deploy/jbpm-test"/>
- <!-- start jboss
- <ant antfile="${jbpm.home}/install/build.xml" target="start.jboss" /> -->
+ <!-- copy the test classes to the test web app -->
+ <copy file="../modules/test-enterprise/test-enterprise-suite/target/jbpm-test-enterprise-suite-${jbpm.version}-tests.jar"
+ todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
+
+ <!-- start hsqldb -->
+ <ant antfile="${jbpm.home}/install/build.xml" target="start.hsqldb.server" />
+ <ant antfile="${jbpm.home}/install/build.xml" target="create.jbpm.schema" />
+ <!-- start jboss -->
+ <ant antfile="${jbpm.home}/install/build.xml" target="start.jboss" />
</target>
<!-- ENTERPRISE TEARDOWN -->
@@ -303,7 +310,7 @@
<!-- ### These targets can be called directly ### -->
<!-- ############################################ -->
- <!-- re-install jbpm and setup jboss for cactus testing -->
+ <!-- re-install jbpm and setup jboss for cactus testing -->
<target name="jboss.test.setup.base"
depends="reinstall.jbpm">
<ant antfile="${jbpm.home}/install/build.xml" target="reinstall.jboss" />
Modified: jbpm4/trunk/qa/hudson-jbpm4-enterprise.bat
===================================================================
--- jbpm4/trunk/qa/hudson-jbpm4-enterprise.bat 2009-12-18 16:15:40 UTC (rev 5995)
+++ jbpm4/trunk/qa/hudson-jbpm4-enterprise.bat 2009-12-18 16:52:34 UTC (rev 5996)
@@ -13,3 +13,5 @@
cd ..\..\..
cmd /C ant -f qa/build.xml %ANT_PROPERTIES% testsuite.enterprise.teardown
+
+echo
16 years, 4 months