JBoss JBPM SVN: r6480 - jbpm4/trunk.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-07-14 03:33:44 -0400 (Wed, 14 Jul 2010)
New Revision: 6480
Modified:
jbpm4/trunk/pom.xml
Log:
JBPM-2893: bump jbpm.gpd.version to 4.4 and errai.version to 1.1-M2
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2010-07-14 06:21:50 UTC (rev 6479)
+++ jbpm4/trunk/pom.xml 2010-07-14 07:33:44 UTC (rev 6480)
@@ -52,13 +52,13 @@
<cdi.version>1.0</cdi.version>
<commons.httpclient.version>3.1</commons.httpclient.version>
<drools.version>5.0.1</drools.version>
- <errai.version>1.1-M1</errai.version>
+ <errai.version>1.1-M2</errai.version>
<freemarker.version>2.3.15</freemarker.version>
<groovy.version>1.5.6</groovy.version>
<gwt.console.version>2.1</gwt.console.version>
<hibernate.version>3.3.1.GA</hibernate.version>
<hsqldb.version>1.8.0.7</hsqldb.version>
- <jbpm.gpd.version>4.3</jbpm.gpd.version>
+ <jbpm.gpd.version>4.4</jbpm.gpd.version>
<jboss.j2ee.version>4.2.2.GA</jboss.j2ee.version>
<jboss.client.version>5.0.1.GA</jboss.client.version>
<juel.version>2.2.1</juel.version>
13 years, 11 months
JBoss JBPM SVN: r6479 - in jbpm4/trunk/modules: jpdl/src/test/java/org/jbpm/jpdl/parsing and 1 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-07-14 02:21:50 -0400 (Wed, 14 Jul 2010)
New Revision: 6479
Added:
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
Log:
JBPM-2506: incorporate variable declarations into jpdl schema
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd 2010-07-14 00:56:00 UTC (rev 6478)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd 2010-07-14 06:21:50 UTC (rev 6479)
@@ -21,6 +21,7 @@
<element ref="tns:swimlane" />
<element ref="tns:on" />
<element ref="tns:timer" />
+ <element ref="tns:variable" />
<group ref="tns:activityGroup" />
</choice>
<element ref="tns:migrate-instances" minOccurs="0" />
@@ -94,7 +95,7 @@
</attribute>
<attribute name="state" default="ended" type="string">
<annotation>
- <documentation>Set the end state of the execution explicitly.</documentation>
+ <documentation>Specify the end state of the execution explicitly.</documentation>
</annotation>
</attribute>
</complexType>
@@ -496,8 +497,7 @@
<attribute name="swimlane" type="string" />
<attribute name="form" type="string">
<annotation>
- <documentation>the resource name of the form in the
- deployment.</documentation>
+ <documentation>Resource name of the form in the deployment.</documentation>
</annotation>
</attribute>
<attribute name="duedate" type="string" />
@@ -516,9 +516,8 @@
<!-- ~~~ SUB-PROCESS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="sub-process">
<annotation>
- <documentation>Waits while a sub process instance is
- being executed and continues when
- the sub process instance ends.</documentation>
+ <documentation>Waits while a sub process instance is being executed
+ and continues when the sub process instance ends.</documentation>
</annotation>
<complexType>
<sequence>
@@ -565,8 +564,7 @@
<annotation>
<documentation>References a sub-process by key. Therefore, the latest
version of the process definition with the given key is referenced.
- The latest version is resolved each time the activity executes.
- </documentation>
+ The latest version is resolved in each execution.</documentation>
</annotation>
</attribute>
<attribute name="outcome" type="string">
@@ -582,8 +580,7 @@
<!-- ~~~ GROUP ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="group">
<annotation>
- <documentation>Scope enclosing a number of activities.
- </documentation>
+ <documentation>Scope enclosing a number of activities.</documentation>
</annotation>
<complexType>
<sequence>
@@ -628,8 +625,8 @@
<!-- ~~~ RULES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="rules">
<annotation>
- <documentation>Evaluates rules after feeding in some facts in a stateful knowledge
- session.</documentation>
+ <documentation>Evaluates rules after feeding in some facts in a stateful
+ knowledge session.</documentation>
</annotation>
<complexType>
<sequence>
@@ -1514,6 +1511,34 @@
</complexType>
</element>
+ <element name="variable">
+ <complexType>
+ <annotation>
+ <documentation>Explicit variable declaration.</documentation>
+ </annotation>
+ <sequence>
+ <group ref="tns:wireObjectGroup" minOccurs="0" />
+ </sequence>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>Name of the variable. Must differ from other variable
+ names.</documentation>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string">
+ <annotation>
+ <documentation>Type of the variable.</documentation>
+ </annotation>
+ </attribute>
+ <attribute name="init-expr" type="string">
+ <annotation>
+ <documentation></documentation>
+ </annotation>
+ </attribute>
+ <attribute name="history" type="tns:booleanValueType" />
+ </complexType>
+ </element>
+
<group name="eventListenerGroup">
<choice>
<element name="event-listener">
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java 2010-07-14 00:56:00 UTC (rev 6478)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java 2010-07-14 06:21:50 UTC (rev 6479)
@@ -33,16 +33,14 @@
*/
public abstract class JpdlParseTestCase extends BaseJbpmTestCase {
- static JpdlParser jpdlParser = new JpdlParser();
+ protected static final JpdlParser jpdlParser = new JpdlParser();
public List<Problem> parseProblems(String xmlString) {
List<Problem> problems = jpdlParser.createParse()
.setString(xmlString)
.execute()
.getProblems();
- if ( (problems==null)
- || (problems.isEmpty())
- ) {
+ if (problems.isEmpty()) {
fail("expected problems during parse");
}
return problems;
Added: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java 2010-07-14 06:21:50 UTC (rev 6479)
@@ -0,0 +1,49 @@
+/*
+ * 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.jpdl.parsing;
+
+import java.util.List;
+
+import org.jbpm.pvm.internal.xml.Problem;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class VariableParsingTest extends JpdlParseTestCase {
+
+ public void testVariableParse() {
+ List<Problem> problems = jpdlParser.createParse()
+ .setString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='s' type='string' init-expr='static' history='true'/>"
+ + " <variable name='i' type='integer' init-expr='#{param * 2}' history='false'/>"
+ + " <variable name='d' type='serializable'>"
+ + " <object class='java.util.Date'>"
+ + " <constructor><arg><long value='1276086573250'/></arg></constructor>"
+ + " </object>"
+ + " </variable>"
+ + " <start/>"
+ + "</process>")
+ .execute()
+ .getProblems();
+ assertEquals(problems.toString(), 0, problems.size());
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/VariableParsingTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java 2010-07-14 00:56:00 UTC (rev 6478)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java 2010-07-14 06:21:50 UTC (rev 6479)
@@ -187,7 +187,7 @@
* 'warning'. */
public Parse checkErrors(String description) {
if (hasErrors()) {
- throw getJbpmException();
+ throw getJbpmException(description);
}
return this;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2010-07-14 00:56:00 UTC (rev 6478)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2010-07-14 06:21:50 UTC (rev 6479)
@@ -31,10 +31,6 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
13 years, 11 months
JBoss JBPM SVN: r6478 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-07-13 20:56:00 -0400 (Tue, 13 Jul 2010)
New Revision: 6478
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/EnvironmentBindings.java
Log:
JBPM-2897 remove UnsupportedOperationException, re-patch this issue, because r6445 reverted change.
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/EnvironmentBindings.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/EnvironmentBindings.java 2010-07-10 08:20:41 UTC (rev 6477)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/EnvironmentBindings.java 2010-07-14 00:56:00 UTC (rev 6478)
@@ -22,6 +22,7 @@
package org.jbpm.pvm.internal.script;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
@@ -60,34 +61,33 @@
}
public Object remove(Object key) {
- throw new UnsupportedOperationException();
+ return null;
}
public void clear() {
- throw new UnsupportedOperationException();
}
public boolean containsValue(Object value) {
- throw new UnsupportedOperationException();
+ return false;
}
public Set<Entry<String, Object>> entrySet() {
- throw new UnsupportedOperationException();
+ return Collections.EMPTY_SET;
}
public boolean isEmpty() {
- throw new UnsupportedOperationException();
+ return true;
}
public Set<String> keySet() {
- throw new UnsupportedOperationException();
+ return Collections.EMPTY_SET;
}
public int size() {
- throw new UnsupportedOperationException();
+ return 0;
}
public Collection<Object> values() {
- throw new UnsupportedOperationException();
+ return Collections.EMPTY_SET;
}
}
13 years, 11 months
JBoss JBPM SVN: r6477 - in jbpm4/trunk/modules: bpmn/src/main/java/org/jbpm/bpmn/flownodes and 11 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-07-10 04:20:41 -0400 (Sat, 10 Jul 2010)
New Revision: 6477
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/CacheParsingTest.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/MailParsingTest.java
jbpm4/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Converter.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/TypesBindingTest.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/mail/CustomMailProducerTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/assign/AssignTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/foreach/ForEachTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/HistoryVariableTest.java
Log:
JBPM-2715: remove sequence restrictions in jpdl schema
take out unneeded sax objects from parser, simplify initialization
revert to http://jbpm.org/4.4/jpdl namespace
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.4.xsd 2010-07-10 08:20:41 UTC (rev 6477)
@@ -1,60 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://jbpm.org/4.4/jpdl"
- xmlns:tns="http://jbpm.org/4.4/jpdl"
- elementFormDefault="qualified"
- attributeFormDefault="unqualified">
-
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jbpm.org/4.4/jpdl"
+ xmlns:tns="http://jbpm.org/4.4/jpdl" elementFormDefault="qualified">
<annotation>
<documentation>Schema for jPDL 4 process descriptions;
- the top level element is process.
- </documentation>
+ the top level element is process.</documentation>
</annotation>
<!-- ### PROCESS DEFINITION ############################################# -->
<element name="process">
- <annotation><documentation>jPDL process definition.
- This is the top level element in a jPDL process file.</documentation></annotation>
+ <annotation>
+ <documentation>jBPM Process Definition Language definition.
+ This is the top level element in a process definition file.</documentation>
+ </annotation>
<complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
+ <sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:swimlane" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:migrate-instances" minOccurs="0" maxOccurs="1" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:swimlane" />
+ <element ref="tns:on" />
+ <element ref="tns:timer" />
+ <group ref="tns:activityGroup" />
+ </choice>
+ <element ref="tns:migrate-instances" minOccurs="0" />
</sequence>
<attribute name="name" use="required" type="string">
<annotation>
- <documentation>
- The process name. Multiple processes can be deployed with the same name,
- as long as they have a different version.
- </documentation>
+ <documentation>The process name. Multiple processes can be deployed with the same
+ name, as long as they have a different version.</documentation>
</annotation>
</attribute>
<attribute name="key" type="string">
<annotation>
- <documentation>
- The key can be used to provide a short acronym that replaces the name as
- the basis for the generated process definition id.
- </documentation>
+ <documentation>The key can be used to provide a short acronym that replaces the name
+ as the basis for the generated process definition id.</documentation>
</annotation>
</attribute>
<attribute name="version" type="int">
<annotation>
- <documentation>
- Indicates the version number of this process definition among its homonyms.
- By specifying a version, automatic deployment can tell whether this process
- is already deployed.
- </documentation>
+ <documentation>Indicates the version number of this process definition among its
+ homonyms. By specifying a version, automatic deployment can tell whether this
+ process is already deployed.</documentation>
</annotation>
</attribute>
- <anyAttribute processContents="skip">
- <annotation><documentation>for extensibility
- </documentation></annotation>
- </anyAttribute>
</complexType>
</element>
@@ -64,60 +53,68 @@
<choice>
<!-- ~~~ START ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="start">
- <annotation><documentation>Start event
- </documentation></annotation>
+ <annotation>
+ <documentation>Start event.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="form" type="string">
- <annotation><documentation>the resource name of the form in the
- deployment.</documentation></annotation>
+ <annotation>
+ <documentation>Resource name of the form in the deployment.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
<!-- ~~~ END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="end">
- <annotation><documentation>End event.
- </documentation></annotation>
+ <annotation>
+ <documentation>End event.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="ends" default="process-instance">
<simpleType>
<restriction base="string">
- <enumeration value="execution"/>
- <enumeration value="process-instance"/>
+ <enumeration value="execution" />
+ <enumeration value="process-instance" />
</restriction>
</simpleType>
</attribute>
<attribute name="state" default="ended" type="string">
- <annotation><documentation>sets the state of the execution explicitely</documentation></annotation>
+ <annotation>
+ <documentation>Set the end state of the execution explicitly.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
<element name="end-cancel">
- <annotation><documentation>End cancel event.
- </documentation></annotation>
+ <annotation>
+ <documentation>End cancel event.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="ends" default="process-instance">
<simpleType>
<restriction base="string">
- <enumeration value="execution"/>
- <enumeration value="process-instance"/>
+ <enumeration value="execution" />
+ <enumeration value="process-instance" />
</restriction>
</simpleType>
</attribute>
@@ -125,19 +122,20 @@
</element>
<element name="end-error">
- <annotation><documentation>End cancel event.
- </documentation></annotation>
+ <annotation>
+ <documentation>End cancel event.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="ends" default="process-instance">
<simpleType>
<restriction base="string">
- <enumeration value="execution"/>
- <enumeration value="process-instance"/>
+ <enumeration value="execution" />
+ <enumeration value="process-instance" />
</restriction>
</simpleType>
</attribute>
@@ -146,25 +144,28 @@
<!-- ~~~ STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="state">
- <annotation><documentation>A wait state. When an execution arrives in this
- activity, the execution will wait until an external trigger is received
- with execution.signal() or execution.getActivityInstance().signal()
- </documentation></annotation>
+ <annotation>
+ <documentation>Wait state. When an execution arrives in this activity,
+ the execution stops until an external trigger is delivered through
+ execution.signal() or execution.getActivityInstance().signal()</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element name="transition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <complexContent>
- <extension base="tns:transitionType">
- <sequence>
- <element ref="tns:timer" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element name="transition">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element ref="tns:timer" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
</complexType>
@@ -172,80 +173,91 @@
<!-- ~~~ DECISION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="decision">
- <annotation><documentation>Decision gateway: selects one path out of many alternatives.
- When an execution comes in, exactly one outgoing transition is taken.
- </documentation></annotation>
+ <annotation>
+ <documentation>Decision gateway: selects one path out of many alternatives.
+ When an execution arrives, it takes exactly one outgoing transition.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
<element name="handler" minOccurs="0" type="tns:wireObjectType" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element name="transition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <complexContent>
- <extension base="tns:transitionType">
- <sequence>
- <element name="condition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="handler" minOccurs="0" type="tns:wireObjectType" />
- </sequence>
- <attribute name="expr" type="string">
- <annotation><documentation>The script text that will be evaluated.
- </documentation></annotation>
- </attribute>
- <attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use.</documentation></annotation>
- </attribute>
- </complexType>
- </element>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded" />
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element name="condition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <attribute name="expr" type="string">
+ <annotation>
+ <documentation>Expression to evaluate.</documentation>
+ </annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation>
+ <documentation>Scripting language to interpret.</documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="expr" type="string">
- <annotation><documentation>The script that will be evaluated and resolve to
- the name of the outgoing transition.
- </documentation></annotation>
+ <annotation>
+ <documentation>The script that will be evaluated and resolve to
+ the name of the outgoing transition.</documentation>
+ </annotation>
</attribute>
<attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use for the expr attribute.</documentation></annotation>
+ <annotation>
+ <documentation>Identification of the scripting language
+ to use for the expr attribute.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
<!-- ~~~ FOREACH ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="foreach">
- <annotation><documentation>Spawns concurrent paths of execution
- over each element of a collection.
- </documentation></annotation>
+ <annotation>
+ <documentation>Spawns concurrent paths of execution
+ over each element of a collection.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
- <attribute name="var" type="string" use="required"/>
- <attribute name="in" type="string" use="required"/>
+ <attribute name="var" type="string" use="required" />
+ <attribute name="in" type="string" use="required" />
</complexType>
</element>
<!-- ~~~ FORK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="fork">
- <annotation><documentation>Spawns multiple concurrent paths of
- execution.
- </documentation></annotation>
+ <annotation>
+ <documentation>Spawns multiple concurrent paths of
+ execution.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
</complexType>
@@ -253,25 +265,28 @@
<!-- ~~~ JOIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="join">
- <annotation><documentation>Spawns multiple concurrent paths of
- execution.
- </documentation></annotation>
+ <annotation>
+ <documentation>Spawns multiple concurrent paths of
+ execution.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="multiplicity" type="string" />
<attribute name="lockmode" default="upgrade">
<simpleType>
<restriction base="string">
- <enumeration value="none"/>
- <enumeration value="read"/>
- <enumeration value="upgrade"/>
- <enumeration value="upgrade_nowait"/>
- <enumeration value="write"/>
+ <enumeration value="none" />
+ <enumeration value="read" />
+ <enumeration value="upgrade" />
+ <enumeration value="upgrade_nowait" />
+ <enumeration value="write" />
</restriction>
</simpleType>
</attribute>
@@ -280,15 +295,16 @@
<!-- ~~~ SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="script">
- <annotation><documentation>Evaluates a piece of text as a script
- </documentation></annotation>
+ <annotation>
+ <documentation>Evaluates a piece of text as a script.</documentation>
+ </annotation>
<complexType>
<complexContent>
<extension base="tns:scriptType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
<attributeGroup ref="tns:activityAttributes" />
</extension>
</complexContent>
@@ -297,15 +313,16 @@
<!-- ~~~ HQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="hql">
- <annotation><documentation>Performs a hibernate query
- </documentation></annotation>
+ <annotation>
+ <documentation>Performs a Hibernate query.</documentation>
+ </annotation>
<complexType>
<complexContent>
<extension base="tns:qlType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
<attributeGroup ref="tns:activityAttributes" />
</extension>
</complexContent>
@@ -314,15 +331,16 @@
<!-- ~~~ SQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="sql">
- <annotation><documentation>Performs a hibernate SQL query
- </documentation></annotation>
+ <annotation>
+ <documentation>Performs a Hibernate SQL query.</documentation>
+ </annotation>
<complexType>
<complexContent>
<extension base="tns:qlType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
<attributeGroup ref="tns:activityAttributes" />
</extension>
</complexContent>
@@ -331,15 +349,16 @@
<!-- ~~~ MAIL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="mail">
- <annotation><documentation>Sends an email
- </documentation></annotation>
+ <annotation>
+ <documentation>Sends an email.</documentation>
+ </annotation>
<complexType>
<complexContent>
<extension base="tns:mailType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
<attributeGroup ref="tns:activityAttributes" />
</extension>
</complexContent>
@@ -348,15 +367,16 @@
<!-- ~~~ JMS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="jms">
- <annotation><documentation>Sends an email
- </documentation></annotation>
+ <annotation>
+ <documentation>Sends an email.</documentation>
+ </annotation>
<complexType>
<complexContent>
<extension base="tns:jmsType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
<attributeGroup ref="tns:activityAttributes" />
</extension>
</complexContent>
@@ -365,18 +385,20 @@
<!-- ~~~ JAVA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="java">
- <annotation><documentation>Invokes a method on a java object.
- Either the java class is instantiated with reflection, or the
- java object is fetched from the environment. Then values from the
- environment are injected into the fields and a method is executed.
- </documentation></annotation>
+ <annotation>
+ <documentation>Invokes a method on a java object.
+ Either the java class is instantiated with reflection,
+ or the java object is fetched from the environment.
+ Values are then injected into the fields and.
+ Finally a method is invoked.</documentation>
+ </annotation>
<complexType>
<complexContent>
<extension base="tns:javaType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
<attributeGroup ref="tns:activityAttributes" />
</extension>
</complexContent>
@@ -385,15 +407,16 @@
<!-- ~~~ ASSIGN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="assign">
- <annotation><documentation>Assigns a source value to a target location
- </documentation></annotation>
+ <annotation>
+ <documentation>Assigns a source value to a target location.</documentation>
+ </annotation>
<complexType>
<complexContent>
<extension base="tns:assignType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:transition" />
+ </choice>
<attributeGroup ref="tns:activityAttributes" />
</extension>
</complexContent>
@@ -402,15 +425,16 @@
<!-- ~~~ CUSTOM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="custom">
- <annotation><documentation>Uses a user defined, custom implementation of
- ActivityBehaviour
- </documentation></annotation>
+ <annotation>
+ <documentation>Calls a user defined, custom implementation of
+ ActivityBehaviour.</documentation>
+ </annotation>
<complexType>
<complexContent>
<extension base="tns:wireObjectType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element name="transition">
<complexType>
<complexContent>
<extension base="tns:transitionType">
@@ -421,7 +445,7 @@
</complexContent>
</complexType>
</element>
- </sequence>
+ </choice>
<attributeGroup ref="tns:activityAttributes" />
</extension>
</complexContent>
@@ -430,13 +454,13 @@
<!-- ~~~ TASK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="task">
- <annotation><documentation>Creates a task in the task component.
- </documentation></annotation>
+ <annotation>
+ <documentation>Creates a task in the task component.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element name="assignment-handler" minOccurs="0" type="tns:wireObjectType" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="assignment-handler" minOccurs="0" type="tns:wireObjectType" />
<element name="notification" minOccurs="0">
<complexType>
<attribute name="continue" type="tns:continueType" default="sync" />
@@ -448,35 +472,40 @@
<attribute name="duedate" type="string" />
<attribute name="repeat" type="string" />
<attribute name="continue" type="tns:continueType" default="sync" />
- <attribute name="template" type="tns:templateType" use="optional"/>
+ <attribute name="template" type="tns:templateType" use="optional" />
</complexType>
</element>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- <element name="transition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <complexContent>
- <extension base="tns:transitionType">
- <sequence>
- <element ref="tns:timer" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" />
+ <element ref="tns:timer" />
+ <element name="transition">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element ref="tns:timer" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
- <attributeGroup ref="tns:assignmentAttributes"/>
+ <attributeGroup ref="tns:assignmentAttributes" />
<attribute name="swimlane" type="string" />
<attribute name="form" type="string">
- <annotation><documentation>the resource name of the form in the
- deployment.</documentation></annotation>
+ <annotation>
+ <documentation>the resource name of the form in the
+ deployment.</documentation>
+ </annotation>
</attribute>
- <attribute name="duedate" type="string" />
+ <attribute name="duedate" type="string" />
<attribute name="on-transition" default="cancel">
<simpleType>
<restriction base="string">
- <enumeration value="keep"/>
- <enumeration value="cancel"/>
+ <enumeration value="keep" />
+ <enumeration value="cancel" />
</restriction>
</simpleType>
</attribute>
@@ -486,55 +515,65 @@
<!-- ~~~ SUB-PROCESS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="sub-process">
- <annotation><documentation>Waits while a sub process instance is
- being executed and continues when the sub process instance ends.
- </documentation></annotation>
+ <annotation>
+ <documentation>Waits while a sub process instance is
+ being executed and continues when
+ the sub process instance ends.</documentation>
+ </annotation>
<complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
+ <sequence>
<element name="description" minOccurs="0" type="string" />
- <element name="parameter-in" type="tns:parameterType" minOccurs="0" maxOccurs="unbounded" />
- <element name="parameter-out" type="tns:parameterType" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
- <element name="swimlane-mapping" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <attribute name="swimlane" type="string" use="required" />
- <attribute name="sub-swimlane" type="string" use="required" />
- </complexType>
- </element>
- <element name="transition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <complexContent>
- <extension base="tns:transitionType">
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element name="outcome-value">
- <complexType>
- <group ref="tns:wireObjectGroup" />
- </complexType>
- </element>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="parameter-in" type="tns:parameterType" />
+ <element name="parameter-out" type="tns:parameterType" />
+ <element ref="tns:timer" />
+ <element ref="tns:on">
+ <annotation>
+ <documentation>Events on which listeners can be registered.</documentation>
+ </annotation>
+ </element>
+ <element name="swimlane-mapping">
+ <complexType>
+ <attribute name="swimlane" type="string" use="required" />
+ <attribute name="sub-swimlane" type="string" use="required" />
+ </complexType>
+ </element>
+ <element name="transition">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element name="outcome-value" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+ </choice>
</sequence>
<attribute name="sub-process-id" type="string">
- <annotation><documentation>Identifies the sub process by the id. This means that a specific
- version of a process definition is referenced
- </documentation></annotation>
+ <annotation>
+ <documentation>References a sub-process by id. This means that a specific
+ version of a process definition is referenced.</documentation>
+ </annotation>
</attribute>
<attribute name="sub-process-key" type="string">
- <annotation><documentation>Identifies the sub process by the key. This means that the latest
- version of the process definition with the given key is referenced. The latest version
- of the process is looked up each time the activity executes.
- </documentation></annotation>
+ <annotation>
+ <documentation>References a sub-process by key. Therefore, the latest
+ version of the process definition with the given key is referenced.
+ The latest version is resolved each time the activity executes.
+ </documentation>
+ </annotation>
</attribute>
<attribute name="outcome" type="string">
- <annotation><documentation>Expression that is evaluated when the sub process
- instance ends. The value is then used for outcome transition mapping.
- </documentation></annotation>
+ <annotation>
+ <documentation>Expression that is evaluated when the sub process instance ends.
+ The value is then used for outcome transition mapping.</documentation>
+ </annotation>
</attribute>
<attributeGroup ref="tns:activityAttributes" />
</complexType>
@@ -542,17 +581,23 @@
<!-- ~~~ GROUP ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="group">
- <annotation><documentation>Scope enclosing a number of activities.
- </documentation></annotation>
+ <annotation>
+ <documentation>Scope enclosing a number of activities.
+ </documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <group ref="tns:activityGroup" />
+ <element ref="tns:transition" />
+ <element ref="tns:on">
+ <annotation>
+ <documentation>Events on which listeners can be registered.</documentation>
+ </annotation>
+ </element>
+ <element ref="tns:timer" />
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
</complexType>
@@ -560,15 +605,21 @@
<!-- ~~~ RULES DECISION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="rules-decision">
- <annotation><documentation>Selects one outgoing transition based on evaluation of rules.
- </documentation></annotation>
+ <annotation>
+ <documentation>Selects one outgoing transition based on evaluation
+ of rules.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:transition" />
+ <element ref="tns:on">
+ <annotation>
+ <documentation>Events on which listeners can be registered.</documentation>
+ </annotation>
+ </element>
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
</complexType>
@@ -576,50 +627,57 @@
<!-- ~~~ RULES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="rules">
- <annotation><documentation>Evaluates rules after feeding in some facts in a stateful knowledge session.
- </documentation></annotation>
+ <annotation>
+ <documentation>Evaluates rules after feeding in some facts in a stateful knowledge
+ session.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
- <element name="fact" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <attribute name="var" type="string" />
- <attribute name="expr" type="string" />
- </complexType>
- </element>
- <element name="transition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <complexContent>
- <extension base="tns:transitionType">
- <sequence>
- <element name="condition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="handler" minOccurs="0" type="tns:wireObjectType" />
- </sequence>
- <attribute name="expr" type="string">
- <annotation><documentation>The script text that will be evaluated.
- </documentation></annotation>
- </attribute>
- <attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use.</documentation></annotation>
- </attribute>
- </complexType>
- </element>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="fact">
+ <complexType>
+ <attribute name="var" type="string" />
+ <attribute name="expr" type="string" />
+ </complexType>
+ </element>
+ <element name="transition">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element name="condition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="handler" minOccurs="0" type="tns:wireObjectType" />
+ </sequence>
+ <attribute name="expr" type="string">
+ <annotation>
+ <documentation>Expression to evaluate.</documentation>
+ </annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation>
+ <documentation>Script language to interpret.</documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+ <element ref="tns:on">
+ <annotation>
+ <documentation>Events on which listeners can be registered.</documentation>
+ </annotation>
+ </element>
+ </choice>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
</complexType>
</element>
-
</choice>
</group>
@@ -628,24 +686,31 @@
<!-- SPECIAL OBJECTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="null">
- <annotation><documentation>the null value
- </documentation></annotation>
+ <annotation>
+ <documentation>The null value.</documentation>
+ </annotation>
</element>
<element name="ref">
- <annotation><documentation>A reference to an object in the current environment</documentation></annotation>
+ <annotation>
+ <documentation>Reference to an object in the current environment.</documentation>
+ </annotation>
<complexType>
<attribute name="object" type="string" use="required">
- <annotation><documentation>The name of the referred object</documentation></annotation>
+ <annotation>
+ <documentation>The name of the referred object.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
<element name="env-ref">
- <annotation><documentation>The current environment.
- </documentation></annotation>
+ <annotation>
+ <documentation>The current environment.</documentation>
+ </annotation>
</element>
<element name="jndi">
- <annotation><documentation>A lookup from JNDI through the InitialContext
- </documentation></annotation>
+ <annotation>
+ <documentation>JNDI lookup based off the initial context.</documentation>
+ </annotation>
<complexType>
<attribute name="jndi-name" type="string" use="required" />
</complexType>
@@ -653,49 +718,69 @@
<!-- COLLECTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="list">
- <annotation><documentation>A java.util.List</documentation></annotation>
+ <annotation>
+ <documentation>java.util.List instance.</documentation>
+ </annotation>
<complexType>
<choice minOccurs="0" maxOccurs="unbounded">
<group ref="tns:wireObjectGroup" />
</choice>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
+ </attribute>
<attribute name="class" type="string" default="java.util.ArrayList">
- <annotation><documentation>Implementation class for this list.
- </documentation></annotation>
+ <annotation>
+ <documentation>List implementation class.</documentation>
+ </annotation>
</attribute>
<attribute name="synchronized" type="tns:booleanValueType" default="false">
- <annotation><documentation>Indicates if this collection should be synchronized
- with Collections.synchronizedList(List)</documentation></annotation>
+ <annotation>
+ <documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedList()</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
- <element name="map" type="tns:mapType"/>
+ <element name="map" type="tns:mapType" />
<element name="set">
- <annotation><documentation>A java.util.Set
- </documentation></annotation>
+ <annotation>
+ <documentation>java.util.Set instance.</documentation>
+ </annotation>
<complexType>
<choice minOccurs="0" maxOccurs="unbounded">
<group ref="tns:wireObjectGroup" />
</choice>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
<attribute name="class" type="string" default="java.util.HashList">
- <annotation><documentation>Implementation class for this set.
- </documentation></annotation>
+ <annotation>
+ <documentation>Set implementation class.</documentation>
+ </annotation>
</attribute>
<attribute name="synchronized" type="tns:booleanValueType" default="false">
- <annotation><documentation>Indicates if this collection should be synchronized
- with Collections.synchronizedSet(Set)</documentation></annotation>
+ <annotation>
+ <documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedSet()</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
<element name="properties">
- <annotation><documentation>A java.util.Properties</documentation></annotation>
+ <annotation>
+ <documentation>java.util.Properties instance.</documentation>
+ </annotation>
<complexType>
<choice minOccurs="0" maxOccurs="unbounded">
<element name="property">
@@ -705,20 +790,35 @@
</complexType>
</element>
</choice>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
+ </attribute>
<attribute name="file" type="string">
- <annotation><documentation>A file on the file system</documentation></annotation>
+ <annotation>
+ <documentation>File in the file system.</documentation>
+ </annotation>
</attribute>
<attribute name="resource" type="string">
- <annotation><documentation>A file as a resource in the classpath</documentation></annotation>
+ <annotation>
+ <documentation>Resource in the classpath.</documentation>
+ </annotation>
</attribute>
<attribute name="url" type="string">
- <annotation><documentation>the contents is fetched by loading a url</documentation></annotation>
+ <annotation>
+ <documentation>Resource in the web.</documentation>
+ </annotation>
</attribute>
<attribute name="is-xml" type="tns:booleanValueType">
- <annotation><documentation>optionally indicates if the content of referenced file in attributes
- 'file', 'resource' or 'url' is XML. The default is the
- plain properties format with a space or the equals character (=) separating key and value on
- each line.</documentation></annotation>
+ <annotation>
+ <documentation>tells whether the resource referenced by
+ attributes 'file', 'resource' or 'url' is XML. The default is the
+ plain properties format, where a space or '=' separates the key
+ from the value in each line.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
@@ -729,33 +829,43 @@
<!-- BASIC TYPES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="string">
<complexType>
- <attribute name="name">
- <annotation><documentation>the name of the string object</documentation></annotation>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
- <attribute name="value">
- <annotation><documentation>the actual string value</documentation></annotation>
- </attribute>
+ <attribute name="value" />
</complexType>
</element>
<element name="byte">
- <annotation><documentation>A java.lang.Byte</documentation></annotation>
+ <annotation>
+ <documentation>8-bit signed integer.</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
<attribute name="value" type="byte" use="required" />
</complexType>
</element>
<element name="char">
- <annotation><documentation>A java.lang.Character</documentation></annotation>
+ <annotation>
+ <documentation>16-bit Unicode character.</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
<attribute name="value" use="required">
<simpleType>
@@ -767,135 +877,154 @@
</complexType>
</element>
<element name="double">
- <annotation><documentation>A java.lang.Double</documentation></annotation>
+ <annotation>
+ <documentation>64-bit floating point number.</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
<attribute name="value" type="double" use="required" />
</complexType>
</element>
<element name="false">
- <annotation><documentation>java.lang.Boolean.FALSE
- </documentation></annotation>
+ <annotation>
+ <documentation>Boolean false value</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
<element name="float">
- <annotation><documentation>A java.lang.Float
- </documentation></annotation>
+ <annotation>
+ <documentation>32-bit floating point number.</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
<attribute name="value" type="float" use="required" />
</complexType>
</element>
<element name="int">
- <annotation><documentation>A java.lang.Integer
- </documentation></annotation>
+ <annotation>
+ <documentation>32-bit signed integer.</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
- <attribute name="value" type="int" use="required"/>
+ <attribute name="value" type="int" use="required" />
</complexType>
</element>
<element name="long">
- <annotation><documentation>A java.lang.Long</documentation></annotation>
+ <annotation>
+ <documentation>64-bit signed integer.</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
- <attribute name="value" type="long" use="required"/>
+ <attribute name="value" type="long" use="required" />
</complexType>
</element>
<element name="short">
- <annotation><documentation>a java.lang.Short
- </documentation></annotation>
+ <annotation>
+ <documentation>16-bit signed integer.</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
- <attribute name="value" type="short" use="required"/>
+ <attribute name="value" type="short" use="required" />
</complexType>
</element>
<element name="true">
- <annotation><documentation>java.lang.Boolean.TRUE
- </documentation></annotation>
+ <annotation>
+ <documentation>Boolean true value.</documentation>
+ </annotation>
<complexType>
<attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
+ <annotation>
+ <documentation>The name of the object. Optional, serves as an identifier
+ to refer to this object from other object descriptions.
+ Also used to fetch the object programmatically.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
-
-
</choice>
</group>
<complexType name="wireObjectType">
- <annotation><documentation>Any java object that will be created by reflection. .
- <p>There are three main ways to create an object: by constructor or by a factory
- object or a static factory method.</p>
- <p><b>Using the constructor</b>: Then the <code>class</code> attribute must provide the
- fully qualified class name. In case another constructor then the default is
- targetted, a <code>constructor</code> child element can be provided.
- The <code>factory</code> attribute should not be provided for using a constructor.
- </p>
- <p><b>Using a factory</b>: Then the <code>factory</code> attribute or one
- <code>factory</code> element must be provided along with the attribute
- <code>method</code>.
- </p>
- <p><b>Using a static factory method</b>: Then the <code>class</code> and
- <code>method</code> attributes should be specified. There should be no
- reference to a <code>factory</code> attribute of element.
- </p>
- <p><b>Construction and initialization</b>: all objects (constructor and factory)
- are build in two phases: construction and initialisation phase. During construction
- all is done until a pointer is obtained to the object. In initialisation, operations
- are applied to the object until it is ready to be used. The separation between
- construction and initialisation is made to allow for bidirectional references. In
- that case, at least one of both ends can not be fully initialised before it is injected
- into the other end.
- </p>
- <p><b>Operations</b>: after construction, various operations can be applied to objects
- like e.g. direct field injection, injection through setters, method invocation,
- enlist with the standard transaction, subscribe the object as a listener to an observable
- </p>
- <p><b>Arguments</b>: There are two different places for arguments. The <code>arg</code>
- elements for the factory method invocation should be placed as child elements under the
- <code>object</code> element. The <code>arg</code> elements for the constructor should be
- placed as child elements under the <code>constructor</code> element.
- </p>
- </documentation></annotation>
+ <annotation>
+ <documentation>Any java object that will be created by reflection.
+ <p>There are three main ways to create an object: by constructor or by a factory
+ object or a static factory method.</p>
+ <p><b>Using the constructor</b>: the <code>class</code> attribute must provide
+ the fully qualified class name. In case a constructor other than the default
+ should be invoked, a <code>constructor</code> child element can be provided.
+ The <code>factory</code> attribute should be absent when using a constructor.</p>
+ <p><b>Using a factory</b>: the <code>factory</code> attribute or one
+ <code>factory</code> element must be provided along with the attribute
+ <code>method</code>.</p>
+ <p><b>Using a static factory method</b>: the <code>class</code> and <code>method</code>
+ attributes should be specified. There should not be a <code>factory</code>
+ attribute or element.</p>
+ <p><b>Construction and initialization</b>: all objects (constructor and factory)
+ are build in two phases: construction and initialisation phase. During construction
+ all is done until a pointer is obtained to the object. In initialisation, operations
+ are applied to the object until it is ready to be used. The separation between
+ construction and initialisation is made to allow for bidirectional references.</p>
+ <p><b>Operations</b>: after construction, various operations can be applied to objects
+ like e.g. direct field injection, injection through setters, method invocation,
+ enlist with the standard transaction, subscribe the object to an observable.</p>
+ <p><b>Arguments</b>: there are two different places for arguments. The <code>arg</code>
+ elements for the factory method invocation should be placed as child elements under
+ the <code>object</code> element. The <code>arg</code> elements for the constructor
+ should be placed as child elements of the <code>constructor</code> element.</p>
+ </documentation>
+ </annotation>
<choice minOccurs="0" maxOccurs="unbounded">
<element name="description" minOccurs="0" maxOccurs="unbounded" type="string" />
<element name="factory">
- <annotation><documentation>Contains one element that describes the factory object.</documentation></annotation>
+ <annotation>
+ <documentation>Contains one element that describes the factory object.</documentation>
+ </annotation>
<complexType>
<group ref="tns:wireObjectGroup" />
</complexType>
</element>
<element name="constructor">
- <annotation><documentation>Specifies the arguments to use for a non-default constructor.</documentation></annotation>
+ <annotation>
+ <documentation>Specifies the arguments for a non-default constructor.</documentation>
+ </annotation>
<complexType>
<choice maxOccurs="unbounded">
<element name="arg" type="tns:argType" />
@@ -903,90 +1032,116 @@
</complexType>
</element>
<element name="arg" type="tns:argType">
- <annotation><documentation>The factory method arguments.</documentation></annotation>
+ <annotation>
+ <documentation>The factory method arguments.</documentation>
+ </annotation>
</element>
<element name="field">
- <annotation><documentation>Injects a value into a member field of this object.
- Exactly one child element must specify the value.
- </documentation></annotation>
+ <annotation>
+ <documentation>Injects a value into a member field of this object.
+ Exactly one child element must specify the value.</documentation>
+ </annotation>
<complexType>
<group ref="tns:wireObjectGroup" />
<attribute name="name">
- <annotation><documentation>The member field name</documentation></annotation>
+ <annotation>
+ <documentation>Member field name.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
<element name="property">
- <annotation><documentation>Injects a value through a setter method.
- Exactly one child element must specify the value.
- </documentation></annotation>
+ <annotation>
+ <documentation>Injects a value through a setter method.
+ Exactly one child element must specify the value.</documentation>
+ </annotation>
<complexType>
<group ref="tns:wireObjectGroup" />
<attribute name="name">
- <annotation><documentation>The name of the property (without the 'set' prefix)</documentation></annotation>
+ <annotation>
+ <documentation>Name of the property (without the 'set' prefix).</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
<element name="invoke">
- <annotation><documentation>Invokes a method</documentation></annotation>
+ <annotation>
+ <documentation>Invokes a method.</documentation>
+ </annotation>
<complexType>
<choice minOccurs="0" maxOccurs="unbounded">
<element name="arg" type="tns:argType" />
</choice>
<attribute name="method" type="string" use="required">
- <annotation><documentation>the method name</documentation></annotation>
+ <annotation>
+ <documentation>Method name.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
</choice>
<attribute name="class" type="string">
- <annotation><documentation>The fully qualified class name</documentation></annotation>
+ <annotation>
+ <documentation>Fully qualified class name</documentation>
+ </annotation>
</attribute>
<attribute name="expr" type="string">
- <annotation><documentation>The class to instantiate.
- </documentation></annotation>
+ <annotation>
+ <documentation>Expression that provides the object.</documentation>
+ </annotation>
</attribute>
<attribute name="lang" type="string">
- <annotation><documentation>The class to instantiate.
- </documentation></annotation>
+ <annotation>
+ <documentation>Script language to interpret.</documentation>
+ </annotation>
</attribute>
<attribute name="factory" type="string">
- <annotation><documentation>The name of the factory object</documentation></annotation>
+ <annotation>
+ <documentation>Name of the factory object.</documentation>
+ </annotation>
</attribute>
<attribute name="method" type="string">
- <annotation><documentation>The factory method name</documentation></annotation>
+ <annotation>
+ <documentation>Factory method name</documentation>
+ </annotation>
</attribute>
<attribute name="auto-wire" type="string">
- <annotation><documentation>Indicates if the member fields and setter properties
- should be automatically wired based on matching the property names and types with the
- object names and types</documentation></annotation>
+ <annotation>
+ <documentation>Indicates if the member fields and setter properties
+ should be wired automatically based on matching the property names and types
+ with the object names and types.</documentation>
+ </annotation>
</attribute>
<attribute name="cache" type="tns:booleanValueType">
- <annotation><documentation>Indicates if the user code should be cached
- </documentation></annotation>
+ <annotation>
+ <documentation>Indicates if the user code should be cached.</documentation>
+ </annotation>
</attribute>
</complexType>
<complexType name="argType">
- <annotation><documentation>The method arguments.
- Each 'arg' element should have exactly one child element
- that represents the value of the argument.
- </documentation></annotation>
- <group ref="tns:wireObjectGroup"/>
+ <annotation>
+ <documentation>The method arguments.
+ Each 'arg' element should have exactly one child
+ element that represents the value of the argument.</documentation>
+ </annotation>
+ <group ref="tns:wireObjectGroup" />
<attribute name="type" type="string">
- <annotation><documentation>The java class name representing
- the type of the method. This is optional and can be used to
- indicate the appropriate method in case of method overloading.
- </documentation></annotation>
+ <annotation>
+ <documentation>Class name representing the method type.
+ Optional, helps resolve the appropriate method in case of overloading.</documentation>
+ </annotation>
</attribute>
</complexType>
<complexType name="mapType">
- <annotation><documentation>A java.util.Map</documentation></annotation>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element name="entry">
+ <annotation>
+ <documentation>java.util.Map instance.</documentation>
+ </annotation>
+ <sequence>
+ <element name="entry" minOccurs="0" maxOccurs="unbounded">
<complexType>
- <sequence minOccurs="0">
+ <sequence>
<element name="key" minOccurs="0">
<complexType>
<group ref="tns:wireObjectGroup" />
@@ -1000,86 +1155,105 @@
</sequence>
</complexType>
</element>
- </choice>
+ </sequence>
<attribute name="class" type="string" default="java.util.HashMap">
- <annotation><documentation>Implementation class for this map.
- </documentation></annotation>
+ <annotation>
+ <documentation>Map implementation class.</documentation>
+ </annotation>
</attribute>
<attribute name="synchronized" type="tns:booleanValueType" default="false">
- <annotation><documentation>Indicates if this collection should be synchronized
- with Collections.synchronizedList(List)</documentation></annotation>
+ <annotation>
+ <documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedCollection()</documentation>
+ </annotation>
</attribute>
</complexType>
<complexType name="javaType">
<sequence>
- <element name="description" minOccurs="0" maxOccurs="unbounded" type="string" />
- <element name="field" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Field injections from the environment
- invocation.</documentation></annotation>
- </element>
- <element name="arg" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Method arguments.</documentation></annotation>
- </element>
+ <element name="description" minOccurs="0" type="string" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="field">
+ <annotation>
+ <documentation>Field injections from the environment invocation.</documentation>
+ </annotation>
+ </element>
+ <element name="arg">
+ <annotation>
+ <documentation>Method arguments.</documentation>
+ </annotation>
+ </element>
+ </choice>
</sequence>
<attribute name="method" type="string" use="required">
- <annotation><documentation>The name of the method to invoke.
- </documentation></annotation>
+ <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>
+ <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>
+ <annotation>
+ <documentation>The class to instantiate.</documentation>
+ </annotation>
</attribute>
<attribute name="expr" type="string">
- <annotation><documentation>Expression that resolves to the target object
- on which the method should be invoked.
- </documentation></annotation>
+ <annotation>
+ <documentation>Expression that resolves to the target object
+ on which the method should be invoked.</documentation>
+ </annotation>
</attribute>
<attribute name="lang" type="string">
- <annotation><documentation>The language in which attribute 'expr' is to be
- resolved.
- </documentation></annotation>
+ <annotation>
+ <documentation>The language in which attribute 'expr' is to be
+ resolved.</documentation>
+ </annotation>
</attribute>
<attribute name="var" type="string">
- <annotation><documentation>The variable name to store the return value
- </documentation></annotation>
+ <annotation>
+ <documentation>The variable name to store the return value.</documentation>
+ </annotation>
</attribute>
</complexType>
<complexType name="scriptType">
<sequence>
- <element name="description" minOccurs="0" maxOccurs="unbounded" type="string" />
+ <element name="description" minOccurs="0" type="string" />
<element name="text" type="string" minOccurs="0">
- <annotation><documentation>The content of this expression element
- is the script text that will be evaluated. This is mutually
- exclusive with the expression attribute.</documentation></annotation>
+ <annotation>
+ <documentation>The text content of this element is the script to evaluate.
+ This element and the expression attribute are mutually exclusive.</documentation>
+ </annotation>
</element>
</sequence>
<attribute name="expr" type="string">
- <annotation><documentation>The script text that will be evaluated. This
- is mutually exclusive with the expression element.
- </documentation></annotation>
+ <annotation>
+ <documentation>The value of this attribute is the script to evaluate.
+ This attribute and the text element are mutually exclusive.</documentation>
+ </annotation>
</attribute>
<attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use.</documentation></annotation>
+ <annotation>
+ <documentation>Identifies the scripting language in use.</documentation>
+ </annotation>
</attribute>
<attribute name="var" type="string">
- <annotation><documentation>Name of the variable in which the result
- of the script evaluation will be stored</documentation></annotation>
+ <annotation>
+ <documentation>Name of the variable in which the result
+ of the script evaluation will be stored.</documentation>
+ </annotation>
</attribute>
</complexType>
<complexType name="assignType">
<sequence>
- <element name="description" minOccurs="0" maxOccurs="unbounded" type="string" />
+ <element name="description" minOccurs="0" type="string" />
<element name="from" minOccurs="0">
<annotation>
- <documentation>Descriptor that constructs the source value</documentation>
+ <documentation>Descriptor that constructs the source value.</documentation>
</annotation>
<complexType>
<group ref="tns:wireObjectGroup" />
@@ -1088,39 +1262,43 @@
</sequence>
<attribute name="from-expr" type="string">
<annotation>
- <documentation>Expression that resolves the source value</documentation>
+ <documentation>Expression that resolves the source value.</documentation>
</annotation>
</attribute>
<attribute name="lang" type="string">
<annotation>
- <documentation>Language in which from-expr is written</documentation>
+ <documentation>Language in which from-expr is written.</documentation>
</annotation>
</attribute>
<attribute name="from-var" type="string">
<annotation>
- <documentation>Variable that provides the source value</documentation>
+ <documentation>Variable that provides the source value.</documentation>
</annotation>
</attribute>
<attribute name="to-expr" type="string">
<annotation>
- <documentation>Expression that resolves the target location</documentation>
+ <documentation>Expression that resolves the target location.</documentation>
</annotation>
</attribute>
<attribute name="to-var" type="string">
<annotation>
- <documentation>Variable that provides the target location</documentation>
+ <documentation>Variable that provides the target location.</documentation>
</annotation>
</attribute>
</complexType>
<complexType name="qlType">
<sequence>
- <element name="description" minOccurs="0" maxOccurs="unbounded" type="string" />
+ <element name="description" minOccurs="0" type="string" />
<element name="query" type="string">
- <annotation><documentation>The query text.</documentation></annotation>
+ <annotation>
+ <documentation>Query text.</documentation>
+ </annotation>
</element>
<element name="parameters" minOccurs="0">
- <annotation><documentation>Query parameters.</documentation></annotation>
+ <annotation>
+ <documentation>Query parameters.</documentation>
+ </annotation>
<complexType>
<sequence>
<group ref="tns:wireObjectGroup" maxOccurs="unbounded" />
@@ -1129,28 +1307,34 @@
</element>
</sequence>
<attribute name="var" type="string">
- <annotation><documentation>Name of the variable in which the result
- of the script evaluation will be stored</documentation></annotation>
+ <annotation>
+ <documentation>Name of the variable in which the result
+ of the script evaluation will be stored.</documentation>
+ </annotation>
</attribute>
<attribute name="unique" type="string">
- <annotation><documentation>Does this query return a unique result or a list
- </documentation></annotation>
+ <annotation>
+ <documentation>Tells whether the query returns a unique result.</documentation>
+ </annotation>
</attribute>
</complexType>
<attributeGroup name="activityAttributes">
<attribute name="name" type="string">
- <annotation><documentation>The id of this activity. The name should be unique
- in the complete scope of the process.</documentation></annotation>
+ <annotation>
+ <documentation>Name of this activity. The name should be unique
+ in the complete scope of the process.</documentation>
+ </annotation>
</attribute>
<attribute name="g" type="string">
- <annotation><documentation>Graphical information used by process designer tool.
- </documentation></annotation>
+ <annotation>
+ <documentation>Graphical information used by process designer tool.</documentation>
+ </annotation>
</attribute>
<attribute name="continue" default="sync" type="tns:continueType">
- <annotation><documentation>To specify async continuations.
- sync is the default.
- </documentation></annotation>
+ <annotation>
+ <documentation>Specifies async continuation.</documentation>
+ </annotation>
</attribute>
</attributeGroup>
@@ -1162,42 +1346,55 @@
</restriction>
</simpleType>
-
<attributeGroup name="assignmentAttributes">
- <annotation><documentation>the assignment attributes will be used in
- tasks and swimlanes to specify to whom these respectively are assigned.
- </documentation></annotation>
+ <annotation>
+ <documentation>The assignment attributes are used in
+ tasks and swimlanes to specify who is the assignee.
+ </documentation>
+ </annotation>
<attribute name="assignee" type="string">
- <annotation><documentation>Expression that resolves to a userId referencing
- the person to which the task or swimlane will be assigned.
- </documentation></annotation>
+ <annotation>
+ <documentation>Expression that resolves to a userId referencing
+ the person to whom the task or swimlane will be assigned.</documentation>
+ </annotation>
</attribute>
<attribute name="assignee-lang" type="string">
- <annotation><documentation>Expression language for the assignee attribute.
- </documentation></annotation>
+ <annotation>
+ <documentation>Expression language for the assignee attribute.</documentation>
+ </annotation>
</attribute>
<attribute name="candidate-users" type="string">
- <annotation><documentation>Expression that resolves to a comma separated
- list of userId's. All the referred people will be candidates for
- take the task or swimlane.</documentation></annotation>
+ <annotation>
+ <documentation>Expression that resolves to a comma separated
+ list of userIds. All the referred people will be candidates for
+ take the task or swimlane.</documentation>
+ </annotation>
</attribute>
<attribute name="candidate-users-lang" type="string">
- <annotation><documentation>Expression language for the
- candidate-users attribute.</documentation></annotation>
+ <annotation>
+ <documentation>Expression language for the
+ candidate-users attribute.</documentation>
+ </annotation>
</attribute>
<attribute name="candidate-groups" type="string">
- <annotation><documentation>Resolves to a comma separated list of groupId's.
- All the referred people will be candidates to
- take the task or swimlane.</documentation></annotation>
+ <annotation>
+ <documentation>Resolves to a comma separated list of groupIds.
+ All the referred people will be candidates to
+ take the task or swimlane.</documentation>
+ </annotation>
</attribute>
<attribute name="candidate-groups-lang" type="string">
- <annotation><documentation>Expression language for the
- candidate-groups attribute.</documentation></annotation>
+ <annotation>
+ <documentation>Expression language for the
+ candidate-groups attribute.</documentation>
+ </annotation>
</attribute>
</attributeGroup>
<element name="swimlane">
- <annotation><documentation>A process role.</documentation></annotation>
+ <annotation>
+ <documentation>Process role.</documentation>
+ </annotation>
<complexType>
<sequence>
<element name="description" minOccurs="0" type="string" />
@@ -1208,28 +1405,35 @@
</element>
<complexType name="transitionType">
- <annotation><documentation>The outgoing transitions. The first in the list
- will be the default outgoing transition.
- </documentation></annotation>
+ <annotation>
+ <documentation>The outgoing transitions. The first in the list
+ will be the default outgoing transition.</documentation>
+ </annotation>
<sequence>
- <element name="description" minOccurs="0" maxOccurs="unbounded" type="string" />
+ <element name="description" minOccurs="0" type="string" />
<group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attribute name="name" type="string">
- <annotation><documentation>Name of this outgoing transition</documentation></annotation>
+ <annotation>
+ <documentation>Name of this outgoing transition</documentation>
+ </annotation>
</attribute>
<attribute name="to" type="string">
- <annotation><documentation>Name of the destination activity of this transition.
- </documentation></annotation>
+ <annotation>
+ <documentation>Name of the destination activity of this transition.</documentation>
+ </annotation>
</attribute>
<attribute name="g" type="string">
- <annotation><documentation>Graphical information used by process designer tool.
- </documentation></annotation>
+ <annotation>
+ <documentation>Graphical information used by process designer tool.</documentation>
+ </annotation>
</attribute>
</complexType>
<element name="transition" type="tns:transitionType">
- <annotation><documentation>A transition from one activity to another.</documentation></annotation>
+ <annotation>
+ <documentation>Link from one activity to another.</documentation>
+ </annotation>
</element>
<element name="on">
@@ -1237,14 +1441,17 @@
<sequence>
<element ref="tns:timer" minOccurs="0" />
<group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>A list of event listeners that will
- be notified when the event is fired</documentation></annotation>
+ <annotation>
+ <documentation>List of event listeners that will
+ be notified when the event is fired</documentation>
+ </annotation>
</group>
</sequence>
<attribute name="event" type="string">
- <annotation><documentation>The event identification. start, end, take or
- any other custom event.
- </documentation></annotation>
+ <annotation>
+ <documentation>Event identification. start, end, take or
+ any other custom event.</documentation>
+ </annotation>
</attribute>
<attribute name="continue" type="tns:continueType" default="sync" />
</complexType>
@@ -1252,50 +1459,57 @@
<complexType name="parameterType">
<attribute name="subvar" type="string">
- <annotation><documentation>The name of the sub process variable.
- </documentation></annotation>
+ <annotation>
+ <documentation>Name of the sub process variable.</documentation>
+ </annotation>
</attribute>
<attribute name="expr" type="string">
- <annotation><documentation>An expression for which the resulting
- value will be used as value.
- </documentation></annotation>
+ <annotation>
+ <documentation>Expression that provides the variable value.</documentation>
+ </annotation>
</attribute>
<attribute name="lang" type="string">
- <annotation><documentation>Language of the expression.
- </documentation></annotation>
+ <annotation>
+ <documentation>Language of the expression.</documentation>
+ </annotation>
</attribute>
<attribute name="var" type="string">
- <annotation><documentation>Name of the process variable
- in the super process execution..
- </documentation></annotation>
+ <annotation>
+ <documentation>Name of the process variable
+ in the super process.</documentation>
+ </annotation>
</attribute>
</complexType>
-
<element name="timer">
<complexType>
<sequence>
- <annotation><documentation>A list of event listeners that will
- be notified when the timer fires</documentation></annotation>
+ <annotation>
+ <documentation>List of event listeners that will
+ be notified when the timer fires.</documentation>
+ </annotation>
<element name="description" minOccurs="0" type="string" />
- <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
- </group>
+ <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attribute name="duedate" type="string">
- <annotation><documentation>Timer duedate expression that defines the duedate of this
- timer relative to the creation time of the timer. E.g. '2 hours' or '4 business days'
- </documentation></annotation>
+ <annotation>
+ <documentation>Timer duedate expression that defines the duedate of this
+ timer relative to the creation time of the timer.
+ E.g. '2 hours' or '4 business days'.</documentation>
+ </annotation>
</attribute>
<attribute name="repeat" type="string">
- <annotation><documentation>Timer duedate expression that defines repeated scheduling
- relative to the last timer fire event. E.g. '2 hours' or '4 business days'
- </documentation></annotation>
+ <annotation>
+ <documentation>Timer duedate expression that defines repeated scheduling
+ relative to the last timer fire event.
+ E.g. '2 hours' or '4 business days'</documentation>
+ </annotation>
</attribute>
<attribute name="duedatetime" type="string">
- <annotation><documentation>Absolute time in format <code>HH:mm dd/MM/yyyy</code>
- (see SimpleDateFormat). The format for the absolute time can be customized in the
- jbpm configuration.
- </documentation></annotation>
+ <annotation>
+ <documentation>Absolute time in the format <code>HH:mm dd/MM/yyyy</code>.
+ The format can be customized in the configuration.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
@@ -1379,19 +1593,25 @@
<element name="subject" type="string" minOccurs="0" />
<element name="text" type="string" minOccurs="0" />
<element name="html" type="string" minOccurs="0" />
- <element name="attachments" minOccurs="0" >
+ <element name="attachments" minOccurs="0">
<complexType>
<sequence>
<element name="attachment" maxOccurs="unbounded">
<complexType>
<attribute name="url" type="string">
- <annotation><documentation>URL reference to the attachment</documentation></annotation>
+ <annotation>
+ <documentation>Resource in the web.</documentation>
+ </annotation>
</attribute>
<attribute name="resource" type="string">
- <annotation><documentation>Name of the attachment resource on the classpath</documentation></annotation>
+ <annotation>
+ <documentation>Resource in the classpath.</documentation>
+ </annotation>
</attribute>
<attribute name="file" type="string">
- <annotation><documentation>File reference to the attachment</documentation></annotation>
+ <annotation>
+ <documentation>Path in the file system.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
@@ -1406,35 +1626,52 @@
<complexType name="jmsType">
<choice minOccurs="1" maxOccurs="1">
- <element name="object" type="tns:wireObjectType"/>
- <element name="text" type="string"/>
- <element name="map" type="tns:mapType"/>
+ <element name="object" type="tns:wireObjectType" />
+ <element name="text" type="string" />
+ <element name="map" type="tns:mapType" />
</choice>
<attribute name="connection-factory" type="string">
- <annotation><documentation>jndi name of the jms connection factory</documentation></annotation>
+ <annotation>
+ <documentation>JNDI name of the connection factory.</documentation>
+ </annotation>
</attribute>
<attribute name="destination" type="string">
- <annotation><documentation>jndi name of the destination to send the message to</documentation></annotation>
+ <annotation>
+ <documentation>JNDI name of the destination.</documentation>
+ </annotation>
</attribute>
<attribute name="transacted" type="tns:booleanValueType" default="false">
- <annotation><documentation>indicates whether the message should be sent in a transactional way</documentation></annotation>
+ <annotation>
+ <documentation>Tells whether the message should be sent in a transaction.</documentation>
+ </annotation>
</attribute>
<attribute name="acknowledge" type="tns:acknowledgeType" default="auto">
- <annotation><documentation>indicates the acknowledgment mode</documentation></annotation>
+ <annotation>
+ <documentation>Indicates the acknowledgment mode.</documentation>
+ </annotation>
</attribute>
</complexType>
<complexType name="mailRecipientType">
<attribute name="addresses" type="string">
- <annotation><documentation>list of email address separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
+ <annotation>
+ <documentation>List of email addresses separated by ',' (comma)
+ or whitespace.</documentation>
+ </annotation>
</attribute>
<attribute name="users" type="string">
- <annotation><documentation>list of user ids that are resolved to the email address against configured identity component.
- user ids should be separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
+ <annotation>
+ <documentation>List of users, resolved to email addresses thought
+ the configured identity component. Users are separated by ',' (comma)
+ ';' (semicolon) or whitespace.</documentation>
+ </annotation>
</attribute>
<attribute name="groups" type="string">
- <annotation><documentation>list of group ids that are resolved to the email address against configured identity component.
- group ids should be separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
+ <annotation>
+ <documentation>List of groups, that are resolved to the email address against
+ configured identity component. Groups are separated by ',' (comma)
+ ';' (semicolon) or whitespace</documentation>
+ </annotation>
</attribute>
</complexType>
@@ -1457,37 +1694,51 @@
</restriction>
</simpleType>
-
<simpleType name="templateType">
- <annotation><documentation>Reference to the email template</documentation></annotation>
- <restriction base="string"></restriction>
+ <annotation>
+ <documentation>Reference to the email template.</documentation>
+ </annotation>
+ <restriction base="string" />
</simpleType>
<element name="migrate-instances">
- <annotation><documentation>Information to migrate instances of previously deployed process definitions
- to the new one</documentation></annotation>
+ <annotation>
+ <documentation>Information to migrate instances of previously deployed
+ process definitions to the new version.</documentation>
+ </annotation>
<complexType>
- <sequence>
- <element name="migration-handler" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>The migration handler specifies the name of a class to be executed while migrating the process instance.</documentation></annotation>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="migration-handler">
+ <annotation>
+ <documentation>The migration handler specifies the name of a class to be executed
+ while migrating the process instance.</documentation>
+ </annotation>
<complexType>
- <attribute name="class"/>
+ <attribute name="class" />
</complexType>
</element>
- <element name="activity-mapping" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>One activity mapping will be present for each activity of which the name changed.</documentation></annotation>
+ <element name="activity-mapping">
+ <annotation>
+ <documentation>One activity mapping will be present for each activity of which the
+ name changed.</documentation>
+ </annotation>
<complexType>
<attribute name="old-name" type="string" use="required">
- <annotation><documentation>The name of the activity in the previously deployed process definition.</documentation></annotation>
+ <annotation>
+ <documentation>Name of the activity in the previously deployed
+ process definition.</documentation>
+ </annotation>
</attribute>
<attribute name="new-name" type="string" use="required">
- <annotation><documentation>The name of the activity in the newly deployed process definition</documentation></annotation>
+ <annotation>
+ <documentation>Name of the activity in the newly deployed
+ process definition.</documentation>
+ </annotation>
</attribute>
</complexType>
</element>
- </sequence>
- <attribute name="action" type="tns:migrationActionType" default="migrate">
- </attribute>
+ </choice>
+ <attribute name="action" type="tns:migrationActionType" default="migrate" />
</complexType>
</element>
@@ -1497,5 +1748,4 @@
<enumeration value="migrate" />
</restriction>
</simpleType>
-
</schema>
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -30,7 +30,7 @@
public abstract class BpmnBinding extends TagBinding {
- protected static final WireParser wireParser = BpmnParser.wireParser;
+ protected static final WireParser wireParser = WireParser.getInstance();
protected String default_;
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 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -27,23 +27,17 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.api.model.Activity;
-import org.jbpm.api.model.Transition;
import org.jbpm.bpmn.common.Resource;
import org.jbpm.bpmn.common.ResourceParameter;
import org.jbpm.bpmn.flownodes.BpmnActivity;
-import org.jbpm.bpmn.flownodes.BpmnBinding;
-import org.jbpm.bpmn.flownodes.BpmnEvent;
-import org.jbpm.bpmn.flownodes.NoneStartEventActivity;
-import org.jbpm.bpmn.flownodes.SubProcessActivity;
import org.jbpm.bpmn.model.BpmnProcessDefinition;
import org.jbpm.bpmn.model.SequenceflowCondition;
import org.jbpm.internal.log.Log;
@@ -58,14 +52,12 @@
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.util.CollectionUtil;
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.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
@@ -77,27 +69,18 @@
private static final Log log = Log.getLog(BpmnParser.class.getName());
- static ObjectBinding objectBinding = new ObjectBinding();
- public static final WireParser wireParser = WireParser.getInstance();
+ private static final String[] DEFAULT_ACTIVITIES_RESOURCES = { "jbpm.bpmn.flownodes.xml" };
+ private static final String CATEGORY_ACTIVITY = "activity";
+ private static final String[] SCHEMA_RESOURCES = { "BPMN20.xsd", "DiagramDefinition.xsd",
+ "DiagramInterchange.xsd", "BpmnDi.xsd" };
- static final String[] DEFAULT_ACTIVITIES_RESOURCES = { "jbpm.bpmn.flownodes.xml" };
- static final String CATEGORY_ACTIVITY = "activity";
-
static BindingsParser bindingsParser = new BindingsParser();
public BpmnParser() {
-
- initialize(); // initialises underlying SAX parser
- parseBindings(); // initialises bindings
-
+ // initialises bindings
+ parseBindings();
// Setting BPMN2 xsd schema
- List<String> schemaResources = new ArrayList<String>();
- schemaResources.add("BPMN20.xsd");
- schemaResources.add("DiagramDefinition.xsd");
- schemaResources.add("DiagramInterchange.xsd");
- schemaResources.add("BpmnDi.xsd");
- setSchemaResources(schemaResources);
-
+ setSchemaResources(SCHEMA_RESOURCES);
}
public Object parseDocumentElement(Element documentElement, Parse parse) {
@@ -173,10 +156,13 @@
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<?> activityBindings = (List<?>) bindingsParser.createParse()
+ .setUrl(resourceUrl)
+ .execute()
+ .checkErrors("bpmn activities from " + resourceUrl.toString())
+ .getDocumentObject();
- for (TagBinding binding : activityBindings) {
+ for (TagBinding binding: CollectionUtil.checkList(activityBindings, TagBinding.class)) {
binding.setCategory(CATEGORY_ACTIVITY);
bindings.addBinding(binding);
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -25,13 +25,14 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
+import org.w3c.dom.Element;
+
import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.listener.EventListener;
@@ -73,7 +74,6 @@
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.jbpm.pvm.internal.xml.ProblemImpl;
-import org.w3c.dom.Element;
/**
* @author Tom Baeyens
@@ -88,18 +88,18 @@
public static final String NAMESPACE_JPDL_44 = "http://jbpm.org/4.4/jpdl";
public static final String CURRENT_VERSION_JBPM = "4.4";
- public static final String CURRENT_VERSION_NAMESPACE = "http://jbpm.org/" + CURRENT_VERSION_JBPM + "/jpdl";
- public static final String CURRENT_VERSION_PROCESS_LANGUAGE_ID = "jpdl-" + CURRENT_VERSION_JBPM;
+ public static final String CURRENT_VERSION_NAMESPACE =
+ "http://jbpm.org/" + CURRENT_VERSION_JBPM + "/jpdl";
+ public static final String CURRENT_VERSION_PROCESS_LANGUAGE_ID =
+ "jpdl-" + CURRENT_VERSION_JBPM;
- private static final List<String> SCHEMA_RESOURCES = Arrays.asList("jpdl-4.0.xsd",
- "jpdl-4.2.xsd", "jpdl-4.3.xsd", "jpdl-4.4.xsd");
+ private static final String[] SCHEMA_RESOURCES =
+ { "jpdl-4.0.xsd", "jpdl-4.2.xsd", "jpdl-4.3.xsd", "jpdl-4.4.xsd" };
// array elements are mutable, even when final
// never make a static array public
- private static final String[] DEFAULT_BINDING_RESOURCES = {
- "jbpm.jpdl.bindings.xml",
- "jbpm.user.bindings.xml"
- };
+ private static final String[] DEFAULT_BINDING_RESOURCES =
+ { "jbpm.jpdl.bindings.xml", "jbpm.user.bindings.xml" };
private static JpdlBindingsParser jpdlBindingsParser = new JpdlBindingsParser();
@@ -107,7 +107,6 @@
public static final String CATEGORY_EVENT_LISTENER = "eventlistener";
public JpdlParser() {
- initialize();
parseBindings();
setSchemaResources(SCHEMA_RESOURCES);
}
@@ -115,21 +114,22 @@
protected void parseBindings() {
this.bindings = new Bindings();
- for (String activityResource: DEFAULT_BINDING_RESOURCES) {
+ for (String activityResource : DEFAULT_BINDING_RESOURCES) {
Enumeration<URL> resourceUrls = getResources(activityResource);
if (resourceUrls.hasMoreElements()) {
while (resourceUrls.hasMoreElements()) {
URL resourceUrl = resourceUrls.nextElement();
- log.trace("loading jpdl bindings from resource: "+resourceUrl);
+ log.trace("loading jpdl bindings from resource: " + resourceUrl);
jpdlBindingsParser.createParse()
.setUrl(resourceUrl)
.contextMapPut(Parse.CONTEXT_KEY_BINDINGS, bindings)
.execute()
- .checkErrors("jpdl bindings from "+resourceUrl.toString());
+ .checkErrors("jpdl bindings from " + resourceUrl.toString());
}
- } else {
- log.trace("skipping unavailable jpdl activities resource: "+activityResource);
}
+ else {
+ log.trace("skipping unavailable jpdl activities resource: " + activityResource);
+ }
}
}
@@ -142,20 +142,19 @@
if (!resourceUrls.hasMoreElements()) {
resourceUrls = JpdlParser.class.getClassLoader().getResources(resourceName);
}
- } catch (Exception e) {
- throw new JbpmException("couldn't get resource urls for "+resourceName, e);
}
+ catch (Exception e) {
+ throw new JbpmException("couldn't get resource urls for " + resourceName, e);
+ }
return resourceUrls;
}
public Object parseDocumentElement(Element documentElement, Parse parse) {
- List<ProcessDefinitionImpl> processDefinitions = new ArrayList<ProcessDefinitionImpl>();
-
JpdlProcessDefinition processDefinition = instantiateNewJpdlProcessDefinition();
+ parse.contextStackPush(processDefinition);
+ List<ProcessDefinitionImpl> processDefinitions = new ArrayList<ProcessDefinitionImpl>();
processDefinitions.add(processDefinition);
-
- parse.contextStackPush(processDefinition);
try {
// process attribues
String name = XmlUtil.attribute(documentElement, "name", parse);
@@ -165,33 +164,34 @@
// to allow for specific parsing behaviour per version
// first check if the langid is available as a deployment property
- DeploymentImpl deployment = (DeploymentImpl) parse.contextMapGet(Parse.CONTEXT_KEY_DEPLOYMENT);
- if (deployment!=null) {
+ DeploymentImpl deployment =
+ (DeploymentImpl) parse.contextMapGet(Parse.CONTEXT_KEY_DEPLOYMENT);
+ if (deployment != null) {
String processLanguageId = deployment.getProcessLanguageId(name);
- if (processLanguageId==null) {
+ if (processLanguageId == null) {
// if it is not available as a deployment property, check if the
// jpdlparser attribute specifies a specific jpdl version.
// this is the case for certain compatibility tests in our test suite
String jpdlParser = XmlUtil.attribute(documentElement, "jpdlparser");
- if (jpdlParser!=null) {
+ if (jpdlParser != null) {
processLanguageId = "jpdl-" + jpdlParser;
-
- } else {
+ }
+ else {
// if none of the above, check if this is a parser test run for a specific verion
// specify the jpdltestversion with "mvn -Djpdlparser=jpdl-4.4 clean install"
// that way, the whole test suite will be use the specified parser
jpdlParser = System.getProperty("jpdlparser");
- if (jpdlParser!=null) {
+ if (jpdlParser != null) {
processLanguageId = "jpdl-" + jpdlParser;
-
- } else {
+ }
+ else {
// if this process has a namespace, then use the namespace
// to see what jpdl parser version should be used
String namespaceUri = documentElement.getNamespaceURI();
- if (namespaceUri!=null) {
+ if (namespaceUri != null) {
processLanguageId = "jpdl-" + namespaceUri.substring(16, 19);
-
- } else {
+ }
+ else {
// if none of the above, just deploy it as the current library version
processLanguageId = CURRENT_VERSION_PROCESS_LANGUAGE_ID;
}
@@ -209,17 +209,17 @@
processDefinition.setPackageName(packageName);
Integer version = XmlUtil.attributeInteger(documentElement, "version", parse);
- if (version!=null) {
+ if (version != null) {
processDefinition.setVersion(version);
}
String key = XmlUtil.attribute(documentElement, "key");
- if (key!=null) {
+ if (key != null) {
processDefinition.setKey(key);
}
Element descriptionElement = XmlUtil.element(documentElement, "description");
- if (descriptionElement!=null) {
+ if (descriptionElement != null) {
String description = XmlUtil.getContentText(descriptionElement);
processDefinition.setDescription(description);
}
@@ -229,11 +229,11 @@
// swimlanes
List<Element> swimlaneElements = XmlUtil.elements(documentElement, "swimlane");
- for (Element swimlaneElement: swimlaneElements) {
+ for (Element swimlaneElement : swimlaneElements) {
String swimlaneName = XmlUtil.attribute(swimlaneElement, "name", parse);
- if (swimlaneName!=null) {
+ if (swimlaneName != null) {
SwimlaneDefinitionImpl swimlaneDefinition =
- processDefinition.createSwimlaneDefinition(swimlaneName);
+ processDefinition.createSwimlaneDefinition(swimlaneName);
parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
}
}
@@ -255,12 +255,12 @@
if (migrationElement != null) {
MigrationHelper.parseMigrationDescriptor(migrationElement, parse, processDefinition);
}
-
- } finally {
+ }
+ finally {
parse.contextStackPop();
}
- if (processDefinition.getInitial()==null) {
+ if (processDefinition.getInitial() == null) {
parse.addProblem("no start activity in process", documentElement);
}
@@ -271,21 +271,21 @@
return new JpdlProcessDefinition();
}
- protected void resolveTransitionDestinations(Parse parse, JpdlProcessDefinition processDefinition, UnresolvedTransitions unresolvedTransitions) {
- for (UnresolvedTransition unresolvedTransition: unresolvedTransitions.list) {
+ protected void resolveTransitionDestinations(Parse parse,
+ JpdlProcessDefinition processDefinition, UnresolvedTransitions unresolvedTransitions) {
+ for (UnresolvedTransition unresolvedTransition : unresolvedTransitions.list) {
unresolvedTransition.resolve(processDefinition, parse);
}
}
- public void parseActivities(Element documentElement, Parse parse, CompositeElementImpl compositeElement) {
+ public void parseActivities(Element documentElement, Parse parse,
+ CompositeElementImpl compositeElement) {
List<Element> elements = XmlUtil.elements(documentElement);
for (Element nestedElement : elements) {
String tagName = nestedElement.getLocalName();
- if ("on".equals(tagName)
- || "timer".equals(tagName)
- || "swimlane".equals(tagName)
- || "migrate-instances".equals(tagName)
- || "description".equals(tagName)) continue;
+ if ("on".equals(tagName) || "timer".equals(tagName) || "swimlane".equals(tagName)
+ || "migrate-instances".equals(tagName) || "description".equals(tagName))
+ continue;
JpdlBinding activityBinding = (JpdlBinding) getBinding(nestedElement, CATEGORY_ACTIVITY);
if (activityBinding == null) {
@@ -302,16 +302,17 @@
parseVariableDefinitions(nestedElement, parse, activity);
Element descriptionElement = XmlUtil.element(nestedElement, "description");
- if (descriptionElement!=null) {
+ if (descriptionElement != null) {
String description = XmlUtil.getContentText(descriptionElement);
activity.setDescription(description);
}
String continuationText = XmlUtil.attribute(nestedElement, "continue");
- if (continuationText!=null) {
+ if (continuationText != null) {
if ("async".equals(continuationText)) {
activity.setContinuation(Continuation.ASYNCHRONOUS);
- } else if ("exclusive".equals(continuationText)) {
+ }
+ else if ("exclusive".equals(continuationText)) {
activity.setContinuation(Continuation.EXCLUSIVE);
}
}
@@ -320,7 +321,8 @@
if (parseResult instanceof ActivityBehaviour) {
ActivityBehaviour activityBehaviour = (ActivityBehaviour) parseResult;
activity.setActivityBehaviour(activityBehaviour);
- } else {
+ }
+ else {
Descriptor activityBehaviourDescriptor = (Descriptor) parseResult;
activity.setActivityBehaviourDescriptor(activityBehaviourDescriptor);
}
@@ -328,7 +330,8 @@
parseOnEvents(nestedElement, parse, activity);
String g = XmlUtil.attribute(nestedElement, "g");
- if (g == null) continue;
+ if (g == null)
+ continue;
StringTokenizer stringTokenizer = new StringTokenizer(g, ",");
ActivityCoordinatesImpl coordinates = null;
@@ -339,43 +342,50 @@
int width = Integer.parseInt(stringTokenizer.nextToken());
int height = Integer.parseInt(stringTokenizer.nextToken());
coordinates = new ActivityCoordinatesImpl(x, y, width, height);
- } catch (NumberFormatException e) {
+ }
+ catch (NumberFormatException e) {
coordinates = null;
}
}
if (coordinates != null) {
activity.setCoordinates(coordinates);
- } else {
+ }
+ else {
parse.addProblem("invalid coordinates g=\"" + g + "\" in " + activity, nestedElement);
}
- } finally {
+ }
+ finally {
parse.contextStackPop();
}
}
}
- public TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
+ public TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse,
+ ScopeElementImpl scopeElement) {
TimerDefinitionImpl timerDefinition = scopeElement.createTimerDefinition();
String duedate = XmlUtil.attribute(timerElement, "duedate");
String duedatetime = XmlUtil.attribute(timerElement, "duedatetime");
- if (duedate!=null) {
+ if (duedate != null) {
timerDefinition.setDueDateDescription(duedate);
-
- } else if (duedatetime!=null) {
- String dueDateTimeFormatText = (String) EnvironmentImpl.getFromCurrent("jbpm.duedatetime.format", false);
- if (dueDateTimeFormatText==null) {
+ }
+ else if (duedatetime != null) {
+ String dueDateTimeFormatText =
+ (String) EnvironmentImpl.getFromCurrent("jbpm.duedatetime.format", false);
+ if (dueDateTimeFormatText == null) {
dueDateTimeFormatText = "HH:mm dd/MM/yyyy";
}
SimpleDateFormat dateFormat = new SimpleDateFormat(dueDateTimeFormatText);
try {
Date duedatetimeDate = dateFormat.parse(duedatetime);
timerDefinition.setDueDate(duedatetimeDate);
- } catch (ParseException e) {
- parse.addProblem("couldn't parse duedatetime "+duedatetime, e);
}
- } else {
+ catch (ParseException e) {
+ parse.addProblem("couldn't parse duedatetime " + duedatetime, e);
+ }
+ }
+ else {
parse.addProblem("either duedate or duedatetime is required in timer", timerElement);
}
@@ -388,80 +398,84 @@
public void parseOnEvents(Element element, Parse parse, ScopeElementImpl scopeElement) {
// event listeners
List<Element> onElements = XmlUtil.elements(element, "on");
- for (Element onElement: onElements) {
+ for (Element onElement : onElements) {
String eventName = XmlUtil.attribute(onElement, "event", parse);
parseOnEvent(onElement, parse, scopeElement, eventName);
Element timerElement = XmlUtil.element(onElement, "timer");
- if (timerElement!=null) {
- TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, scopeElement);
+ if (timerElement != null) {
+ TimerDefinitionImpl timerDefinitionImpl =
+ parseTimerDefinition(timerElement, parse, scopeElement);
timerDefinitionImpl.setEventName(eventName);
}
}
}
- public void parseOnEvent(Element element, Parse parse, ObservableElementImpl observableElement, String eventName) {
- if (eventName!=null) {
+ public void parseOnEvent(Element element, Parse parse,
+ ObservableElementImpl observableElement, String eventName) {
+ if (eventName != null) {
EventImpl event = observableElement.getEvent(eventName);
- if (event==null) {
+ if (event == null) {
event = observableElement.createEvent(eventName);
}
String continuationText = XmlUtil.attribute(element, "continue");
- if (continuationText!=null) {
+ if (continuationText != null) {
if ("async".equals(continuationText)) {
event.setContinuation(Continuation.ASYNCHRONOUS);
- } else if ("exclusive".equals(continuationText)) {
+ }
+ else if ("exclusive".equals(continuationText)) {
event.setContinuation(Continuation.EXCLUSIVE);
}
}
- for (Element eventListenerElement: XmlUtil.elements(element)) {
- JpdlBinding eventBinding = (JpdlBinding) getBinding(eventListenerElement, CATEGORY_EVENT_LISTENER);
- if (eventBinding!=null) {
+ for (Element eventListenerElement : XmlUtil.elements(element)) {
+ JpdlBinding eventBinding =
+ (JpdlBinding) getBinding(eventListenerElement, CATEGORY_EVENT_LISTENER);
+ if (eventBinding != null) {
EventListenerReference eventListenerReference = null;
Object parseResult = eventBinding.parse(eventListenerElement, parse, this);
if (parseResult instanceof EventListener) {
EventListener eventListener = (EventListener) parseResult;
eventListenerReference = event.createEventListenerReference(eventListener);
- } else {
+ }
+ else {
Descriptor eventListenerDescriptor = (Descriptor) parseResult;
- eventListenerReference = event.createEventListenerReference(eventListenerDescriptor);
+ eventListenerReference =
+ event.createEventListenerReference(eventListenerDescriptor);
}
- Boolean propagationEnabled = XmlUtil.attributeBoolean(eventListenerElement, "propagation", parse);
- if (propagationEnabled!=null) {
+ Boolean propagationEnabled =
+ XmlUtil.attributeBoolean(eventListenerElement, "propagation", parse);
+ if (propagationEnabled != null) {
eventListenerReference.setPropagationEnabled(propagationEnabled);
}
continuationText = XmlUtil.attribute(eventListenerElement, "continue");
- if (continuationText!=null) {
+ if (continuationText != null) {
if (observableElement instanceof ActivityImpl) {
- if (observableElement.getName()==null) {
+ if (observableElement.getName() == null) {
parse.addProblem("async continuation on event listener requires activity name", eventListenerElement);
}
- } else if (observableElement instanceof TransitionImpl) {
+ }
+ else if (observableElement instanceof TransitionImpl) {
TransitionImpl transition = (TransitionImpl) observableElement;
- if (transition.getSource().getName()==null) {
+ if (transition.getSource().getName() == null) {
parse.addProblem("async continuation on event listener requires name in the transition source activity", eventListenerElement);
}
}
if ("async".equals(continuationText)) {
eventListenerReference.setContinuation(Continuation.ASYNCHRONOUS);
- } else if ("exclusive".equals(continuationText)) {
+ }
+ else if ("exclusive".equals(continuationText)) {
eventListenerReference.setContinuation(Continuation.EXCLUSIVE);
}
}
-
- } else {
+ }
+ else {
String tagName = eventListenerElement.getLocalName();
- if ( ! ( (observableElement instanceof TransitionImpl)
- && ( "condition".equals(tagName)
- || "timer".equals(tagName)
- )
- )
- ) {
- parse.addProblem("unrecognized event listener: "+tagName, null, ProblemImpl.TYPE_WARNING, eventListenerElement);
+ if (!(observableElement instanceof TransitionImpl && ("condition".equals(tagName) || "timer".equals(tagName)))) {
+ parse.addProblem("unrecognized event listener: " + tagName, null, ProblemImpl.TYPE_WARNING, eventListenerElement);
}
}
}
@@ -469,14 +483,17 @@
}
public void parseTransitions(Element element, ActivityImpl activity, Parse parse) {
+ UnresolvedTransitions unresolvedTransitions =
+ parse.contextStackFind(UnresolvedTransitions.class);
+
List<Element> transitionElements = XmlUtil.elements(element, "transition");
- UnresolvedTransitions unresolvedTransitions = parse.contextStackFind(UnresolvedTransitions.class);
- for (Element transitionElement: transitionElements) {
+ for (Element transitionElement : transitionElements) {
String transitionName = XmlUtil.attribute(transitionElement, "name");
Element timerElement = XmlUtil.element(transitionElement, "timer");
- if (timerElement!=null) {
- TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
+ if (timerElement != null) {
+ TimerDefinitionImpl timerDefinitionImpl =
+ parseTimerDefinition(timerElement, parse, activity);
timerDefinitionImpl.setSignalName(transitionName);
}
@@ -484,48 +501,56 @@
transition.setName(transitionName);
unresolvedTransitions.add(transition, transitionElement);
-
parseOnEvent(transitionElement, parse, transition, Event.TAKE);
}
}
- public void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
+ public void parseAssignmentAttributes(Element element,
+ AssignableDefinitionImpl assignableDefinition, Parse parse) {
Element descriptionElement = XmlUtil.element(element, "description");
- if (descriptionElement!=null) {
+ if (descriptionElement != null) {
String descriptionText = XmlUtil.getContentText(descriptionElement);
- Expression descriptionExpression = Expression.create(descriptionText, Expression.LANGUAGE_UEL_VALUE);
+ Expression descriptionExpression =
+ Expression.create(descriptionText, Expression.LANGUAGE_UEL_VALUE);
assignableDefinition.setDescription(descriptionExpression);
}
Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
- if (assignmentHandlerElement!=null) {
- UserCodeReference assignmentHandlerReference = parseUserCodeReference(assignmentHandlerElement, parse);
+ if (assignmentHandlerElement != null) {
+ UserCodeReference assignmentHandlerReference =
+ parseUserCodeReference(assignmentHandlerElement, parse);
assignableDefinition.setAssignmentHandlerReference(assignmentHandlerReference);
}
String assigneeExpressionText = XmlUtil.attribute(element, "assignee");
- if (assigneeExpressionText!=null) {
+ if (assigneeExpressionText != null) {
String assigneeExpressionLanguage = XmlUtil.attribute(element, "assignee-lang");
- Expression assigneeExpression = Expression.create(assigneeExpressionText, assigneeExpressionLanguage);
+ Expression assigneeExpression =
+ Expression.create(assigneeExpressionText, assigneeExpressionLanguage);
assignableDefinition.setAssigneeExpression(assigneeExpression);
}
String candidateUsersExpressionText = XmlUtil.attribute(element, "candidate-users");
- if (candidateUsersExpressionText!=null) {
- String candidateUsersExpressionLanguage = XmlUtil.attribute(element, "candidate-users-lang");
- Expression candidateUsersExpression = Expression.create(candidateUsersExpressionText, candidateUsersExpressionLanguage);
+ if (candidateUsersExpressionText != null) {
+ String candidateUsersExpressionLanguage =
+ XmlUtil.attribute(element, "candidate-users-lang");
+ Expression candidateUsersExpression =
+ Expression.create(candidateUsersExpressionText, candidateUsersExpressionLanguage);
assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
}
String candidateGroupsExpressionText = XmlUtil.attribute(element, "candidate-groups");
- if (candidateGroupsExpressionText!=null) {
- String candidateGroupsExpressionLanguage = XmlUtil.attribute(element, "candidate-groups-lang");
- Expression candidateGroupsExpression = Expression.create(candidateGroupsExpressionText, candidateGroupsExpressionLanguage);
+ if (candidateGroupsExpressionText != null) {
+ String candidateGroupsExpressionLanguage =
+ XmlUtil.attribute(element, "candidate-groups-lang");
+ Expression candidateGroupsExpression =
+ Expression.create(candidateGroupsExpressionText, candidateGroupsExpressionLanguage);
assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
}
}
- public TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, ScopeElementImpl scopeElement) {
+ public TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse,
+ ScopeElementImpl scopeElement) {
TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
String taskName = XmlUtil.attribute(element, "name");
@@ -542,22 +567,27 @@
taskDefinition.setPriority(priority);
}
- ProcessDefinitionImpl processDefinition = parse.contextStackFind(ProcessDefinitionImpl.class);
- if (processDefinition.getTaskDefinition(taskName)!=null) {
- parse.addProblem("duplicate task name "+taskName, element);
- } else {
+ ProcessDefinitionImpl processDefinition =
+ parse.contextStackFind(ProcessDefinitionImpl.class);
+ if (processDefinition.getTaskDefinition(taskName) != null) {
+ parse.addProblem("duplicate task name " + taskName, element);
+ }
+ else {
processDefinition.addTaskDefinitionImpl(taskDefinition);
}
String swimlaneName = XmlUtil.attribute(element, "swimlane");
- if (swimlaneName!=null) {
- JpdlProcessDefinition jpdlProcessDefinition = parse.contextStackFind(JpdlProcessDefinition.class);
- SwimlaneDefinitionImpl swimlaneDefinition = jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
- if (swimlaneDefinition!=null) {
+ if (swimlaneName != null) {
+ JpdlProcessDefinition jpdlProcessDefinition =
+ parse.contextStackFind(JpdlProcessDefinition.class);
+ SwimlaneDefinitionImpl swimlaneDefinition =
+ jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
+ if (swimlaneDefinition != null) {
taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
- } else {
- parse.addProblem("swimlane "+swimlaneName+" not declared", element);
}
+ else {
+ parse.addProblem("swimlane " + swimlaneName + " not declared", element);
+ }
}
parseAssignmentAttributes(element, taskDefinition, parse);
@@ -572,17 +602,19 @@
if (reminderElement != null) {
parseMailEvent(reminderElement, parse, scopeElement, Event.REMIND);
// associate timer to event
- TimerDefinitionImpl timerDefinition = parseTimerDefinition(reminderElement, parse, scopeElement);
+ TimerDefinitionImpl timerDefinition =
+ parseTimerDefinition(reminderElement, parse, scopeElement);
timerDefinition.setEventName(Event.REMIND);
}
return taskDefinition;
}
- public void parseVariableDefinitions(Element element, Parse parse, ScopeElementImpl scopeElement) {
+ public void parseVariableDefinitions(Element element, Parse parse,
+ ScopeElementImpl scopeElement) {
List<VariableDefinitionImpl> variableDefinitions = new ArrayList<VariableDefinitionImpl>();
- for (Element variableElement: XmlUtil.elements(element, "variable")) {
+ for (Element variableElement : XmlUtil.elements(element, "variable")) {
VariableDefinitionImpl variableDefinition = scopeElement.createVariableDefinition();
String name = XmlUtil.attribute(variableElement, "name", parse);
@@ -600,20 +632,21 @@
String initExpr = XmlUtil.attribute(variableElement, "init-expr");
String initExprType = XmlUtil.attribute(variableElement, "init-expr-type");
- if (initExpr!=null) {
+ if (initExpr != null) {
Expression initExpression = Expression.create(initExpr, initExprType);
variableDefinition.setInitExpression(initExpression);
sources++;
}
Element initDescriptorElement = XmlUtil.element(variableElement);
- if (initDescriptorElement!=null) {
- Descriptor initValueDescriptor = (Descriptor) WireParser.getInstance().parseElement(initDescriptorElement, parse);
+ if (initDescriptorElement != null) {
+ Descriptor initValueDescriptor =
+ (Descriptor) WireParser.getInstance().parseElement(initDescriptorElement, parse);
variableDefinition.setInitDescriptor(initValueDescriptor);
sources++;
}
- if (sources>1) {
+ if (sources > 1) {
parse.addProblem("init attribute and init element are mutually exclusive on element variable", variableElement);
}
@@ -622,7 +655,7 @@
}
public void parseMailEvent(Element element, Parse parse,
- ObservableElementImpl observableElement, String eventName) {
+ ObservableElementImpl observableElement, String eventName) {
// obtain assign event
EventImpl event = observableElement.getEvent(eventName);
if (event == null) {
@@ -640,20 +673,22 @@
eventListenerRef.setContinuation(Continuation.EXCLUSIVE);
}
- //https://jira.jboss.org/jira/browse/JBPM-2466
+ // https://jira.jboss.org/jira/browse/JBPM-2466
String mailTemplateName = eventName;
if (Event.ASSIGN.equals(eventName)) {
- mailTemplateName = "task-notification";
- } else if (Event.REMIND.equals(eventName)) {
- mailTemplateName = "task-reminder";
+ mailTemplateName = "task-notification";
}
+ else if (Event.REMIND.equals(eventName)) {
+ mailTemplateName = "task-reminder";
+ }
// associate mail producer to event listener
UserCodeReference mailProducer = parseMailProducer(element, parse, mailTemplateName);
eventListener.setMailProducerReference(mailProducer);
}
- public UserCodeReference parseMailProducer(Element element, Parse parse, String defaultTemplateName) {
+ public UserCodeReference parseMailProducer(Element element, Parse parse,
+ String defaultTemplateName) {
// check whether the element is a generic object descriptor
if (ObjectBinding.isObjectDescriptor(element)) {
return parseUserCodeReference(element, parse);
@@ -670,7 +705,7 @@
}
private MailTemplate parseMailTemplate(Element element, Parse parse,
- String defaultTemplateName) {
+ String defaultTemplateName) {
if (element.hasAttribute("template")) {
// fetch template from configuration
return findMailTemplate(element, parse, element.getAttribute("template"));
@@ -684,15 +719,17 @@
return findMailTemplate(element, parse, defaultTemplateName);
}
parse.addProblem("mail template must be referenced in the 'template' attribute "
- + "or specified inline", element);
+ + "or specified inline", element);
return null;
}
private MailTemplate findMailTemplate(Element element, Parse parse, String templateName) {
- MailTemplateRegistry templateRegistry = EnvironmentImpl.getFromCurrent(MailTemplateRegistry.class);
+ MailTemplateRegistry templateRegistry =
+ EnvironmentImpl.getFromCurrent(MailTemplateRegistry.class);
if (templateRegistry != null) {
MailTemplate template = templateRegistry.getTemplate(templateName);
- if (template != null) return template;
+ if (template != null)
+ return template;
}
parse.addProblem("mail template not found: " + templateName, element);
return null;
@@ -704,13 +741,13 @@
ObjectDescriptor objectDescriptor = parseObjectDescriptor(element, parse);
userCodeReference.setDescriptor(objectDescriptor);
- if (objectDescriptor.getExpression()!=null) {
+ if (objectDescriptor.getExpression() != null) {
// expressions are not cached by default
userCodeReference.setCached(false);
}
Boolean isCached = XmlUtil.attributeBoolean(element, "cache", parse);
- if (isCached!=null) {
+ if (isCached != null) {
userCodeReference.setCached(isCached.booleanValue());
}
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/CacheParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/CacheParsingTest.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/CacheParsingTest.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -11,7 +11,7 @@
public class CacheParsingTest extends JpdlParseTestCase {
public void testCacheDisabled() {
- String xmlString = "<process name='MyProsess' version='1' xmlns='http://jbpm.org/jpdl/4.4'>\n"
+ String xmlString = "<process name='MyProcess' xmlns='http://jbpm.org/4.4/jpdl'>\n"
+ " <start name='start'>\n"
+ " <transition name='myTransition' to='end'>\n"
+ " <event-listener class='com.comp.MyEventListener' cache='disabled'/>\n"
@@ -24,11 +24,11 @@
.setString(xmlString)
.execute()
.getProblems();
- assertEquals(0, problems.size());
+ assertEquals(problems.toString(), 0, problems.size());
}
public void testCachePowered() {
- String xmlString = "<process name='MyProsess' version='1' xmlns='http://jbpm.org/jpdl/4.4'>\n"
+ String xmlString = "<process name='MyProcess' xmlns='http://jbpm.org/4.4/jpdl'>\n"
+ " <start name='start'>\n"
+ " <transition name='myTransition' to='end'>\n"
+ " <event-listener class='com.comp.MyEventListener' cache='powered'/>\n"
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/MailParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/MailParsingTest.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/MailParsingTest.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -11,7 +11,7 @@
public class MailParsingTest extends JpdlParseTestCase {
public void testMailParse() {
- String xmlString = "<process name='MyProsess' version='1' xmlns='http://jbpm.org/jpdl/4.4'>"
+ String xmlString = "<process name='MyProcess' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start name='start'>"
+ " <transition to='mail'/>"
+ " </start>"
@@ -25,6 +25,6 @@
.setString(xmlString)
.execute()
.getProblems();
- assertEquals(0, problems.size());
+ assertEquals(problems.toString(), 0, problems.size());
}
}
Modified: jbpm4/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Converter.java
===================================================================
--- jbpm4/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Converter.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Converter.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -50,6 +50,8 @@
import org.jbpm.jpdl.internal.convert.problem.Problem;
import org.jbpm.jpdl.internal.convert.problem.ProblemListener;
import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.util.CollectionUtil;
+
import org.xml.sax.InputSource;
/**
@@ -313,7 +315,7 @@
}
//Implement it
- List starts = jpdl4Element.elements("start-state");
+ List<?> starts = jpdl4Element.elements("start-state");
// check for duplicate start-states
if ((node instanceof StartState) && !starts.isEmpty()) {
@@ -386,8 +388,8 @@
newTransistion.addAttribute("to", to);
} else {
//The last task node has a transition to the node after the original TaskNode
- List<Element> transitions = jpdl3Element.elements("transition");
- for (Element trans : transitions) {
+ List<?> transitions = jpdl3Element.elements("transition");
+ for (Element trans : CollectionUtil.checkList(transitions, Element.class)) {
Element transElement = task4.addElement("transition");
String transName = trans.attributeValue("name") == null ? trans.attributeValue("to") :trans.attributeValue("name");
transElement.addAttribute("name", transName);
@@ -463,9 +465,7 @@
log.info("process xml information: no swimlane or assignment specified for task '" + taskElement.asXML() + "'");
}
- //event elements
- convertEvents(taskElement, task4);
-
+ //notification attribute
String notificationsText = taskElement.attributeValue("notify");
if (notificationsText != null && ("true".equalsIgnoreCase(notificationsText)
|| "on".equalsIgnoreCase(notificationsText) || "yes".equalsIgnoreCase(notificationsText))) {
@@ -475,6 +475,10 @@
}
//Reminder elements
convertTaskReminders(taskElement, task4);
+
+ //event elements
+ convertEvents(taskElement, task4);
+
//timer elements
convertTaskTimers(taskElement, task4);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -109,7 +109,8 @@
String addresses = fromTemplate.getAddresses();
if (addresses != null) {
addresses = evaluateExpression(addresses);
- email.addFrom(InternetAddress.parse(addresses));
+ // non-strict parsing applies to a list of mail addresses entered by a human
+ email.addFrom(InternetAddress.parse(addresses, false));
}
EnvironmentImpl environment = EnvironmentImpl.getCurrent();
@@ -179,7 +180,8 @@
String addresses = addressTemplate.getAddresses();
if (addresses != null) {
addresses = evaluateExpression(addresses);
- email.addRecipients(recipientType, InternetAddress.parse(addresses));
+ // non-strict parsing applies to a list of mail addresses entered by a human
+ email.addRecipients(recipientType, InternetAddress.parse(addresses, false));
}
EnvironmentImpl environment = EnvironmentImpl.getCurrent();
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -21,16 +21,27 @@
*/
package org.jbpm.pvm.internal.xml;
+import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.stream.StreamInput;
import org.jbpm.pvm.internal.util.UrlEntity;
@@ -38,11 +49,6 @@
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
import org.jbpm.pvm.internal.wire.xml.WireParser;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
/** makes typical usage of JAXP more convenient, adds a binding framework,
* entity resolution and error handling.
@@ -247,25 +253,19 @@
*/
public class Parser {
- private static Log log = Log.getLog(Parser.class.getName());
+ private static final Log log = Log.getLog(Parser.class.getName());
- protected SAXParserFactory saxParserFactory;
- protected String[] schemaResources;
-
- protected DocumentBuilderFactory documentBuilderFactory = null;
-
- protected Bindings bindings = null;
- protected ClassLoader classLoader = null;
+ protected Bindings bindings;
+ protected final DocumentBuilderFactory documentBuilderFactory =
+ createDocumentBuilderFactory();
/** the default parser */
public Parser() {
- initialize();
}
/** creates a new Parser with bindings that can be maintained statically in
* specialized subclasses of Parser. */
public Parser(Bindings bindings) {
- initialize();
this.bindings = bindings;
}
@@ -274,61 +274,99 @@
* @deprecated entities should be replaced by {@link #setSchemaResources(List)} */
@Deprecated
public Parser(Bindings bindings, Map<String, Entity> entities) {
- initialize();
this.bindings = bindings;
}
-
+
// initialization ///////////////////////////////////////////////////////////
- public void initialize() {
- initializeSaxParserFactory();
- initializeDocumentBuilderFactory();
+ protected DocumentBuilderFactory createDocumentBuilderFactory() {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setCoalescing(true);
+ factory.setIgnoringComments(true);
+ return factory;
}
- public void initializeDocumentBuilderFactory() {
- documentBuilderFactory = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setNamespaceAware(true);
- }
-
- public void initializeSaxParserFactory() {
- saxParserFactory = SAXParserFactory.newInstance();
- saxParserFactory.setNamespaceAware(true);
- }
-
// document builder methods /////////////////////////////////////////////////
/** customizable creation of a new document builder. Used by
- * {@link #buildDom(Parse)}. */
+ * {@link #buildDocument(Parse)}. */
protected DocumentBuilder createDocumentBuilder(Parse parse) {
try {
- parse.documentBuilder = documentBuilderFactory.newDocumentBuilder();
- } catch (Exception e) {
- parse.addProblem("couldn't get new document builder", e);
+ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ documentBuilder.setErrorHandler(parse);
+ parse.documentBuilder = documentBuilder;
+ return documentBuilder;
+ }
+ catch (ParserConfigurationException e) {
+ parse.addProblem("could not create document builder", e);
return null;
}
- parse.documentBuilder.setErrorHandler(parse);
- return parse.documentBuilder;
}
// schema validation ////////////////////////////////////////////////////////
-
- public void setSchemaResources(List<String> resources) {
- saxParserFactory.setValidating(true);
- saxParserFactory.setNamespaceAware(true);
+ public void setSchemaResources(String... schemaResources) {
+ // load resources from classpath
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- List<String> schemaLocations = new ArrayList<String>(resources.size());
- for (String schemaResource: resources) {
- URL schemaUrl = classLoader.getResource(schemaResource);
- if (schemaUrl!=null) {
- String schemaLocation = schemaUrl.toString();
- log.trace("schema resource found: " + schemaResource);
- schemaLocations.add(schemaLocation);
- } else {
- log.debug("skipping unavailble schema resource: " + schemaResource);
+ String[] schemaSources = new String[schemaResources.length];
+
+ for (int i = 0; i < schemaResources.length; i++) {
+ String schemaResource = schemaResources[i];
+ URL schemaLocation = classLoader.getResource(schemaResource);
+ if (schemaLocation != null) {
+ log.info("loading schema resource: " + schemaResource);
+ schemaSources[i] = schemaLocation.toString();
}
+ else {
+ log.warn("skipping unavailable schema resource: " + schemaResource);
+ }
}
- schemaResources = schemaLocations.toArray(new String[schemaLocations.size()]);
+
+ documentBuilderFactory.setValidating(true);
+ try {
+ // set xml schema as the schema language
+ documentBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+ XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ // set schema sources
+ documentBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
+ schemaSources);
+ }
+ catch (IllegalArgumentException e) {
+ log.warn("JAXP implementation does not support XML Schema, "
+ + "XML documents will not be checked for grammar errors", e);
+ }
+
+ try {
+ // validate the document only if a grammar is specified
+ documentBuilderFactory.setAttribute("http://apache.org/xml/features/validation/dynamic",
+ Boolean.TRUE);
+ }
+ catch (IllegalArgumentException e) {
+ log.warn("JAXP implementation is not Xerces, cannot enable dynamic validation, "
+ + "XML documents without schema location will not parse", e);
+ }
+
+ /*
+ try {
+ // parse schema sources
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(sources.toArray(new Source[sources.size()]));
+ // register schema
+ documentBuilderFactory.setSchema(schema);
+ try {
+ // validate the document only if a grammar is specified
+ documentBuilderFactory.setAttribute("http://apache.org/xml/features/validation/dynamic",
+ Boolean.TRUE);
+ }
+ catch (IllegalArgumentException e) {
+ log.info("could not enable dynamic validation feature", e);
+ }
+ }
+ catch (SAXException e) {
+ log.info("could not set schema", e);
+ }
+ */
}
// bindings /////////////////////////////////////////////////////////////////
@@ -350,7 +388,7 @@
/** the handler for the given element limited to a given category */
public Binding getBinding(Element element, String category) {
- return (bindings!=null ? bindings.getBinding(element, category) : null);
+ return (bindings != null ? bindings.getBinding(element, category) : null);
}
// runtime parsing methods //////////////////////////////////////////////////
@@ -369,98 +407,66 @@
// build the dom of the imported document
Parse importedParse = createParse();
importedParse.setStreamSource(importedStreamInput);
- Document importedDocument = buildDom(importedParse);
-
- // loop over all the imported document elements
+ Document importedDocument = buildDocument(importedParse);
+
+ // loop over all the imported document elements
Element importedDocumentElement = importedDocument.getDocumentElement();
- for(Element e : XmlUtil.elements(importedDocumentElement)) {
+ for (Element e : XmlUtil.elements(importedDocumentElement)) {
// import the element into the destination element
destination.appendChild(destination.getOwnerDocument().importNode(e, true));
}
importedParse.checkErrors(destination.getTagName());
-
- } catch (Exception e) {
- importingParse.addProblem("couldn't import "+importedStreamInput, e);
}
+ catch (Exception e) {
+ importingParse.addProblem("could not import " + importedStreamInput, e);
+ }
}
/** customizable parse execution */
protected void execute(Parse parse) {
try {
- if (parse.document==null) {
- parse.document = buildDom(parse);
+ if (parse.document == null) {
+ parse.document = buildDocument(parse);
}
// walk the dom tree
- if (parse.document!=null) {
+ if (parse.document != null) {
try {
// walk the dom tree
parseDocument(parse.document, parse);
-
- } catch (Exception e) {
- parse.addProblem("parsing exception: "+e.getMessage(), e);
}
+ catch (Exception e) {
+ parse.addProblem("parsing exception: " + e.getMessage(), e);
+ }
}
-
- } finally {
- if (parse.inputStream!=null) {
+ }
+ finally {
+ if (parse.inputStream != null) {
try {
parse.inputStream.close();
- } catch (Exception e) {
+ }
+ catch (Exception e) {
parse.addProblem("couldn't close input stream", e);
}
}
}
}
- protected Document buildDom(Parse parse) {
- Document document = null;
-
+ protected Document buildDocument(Parse parse) {
+ DocumentBuilder documentBuilder = createDocumentBuilder(parse);
+ InputSource inputSource = parse.getInputSource();
try {
- SAXParser saxParser = saxParserFactory.newSAXParser();
- XMLReader xmlReader = saxParser.getXMLReader();
-
- try {
- saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- } catch (Exception e){
- log.info("couldn't set schema language property", e);
- }
-
- if (schemaResources!=null) {
- try {
- saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaResources);
- } catch (Exception e){
- log.info("couldn't set schema source property", e);
- }
- }
-
- try {
- xmlReader.setFeature("http://apache.org/xml/features/validation/dynamic", true);
- } catch (Exception e){
- log.info("couldn't set dynamic validation feature", e);
- }
-
- DocumentBuilder documentBuilder = createDocumentBuilder(parse);
- document = documentBuilder.getDOMImplementation().createDocument(null, null, null);
- parse.setDocument(document);
-
- DomBuilder domBuilder = new DomBuilder();
- domBuilder.setDocument(document);
-
- xmlReader.setContentHandler(domBuilder);
- xmlReader.setErrorHandler(parse);
-
- InputSource inputSource = parse.getInputSource();
- xmlReader.parse(inputSource);
-
- } catch (Exception e) {
- parse.addProblem("couldn't parse xml document", e);
+ return documentBuilder.parse(inputSource);
}
-
- return document;
+ catch (IOException e) {
+ parse.addProblem("could not read input", e);
+ }
+ catch (SAXException e) {
+ parse.addProblem("failed to parse xml", e);
+ }
+ return null;
}
-
// Document Object Model walking ////////////////////////////////////////////
/** start of the DOM walk.
@@ -505,17 +511,18 @@
*
* @return the object that is the result from parsing this element. */
public Object parseElement(Element element, Parse parse, String category) {
-
Object object = null;
String tagName = element.getLocalName();
Binding binding = getBinding(element, category);
- if (binding!=null) {
+ if (binding != null) {
object = binding.parse(element, parse, this);
- } else if (log.isDebugEnabled()) {
- log.debug("no element parser for tag "+tagName+(category!=null ? " in category "+category : " in the default category"));
}
+ else if (log.isDebugEnabled()) {
+ log.debug("no element parser for tag " + tagName
+ + (category != null ? " in category " + category : " in the default category"));
+ }
return object;
}
@@ -526,17 +533,20 @@
public List<ArgDescriptor> parseArgs(List<Element> argElements, Parse parse, String category) {
List<ArgDescriptor> args = null;
- if (argElements!=null) {
- if (argElements.size()>0) {
+ if (argElements != null) {
+ if (argElements.size() > 0) {
args = new ArrayList<ArgDescriptor>(argElements.size());
}
- for (Element argElement: argElements) {
+ for (Element argElement : argElements) {
ArgDescriptor argDescriptor = new ArgDescriptor();
argDescriptor.setTypeName(XmlUtil.attribute(argElement, "type"));
Element descriptorElement = XmlUtil.element(argElement);
- if (descriptorElement==null) {
- parse.addProblem("arg must contain exactly one descriptor element out of "+bindings.getTagNames(category)+" as contents:"+XmlUtil.toString(argElement.getParentNode()), argElement);
- } else {
+ if (descriptorElement == null) {
+ parse.addProblem("arg must contain exactly one descriptor element out of "
+ + bindings.getTagNames(category) + " as contents:"
+ + XmlUtil.toString(argElement.getParentNode()), argElement);
+ }
+ else {
Descriptor descriptor = (Descriptor) parseElement(descriptorElement, parse, category);
argDescriptor.setDescriptor(descriptor);
}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/TypesBindingTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/TypesBindingTest.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/binding/TypesBindingTest.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -27,27 +27,22 @@
import org.jbpm.pvm.internal.xml.Bindings;
import org.jbpm.pvm.internal.xml.Problem;
-
/**
* @author Huisheng Xu
*/
public class TypesBindingTest extends BaseJbpmTestCase {
- public void testParse() {
- Parser parser = new Parser();
- Bindings bindings = new Bindings();
- parser.setBindings(bindings);
- parser.getBindings().addBinding(new TypesBinding());
- String xml = "<types resource='org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml' />";
+ public void testParse() {
+ Parser parser = new Parser();
+ Bindings bindings = new Bindings();
+ parser.setBindings(bindings);
+ parser.getBindings().addBinding(new TypesBinding());
- List<Problem> problems = parser
- .createParse()
- .setString(xml)
- .execute()
- .getProblems();
+ String xml = "<types resource='org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml' />";
- assertTextPresent(
- "couldn't import resource://org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml",
- problems.get(0).getMsg());
- }
+ List<Problem> problems = parser.createParse().setString(xml).execute().getProblems();
+
+ assertTextPresent("org/jbpm/pvm/internal/wire/binding/invalid.jbpm.variable.types.xml",
+ problems.get(0).getMsg());
+ }
}
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/mail/CustomMailProducerTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/mail/CustomMailProducerTest.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/mail/CustomMailProducerTest.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -81,7 +81,7 @@
public void testCustomMailProducer() {
// deploy process
- deployJpdlXmlString("<process name='custommail' xmlns='http://jbpm.org/jpdl/4.4'>"
+ deployJpdlXmlString("<process name='custommail' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start>"
+ " <transition to='send mail' />"
+ " </start>"
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/assign/AssignTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/assign/AssignTest.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/assign/AssignTest.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -33,7 +33,7 @@
public class AssignTest extends JbpmTestCase {
public void testFromExprToVar() {
- deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/jpdl/4.4'>"
+ deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start>"
+ " <transition to='resolve' />"
+ " </start>"
@@ -52,7 +52,7 @@
}
public void testFromMethodExprToVar() {
- deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/jpdl/4.4'>"
+ deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start>"
+ " <transition to='resolve' />"
+ " </start>"
@@ -71,7 +71,7 @@
}
public void testFromMethodParamExprToVar() {
- deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/jpdl/4.4'>"
+ deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start>"
+ " <transition to='resolve' />"
+ " </start>"
@@ -90,7 +90,7 @@
}
public void testFromDescToExpr() {
- deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/jpdl/4.4'>"
+ deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start>"
+ " <transition to='resolve' />"
+ " </start>"
@@ -111,7 +111,7 @@
}
public void testFromVarToVar() {
- deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/jpdl/4.4'>"
+ deployJpdlXmlString("<process name='AssignTest' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start>"
+ " <transition to='resolve' />"
+ " </start>"
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/foreach/ForEachTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/foreach/ForEachTest.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/foreach/ForEachTest.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -42,7 +42,7 @@
public void testForEachLiteral() {
deployJpdlXmlString(""
- + "<process name='ForEachLiteral' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachLiteral' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -88,7 +88,7 @@
public void testForEachList() {
deployJpdlXmlString(""
- + "<process name='ForEachList' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachList' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -135,7 +135,7 @@
public void testForEachArray() {
deployJpdlXmlString(""
- + "<process name='ForEachArray' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachArray' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -182,7 +182,7 @@
public void testForEachInvalid() {
deployJpdlXmlString(""
- + "<process name='ForEachInvalid' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachInvalid' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -214,7 +214,7 @@
public void testForEachMissingVar() {
try {
deployJpdlXmlString(""
- + "<process name='ForEachMissingVar' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachMissingVar' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -243,7 +243,7 @@
public void testForEachJoinMultiplicity() {
deployJpdlXmlString(""
- + "<process name='ForEachJoinMultiplicity' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachJoinMultiplicity' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -278,7 +278,7 @@
public void testForEachConditionMet() {
deployJpdlXmlString(""
- + "<process name='ForEachConditionMet' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachConditionMet' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -326,7 +326,7 @@
public void testForEachConditionNotMet() {
deployJpdlXmlString(""
- + "<process name='ForEachConditionNotMet' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachConditionNotMet' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -361,7 +361,7 @@
public void testForEachNoTransitions() {
try {
deployJpdlXmlString(""
- + "<process name='ForEachNoTransition' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachNoTransition' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -388,7 +388,7 @@
public void testForEachJoinMultiplicityLeftTask() {
deployJpdlXmlString(""
- + "<process name='ForEachJoinMultiplicity' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachJoinMultiplicity' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
@@ -438,7 +438,7 @@
public void testForEachJoinMultiplicityLeftTasks() {
deployJpdlXmlString(""
- + "<process name='ForEachJoinMultiplicity' xmlns='http://jbpm.org/jpdl/4.4'>"
+ + "<process name='ForEachJoinMultiplicity' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start g='179,17,32,29' name='start1'>"
+ " <transition g='-43,-18' name='to foreach1' to='foreach1'/>"
+ " </start>"
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/HistoryVariableTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/HistoryVariableTest.java 2010-07-09 19:27:23 UTC (rev 6476)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/HistoryVariableTest.java 2010-07-10 08:20:41 UTC (rev 6477)
@@ -15,9 +15,9 @@
public class HistoryVariableTest extends JbpmTestCase {
public void testDeclaredVariableWithHistory() {
- deployJpdlXmlString("<process name='var'>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <variable name='test' type='string' init-expr='history' history='true'/>"
- + " <start name='a'>"
+ + " <start nam='a'>"
+ " <transition to='b' />"
+ " </start>"
+ " <state name='b'/>"
@@ -41,9 +41,9 @@
}
public void testDeclaredVariablesWithHistory() {
- deployJpdlXmlString("<process name='var'>"
- + " <variable name='test' type='string' init-expr='test value' history='true'/>"
- + " <variable name='real' type='string' init-expr='real value' history='true'/>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='test' type='string' init-expr='test value' history='true'/>"
+ + " <variable name='real' type='string' init-expr='real value' history='true'/>"
+ " <start name='a'>"
+ " <transition to='b' />"
+ " </start>"
@@ -66,7 +66,7 @@
}
public void testCreateVariableWithHistory() {
- deployJpdlXmlString("<process name='var'>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start name='a'>"
+ " <transition to='b' />"
+ " </start>"
@@ -92,7 +92,7 @@
}
public void testCreateVariablesWithHistory() {
- deployJpdlXmlString("<process name='var'>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <start name='a'>"
+ " <transition to='b' />"
+ " </start>"
@@ -121,9 +121,9 @@
}
public void testDeclaredVariablesMixed() {
- deployJpdlXmlString("<process name='var'>"
- + " <variable name='test' type='string' init-expr='test value' history='true'/>"
- + " <variable name='real' type='string' init-expr='real value' history='false'/>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='test' type='string' init-expr='test value' history='true'/>"
+ + " <variable name='real' type='string' init-expr='real value' history='false'/>"
+ " <start name='a'>"
+ " <transition to='b' />"
+ " </start>"
@@ -148,8 +148,8 @@
}
public void testDeclaredIntegerVariableWithHistory() {
- deployJpdlXmlString("<process name='var'>"
- + " <variable name='test' type='integer' init-expr='#{testV}' history='true'/>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='test' type='integer' init-expr='#{testV}' history='true'/>"
+ " <start name='a'>"
+ " <transition to='b' />"
+ " </start>"
@@ -175,7 +175,7 @@
}
public void testDeclaredSerializableVariableWithHistory() {
- deployJpdlXmlString("<process name='var'>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <variable name='test' type='serializable' history='true'>"
+ " <object class='java.util.Date'>"
+ " <constructor><arg><long value='1276086573250'/></arg></constructor>"
@@ -204,73 +204,75 @@
assertEquals(variableValue.toString(), historyValue);
}
public void testDeclaredVariableWithHistoryWrongProcessInstanceId() {
- deployJpdlXmlString("<process name='var'>"
- + " <variable name='test' type='string' init-expr='history' history='true'/>"
- + " <start name='a'>"
- + " <transition to='b' />"
- + " </start>"
- + " <state name='b'/>"
- + "</process>");
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='test' type='string' init-expr='history' history='true'/>"
+ + " <start name='a'>"
+ + " <transition to='b' />"
+ + " </start>"
+ + " <state name='b'/>"
+ + "</process>");
- executionService.startProcessInstanceByKey("var", "one");
+ executionService.startProcessInstanceByKey("var", "one");
- Set<String> variableNames = executionService.getVariableNames("var.one");
- assertEquals(1, variableNames.size());
- assertEquals("test", variableNames.iterator().next());
+ Set<String> variableNames = executionService.getVariableNames("var.one");
+ assertEquals(1, variableNames.size());
+ assertEquals("test", variableNames.iterator().next());
- String executionValue = (String) executionService.getVariable("var.one", "test");
- assertEquals("history", executionValue);
+ String executionValue = (String) executionService.getVariable("var.one", "test");
+ assertEquals("history", executionValue);
- Set<String> historyVariables = historyService.getVariableNames("var.one");
- assertEquals(1, historyVariables.size());
- assertEquals("test", historyVariables.iterator().next());
+ Set<String> historyVariables = historyService.getVariableNames("var.one");
+ assertEquals(1, historyVariables.size());
+ assertEquals("test", historyVariables.iterator().next());
- String wrongProcessInstanceId = "var.one.1";
- try {
- historyService.getVariable(wrongProcessInstanceId, "test");
- fail("should fail since it uses wrong process instance id");
- } catch (JbpmException e) {
- String message = e.getMessage();
- assertTrue(message, message.contains(wrongProcessInstanceId));
- }
+ String wrongProcessInstanceId = "var.one.1";
+ try {
+ historyService.getVariable(wrongProcessInstanceId, "test");
+ fail("should fail since it uses wrong process instance id");
}
-
+ catch (JbpmException e) {
+ String message = e.getMessage();
+ assertTrue(message, message.contains(wrongProcessInstanceId));
+ }
+ }
+
public void testDeclaredVariableWithHistoryWrongProcess() {
- deployJpdlXmlString("<process name='var'>"
- + " <variable name='test' type='string' init-expr='history' history='true'/>"
- + " <start name='a'>"
- + " <transition to='b' />"
- + " </start>"
- + " <state name='b'/>"
- + "</process>");
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='test' type='string' init-expr='history' history='true'/>"
+ + " <start name='a'>"
+ + " <transition to='b' />"
+ + " </start>"
+ + " <state name='b'/>"
+ + "</process>");
- executionService.startProcessInstanceByKey("var", "one");
+ executionService.startProcessInstanceByKey("var", "one");
- Set<String> variableNames = executionService.getVariableNames("var.one");
- assertEquals(1, variableNames.size());
- assertEquals("test", variableNames.iterator().next());
+ Set<String> variableNames = executionService.getVariableNames("var.one");
+ assertEquals(1, variableNames.size());
+ assertEquals("test", variableNames.iterator().next());
- String executionValue = (String) executionService.getVariable("var.one", "test");
- assertEquals("history", executionValue);
- try {
-
- historyService.getVariables(null, null);
- fail("should fail since process instance id is null");
- } catch (Exception e) {
- assertEquals("processInstanceId is null", e.getMessage());
- }
- try {
-
- historyService.getVariables("var.one", null);
- fail("should fail since variable names set is null");
- } catch (Exception e) {
- assertEquals("variableNames is null", e.getMessage());
- }
+ String executionValue = (String) executionService.getVariable("var.one", "test");
+ assertEquals("history", executionValue);
+ try {
+ historyService.getVariables(null, null);
+ fail("should fail since process instance id is null");
}
+ catch (JbpmException e) {
+ assertEquals("processInstanceId is null", e.getMessage());
+ }
+ try {
+ historyService.getVariables("var.one", null);
+ fail("should fail since variable names set is null");
+ }
+ catch (JbpmException e) {
+ assertEquals("variableNames is null", e.getMessage());
+ }
+ }
+
public void testDeclaredVariableWithHistoryAndUpdateBySignal() {
- deployJpdlXmlString("<process name='var'>"
- + " <variable name='test' type='integer' init-expr='#{testV}' history='true'/>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='test' type='integer' init-expr='#{testV}' history='true'/>"
+ " <start name='a'>"
+ " <transition to='b' />"
+ " </start>"
@@ -289,7 +291,7 @@
Integer executionValue = (Integer) executionService.getVariable("var.one", "test");
assertEquals(35, executionValue.intValue());
-
+
// signal to next state
executionService.signalExecutionById(pi.getId(), Collections.singletonMap("test", 55));
@@ -299,11 +301,11 @@
String historyValue = (String) historyService.getVariable("var.one", "test");
assertEquals("55", historyValue);
- }
-
+ }
+
public void testDeclaredVariableWithHistoryAndUpdateByExecService() {
- deployJpdlXmlString("<process name='var'>"
- + " <variable name='test' type='integer' init-expr='#{testV}' history='true'/>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='test' type='integer' init-expr='#{testV}' history='true'/>"
+ " <start name='a'>"
+ " <transition to='b' />"
+ " </start>"
@@ -322,9 +324,9 @@
Integer executionValue = (Integer) executionService.getVariable("var.one", "test");
assertEquals(35, executionValue.intValue());
-
+
executionService.setVariable(pi.getId(), "test", 55);
-
+
// signal to next state
executionService.signalExecutionById(pi.getId());
@@ -335,11 +337,13 @@
String historyValue = (String) historyService.getVariable("var.one", "test");
assertEquals("55", historyValue);
}
-
+
public void testDeclaredSerializableVariableWithHistoryAndUpdateByExecService() {
- deployJpdlXmlString("<process name='var'>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ " <variable name='test' type='serializable' history='true'>"
- + " <object class='"+SetVariableListener.class.getName()+"'>"
+ + " <object class='"
+ + SetVariableListener.class.getName()
+ + "'>"
+ " </object>"
+ " </variable>"
+ " <start name='a'>"
@@ -363,7 +367,7 @@
SetVariableListener newInstance = new SetVariableListener();
newInstance.setSimpleValue("value test");
executionService.setVariable(pi.getId(), "test", newInstance);
-
+
// signal to next state
executionService.signalExecutionById(pi.getId());
@@ -374,17 +378,19 @@
String historyValue = (String) historyService.getVariable("var.one", "test");
assertEquals("value test", historyValue);
}
-
+
public void testDeclaredVariableWithHistoryAndUpdateByEvent() {
- deployJpdlXmlString("<process name='var'>"
- + " <variable name='test' type='integer' init-expr='#{testV}' history='true'/>"
+ deployJpdlXmlString("<process name='var' xmlns='http://jbpm.org/4.4/jpdl'>"
+ + " <variable name='test' type='integer' init-expr='#{testV}' history='true'/>"
+ " <start name='a'>"
+ " <transition to='b' />"
+ " </start>"
+ " <state name='b'>"
+ " <on event='end'>"
- + " <event-listener class='"+SetVariableListener.class.getName()+"' />"
- + " </on>"
+ + " <event-listener class='"
+ + SetVariableListener.class.getName()
+ + "' />"
+ + " </on>"
+ " <transition to='c' />"
+ " </state>"
+ " <state name='c'/>"
@@ -399,7 +405,7 @@
Integer executionValue = (Integer) executionService.getVariable("var.one", "test");
assertEquals(35, executionValue.intValue());
-
+
// signal to next state
executionService.signalExecutionById(pi.getId());
@@ -409,23 +415,23 @@
String historyValue = (String) historyService.getVariable("var.one", "test");
assertEquals("55", historyValue);
- }
-
+ }
+
public static class SetVariableListener implements EventListener {
+
+ private String simpleValue = "test value";
private static final long serialVersionUID = 1L;
- private String simpleValue = "test value";
+
public void notify(EventListenerExecution execution) {
execution.setVariable("test", 55);
}
-
+
public void setSimpleValue(String value) {
this.simpleValue = value;
}
-
+
public String toString() {
return this.simpleValue;
}
}
-
-
}
13 years, 11 months
JBoss JBPM SVN: r6476 - in jbpm4/trunk/modules/distro/src/main/files/install/src/cfg: hibernate/jdbc and 2 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-07-09 15:27:23 -0400 (Fri, 09 Jul 2010)
New Revision: 6476
Modified:
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/hsqldb.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/mysql.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/oracle.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/postgresql.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/sybase.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/mysql.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/oracle.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/postgresql.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/sybase.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/spring/hsqldb.inmem.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/spring/applicationContext.xml
Log:
JBPM-2893: format distribution xml files, they were a mess
Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/hsqldb.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/hsqldb.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/hsqldb.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,23 +1,21 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.connection.datasource">java:JbpmDS</property>
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="jta.UserTransaction">UserTransaction</property>
- <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
- <property name="hibernate.connection.datasource">java:JbpmDS</property>
- <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
- <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
- <property name="jta.UserTransaction">UserTransaction</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/datasource/mysql.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/mysql.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/mysql.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,23 +1,21 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
+ <property name="hibernate.connection.datasource">java:JbpmDS</property>
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="jta.UserTransaction">UserTransaction</property>
- <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
- <property name="hibernate.connection.datasource">java:JbpmDS</property>
- <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
- <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
- <property name="jta.UserTransaction">UserTransaction</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/datasource/oracle.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/oracle.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/oracle.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,23 +1,21 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</property>
+ <property name="hibernate.connection.datasource">java:JbpmDS</property>
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="jta.UserTransaction">UserTransaction</property>
- <property name="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</property>
- <property name="hibernate.connection.datasource">java:JbpmDS</property>
- <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
- <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
- <property name="jta.UserTransaction">UserTransaction</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/datasource/postgresql.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/postgresql.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/postgresql.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,23 +1,21 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
+ <property name="hibernate.connection.datasource">java:JbpmDS</property>
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="jta.UserTransaction">UserTransaction</property>
- <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
- <property name="hibernate.connection.datasource">java:JbpmDS</property>
- <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
- <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
- <property name="jta.UserTransaction">UserTransaction</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/datasource/sybase.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/sybase.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/datasource/sybase.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,23 +1,21 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
+ <property name="hibernate.connection.datasource">java:JbpmDS</property>
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="jta.UserTransaction">UserTransaction</property>
- <property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
- <property name="hibernate.connection.datasource">java:JbpmDS</property>
- <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
- <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
- <property name="jta.UserTransaction">UserTransaction</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,13 +1,12 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
-
- <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.connection.driver_class">@jdbc.driver@</property>
<property name="hibernate.connection.url">@jdbc.url@</property>
<property name="hibernate.connection.username">@jdbc.username@</property>
@@ -16,11 +15,10 @@
<property name="hibernate.format_sql">true</property>
<property name="current_session_context_class">thread</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/jdbc/mysql.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/mysql.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/mysql.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,24 +1,22 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
-
- <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<property name="hibernate.connection.driver_class">@jdbc.driver@</property>
<property name="hibernate.connection.url">@jdbc.url@</property>
<property name="hibernate.connection.username">@jdbc.username@</property>
<property name="hibernate.connection.password">@jdbc.password@</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/jdbc/oracle.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/oracle.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/oracle.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,12 +1,11 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
-
+ <session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.connection.driver_class">@jdbc.driver@</property>
<property name="hibernate.connection.url">@jdbc.url@</property>
@@ -19,6 +18,5 @@
<mapping resource="jbpm.history.hbm.xml" />
<mapping resource="jbpm.task.hbm.xml" />
<mapping resource="jbpm.identity.hbm.xml" />
-
- </session-factory>
+ </session-factory>
</hibernate-configuration>
Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/postgresql.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/postgresql.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/postgresql.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,24 +1,22 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
-
- <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">@jdbc.driver@</property>
<property name="hibernate.connection.url">@jdbc.url@</property>
<property name="hibernate.connection.username">@jdbc.username@</property>
<property name="hibernate.connection.password">@jdbc.password@</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/jdbc/sybase.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/sybase.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/sybase.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,24 +1,22 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory>
-
- <property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
+ <session-factory>
+ <property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
<property name="hibernate.connection.driver_class">@jdbc.driver@</property>
<property name="hibernate.connection.url">@jdbc.url@</property>
<property name="hibernate.connection.username">@jdbc.username@</property>
<property name="hibernate.connection.password">@jdbc.password@</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>
+ <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/distro/src/main/files/install/src/cfg/hibernate/spring/hsqldb.inmem.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/spring/hsqldb.inmem.hibernate.cfg.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/spring/hsqldb.inmem.hibernate.cfg.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -8,7 +8,6 @@
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.format_sql">true</property>
-
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<mapping resource="jbpm.repository.hbm.xml" />
Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/spring/applicationContext.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/spring/applicationContext.xml 2010-07-09 08:42:29 UTC (rev 6475)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/spring/applicationContext.xml 2010-07-09 19:27:23 UTC (rev 6476)
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
+ xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" />
@@ -19,7 +17,7 @@
<property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
-
+
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
<property name="dataSource" ref="dataSource" />
13 years, 11 months
JBoss JBPM SVN: r6475 - in jbpm4/trunk/modules: jpdl/src/test/java/org/jbpm/jpdl/parsing and 3 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-07-09 04:42:29 -0400 (Fri, 09 Jul 2010)
New Revision: 6475
Removed:
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
Log:
JBPM-2904: remove slash in activity name restriction without introducing a configuration setting
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2010-07-09 07:38:13 UTC (rev 6474)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2010-07-09 08:42:29 UTC (rev 6475)
@@ -24,7 +24,6 @@
import org.w3c.dom.Element;
import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.util.TagBinding;
import org.jbpm.pvm.internal.util.XmlUtil;
@@ -33,10 +32,9 @@
/**
* @author Tom Baeyens
- * @author Huisheng Xu
*/
public abstract class JpdlBinding extends TagBinding {
-
+
public JpdlBinding(String tagName) {
super(tagName, null, null);
}
@@ -49,21 +47,12 @@
public void parseName(Element element, ActivityImpl activity, Parse parse) {
String name = XmlUtil.attribute(element, "name", isNameRequired() ? parse : null);
-
- if (name != null) {
+
+ if (name!=null) {
// basic name validation
- if ("".equals(name)) {
+ if (name.length()==0) {
parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
}
-
- boolean isActivityAllowSlash = true;
- Boolean candidateCondition = (Boolean) EnvironmentImpl.getFromCurrent("jbpm.activity.allow.slash", false);
- if (candidateCondition != null) {
- isActivityAllowSlash = candidateCondition.booleanValue();
- }
- if (!isActivityAllowSlash && name.indexOf('/') != -1) {
- parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
- }
activity.setName(name);
}
}
@@ -71,31 +60,4 @@
public boolean isNameRequired() {
return true;
}
-
-// TODO remove this dead code
-//
-// public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
-// List<Element> transitionElements = XmlUtil.elements(element, "transition");
-// UnresolvedTransitions unresolvedTransitions = parse.contextStackFind(UnresolvedTransitions.class);
-// for (Element transitionElement: transitionElements) {
-// String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
-//
-// Element timerElement = XmlUtil.element(transitionElement, "timer");
-// if (timerElement!=null) {
-// if (transitionName!=null) {
-// TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
-// timerDefinitionImpl.setSignalName(transitionName);
-// } else {
-// parse.addProblem("a transition name is required when a timer is placed on a transition", element);
-// }
-// }
-//
-// TransitionImpl transition = activity.createOutgoingTransition();
-// transition.setName(transitionName);
-//
-// unresolvedTransitions.add(transition, transitionElement);
-//
-// jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
-// }
-// }
}
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java 2010-07-09 07:38:13 UTC (rev 6474)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java 2010-07-09 08:42:29 UTC (rev 6475)
@@ -23,17 +23,27 @@
import java.util.List;
+import org.jbpm.api.model.Activity;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.xml.Problem;
-
/**
* @author Tom Baeyens
*/
public class ActivityParsingTest extends JpdlParseTestCase {
+ public void testSlashInActivityName() {
+ ClientProcessDefinition processDefinition = parse(
+ "<process name='p'>" +
+ " <start name='slash / activityname' />" +
+ "</process>"
+ );
+
+ Activity initial = processDefinition.getInitial();
+ assertEquals("slash / activityname", initial.getName());
+ }
+
public void testEmptyActivityName() {
List<Problem> problems = parseProblems(
"<process name='p'>" +
@@ -54,8 +64,7 @@
);
assertEquals("process definition description", processDefinition.getDescription());
- ProcessDefinitionImpl processDefinitionImpl = (ProcessDefinitionImpl) processDefinition;
- ActivityImpl activity = processDefinitionImpl.getInitial();
+ ActivityImpl activity = (ActivityImpl) processDefinition.getInitial();
assertEquals("start description", activity.getDescription());
}
}
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml 2010-07-09 07:38:13 UTC (rev 6474)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml 2010-07-09 08:42:29 UTC (rev 6475)
@@ -88,39 +88,4 @@
url="http://docs.jboss.com/jbpm/v4/devguide/html_single/#mailsupport">Developer
Guide</ulink> for advanced, yet unsupported, email settings.</para>
</section>
-
- <section id="configuration-jpdl">
- <title>Validate activity name</title>
-
- <para>When we try to deploy a jpdl process definition,
- the <literal>JpdlBinding</literal> will validate the name of activities contained by this process definition.
- By default, the rule of validation as followed:
- <itemizedlist>
- <listitem>
- <para>If the activity has a name, the name shouldnot be empty.
- The <literal>""</literal> isnot allowed to be used by the name of activity.</para>
- </listitem>
- <listitem>
- <para>Before jBPM 4.4, the name of activity cannot contain slash(/). It comes from jBPM 3.x.
- Because jBPM 3.x supported <literal>hierarchical names</literal>,
- it allowed an execution could jump from a super-state to the other level of activities.
- But in jBPM 4.x, there would be no chance to achieve this feature.
- So since jBPM 4.4, we allowed slash(/) in the name of activity by default.
- If someone want to use the previous validation rule for slash(/) in jBPM 4.4,
- he could add this configuration parameter into jbpm.cfg.xml.</para>
- <programlisting>
-<jbpm-configuration>
- <import resource="jbpm.default.cfg.xml" />
- <import resource="jbpm.tx.hibernate.cfg.xml" />
- <import resource="jbpm.jpdl.cfg.xml" />
-
- <process-engine-context>
- <emphasis role="bold"><false name='jbpm.activity.allow.slash'/></emphasis>
- </process-engine-context>
-</jbpm-configuration>
- </programlisting>
- </listitem>
- </itemizedlist>
- </para>
- </section>
</chapter>
13 years, 11 months
JBoss JBPM SVN: r6474 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/id and 15 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-07-09 03:38:13 -0400 (Fri, 09 Jul 2010)
New Revision: 6474
Removed:
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java
jbpm4/trunk/modules/test-load/src/test/resources/jbpm.load.hbm.xml
Modified:
jbpm4/trunk/modules/distro/src/main/files/install/build.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireDbidBlockCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobParcel.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Type.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-load/pom.xml
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/LoadTestCase.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ContinuationTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/test-load/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/test-load/src/test/resources/logging.properties
jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml
Log:
JBPM-1453: revive test load module
Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2010-07-09 07:38:13 UTC (rev 6474)
@@ -163,7 +163,7 @@
<mkdir dir="${cfg.dest.dir}" />
<copy tofile="${cfg.dest.dir}/jbpm.cfg.xml"
file="${install.src.dir}/cfg/jbpm/${tx}.jbpm.cfg.xml"
- overwrite="true" />
+ overwrite="true" failonerror="false" />
<copy tofile="${cfg.dest.dir}/jbpm.hibernate.cfg.xml"
file="${install.src.dir}/cfg/hibernate/${hibernate.connection.type}/${database}.hibernate.cfg.xml"
overwrite="true">
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireDbidBlockCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireDbidBlockCmd.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireDbidBlockCmd.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -1,6 +1,8 @@
package org.jbpm.pvm.internal.id;
import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
+
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
@@ -10,28 +12,23 @@
public class AcquireDbidBlockCmd implements Command<Long> {
private static final long serialVersionUID = 1L;
-
+
long blocksize;
-
+
public AcquireDbidBlockCmd(long blocksize) {
this.blocksize = blocksize;
}
public Long execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
-
- PropertyImpl property = (PropertyImpl) session.createQuery(
- "select property " +
- "from "+PropertyImpl.class.getName()+" as property " +
- "where property.key = '"+PropertyImpl.NEXT_DBID_KEY+"'"
- ).uniqueResult();
-
- String nextIdText = property.getValue();
- Long nextId = new Long(nextIdText);
-
- property.setValue(Long.toString(nextId.longValue()+blocksize));
-
- session.update(property);
+
+ PropertyImpl property = (PropertyImpl) session.createCriteria(PropertyImpl.class)
+ .add(Restrictions.eq("key", PropertyImpl.NEXT_DBID_KEY))
+ .uniqueResult();
+
+ long nextId = Long.parseLong(property.getValue());
+ property.setValue(Long.toString(nextId + blocksize));
+
session.flush();
return nextId;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -24,6 +24,7 @@
import org.jbpm.api.JbpmException;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
+import org.jbpm.pvm.internal.id.DbidGenerator;
import org.jbpm.pvm.internal.wire.Descriptor;
/**
@@ -36,11 +37,13 @@
public CommandMessage() {
}
+ @Deprecated
public CommandMessage(Descriptor commandDescriptor) {
throw new JbpmException("obsolete");
}
public CommandMessage(Command<?> command) {
+ this.dbid = DbidGenerator.getDbidGenerator().getNextId();
setConfiguration(command);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobParcel.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobParcel.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobParcel.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -43,12 +43,12 @@
}
public void run() {
- try {
- for (Long jobDbid : jobDbids) {
+ for (Long jobDbid : jobDbids) {
+ try {
commandService.execute(new ExecuteJobCmd(jobDbid));
+ } catch (RuntimeException e) {
+ log.error("failed to execute job: " + jobDbid, e);
}
- } catch (RuntimeException e) {
- log.error("exception in job block", e);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -26,6 +26,7 @@
import org.jbpm.api.listener.EventListener;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.model.Continuation;
import org.jbpm.pvm.internal.model.EventImpl;
import org.jbpm.pvm.internal.model.EventListenerReference;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -126,7 +127,11 @@
}
public MessageImpl createAsyncMessage(ExecutionImpl execution) {
- return new ExecuteEventListenerMessage(execution);
+ ExecuteEventListenerMessage message = new ExecuteEventListenerMessage(execution);
+ if (execution.getEvent().getContinuation() == Continuation.EXCLUSIVE) {
+ message.setExclusive(true);
+ }
+ return message;
}
public String toString() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -173,9 +173,11 @@
* Note: when using a database, this method must be called within an environment block!
*/
public void initResourceLobDbids() {
- for (Lob resource : resources.values()) {
- long resourceDbid = DbidGenerator.getDbidGenerator().getNextId();
- resource.setDbid(resourceDbid);
+ if (resources != null) {
+ for (Lob resource : resources.values()) {
+ long resourceDbid = DbidGenerator.getDbidGenerator().getNextId();
+ resource.setDbid(resourceDbid);
+ }
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -70,8 +70,6 @@
if (processDefinitions!=null) {
for (ProcessDefinitionImpl processDefinition : processDefinitions) {
if ((processDefinition != null) && (processDefinition.getName() != null)) {
- String processDefinitionName = processDefinition.getName();
-
processDefinition.setSuspended(deployment.isSuspended());
String imageResourceName = resourceName.substring(0, resourceName.lastIndexOf(extension)) + ".png";
@@ -81,6 +79,7 @@
processDefinition.setDeploymentDbid(deployment.getDbid());
+ String processDefinitionName = processDefinition.getName();
if (deployment.hasObjectProperties(processDefinitionName)) {
String key = deployment.getProcessDefinitionKey(processDefinitionName);
String id = deployment.getProcessDefinitionId(processDefinitionName);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Type.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Type.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Type.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -47,7 +47,7 @@
text.append("-->");
}
if (variableClass!=null) {
- text.append(ReflectUtil.getUnqualifiedClassName(variableClass));
+ text.append(variableClass.getSimpleName());
} else {
text.append("undefined");
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -381,24 +381,6 @@
return signature;
}
- public static String getUnqualifiedClassName(Class<?> clazz) {
- if (clazz==null) {
- return null;
- }
- return getUnqualifiedClassName(clazz.getSimpleName());
- }
-
- public static String getUnqualifiedClassName(String className) {
- if (className==null) {
- return null;
- }
- int dotIndex = className.lastIndexOf('.');
- if (dotIndex!=-1) {
- className = className.substring(dotIndex+1);
- }
- return className;
- }
-
public static ClassLoader installDeploymentClassLoader(ProcessDefinitionImpl processDefinition) {
String deploymentId = processDefinition.getDeploymentId();
if (deploymentId==null) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -81,12 +81,12 @@
* @author Guillaume Porcher (documentation)
*
*/
-public class ObjectDescriptor extends AbstractDescriptor implements Descriptor {
+public class ObjectDescriptor extends AbstractDescriptor {
private static final long serialVersionUID = 1L;
private static Log log = Log.getLog(ObjectDescriptor.class.getName());
- protected String className = null;
+ protected String className;
/** specifies the object reference on which the method will be invoked.
* Either className, objectName or a descriptor has to be specified.
@@ -94,23 +94,23 @@
* TODO check if this member can be replaced by a RefDescriptor in the factoryDescriptor member.
*
* */
- String factoryObjectName = null;
+ String factoryObjectName;
protected Expression expression;
/** specifies the object on which to invoke the method.
* Either className, objectName or a descriptor has to be specified. */
- protected Descriptor factoryDescriptor = null;
+ protected Descriptor factoryDescriptor;
- protected String methodName = null;
+ protected String methodName;
/** map to db as a component */
- protected List<ArgDescriptor> argDescriptors = null;
+ protected List<ArgDescriptor> argDescriptors;
/** list of operations to perform during initialization. */
- protected List<Operation> operations = null;
+ protected List<Operation> operations;
/** True if autowiring is enabled. */
- protected boolean isAutoWireEnabled = false;
+ protected boolean isAutoWireEnabled;
public ObjectDescriptor() {
}
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -79,14 +79,14 @@
/** registered deployments. registered deployments will be deleted automatically
* in the tearDown. This is a convenience function as each test is expected to clean up the DB. */
- protected List<String> registeredDeployments = new ArrayList<String>();
+ protected List<String> registeredDeployments;
@Override
protected void setUp() throws Exception {
super.setUp();
processEngine = buildProcessEngine();
- repositoryService = processEngine.get(RepositoryService.class);
+ repositoryService = processEngine.getRepositoryService();
executionService = processEngine.getExecutionService();
historyService = processEngine.getHistoryService();
managementService = processEngine.getManagementService();
@@ -166,8 +166,10 @@
}
protected void deleteRegisteredDeployments() {
- for (String deploymentId : registeredDeployments) {
- repositoryService.deleteDeploymentCascade(deploymentId);
+ if (registeredDeployments != null) {
+ for (String deploymentId : registeredDeployments) {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
}
}
@@ -209,6 +211,7 @@
/** registered deployments will be deleted in the tearDown */
protected void registerDeployment(String deploymentId) {
+ if (registeredDeployments == null) registeredDeployments = new ArrayList<String>();
registeredDeployments.add(deploymentId);
}
Modified: jbpm4/trunk/modules/test-load/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-load/pom.xml 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/pom.xml 2010-07-09 07:38:13 UTC (rev 6474)
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
+<!-- jBPM: Workflow in Java -->
<!-- -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- -->
<!-- Distributable under LGPL license. -->
<!-- See terms of license at http://www.gnu.org. -->
-<!-- -->
<!-- ====================================================================== -->
<!-- $Id$ -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>jBPM 4 - Test Load</name>
<groupId>org.jbpm.jbpm4</groupId>
@@ -30,88 +30,68 @@
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-api</artifactId>
- <version>${project.version}</version>
</dependency>
-
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-test-base</artifactId>
- <version>${project.version}</version>
</dependency>
-
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-jpdl</artifactId>
- <version>${project.version}</version>
</dependency>
-
- <!-- TODO remove PVM dependency for compilation (keep it for test)-->
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-pvm</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
</dependencies>
-
- <!-- Plugins -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/*TestCase.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack.jbpm.db</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- <classifier>config</classifier>
- <overWrite>true</overWrite>
- </artifactItem>
- </artifactItems>
- <excludeTransitive>true</excludeTransitive>
- <outputDirectory>target/jpdl-config</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <!-- Profiles -->
+ <profiles>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>install.hibernate.database.properties</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <copy file="target/jpdl-config/hibernate.cfg.${database}.xml"
- tofile="target/test-classes/hibernate.cfg.xml"
- overwrite="true" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
+ <!-- -Ddatabase= -->
+ <profile>
+ <id>run.database.testsuite</id>
+ <activation>
+ <property>
+ <name>database</name>
+ </property>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>database-test-cfg-customization</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo message="database: ${database}" />
+ <mkdir dir="target/jdbc.properties" />
+ <copy todir="target/jdbc.properties" overwrite="true">
+ <fileset dir="../../qa/jdbc" />
+ </copy>
+ <copy todir="target/jdbc.properties" overwrite="true" failonerror="false">
+ <fileset dir="${user.home}/.jbpm4/jdbc" />
+ </copy>
+ <ant antfile="../distro/src/main/files/install/build.xml" target="create.cfg">
+ <!-- use jbpm.cfg.xml from the resources of this project -->
+ <property name="tx" value="none" />
+ <property name="mail.cfg" value="testsuite" />
+ <property name="database" value="${database}" />
+ <property name="cfg.dest.dir" value="target/test-classes" />
+ <property name="install.src.dir" value="../distro/src/main/files/install/src" />
+ <property name="jdbc.properties.dir" value="target/jdbc.properties" />
+ <!-- use logging.properties from the resources of this project -->
+ <property name="logging" value="none" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/LoadTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/LoadTestCase.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/LoadTestCase.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -21,21 +21,10 @@
*/
package org.jbpm.test.load;
-import java.io.File;
import java.io.PrintWriter;
-import java.util.Date;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.cmd.Environment;
-import org.jbpm.pvm.internal.cmd.CommandService;
-import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
-import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.test.JbpmTestCase;
-
/**
* @author Tom Baeyens
*/
@@ -47,30 +36,18 @@
protected static long checkInterval = 2000;
- protected static String jobsAvailableQueryText =
- "select count(*) "+
- "from "+JobImpl.class.getName()+" as job "+
- "where ( (job.dueDate is null) or (job.dueDate <= :now) ) "+
- " and ( job.retries > 0 )";
-
protected static boolean measureMemory = true;
- protected CommandService commandService;
- protected JobExecutor jobExecutor;
protected long startTime = -1;
protected long stopTime = -1;
protected PrintWriter logFileWriter;
-
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
-
+
if (measureMemory) {
openMemoryLogFile();
}
-
- commandService = processEngine.get(CommandService.class);
- jobExecutor = processEngine.get(JobExecutor.class);
}
protected void tearDown() throws Exception {
@@ -95,8 +72,8 @@
}
protected void openMemoryLogFile() throws Exception {
- String testClass = ReflectUtil.getUnqualifiedClassName(getClass());
- logFileWriter = new PrintWriter(new File("target/"+testClass +".txt"));
+ String testClass = getClass().getSimpleName();
+ logFileWriter = new PrintWriter("target/"+testClass +".txt");
logColumnTitles();
}
@@ -120,39 +97,6 @@
return used;
}
- protected void waitTillNoMoreMessages(JobExecutor jobExecutor) throws Exception {
- boolean jobsAvailable = true;
- while (jobsAvailable) {
- log.debug("going to sleep for " + checkInterval + " millis, waiting for the job executor to process more jobs");
- Thread.sleep(checkInterval);
- jobsAvailable = areJobsAvailable();
- logStatus();
- }
- }
-
- public boolean areJobsAvailable() {
- return commandService.execute(new Command<Boolean>() {
- private static final long serialVersionUID = 1L;
-
- public Boolean execute(Environment environment) {
- Session session = environment.get(Session.class);
-
- Query query = session.createQuery(jobsAvailableQueryText);
- query.setDate("now", new Date());
-
- Long jobs = (Long) query.uniqueResult();
-
- if (jobs.longValue()>0) {
- log.debug("found "+jobs+" more jobs to process");
- return true;
- }
- log.debug("no more jobs to process");
-
- return false;
- }
- });
- }
-
public String getMeasuredTime() {
long stop = stopTime!=-1 ? stopTime : System.currentTimeMillis();
long diff = stop - startTime;
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ContinuationTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ContinuationTest.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ContinuationTest.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -21,88 +21,58 @@
*/
package org.jbpm.test.load.async;
-import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
-import org.hibernate.Session;
+import org.jbpm.test.JbpmTestCase;
-import org.jbpm.api.cmd.Environment;
-import org.jbpm.api.cmd.VoidCommand;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.OpenProcessDefinition;
-
/**
* @author Tom Baeyens
*/
-public class ContinuationTest extends JobExecutorTestCase {
+public class ContinuationTest extends JbpmTestCase {
- // private static final Log log = Log.getLog(ContinuationTest.class.getName());
+ static final Recorder recorder = new Recorder();
+ static final int nbrOfExecutions = 100;
- static Recorder recorder = new Recorder();
-
- int nbrOfExecutions = 100;
-
public void testContinuations() {
-
- try {
- deployProcess();
- startExecutions();
- jobExecutor.start();
- waitTillNoMoreMessages();
+ deployProcess();
+ startExecutions();
+ waitTillNoMoreMessages();
- } finally {
- jobExecutor.stop(true);
- }
-
- List<String> expectedLogs = new ArrayList<String>();
- expectedLogs.add("execute(start)");
- expectedLogs.add("execute(a)");
- expectedLogs.add("execute(b)");
- expectedLogs.add("execute(c)");
- expectedLogs.add("execute(end)");
-
assertEquals(nbrOfExecutions, recorder.executionEvents.size());
+ List<String> expectedLogs = Arrays.asList("execute(a)", "execute(b)", "execute(c)", "execute(end)");
for (List<String> executionLogs : recorder.executionEvents.values()) {
assertEquals(expectedLogs, executionLogs);
}
}
- public void deployProcess() {
- commandService.execute(new VoidCommand() {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void executeVoid(Environment environment) throws Exception {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder.startProcess("continuations")
- .key("continuations")
- .startActivity("start", AutomaticActivity.class)
- .initial()
- .asyncExecute()
- .transition("a")
- .endActivity()
- .startActivity("a", AutomaticActivity.class)
- .asyncExecute()
- .transition("b")
- .endActivity()
- .startActivity("b", AutomaticActivity.class)
- .asyncExecute()
- .transition("c")
- .endActivity()
- .startActivity("c", AutomaticActivity.class)
- .asyncExecute()
- .transition("end")
- .endActivity()
- .startActivity("end", WaitState.class)
- .endActivity()
- .endProcess();
-
- Session session = environment.get(Session.class);
- session.save(processDefinition);
- }
- });
+ void deployProcess() {
+ deployJpdlXmlString("<process name='continuations'>"
+ + "<start>"
+ + " <transition to='a'/>"
+ + "</start>"
+ + "<custom name='a' class='"
+ + AutomaticActivity.class.getName()
+ + "' continue='async'>"
+ + " <transition to='b'/>"
+ + "</custom>"
+ + "<custom name='b' class='"
+ + AutomaticActivity.class.getName()
+ + "' continue='async'>"
+ + " <transition to='c'/>"
+ + "</custom>"
+ + "<custom name='c' class='"
+ + AutomaticActivity.class.getName()
+ + "' continue='async'>"
+ + " <transition to='end'/>"
+ + "</custom>"
+ + "<custom name='end' class='"
+ + WaitState.class.getName()
+ + "'/>"
+ + "</process>");
}
- public void startExecutions() {
+ void startExecutions() {
for (int i = 0; i < nbrOfExecutions; i++) {
executionService.startProcessInstanceByKey("continuations");
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -22,114 +22,105 @@
package org.jbpm.test.load.async;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import org.hibernate.Session;
-import org.jbpm.api.Execution;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.activity.ExternalActivityBehaviour;
import org.jbpm.api.cmd.Environment;
import org.jbpm.api.cmd.VoidCommand;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.session.MessageSession;
+import org.jbpm.test.JbpmTestCase;
/**
* @author Tom Baeyens
+ * @author Alejandro Guizar
*/
-public class ExclusiveMessagesTest extends JobExecutorTestCase {
+public class ExclusiveMessagesTest extends JbpmTestCase {
- static Map<String, Set<Long>> exclusiveThreadIds;
+ // exclusiveThreads maps process instance keys to a set of thread names.
+ // the idea is that for each execution, all the exclusive jobs will
+ // be executed by one thread sequentially.
+ static final Map<String, Set<String>> exclusiveThreads = new HashMap<String, Set<String>>();
- static int nbrOfTestMessagesPerExecution = 5;
- static int nbrOfTestExecutions = 20;
+ static final int nbrOfTestExecutions = 20;
- public void setUp() throws Exception {
- super.setUp();
+ public void testExclusiveMessageProcessing() {
+ insertExclusiveTestMessages();
+ waitTillNoMoreMessages();
- exclusiveThreadIds = new HashMap<String, Set<Long>>();
- }
+ processEngine.execute(new VoidCommand() {
- public void testDecisionMessageProcessing() {
- insertDecisionTestMessages();
-
- JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
- jobExecutor.start();
- try {
-
- waitTillNoMoreMessages();
-
- } finally {
- jobExecutor.stop(true);
- }
-
- commandService.execute(new VoidCommand() {
private static final long serialVersionUID = 1L;
protected void executeVoid(Environment environment) {
- // exclusiveMessageIds maps execution keys to a set of thread ids.
- // the idea is that for each execution, all the exclusive jobs will
- // be executed by 1 thread sequentially.
-
for (int i = 0; i < nbrOfTestExecutions; i++) {
- String executionKey = "execution-" + i;
- Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
- assertNotNull("no thread id set for " + executionKey + " in: " + exclusiveThreadIds, threadIds);
- assertEquals("exclusive messages for " + executionKey + " have been executed by multiple threads: " + threadIds, 1, threadIds.size());
+ String processInstanceKey = Integer.toString(i);
+ Set<String> threadNames = exclusiveThreads.get(processInstanceKey);
+ assertNotNull("no thread name set for "
+ + processInstanceKey
+ + " in: "
+ + exclusiveThreads, threadNames);
+ assertEquals("exclusive messages for "
+ + processInstanceKey
+ + " have been executed by multiple threads: "
+ + threadNames, 1, threadNames.size());
}
}
});
}
- public static class WaitState implements ExternalActivityBehaviour {
+ private void insertExclusiveTestMessages() {
+ deployJpdlXmlString("<process name='excl'>"
+ + " <start>"
+ + " <transition to='f'/>"
+ + " </start>"
+ + " <fork name='f'>"
+ + " <on event='end' continue='exclusive' />"
+ + " <transition to='a'/>"
+ + " <transition to='b'/>"
+ + " <transition to='c'/>"
+ + " <transition to='d'/>"
+ + " <transition to='e'/>"
+ + " </fork>"
+ + " <custom name='a' class='"
+ + ExclusiveActivity.class.getName()
+ + "'/>"
+ + " <custom name='b' class='"
+ + ExclusiveActivity.class.getName()
+ + "'/>"
+ + " <custom name='c' class='"
+ + ExclusiveActivity.class.getName()
+ + "'/>"
+ + " <custom name='d' class='"
+ + ExclusiveActivity.class.getName()
+ + "'/>"
+ + " <custom name='e' class='"
+ + ExclusiveActivity.class.getName()
+ + "'/>"
+ + "</process>");
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) throws Exception {
- execution.waitForSignal();
+ for (int i = 0; i < nbrOfTestExecutions; i++) {
+ executionService.startProcessInstanceByKey("excl", Integer.toString(i));
}
- public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
- execution.take(signalName);
- }
}
- public void insertDecisionTestMessages() {
- commandService.execute(new VoidCommand() {
- private static final long serialVersionUID = 1L;
+ public static class ExclusiveActivity implements ExternalActivityBehaviour {
- protected void executeVoid(Environment environment) {
- ProcessDefinitionImpl processDefinition = ProcessDefinitionBuilder
- .startProcess("excl")
- .startActivity("wait", WaitState.class)
- .initial()
- .endActivity()
- .endProcess();
- processDefinition.setId("excl:1");
-
- Session session = environment.get(Session.class);
- session.save(processDefinition);
- }
- });
+ private static final long serialVersionUID = 1L;
- commandService.execute(new VoidCommand() {
- private static final long serialVersionUID = 1L;
-
- protected void executeVoid(Environment environment) throws Exception {
- MessageSession messageSession = environment.get(MessageSession.class);
- for (int i = 0; i < nbrOfTestExecutions; i++) {
- Execution execution = new StartProcessInstanceCmd("excl:1", null, "execution-" + i).execute(environment);
-
- for (int j = 0; j < nbrOfTestMessagesPerExecution; j++) {
- CommandMessage exclusiveTestMessage = ExclusiveTestCommand.createMessage(execution);
- messageSession.send(exclusiveTestMessage);
- }
- }
+ public void execute(ActivityExecution execution) throws Exception {
+ String processInstanceKey = execution.getProcessInstance().getKey();
+ Set<String> threadNames = ExclusiveMessagesTest.exclusiveThreads.get(processInstanceKey);
+ if (threadNames == null) {
+ threadNames = new HashSet<String>();
+ ExclusiveMessagesTest.exclusiveThreads.put(processInstanceKey, threadNames);
}
- });
- }
+ threadNames.add(Thread.currentThread().getName());
+ }
+ public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters)
+ throws Exception {
+ }
+ }
}
Deleted: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveTestCommand.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveTestCommand.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveTestCommand.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -1,95 +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.load.async;
-
-import java.util.HashSet;
-import java.util.Random;
-import java.util.Set;
-
-import org.hibernate.Session;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.cmd.Environment;
-import org.jbpm.api.cmd.VoidCommand;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
-
-/**
- * @author Tom Baeyens
- */
-public class ExclusiveTestCommand extends VoidCommand {
-
- private static final long serialVersionUID = 1L;
- static Random random = new Random();
-
- String executionId;
-
- public ExclusiveTestCommand() {
- }
-
- public static CommandMessage createMessage(Execution execution) {
- CommandMessage commandMessage = new CommandMessage();
- commandMessage.setExecution((ExecutionImpl) execution);
- commandMessage.setExclusive(true);
-
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(ExclusiveTestCommand.class);
- commandDescriptor.addInjection("executionId", new StringDescriptor(execution.getId()));
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
- }
-
- protected void executeVoid(Environment environment) throws Exception {
- Long threadId = Thread.currentThread().getId();
-
- Session session = environment.get(Session.class);
- ExecutionImpl execution = (ExecutionImpl) session.get(ExecutionImpl.class, executionId);
-
- String executionKey = execution.getKey();
-
- // exclusiveMessageIds maps execution keys to a set of thread ids.
- // the idea is that for each execution, all the exclusive jobs will
- // be executed by 1 thread sequentially.
-
- // in the end, each set should contain exactly 1 element
-
- Set<Long> groupMessages = ExclusiveMessagesTest.exclusiveThreadIds.get(executionKey);
- if (groupMessages==null) {
- groupMessages = new HashSet<Long>();
- ExclusiveMessagesTest.exclusiveThreadIds.put(executionKey, groupMessages);
- }
- groupMessages.add(threadId);
-
- /*
- // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
- int workTime = random.nextInt(150);
- log.debug("executing exclusive message for "+execution+". this is going to take "+workTime+"ms");
- try {
- Thread.sleep(workTime);
- } catch (RuntimeException e) {
- log.debug("sleeping was interrupted");
- }
- */
- }
-
-}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -26,59 +26,53 @@
import java.util.List;
import org.hibernate.Session;
-import org.jbpm.api.cmd.Command;
+
import org.jbpm.api.cmd.Environment;
import org.jbpm.api.cmd.VoidCommand;
import org.jbpm.api.history.HistoryComment;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.MessageSession;
import org.jbpm.pvm.internal.util.CollectionUtil;
+import org.jbpm.test.JbpmTestCase;
/**
* @author Tom Baeyens
*/
-public class FailOnceMessageTest extends JobExecutorTestCase {
+public class FailOnceMessageTest extends JbpmTestCase {
private static final Log log = Log.getLog(FailOnceMessageTest.class.getName());
-
- static long nbrOfTestMessages = 50;
-
- static List<Integer> failOnceMessageIds = Collections.synchronizedList(new ArrayList<Integer>());
-
- public void testFailOnceMessages() {
- failOnceMessageIds.clear();
- jobExecutor.start();
- try {
- insertFailOnceTestMessages();
- waitTillNoMoreMessages();
+ static final long nbrOfTestMessages = 50;
+ static final List<Integer> failOnceMessageIds = Collections.synchronizedList(new ArrayList<Integer>());
- } finally {
- log.debug("stopping job executor");
- jobExecutor.stop(true);
- }
+ public void testFailOnceMessages() {
+ insertFailOnceTestMessages();
+ waitTillNoMoreMessages();
for (int i = 0; i < nbrOfTestMessages; i++) {
assertTrue("message " + i + " is not failed once: " + failOnceMessageIds, failOnceMessageIds.contains(i));
}
assertEquals(nbrOfTestMessages, failOnceMessageIds.size());
-
+
log.debug("==== all messages processed, now checking if all messages have arrived exactly once ====");
- commandService.execute(new VoidCommand() {
+ processEngine.execute(new VoidCommand() {
+
private static final long serialVersionUID = 1L;
@Override
protected void executeVoid(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- List<?> comments = session.createCriteria(HistoryDetailImpl.class).list();
-
+ List<?> comments = session.createCriteria(HistoryCommentImpl.class).list();
+
for (HistoryComment comment : CollectionUtil.checkList(comments, HistoryComment.class)) {
- log.debug("retrieved message: "+comment.getMessage());
+ log.debug("retrieved message: " + comment.getMessage());
Integer messageId = new Integer(comment.getMessage());
assertTrue("message " + messageId + " committed twice", failOnceMessageIds.remove(messageId));
+ // make sure the db stays clean
+ session.delete(comment);
}
assertTrue("not all messages made a successful commit: " + failOnceMessageIds, failOnceMessageIds.isEmpty());
@@ -86,24 +80,23 @@
});
}
- public static class InsertFailOnceTestMsgCmd implements Command<Object> {
+ private static class InsertFailOnceTestMsgCmd extends VoidCommand {
+
+ final int messageId;
private static final long serialVersionUID = 1L;
- int i;
- public InsertFailOnceTestMsgCmd(int i) {
- this.i = i;
+
+ InsertFailOnceTestMsgCmd(int messageId) {
+ this.messageId = messageId;
}
- public Object execute(Environment environment) throws Exception {
- MessageSession messageSession = environment.get(MessageSession.class);
- CommandMessage commandMessage = FailOnceTestCommand.createMessage(i);
- messageSession.send(commandMessage);
- return null;
+ public void executeVoid(Environment environment) throws Exception {
+ CommandMessage commandMessage = FailOnceTestCommand.createMessage(messageId);
+ environment.get(MessageSession.class).send(commandMessage);
}
}
void insertFailOnceTestMessages() {
for (int i = 0; i < nbrOfTestMessages; i++) {
- commandService.execute(new InsertFailOnceTestMsgCmd(i));
+ processEngine.execute(new InsertFailOnceTestMsgCmd(i));
}
}
-
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -28,10 +28,7 @@
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-
/**
* @author Tom Baeyens
*/
@@ -46,11 +43,9 @@
}
public static CommandMessage createMessage(int messageId) {
- CommandMessage commandMessage = new CommandMessage();
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(FailOnceTestCommand.class);
- commandDescriptor.addInjection("messageId", new IntegerDescriptor(messageId));
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
+ FailOnceTestCommand command = new FailOnceTestCommand();
+ command.messageId = messageId;
+ return new CommandMessage(command);
}
public Object execute(Environment environment) throws Exception {
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -23,50 +23,50 @@
import java.util.List;
-import org.jbpm.api.JbpmException;
+import org.hibernate.Session;
+
import org.jbpm.api.cmd.Environment;
import org.jbpm.api.cmd.VoidCommand;
-import org.jbpm.api.job.Job;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.session.MessageSession;
+import org.jbpm.test.JbpmTestCase;
/**
* @author Tom Baeyens
*/
-public class FailingMessageTest extends JobExecutorTestCase {
+public class FailingMessageTest extends JbpmTestCase {
-
public void testFailedMessageProcessing() {
- jobExecutor.start();
- try {
- commandService.execute(new VoidCommand() {
- private static final long serialVersionUID = 1L;
+ processEngine.execute(new VoidCommand() {
- @Override
- protected void executeVoid(Environment environment) throws Exception {
- MessageSession messageSession = environment.get(MessageSession.class);
- CommandMessage commandMessage = FailingTestCommand.createMessage();
- messageSession.send(commandMessage);
- }
- });
+ private static final long serialVersionUID = 1L;
- waitTillNoMoreMessages();
+ @Override
+ protected void executeVoid(Environment environment) throws Exception {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ CommandMessage commandMessage = FailingTestCommand.createMessage();
+ messageSession.send(commandMessage);
+ }
+ });
- } finally {
- jobExecutor.stop(true);
- }
+ waitTillNoMoreMessages();
- commandService.execute(new VoidCommand() {
+ processEngine.execute(new VoidCommand() {
+
private static final long serialVersionUID = 1L;
@Override
public void executeVoid(Environment environment) throws Exception {
- List<Job> deadJobs = null;
- throw new JbpmException("todo get the jobs with exception");
+ Session session = environment.get(Session.class);
-// Session session = environment.get(Session.class);
-// List commands = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
-// assertTrue("command insertion should have been rolled back", commands.isEmpty());
+ List<?> deadJobs = session.createCriteria(JobImpl.class).list();
+ assertEquals(1, deadJobs.size());
+ session.delete(deadJobs.get(0));
+
+ List<?> comments = session.createCriteria(HistoryCommentImpl.class).list();
+ assertEquals("command insertion should have been rolled back", 0, comments.size());
}
});
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -21,34 +21,33 @@
*/
package org.jbpm.test.load.async;
-import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
+import org.jbpm.api.cmd.VoidCommand;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
/**
* @author Tom Baeyens
*/
-public class FailingTestCommand implements Command<Object> {
+public class FailingTestCommand extends VoidCommand {
private static final long serialVersionUID = 1L;
- public Object execute(Environment environment) throws Exception {
+ @Override
+ protected void executeVoid(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
-
+
// this message execution should be rolled back
-// HistoryComment comment = new HistoryDetailImpl("failing update");
-// dbSession.save(comment);
-
- throw new RuntimeException("ooops");
+ HistoryCommentImpl comment = new HistoryCommentImpl("failing update");
+ dbSession.save(comment);
+
+ throw new RuntimeException("ooops");
}
public static CommandMessage createMessage() {
- CommandMessage commandMessage = new CommandMessage();
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(FailingTestCommand.class);
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
+ FailingTestCommand command = new FailingTestCommand();
+ return new CommandMessage(command);
}
}
Deleted: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -1,42 +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.load.async;
-
-import org.jbpm.pvm.internal.cmd.CommandService;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
-import org.jbpm.test.JbpmTestCase;
-
-/**
- * @author Tom Baeyens
- */
-public class JobExecutorTestCase extends JbpmTestCase {
-
- protected CommandService commandService;
- protected JobExecutor jobExecutor;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- commandService = processEngine.get(CommandService.class);
- jobExecutor = processEngine.get(JobExecutor.class);
- }
-}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -21,46 +21,32 @@
*/
package org.jbpm.test.load.async;
-import java.util.Random;
-
import org.hibernate.Session;
-import org.jbpm.api.cmd.Command;
+
import org.jbpm.api.cmd.Environment;
+import org.jbpm.api.cmd.VoidCommand;
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
/**
* @author Tom Baeyens
*/
-public class NormalMessageCommand implements Command<Void> {
-
+public class NormalMessageCommand extends VoidCommand {
+
private static final long serialVersionUID = 1L;
- static Random random = new Random();
-
+
int messageId;
-
- public NormalMessageCommand() {
- }
-
- public NormalMessageCommand(int messageId) {
- this.messageId = messageId;
- }
public static CommandMessage createMessage(int messageId) {
- CommandMessage commandMessage = new CommandMessage();
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(NormalMessageCommand.class);
- commandDescriptor.addInjection("messageId", new IntegerDescriptor(messageId));
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
+ NormalMessageCommand command = new NormalMessageCommand();
+ command.messageId = messageId;
+ return new CommandMessage(command);
}
- public Void execute(Environment environment) throws Exception {
+ protected void executeVoid(Environment environment) throws Exception {
HistoryDetailImpl comment = new HistoryCommentImpl(Integer.toString(messageId));
Session session = environment.get(Session.class);
session.save(comment);
- return null;
}
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -21,82 +21,71 @@
*/
package org.jbpm.test.load.async;
-import java.util.ArrayList;
+import java.util.BitSet;
import java.util.List;
import org.hibernate.Session;
+
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
+import org.jbpm.api.cmd.VoidCommand;
import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.session.MessageSession;
import org.jbpm.pvm.internal.util.CollectionUtil;
-import org.jbpm.test.Db;
+import org.jbpm.test.JbpmTestCase;
/**
* @author Tom Baeyens
*/
-public class NormalMessageTest extends JobExecutorTestCase {
+public class NormalMessageTest extends JbpmTestCase {
- static long nbrOfTestMessages = 100;
+ static long nbrOfTestMessages = 100;
- protected void setUp() throws Exception {
- super.setUp();
- Db.clean(processEngine);
- }
-
public void testNormalMessageProcessing() {
- JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
- jobExecutor.start();
+ // insert ${nbrOfTestMessages} messages...
+ for (int i = 0; i < nbrOfTestMessages; i++) {
+ processEngine.execute(new InsertNormalMessageCmd(i));
+ }
+ // wait till all messages are processed
+ waitTillNoMoreMessages();
- try {
- // insert ${nbrOfTestMessages} messages...
- for (int i = 0; i < nbrOfTestMessages; i++) {
- commandService.execute(new InsertNormalMessageCmd(i));
- }
+ BitSet processedMessageNumbers = processEngine.execute(new Command<BitSet>() {
- // wait till all messages are processed
- waitTillNoMoreMessages();
-
- } finally {
- jobExecutor.stop(true);
- }
-
- List<Integer> processedMessageNumbers = commandService.execute(new Command<List<Integer>>() {
private static final long serialVersionUID = 1L;
- public List<Integer> execute(Environment environment) {
- List<Integer> processedMessageNumbers = new ArrayList<Integer>();
+ public BitSet execute(Environment environment) {
+ BitSet processedMessageNumbers = new BitSet();
Session session = environment.get(Session.class);
List<?> comments = session.createCriteria(HistoryDetailImpl.class).list();
- for (HistoryComment comment: CollectionUtil.checkList(comments, HistoryComment.class)) {
+ for (HistoryComment comment : CollectionUtil.checkList(comments, HistoryComment.class)) {
int processedMessageNumber = Integer.parseInt(comment.getMessage());
- processedMessageNumbers.add(processedMessageNumber);
+ processedMessageNumbers.set(processedMessageNumber);
// make sure the db stays clean
session.delete(comment);
}
return processedMessageNumbers;
}
});
-
+
for (int i = 0; i < nbrOfTestMessages; i++) {
- assertTrue("message " + i + " is not processed: " + processedMessageNumbers, processedMessageNumbers.contains(i));
+ assertTrue("message " + i + " is not processed: " + processedMessageNumbers, processedMessageNumbers.get(i));
}
}
-
- public static class InsertNormalMessageCmd implements Command<Object> {
+
+ public static class InsertNormalMessageCmd extends VoidCommand {
+
+ final int messageId;
private static final long serialVersionUID = 1L;
- int i;
- public InsertNormalMessageCmd(int i) {
- this.i = i;
+
+ public InsertNormalMessageCmd(int messageId) {
+ this.messageId = messageId;
}
- public Object execute(Environment environment) throws Exception {
+ protected void executeVoid(Environment environment) throws Exception {
MessageSession messageSession = environment.get(MessageSession.class);
- CommandMessage commandMessage = NormalMessageCommand.createMessage(i);
+ CommandMessage commandMessage = NormalMessageCommand.createMessage(messageId);
messageSession.send(commandMessage);
- return null;
}
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -28,7 +28,6 @@
import org.jbpm.internal.log.Log;
import org.jbpm.test.load.LoadTestCase;
-
/**
* @author Tom Baeyens
*/
@@ -55,7 +54,7 @@
}
public void testExecuteProcesses() throws Exception {
- // deployJpdlResource("org/jbpm/test/load/executions/process.jpdl.xml");
+ deployFromClasspath("org/jbpm/test/load/executions/process.jpdl.xml");
startMeasuringTime();
@@ -66,7 +65,6 @@
threadList.add(thread);
}
-
for (Thread thread: threadList) {
while (thread.isAlive()) {
try {
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -24,21 +24,25 @@
import org.hibernate.Session;
import org.jbpm.api.cmd.Environment;
import org.jbpm.api.cmd.VoidCommand;
-import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
/**
* @author Tom Baeyens
*/
-public class AddCommentCmd extends VoidCommand {
-
+public class AddCommentCmd extends VoidCommand {
+
private static final long serialVersionUID = 1L;
-
+
protected String message;
+ public AddCommentCmd(String message) {
+ this.message = message;
+ }
+
public void executeVoid(Environment environment) throws Exception {
-// HistoryDetailImpl comment = new HistoryDetailImpl(message);
-// Session session = environment.get(Session.class);
-// session.save(comment);
-// MessageProcessingTest.commentAdded();
+ HistoryCommentImpl comment = new HistoryCommentImpl(message);
+ Session session = environment.get(Session.class);
+ session.save(comment);
+ MessageProcessingTest.commentAdded();
}
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2010-07-09 07:38:13 UTC (rev 6474)
@@ -21,22 +21,20 @@
*/
package org.jbpm.test.load.messages;
-import java.util.ArrayList;
+import java.util.BitSet;
import java.util.List;
import org.hibernate.Session;
+
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
import org.jbpm.api.history.HistoryComment;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cmd.CompositeCmd;
import org.jbpm.pvm.internal.cmd.SendMessageCmd;
-import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.util.CollectionUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
import org.jbpm.test.load.LoadTestCase;
/**
@@ -47,95 +45,70 @@
private static final Log log = Log.getLog(MessageProcessingTest.class.getName());
- static long nbrOfTestMessages = 1000; // nbrOfTestMessages must be dividable by insertGroupSize
- static long insertGroupSize = 100;
-
+ // nbrOfTestMessages must be divisible by insertGroupSize
+ static final long insertGroupSize = 100;
+ static final long nbrOfTestMessages = insertGroupSize * 10;
static int commentsAdded = 0;
-
+
public static synchronized void commentAdded() {
commentsAdded++;
}
- public void setUp() throws Exception {
- super.setUp();
-
- if ( (nbrOfTestMessages % insertGroupSize) != 0 ) {
- fail("nbrOfTestMessages ("+nbrOfTestMessages+") is not dividable by insertGroupSize ("+insertGroupSize+")");
- }
- }
-
protected void logColumnTitles() {
logFileWriter.println("Used Memory\tProcessed Messages\tTime");
}
public void logStatus() {
String measuredTime = getMeasuredTime();
- logFileWriter.println(getUsedMemory()+"\t"+commentsAdded+"\t"+measuredTime);
+ logFileWriter.println(getUsedMemory() + "\t" + commentsAdded + "\t" + measuredTime);
logFileWriter.flush();
- log.info(commentsAdded+" msgs in "+measuredTime);
+ log.info(commentsAdded + " msgs in " + measuredTime);
}
-
+
public void testMessageProcessing() throws Exception {
- JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
-
- try {
- int messageIndex = 0;
- // insert ${nbrOfTestMessages} messages...
- for (int i = 0; i < nbrOfTestMessages; i+=insertGroupSize) {
- CompositeCmd compositeCmd = new CompositeCmd();
- // ...in groups of ${insertGroupSize}
- for (int j = 0; j <insertGroupSize ; j++) {
- String messageText = Integer.toString(messageIndex);
-
- ObjectDescriptor cmdDescriptor = new ObjectDescriptor(AddCommentCmd.class);
- cmdDescriptor.addInjection("message", new StringDescriptor(messageText));
- CommandMessage commandMessage = new CommandMessage(cmdDescriptor);
- SendMessageCmd sendMessageCmd = new SendMessageCmd(commandMessage);
-
- compositeCmd.addCommand(sendMessageCmd);
-
- messageIndex++;
- }
- commandService.execute(compositeCmd);
-
- log.info("added "+messageIndex+" messages");
+ int messageIndex = 0;
+ // insert ${nbrOfTestMessages} messages...
+ for (int i = 0; i < nbrOfTestMessages; i += insertGroupSize) {
+ CompositeCmd compositeCmd = new CompositeCmd();
+ // ...in groups of ${insertGroupSize}
+ for (int j = 0; j < insertGroupSize; j++) {
+ String messageText = Integer.toString(messageIndex++);
+ CommandMessage commandMessage = new CommandMessage(new AddCommentCmd(messageText));
+ SendMessageCmd sendMessageCmd = new SendMessageCmd(commandMessage);
+ compositeCmd.addCommand(sendMessageCmd);
}
+ processEngine.execute(compositeCmd);
+ log.info("added " + messageIndex + " messages");
+ }
- startMeasuringTime();
-
- jobExecutor.start();
+ startMeasuringTime();
+ // wait till all messages are processed
+ waitTillNoMoreMessages();
+ stopMeasuringTime();
- // wait till all messages are processed
- waitTillNoMoreMessages(jobExecutor);
+ log.info("processing " + nbrOfTestMessages + " messages took " + getMeasuredTime());
- } finally {
- stopMeasuringTime();
-
- jobExecutor.stop(true);
- }
-
- log.info("processing "+nbrOfTestMessages+" messages took "+getMeasuredTime());
+ BitSet processedMessageNumbers = processEngine.execute(new Command<BitSet>() {
- List<Integer> processedMessageNumbers = commandService.execute(new Command<List<Integer>>() {
private static final long serialVersionUID = 1L;
- public List<Integer> execute(Environment environment) {
- List<Integer> processedMessageNumbers = new ArrayList<Integer>();
+ public BitSet execute(Environment environment) {
+ BitSet processedMessageNumbers = new BitSet();
Session session = environment.get(Session.class);
- List<?> comments = session.createCriteria(HistoryDetailImpl.class).list();
- for (HistoryComment comment: CollectionUtil.checkList(comments, HistoryComment.class)) {
+ List<?> comments = session.createCriteria(HistoryCommentImpl.class).list();
+ for (HistoryComment comment : CollectionUtil.checkList(comments, HistoryComment.class)) {
int processedMessageNumber = Integer.parseInt(comment.getMessage());
- processedMessageNumbers.add(processedMessageNumber);
+ processedMessageNumbers.set(processedMessageNumber);
// make sure the db stays clean
session.delete(comment);
}
return processedMessageNumbers;
}
});
-
+
for (int i = 0; i < nbrOfTestMessages; i++) {
- assertTrue("message " + i + " is not processed: " + processedMessageNumbers, processedMessageNumbers.contains(i));
+ assertTrue("message " + i + " is not processed: " + processedMessageNumbers, processedMessageNumbers.get(i));
}
}
-
+
}
Modified: jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml 2010-07-09 07:38:13 UTC (rev 6474)
@@ -3,9 +3,10 @@
<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" />
+ <import resource="jbpm.businesscalendar.cfg.xml" />
+ <import resource="jbpm.jobexecutor.cfg.xml" />
</jbpm-configuration>
Modified: jbpm4/trunk/modules/test-load/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/jbpm.hibernate.cfg.xml 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/resources/jbpm.hibernate.cfg.xml 2010-07-09 07:38:13 UTC (rev 6474)
@@ -1,27 +1,23 @@
<?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/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
-
- <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>
- <property name="hibernate.hbm2ddl.auto">create-drop</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" />
+ <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 name="hibernate.hbm2ddl.auto">create-drop</property>
+ <property name="hibernate.format_sql">true</property>
- <mapping resource="jbpm.load.hbm.xml" />
-
+ <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>
Deleted: jbpm4/trunk/modules/test-load/src/test/resources/jbpm.load.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/jbpm.load.hbm.xml 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/resources/jbpm.load.hbm.xml 2010-07-09 07:38:13 UTC (rev 6474)
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping default-access="field">
-
- <subclass name="org.jbpm.test.load.AddCommentMessage"
- extends="org.jbpm.pvm.internal.job.MessageImpl"
- discriminator-value="AddMsg">
- </subclass>
-
-</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/test-load/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/logging.properties 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/resources/logging.properties 2010-07-09 07:38:13 UTC (rev 6474)
@@ -26,7 +26,7 @@
org.hibernate.cfg.HbmBinder.level=SEVERE
org.hibernate.cfg.SettingsFactory.level=SEVERE
# org.hibernate.level=FINE
-# org.hibernate.SQL.level=FINEST
+org.hibernate.SQL.level=FINEST
# org.hibernate.transaction.level=FINEST
# org.hibernate.type.level=FINEST
# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
Modified: jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml 2010-07-08 11:33:58 UTC (rev 6473)
+++ jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml 2010-07-09 07:38:13 UTC (rev 6474)
@@ -2,38 +2,34 @@
<process name="Process">
- <start>
+ <start g="16,16,80,40">
<transition to="a" />
</start>
- <java name="a"
- class="org.jbpm.test.load.executions.Automatic"
- method="doNothing">
+ <java class="org.jbpm.test.load.executions.Automatic" method="doNothing" name="a"
+ g="16,88,80,40">
<transition to="b" />
</java>
-
- <java name="b"
- class="org.jbpm.test.load.executions.Automatic"
- method="doNothing">
+
+ <java class="org.jbpm.test.load.executions.Automatic" method="doNothing" name="b"
+ g="16,160,80,40">
<transition to="c" />
</java>
-
- <state name="c">
+
+ <state name="c" g="16,232,80,40">
<transition to="d" />
</state>
- <java name="d"
- class="org.jbpm.test.load.executions.Automatic"
- method="doNothing">
+ <java class="org.jbpm.test.load.executions.Automatic" method="doNothing" name="d"
+ g="16,304,80,40">
<transition to="e" />
</java>
-
- <java name="e"
- class="org.jbpm.test.load.executions.Automatic"
- method="doNothing">
+
+ <java class="org.jbpm.test.load.executions.Automatic" method="doNothing" name="e"
+ g="16,376,80,40">
<transition to="end" />
</java>
-
- <end name="end" />
-
-</process>
+
+ <end name="end" g="16,448,80,40" />
+
+</process>
\ No newline at end of file
13 years, 11 months
JBoss JBPM SVN: r6473 - jbpm4/trunk/modules/devguide/src/main/docbook/en/modules.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-07-08 07:33:58 -0400 (Thu, 08 Jul 2010)
New Revision: 6473
Modified:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch17-SpringIntegration.xml
Log:
JBPM-2910 escape text in spring integration section of devguide
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch17-SpringIntegration.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch17-SpringIntegration.xml 2010-07-08 05:28:43 UTC (rev 6472)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch17-SpringIntegration.xml 2010-07-08 11:33:58 UTC (rev 6473)
@@ -1,147 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="springIntegration">
<title>Spring Integration</title>
-
+
<para>
- The embeddability of the jBPM engine in different environments has always
- been one of its core strengths, but often extra libraries to do the integration
- were required. Since jBPM4 however, it is now possible to natively
- integrate jBPM with <ulink url="http://www.springsource.org/about">Spring</ulink>.
- This section will explain which steps are required for such an integration.
+ The embeddability of the jBPM engine in different environments has always
+ been one of its core strengths, but often extra libraries to do the integration
+ were required. Since jBPM4 however, it is now possible to natively
+ integrate jBPM with <ulink url="http://www.springsource.org/about">Spring</ulink>.
+ This section will explain which steps are required for such an integration.
</para>
-
+
<para>
- The Spring integration has started out as a community effort by
- <ulink url="http://www.inze.be/andries/">Andries Inzé</ulink>.
- Do note that Spring integration currently is in 'incubation', before
- it is moved to the user guide.
+ The Spring integration has started out as a community effort by
+ <ulink url="http://www.inze.be/andries/">Andries Inzé</ulink>.
+ Do note that Spring integration currently is in 'incubation', before
+ it is moved to the user guide.
</para>
<section id="spring_overview">
<title>Overview</title>
<para>
- The default jBPM behaviour is to open a transaction for each operation
- that is called on the service API. In a typical Spring setup, applications are
- accessed from the web tier and enter a transactional boundary by invoking
- operations on service beans. These service beans will then access the jBPM services.
- All these operations run typically in a single transaction (ie one transaction
- per request from the browser), which invalidates the standard jBPM
- transaction handling approach. Instead of starting and committing
- a transaction for every service operation, the existing transaction
- should be used (or a new one started if none exists).
+ The default jBPM behaviour is to open a transaction for each operation
+ that is called on the service API. In a typical Spring setup, applications are
+ accessed from the web tier and enter a transactional boundary by invoking
+ operations on service beans. These service beans will then access the jBPM services.
+ All these operations run typically in a single transaction (ie one transaction
+ per request from the browser), which invalidates the standard jBPM
+ transaction handling approach. Instead of starting and committing
+ a transaction for every service operation, the existing transaction
+ should be used (or a new one started if none exists).
</para>
</section>
-
+
<section id="spring_configuration">
- <title>Configuration</title>
- <para>
- The easiest way to integrate Spring with jBPM is to import the <emphasis role="bold">jbpm.tx.spring.cfg.xml</emphasis>
- in your jbpm.cfg.xml file:
- <programlisting>
-<import resource="jbpm.tx.spring.cfg.xml" />
- </programlisting>
- This configuration uses the single transaction manager which is defined in the Spring configuration.
- Start from the content of this file if you need to tweak the jBPM-Spring integration
- configuration.
- </para>
+ <title>Configuration</title>
<para>
- If you start from an existing configuration, replace the standard-transaction-interceptor with the
- spring-transaction-interceptor. The hibernate session needs the attribute current=”true”,
- depending if you are using the 'current Session' strategy in Spring.
- Also, the <transaction/> must be removed from the transaction-context if you want the
+ The easiest way to integrate Spring with jBPM is to import the <emphasis role="bold">jbpm.tx.spring.cfg.xml</emphasis>
+ in your jbpm.cfg.xml file:
+ <programlisting>
+<import resource="jbpm.tx.spring.cfg.xml" />
+ </programlisting>
+ This configuration uses the single transaction manager which is defined in the Spring configuration.
+ Start from the content of this file if you need to tweak the jBPM-Spring integration
+ configuration.
+ </para>
+ <para>
+ If you start from an existing configuration, replace the standard-transaction-interceptor with the
+ spring-transaction-interceptor. The hibernate session needs the attribute current=”true”,
+ depending if you are using the 'current Session' strategy in Spring.
+ Also, the <transaction/> must be removed from the transaction-context if you want the
transactions to be handled by Spring only.
- This forces jBPM to search for the current session, which will then be provided by Spring.
- <programlisting>
- <process-engine-context>
- <command-service>
- <emphasis role="bold"><spring-transaction-interceptor /></emphasis>
- ...
- </command-service>
- ...
- </process-engine-context>
- <transaction-context>
- ...
- <emphasis role="bold"><hibernate-session current="true"/></emphasis>
- </transaction-context>
- </programlisting>
- </para>
-
- <para>
- The spring-transaction-interceptor will look by default for a PlatformTransactionManager
- implementation by doing a search by type on the defined beans. In the case of multiple
+ This forces jBPM to search for the current session, which will then be provided by Spring.
+ <programlisting>
+ <process-engine-context>
+ <command-service>
+ <emphasis role="bold"><spring-transaction-interceptor /></emphasis>
+ ...
+ </command-service>
+ ...
+ </process-engine-context>
+ <transaction-context>
+ ...
+ <emphasis role="bold"><hibernate-session current="true"/></emphasis>
+ </transaction-context>
+ </programlisting>
+ </para>
+
+ <para>
+ The spring-transaction-interceptor will look by default for a PlatformTransactionManager
+ implementation by doing a search by type on the defined beans. In the case of multiple
transaction managers, it is possible to specifically define the name of the transaction manager
that must be used by the interceptor:
<programlisting>
-<spring-transaction-interceptor transaction-manager="<emphasis role="bold">myTransactionManager</emphasis>" />
+<spring-transaction-interceptor transaction-manager="<emphasis role="bold">myTransactionManager</emphasis>" />
</programlisting>
- </para>
-
- <para>
- The Spring integration provides a special context, which is added to
- the set of contexts where the jBPM engine will look for beans.
- Using this SpringContext, it is now possible to retrieve beans from the
- Spring Application Context. The jBPM process engine can be configured in a Spring
- applicationContext.xml as follows:
- <programlisting>
- <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
- <property name="jbpmCfg" value="org/jbpm/spring/jbpm.cfg.xml"></property>
- </bean>
+ </para>
- <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
+ <para>
+ The Spring integration provides a special context, which is added to
+ the set of contexts where the jBPM engine will look for beans.
+ Using this SpringContext, it is now possible to retrieve beans from the
+ Spring Application Context. The jBPM process engine can be configured in a Spring
+ applicationContext.xml as follows:
+ <programlisting>
+<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
+ <property name="jbpmCfg" value="org/jbpm/spring/jbpm.cfg.xml"></property>
+</bean>
+
+ <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
</programlisting>
Note that the <emphasis role="bold">jbpmCfg</emphasis> property for the SpringHelper is optional.
If a default jbpm.cfg.xml exists on the classpath (ie not in some package), this line can
be removed.
- </para>
-
- <para>
- The jBPM services can also be defined in the Spring applicationContext, as following:
- <programlisting>
+ </para>
+
+ <para>
+ The jBPM services can also be defined in the Spring applicationContext, as following:
+ <programlisting>
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
- </programlisting>
- </para>
+ </programlisting>
+ </para>
</section>
-
+
<section id="spring_usage">
- <title>Usage</title>
-
- <para>
- The previous section already showed how the jBPM services can be made
- accessible for other Spring services. The other use case is calling
- Spring beans from within a process. This can be done by using
- an expression which resolves to the name of a Spring bean.
-
- <programlisting>
+ <title>Usage</title>
+
+ <para>
+ The previous section already showed how the jBPM services can be made
+ accessible for other Spring services. The other use case is calling
+ Spring beans from within a process. This can be done by using
+ an expression which resolves to the name of a Spring bean.
+
+ <programlisting>
<java name="echo" expr="#{echoService}" method="sayHello" >
- <transition name="to accept" to="join1"/>
- </java>
- </programlisting>
-
- The scripting engine will look into all contexts from the bean named echoService.
- If you configured the ScriptManager as above, Spring will be the last context to search for.
- You can also add a Spring bean to the Spring Application context
- (eg IdentitySessionImpl with id <emphasis role="italic">identitySession</emphasis>)
- and use it in the jBPM config (eg by adding <env class="identitySession" />)
- </para>
-
+ <transition name="to accept" to="join1"/>
+</java>
+ </programlisting>
+
+ The scripting engine will look into all contexts from the bean named echoService.
+ If you configured the ScriptManager as above, Spring will be the last context to search for.
+ You can also add a Spring bean to the Spring Application context
+ (eg IdentitySessionImpl with id <emphasis role="italic">identitySession</emphasis>)
+ and use it in the jBPM config (eg by adding <env class="identitySession" />)
+ </para>
+
</section>
-
+
<section id="spring_testing">
- <title>Testing</title>
-
- <para>
- Use the <emphasis role="bold">AbstractTransactionalJbpmTestCase</emphasis>
- to test a process in isolation (ie without impact on the database).
- This class extends from
- the <emphasis role="italic">AbstractTransactionalDataSourceSpringContextTests</emphasis>
- class, which means that testing a process comes down to exactly the same
- approach as testing a DAO.
- </para>
-
+ <title>Testing</title>
+
+ <para>
+ Use the <emphasis role="bold">AbstractTransactionalJbpmTestCase</emphasis>
+ to test a process in isolation (ie without impact on the database).
+ This class extends from
+ the <emphasis role="italic">AbstractTransactionalDataSourceSpringContextTests</emphasis>
+ class, which means that testing a process comes down to exactly the same
+ approach as testing a DAO.
+ </para>
+
</section>
-
-
-
+
+
+
</chapter>
13 years, 11 months
JBoss JBPM SVN: r6472 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor and 10 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-07-08 01:28:43 -0400 (Thu, 08 Jul 2010)
New Revision: 6472
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobAdditionNotifier.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jobexecutor/
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jobexecutor/JobNotificationTest.java
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jobexecutor/
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jobexecutor/jbpm.cfg.xml
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/MessageImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobAddedNotification.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorMessageSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListenerMessage.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TimerSessionBinding.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/idgenerator/DeploymentIdGenerationTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskDetailTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java
Log:
JBPM-1453 merge job notification booleans
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/MessageImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/MessageImpl.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/MessageImpl.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -36,10 +36,6 @@
public MessageImpl() {
}
- public String toString() {
- return "message[" + dbid + "]";
- }
-
public MessageImpl(ExecutionImpl execution) {
this.execution = execution;
this.processInstance = execution.getProcessInstance();
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -25,8 +25,8 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
-import java.util.List;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
@@ -54,7 +54,7 @@
Collection<Long> acquiredJobDbids = new ArrayList<Long>();
try {
- Collection<JobImpl> acquiredJobs = new ArrayList<JobImpl>();
+ Collection<JobImpl> acquiredJobs;
DbSession dbSession = environment.get(DbSession.class);
if (log.isTraceEnabled()) log.trace("start querying first acquirable job...");
@@ -64,10 +64,9 @@
if (job!=null) {
if (job.isExclusive()) {
if (log.isTraceEnabled()) log.trace("exclusive acquirable job found ("+job+"). querying for other exclusive jobs to lock them all in one tx...");
- List<JobImpl> otherExclusiveJobs = dbSession.findExclusiveJobs(job.getProcessInstance());
- acquiredJobs.addAll(otherExclusiveJobs);
+ acquiredJobs = dbSession.findExclusiveJobs(job.getProcessInstance());
} else {
- acquiredJobs.add(job);
+ acquiredJobs = Collections.singletonList(job);
}
for (JobImpl acquiredJob: acquiredJobs) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobAddedNotification.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobAddedNotification.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobAddedNotification.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.jobexecutor;
+import javax.transaction.Status;
import javax.transaction.Synchronization;
import org.jbpm.internal.log.Log;
@@ -41,9 +42,11 @@
this.jobExecutor = jobExecutor;
}
- public void afterCompletion(int arg0) {
- log.trace("notifying job executor of added message");
- jobExecutor.jobWasAdded();
+ public void afterCompletion(int status) {
+ if (status == Status.STATUS_COMMITTED) {
+ log.trace("notifying job executor of added message");
+ jobExecutor.jobWasAdded();
+ }
}
public void beforeCompletion() {
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobAdditionNotifier.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobAdditionNotifier.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobAdditionNotifier.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -0,0 +1,65 @@
+/*
+ * 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.pvm.internal.jobexecutor;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.tx.Transaction;
+
+/**
+ * @author Huisheng Xu
+ */
+public class JobAdditionNotifier {
+
+ private static final Log log = Log.getLog(JobAdditionNotifier.class.getName());
+
+ /* injected */
+ Transaction transaction;
+
+ /* injected */
+ JobExecutor jobExecutor;
+
+ private boolean notificationRegistered;
+
+ public void registerNotification() {
+ if (jobExecutor == null) {
+ log.debug("cannot find jobExecutor");
+ return;
+ }
+
+ // a transaction is not required (can be null)
+ if (transaction == null) {
+ log.debug("cannot find transaction");
+ return;
+ }
+
+ if (notificationRegistered)
+ return;
+
+ // notify the job executor after the transaction is completed
+ if (log.isTraceEnabled()) {
+ log.trace("registering job addition notifier with " + transaction);
+ }
+ transaction.registerSynchronization(new JobAddedNotification(jobExecutor));
+
+ notificationRegistered = true;
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorMessageSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorMessageSession.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorMessageSession.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -23,41 +23,32 @@
import org.jbpm.api.job.Message;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.session.MessageSession;
-import org.jbpm.pvm.internal.tx.Transaction;
-import org.jbpm.pvm.internal.util.ReflectUtil;
/**
* @author Tom Baeyens
+ * @author Huisheng Xu
*/
public class JobExecutorMessageSession implements MessageSession {
-
+
private static final Log log = Log.getLog(JobExecutorMessageSession.class.getName());
-
+
/* injected */
DbSession dbSession;
- /* injected */
- Transaction transaction;
-
- boolean isNotificationAdded;
+ /* injected. */
+ JobAdditionNotifier jobAdditionNotifier;
public void send(Message message) {
- log.debug("sending message "+ReflectUtil.getUnqualifiedClassName(message.getClass()));
+ if (log.isDebugEnabled()) {
+ log.debug("sending message " + message.getClass().getSimpleName());
+ }
dbSession.save(message);
- if (!isNotificationAdded) {
- isNotificationAdded = true;
-
- JobExecutor jobExecutor = EnvironmentImpl.getCurrent().get(JobExecutor.class);
- if (jobExecutor!=null) {
- // notify the job executor after the transaction is completed
- log.trace("registering job executor notifier with "+transaction);
- transaction.registerSynchronization(new JobAddedNotification(jobExecutor));
- }
+ if (jobAdditionNotifier != null) {
+ jobAdditionNotifier.registerNotification();
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSession.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSession.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -24,48 +24,36 @@
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.job.TimerImpl;
import org.jbpm.pvm.internal.session.TimerSession;
-import org.jbpm.pvm.internal.tx.Transaction;
import org.jbpm.pvm.internal.util.CollectionUtil;
/**
* Timers created with this service are committed at the end of the transaction,
* so their execution will be late if the delay is shorter than the transaction.
* In that case, they will be executed at the end of the transaction.
- *
+ *
* @author Tom Baeyens, Pascal Verdage
+ * @author Huisheng Xu
*/
public class JobExecutorTimerSession implements TimerSession {
private static final Log log = Log.getLog(TimerSession.class.getName());
/* injected */
- Transaction transaction;
-
- /* injected */
- JobExecutor jobExecutor;
-
- /* injected */
Session session;
- boolean jobExecutorNotificationScheduled = false;
+ /* injected. */
+ JobAdditionNotifier jobAdditionNotifier;
public void schedule(Timer timer) {
if (timer == null) throw new JbpmException("null timer scheduled");
TimerImpl timerImpl = (TimerImpl) timer;
timerImpl.validate();
-
+
log.debug("scheduling " + timer);
session.save(timer);
-
- if ( (!jobExecutorNotificationScheduled)
- && (jobExecutor!=null)
- ) {
- jobExecutorNotificationScheduled = true;
-
- //a transaction is not required (can be null)
- if (transaction != null) {
- transaction.registerSynchronization(new JobAddedNotification(jobExecutor));
- }
+
+ if (jobAdditionNotifier != null) {
+ jobAdditionNotifier.registerNotification();
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListenerMessage.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListenerMessage.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListenerMessage.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -152,4 +152,9 @@
execution.performAtomicOperationSync(AtomicOperation.EXECUTE_EVENT_LISTENER);
}
+
+ @Override
+ public String toString() {
+ return "ExecuteEventListenerMessage[" + dbid + "]";
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -21,6 +21,8 @@
*/
package org.jbpm.pvm.internal.wire.binding;
+import org.w3c.dom.Element;
+
import org.jbpm.pvm.internal.jms.JmsMessageSession;
import org.jbpm.pvm.internal.jobexecutor.JobExecutorMessageSession;
import org.jbpm.pvm.internal.session.DbSession;
@@ -29,16 +31,15 @@
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.JndiDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.TransactionRefDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
/** parses a descriptor for creating a {@link MessageSession}.
*
* See schema docs for more details.
*
* @author Tom Baeyens
+ * @author Huisheng Xu
*/
public class MessageSessionBinding extends WireDescriptorBinding {
@@ -72,8 +73,9 @@
} else {
objectDescriptor.setClassName(JobExecutorMessageSession.class.getName());
- objectDescriptor.addInjection("transaction", new TransactionRefDescriptor());
objectDescriptor.addInjection("dbSession", new ContextTypeRefDescriptor(DbSession.class));
+ objectDescriptor.addInjection("jobAdditionNotifier",
+ TimerSessionBinding.getJobAdditionNotifierDescriptor(parse));
}
return objectDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TimerSessionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TimerSessionBinding.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TimerSessionBinding.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -22,23 +22,27 @@
package org.jbpm.pvm.internal.wire.binding;
import org.hibernate.Session;
+import org.w3c.dom.Element;
+
+import org.jbpm.pvm.internal.jobexecutor.JobAdditionNotifier;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.jobexecutor.JobExecutorTimerSession;
import org.jbpm.pvm.internal.session.TimerSession;
import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.WireDefinition;
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.EnvDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.TransactionRefDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
/** parses a descriptor for creating a {@link TimerSession}.
*
* See schema docs for more details.
*
* @author Tom Baeyens, Pascal Verdage
+ * @author Huisheng Xu
*/
public class TimerSessionBinding extends WireDescriptorBinding {
@@ -59,12 +63,31 @@
objectDescriptor.setClassName(JobExecutorTimerSession.class.getName());
// inject fields
- objectDescriptor.addInjection("transaction", new TransactionRefDescriptor());
- objectDescriptor.addInjection("jobExecutor", new EnvDescriptor(JobExecutor.class));
objectDescriptor.addInjection("session", new ContextTypeRefDescriptor(Session.class));
+ objectDescriptor.addInjection("jobAdditionNotifier",
+ getJobAdditionNotifierDescriptor(parse));
}
return objectDescriptor;
}
+
+ static ObjectDescriptor getJobAdditionNotifierDescriptor(Parse parse) {
+ String jobAdditionNotifierName;
+ ObjectDescriptor jobAdditionNotifierDescriptor;
+
+ WireDefinition wireDefinition = parse.contextStackFind(WireDefinition.class);
+ if (wireDefinition != null
+ && (jobAdditionNotifierName = wireDefinition.getDescriptorName(JobAdditionNotifier.class)) != null) {
+ jobAdditionNotifierDescriptor = (ObjectDescriptor) wireDefinition.getDescriptor(jobAdditionNotifierName);
+ }
+ else {
+ jobAdditionNotifierDescriptor = new ObjectDescriptor(JobAdditionNotifier.class);
+ // inject fields
+ jobAdditionNotifierDescriptor.addInjection("transaction", new TransactionRefDescriptor());
+ jobAdditionNotifierDescriptor.addInjection("jobExecutor", new EnvDescriptor(JobExecutor.class));
+ wireDefinition.addDescriptor(jobAdditionNotifierDescriptor);
+ }
+ return jobAdditionNotifierDescriptor;
+ }
}
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 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -22,41 +22,27 @@
package org.jbpm.test;
import org.jbpm.api.Configuration;
-import org.jbpm.api.RepositoryService;
+import org.jbpm.api.ProcessEngine;
-
-
/**
* @author Tom Baeyens
*/
public class JbpmCustomCfgTestCase extends JbpmTestCase {
-
- protected synchronized void initialize() {
- String cfgResource = getClass().getPackage().getName().replace(".", "/")+"/jbpm.cfg.xml";
-
+ protected ProcessEngine buildProcessEngine() {
+ String cfgResource = getClass().getPackage().getName().replace('.', '/') + "/jbpm.cfg.xml";
+
// 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();
+ return new Configuration().setResource(cfgResource).buildProcessEngine();
}
-
-
}
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -24,9 +24,14 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
import javax.jms.Session;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+
import org.jbpm.api.Configuration;
import org.jbpm.api.Execution;
import org.jbpm.api.ExecutionService;
@@ -38,6 +43,8 @@
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.RepositoryService;
import org.jbpm.api.TaskService;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
import org.jbpm.api.task.Task;
import org.jbpm.test.assertion.CollectionAssertions;
@@ -61,14 +68,14 @@
*/
public abstract class JbpmTestCase extends BaseJbpmTestCase {
- protected static ProcessEngine processEngine;
+ protected ProcessEngine processEngine;
- protected static RepositoryService repositoryService;
- protected static ExecutionService executionService;
- protected static ManagementService managementService;
- protected static TaskService taskService;
- protected static HistoryService historyService;
- protected static IdentityService identityService;
+ protected RepositoryService repositoryService;
+ protected ExecutionService executionService;
+ protected ManagementService managementService;
+ protected TaskService taskService;
+ protected HistoryService historyService;
+ protected IdentityService identityService;
/** registered deployments. registered deployments will be deleted automatically
* in the tearDown. This is a convenience function as each test is expected to clean up the DB. */
@@ -77,20 +84,18 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- initialize();
+ processEngine = buildProcessEngine();
+
+ repositoryService = processEngine.get(RepositoryService.class);
+ executionService = processEngine.getExecutionService();
+ historyService = processEngine.getHistoryService();
+ managementService = processEngine.getManagementService();
+ taskService = processEngine.getTaskService();
+ identityService = processEngine.getIdentityService();
}
- protected synchronized void initialize() {
- if (processEngine==null) {
- processEngine = Configuration.getProcessEngine();
-
- repositoryService = processEngine.get(RepositoryService.class);
- executionService = processEngine.getExecutionService();
- historyService = processEngine.getHistoryService();
- managementService = processEngine.getManagementService();
- taskService = processEngine.getTaskService();
- identityService = processEngine.getIdentityService();
- }
+ protected ProcessEngine buildProcessEngine() {
+ return Configuration.getProcessEngine();
}
@Override
@@ -342,4 +347,48 @@
return result.toString();
}
+ public void waitTillNoMoreMessages() {
+ final long timeout = 60 * 1000;
+ final long checkInterval = 1000;
+
+ // install a timer that will interrupt if it takes too long
+ // if that happens, it will lead to an interrupted exception and the test
+ // will fail
+ TimerTask interruptTask = new TimerTask() {
+
+ Thread testThread = Thread.currentThread();
+
+ public void run() {
+ log.debug("test " + getName() + " took too long. going to interrupt..." + testThread);
+ testThread.interrupt();
+ }
+ };
+ Timer timer = new Timer();
+ timer.schedule(interruptTask, timeout);
+
+ try {
+ for (int jobCount; (jobCount = getJobCount()) > 0;) {
+ log.debug("waiting " + checkInterval + " ms for " + jobCount + " jobs to execute");
+ Thread.sleep(checkInterval);
+ }
+ } catch (InterruptedException e) {
+ fail("test execution exceeded treshold of " + timeout + " milliseconds");
+ } finally {
+ timer.cancel();
+ }
+ }
+
+ protected int getJobCount() {
+ return processEngine.execute(new Command<Integer>() {
+ private static final long serialVersionUID = 1L;
+
+ public Integer execute(Environment environment) {
+ org.hibernate.Session session = environment.get(org.hibernate.Session.class);
+ return (Integer) session.createCriteria("org.jbpm.pvm.internal.job.JobImpl")
+ .add(Restrictions.gt("retries", 0))
+ .setProjection(Projections.rowCount())
+ .uniqueResult();
+ }
+ });
+ }
}
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/idgenerator/DeploymentIdGenerationTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/idgenerator/DeploymentIdGenerationTest.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/idgenerator/DeploymentIdGenerationTest.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -31,13 +31,10 @@
import org.jbpm.api.Deployment;
import org.jbpm.api.NewDeployment;
import org.jbpm.api.ProcessEngine;
-import org.jbpm.api.ProcessInstance;
import org.jbpm.pvm.internal.id.DbidGenerator;
import org.jbpm.pvm.internal.id.MemoryDbidGenerator;
-import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.test.JbpmCustomCfgTestCase;
-
/**
* @author Joram Barrez
*/
@@ -97,10 +94,9 @@
private void resetProcessEngineAndDbidGenerator() {
// Close the process engine and recreate it
ProcessEngine oldProcessEngine = processEngine;
- processEngine.close();
- processEngine = null;
+ oldProcessEngine.close();
- initialize(); // creates a new ProcessEngine and services
+ processEngine = buildProcessEngine(); // creates a new ProcessEngine and services
assertNotSame(oldProcessEngine, processEngine);
// Reset the in memory generator and redeploy the process
Added: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jobexecutor/JobNotificationTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jobexecutor/JobNotificationTest.java (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/jobexecutor/JobNotificationTest.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -0,0 +1,98 @@
+/*
+ * 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.jobexecutor;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
+import org.jbpm.pvm.internal.jobexecutor.JobAdditionNotifier;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.test.JbpmCustomCfgTestCase;
+
+/**
+ * Merge job notification booleans.
+ *
+ * @author Alejandro Guizar
+ * @see <a href="https://jira.jboss.org/browse/JBPM-1453">JBPM-1453</a>
+ */
+public class JobNotificationTest extends JbpmCustomCfgTestCase {
+
+ static int notifications;
+
+ public void testJobNotification() {
+ JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
+ assert jobExecutor.getNbrOfThreads() > 1 : jobExecutor.getNbrOfThreads();
+
+ deployJpdlXmlString("<process name='JobNotification'>"
+ + " <on event='timeout'>"
+ + " <timer duedate='1 second'/>"
+ + " <script expr='do nothing' />"
+ + " </on>"
+ + " <start>"
+ + " <transition to='f' />"
+ + " </start>"
+ + " <fork name='f'>"
+ + " <transition name='a' to='a' continue='async' />"
+ + " <transition name='b' to='b' continue='async' />"
+ + " </fork>"
+ + " <state name='a' />"
+ + " <state name='b' />"
+ + "</process>");
+
+ jobExecutor.start();
+ try {
+ String processInstanceId = executionService.startProcessInstanceByKey("JobNotification")
+ .getId();
+ waitTillNoMoreMessages();
+ assertActivitiesActive(processInstanceId, "a", "b");
+ }
+ finally {
+ jobExecutor.stop(true);
+ }
+
+ GetEnvironmentObject<JobAdditionNotifier> command = new GetEnvironmentObject<JobAdditionNotifier>(JobAdditionNotifier.class);
+ JobAdditionNotifier notifier = processEngine.execute(command);
+ assertNotSame(notifier, processEngine.execute(command));
+ }
+
+ public static class Executor extends JobExecutor {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void jobWasAdded() {
+ super.jobWasAdded();
+ notifications++;
+ }
+ }
+
+ private static class GetEnvironmentObject<T> implements Command<T> {
+ private final Class<T> type;
+ private static final long serialVersionUID = 1L;
+
+ GetEnvironmentObject(Class<T> type) {
+ this.type = type;
+ }
+
+ public T execute(Environment environment) throws Exception {
+ return environment.get(type);
+ }
+ }
+}
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jobexecutor/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jobexecutor/jbpm.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/jobexecutor/jbpm.cfg.xml 2010-07-08 05:28:43 UTC (rev 6472)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+ <import resource="jbpm.tx.hibernate.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.bpmn.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+ <import resource="jbpm.businesscalendar.cfg.xml" />
+
+ <process-engine-context>
+ <object class="org.jbpm.test.jobexecutor.JobNotificationTest$Executor">
+ <field name="commandService"><ref object="txRequiredCommandService"/></field>
+ </object>
+ </process-engine-context>
+
+</jbpm-configuration>
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskDetailTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskDetailTest.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskDetailTest.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -23,13 +23,13 @@
import java.util.Date;
import java.util.List;
-import org.jbpm.api.cmd.Command;
+
+import org.jbpm.api.TaskService;
import org.jbpm.api.cmd.Environment;
-import org.jbpm.api.history.HistoryActivityInstance;
+import org.jbpm.api.cmd.VoidCommand;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
-
/**
* @author Huisheng Xu
*/
@@ -85,51 +85,57 @@
assertEquals(1, historyService.createHistoryDetailQuery().list().size());
}
- static class TaskReassignCmd implements Command<Void> {
+ private static class TaskReassignCmd extends VoidCommand {
private String taskId;
private String newAssignee;
- public TaskReassignCmd(String taskId, String newAssignee) {
+ private static final long serialVersionUID = 1L;
+
+ TaskReassignCmd(String taskId, String newAssignee) {
this.taskId = taskId;
this.newAssignee = newAssignee;
}
- public Void execute(Environment env) {
+ @Override
+ protected void executeVoid(Environment environment) throws Exception {
+ TaskService taskService = environment.get(TaskService.class);
Task task = taskService.getTask(taskId);
task.setAssignee(newAssignee);
taskService.saveTask(task);
-
- return null;
}
}
- static class TaskChangePriorityCmd implements Command<Void> {
+ private static class TaskChangePriorityCmd extends VoidCommand {
private String taskId;
private int newPriority;
- public TaskChangePriorityCmd(String taskId, int newPriority) {
+ private static final long serialVersionUID = 1L;
+
+ TaskChangePriorityCmd(String taskId, int newPriority) {
this.taskId = taskId;
this.newPriority = newPriority;
}
- public Void execute(Environment env) {
+ @Override
+ protected void executeVoid(Environment environment) throws Exception {
+ TaskService taskService = environment.get(TaskService.class);
Task task = taskService.getTask(taskId);
task.setPriority(newPriority);
taskService.saveTask(task);
-
- return null;
}
}
- static class TaskChangeDuedateCmd implements Command<Void> {
+ private static class TaskChangeDuedateCmd extends VoidCommand {
private String taskId;
private Date newDuedate;
- public TaskChangeDuedateCmd(String taskId, Date newDuedate) {
+ private static final long serialVersionUID = 1L;
+
+ TaskChangeDuedateCmd(String taskId, Date newDuedate) {
this.taskId = taskId;
this.newDuedate = newDuedate;
}
- public Void execute(Environment env) {
+ @Override
+ protected void executeVoid(Environment environment) throws Exception {
+ TaskService taskService = environment.get(TaskService.class);
Task task = taskService.getTask(taskId);
task.setDuedate(newDuedate);
taskService.saveTask(task);
-
- return null;
}
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java 2010-07-07 17:22:03 UTC (rev 6471)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java 2010-07-08 05:28:43 UTC (rev 6472)
@@ -21,97 +21,22 @@
*/
package org.jbpm.test.load.async;
-import java.util.Date;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.cmd.Environment;
import org.jbpm.pvm.internal.cmd.CommandService;
-import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.test.JbpmTestCase;
-
/**
* @author Tom Baeyens
*/
public class JobExecutorTestCase extends JbpmTestCase {
- long timeoutMillis = 20 * 1000; // 20 seconds
- long checkInterval = 400;
-
- static String jobsAvailableQueryText =
- "select count(*) "+
- "from "+JobImpl.class.getName()+" as job "+
- "where ( (job.dueDate is null) or (job.dueDate <= :now) ) "+
- " and ( job.retries > 0 )";
-
protected CommandService commandService;
protected JobExecutor jobExecutor;
protected void setUp() throws Exception {
super.setUp();
-
+
commandService = processEngine.get(CommandService.class);
jobExecutor = processEngine.get(JobExecutor.class);
}
-
- protected void waitTillNoMoreMessages() {
-
- // install a timer that will interrupt if it takes too long
- // if that happens, it will lead to an interrupted exception and the test
- // will fail
- TimerTask interruptTask = new TimerTask() {
-
- Thread testThread = Thread.currentThread();
-
- public void run() {
- log.debug("test " + getName() + " took too long. going to interrupt..." + testThread);
- testThread.interrupt();
- }
- };
- Timer timer = new Timer();
- timer.schedule(interruptTask, timeoutMillis);
-
- try {
- boolean jobsAvailable = true;
- while (jobsAvailable) {
- log.debug("going to sleep for " + checkInterval + " millis, waiting for the job executor to process more jobs");
- Thread.sleep(checkInterval);
- jobsAvailable = areJobsAvailable();
- }
-
- } catch (InterruptedException e) {
- fail("test execution exceeded treshold of " + timeoutMillis + " milliseconds");
- } finally {
- timer.cancel();
- }
- }
-
- public boolean areJobsAvailable() {
- return commandService.execute(new Command<Boolean>() {
- private static final long serialVersionUID = 1L;
-
- public Boolean execute(Environment environment) {
- Session session = environment.get(Session.class);
-
- Query query = session.createQuery(jobsAvailableQueryText);
- query.setDate("now", new Date());
-
- Long jobs = (Long) query.uniqueResult();
-
- if (jobs.longValue()>0) {
- log.debug("found "+jobs+" more jobs to process");
- return true;
- }
- log.debug("no more jobs to process");
-
- return false;
- }
- });
- }
-
}
13 years, 11 months
JBoss JBPM SVN: r6471 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/bpmn/test and 2 other directories.
by do-not-reply@jboss.org
Author: swiderski.maciej
Date: 2010-07-07 13:22:03 -0400 (Wed, 07 Jul 2010)
New Revision: 6471
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/test/task/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/test/task/ManualTaskTest.java
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/manualTask.bpmn.xml
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskActivity.java
Log:
JBPM-2909: fixed ManualTaskActivity to move on on execute method
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskActivity.java 2010-07-07 08:37:01 UTC (rev 6470)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskActivity.java 2010-07-07 17:22:03 UTC (rev 6471)
@@ -13,5 +13,6 @@
private static final long serialVersionUID = 1L;
public void execute(ExecutionImpl executionImpl) {
+ proceed(executionImpl, findOutgoingSequenceFlow(executionImpl, CONDITIONS_CHECKED));
}
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/test/task/ManualTaskTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/test/task/ManualTaskTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/test/task/ManualTaskTest.java 2010-07-07 17:22:03 UTC (rev 6471)
@@ -0,0 +1,46 @@
+package org.jbpm.bpmn.test.task;
+
+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 ManualTaskTest extends JbpmTestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ NewDeployment deployment = repositoryService.createDeployment();
+ deployment.addResourceFromClasspath("org/jbpm/bpmn/manualTask.bpmn.xml");
+ registerDeployment(deployment.deploy());
+
+ identityService.createGroup("sales");
+ identityService.createUser("johndoe", "John", "Doe");
+ identityService.createMembership("johndoe", "sales");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ identityService.deleteGroup("sales");
+ identityService.deleteUser("johndoe");
+
+ super.tearDown();
+ }
+
+ public void testJavaServiceTaskCall() {
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("manualTaskProcess");
+
+ assertNotNull(pi.getId());
+
+ List<Task> allTasks = taskService.findGroupTasks("johndoe");
+ assertEquals(1, allTasks.size());
+
+ taskService.completeTask(allTasks.get(0).getId());
+ assertProcessInstanceEnded(pi);
+ }
+
+}
Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/manualTask.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/manualTask.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/manualTask.bpmn.xml 2010-07-07 17:22:03 UTC (rev 6471)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<definitions id="sid-e471f2be-74cc-4f20-a201-09327449efdf"
+ typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
+ targetNamespace="http://www.omg.org/bpmn20" xmlns="http://schema.omg.org/spec/BPMN/2.0"
+ xmlns:jbpm="http://jbpm.org/bpmn2">
+ <process id="manualTaskProcess" name="manualTaskProcess">
+ <laneSet id="laneSet">
+ <lane name="DefaultLane" id="lane">
+ <flowElementRef>start</flowElementRef>
+ <flowElementRef>manualTask</flowElementRef>
+ <flowElementRef>userTask</flowElementRef>
+ <flowElementRef>end</flowElementRef>
+ </lane>
+ </laneSet>
+ <startEvent name="Process start" id="start"/>
+ <manualTask name="Do it manually" id="manualTask"/>
+ <userTask implementation="other" name="Sales operation" id="userTask">
+ <potentialOwner resourceRef="sales" jbpm:type="group">
+ <resourceAssignmentExpression>
+ <formalExpression>sales</formalExpression>
+ </resourceAssignmentExpression>
+ </potentialOwner>
+ </userTask>
+ <endEvent name="Process end" id="end"/>
+ <sequenceFlow targetRef="manualTask" sourceRef="start" name="flow2Manual" id="flow1"/>
+ <sequenceFlow targetRef="userTask" sourceRef="manualTask" name="flow2user" id="flow2"/>
+ <sequenceFlow targetRef="end" sourceRef="userTask" name="flow2End" id="flow3"/>
+ </process>
+</definitions>
13 years, 11 months