Author: alex.guizar(a)jboss.com
Date: 2010-08-11 23:08:13 -0400 (Wed, 11 Aug 2010)
New Revision: 6579
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2818/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2818/JBPM2818Test.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/gpd.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/processdefinition.xml
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/modelling.xml
Log:
JBPM-2818 test super-state leaving transition
review and improve super-state documentation
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2818/JBPM2818Test.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2818/JBPM2818Test.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2818/JBPM2818Test.java 2010-08-12
03:08:13 UTC (rev 6579)
@@ -0,0 +1,52 @@
+/*
+ * 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.jbpm2818;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * Leaving node in super-state throws JbpmException: cannot leave Node without leaving
+ * transition.
+ *
+ * @see <a
href="https://jira.jboss.org/browse/JBPM-2818">JBPM-2818<...
+ * @author Alejandro Guizar
+ */
+public class JBPM2818Test extends AbstractDbTestCase {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlResource("org/jbpm/jbpm2818/processdefinition.xml");
+ deployProcessDefinition(processDefinition);
+ }
+
+ public void testSuperStateLeavingTransition() {
+ ProcessInstance processInstance =
jbpmContext.newProcessInstance("jbpm2818");
+ processInstance.signal();
+ assertEquals("state1",
processInstance.getRootToken().getNode().getName());
+
+ processInstance = saveAndReload(processInstance);
+ processInstance.signal();
+ assertTrue("expected " + processInstance + " to have ended",
processInstance.hasEnded());
+ }
+}
Property changes on:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2818/JBPM2818Test.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/gpd.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/gpd.xml 2010-08-12
03:08:13 UTC (rev 6579)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="jbpm2818" width="842"
height="584">
+ <node name="start" x="72" y="36" width="145"
height="37">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node-container name="super-state1" x="36" y="120"
width="217" height="145">
+ <node name="node1" x="33" y="15"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="state1" x="33" y="80"
width="132" height="36"/>
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node-container>
+ <node name="end" x="84" y="312" width="121"
height="37"/>
+ <deployment serverName="" serverPort=""
serverDeployer="">
+ <classesAndResources/>
+ <filesAndFolders>
+ <element
value="/jbpm-jpdl/src/test/resources/org/jbpm/jbpm2818/gpd.xml"/>
+ <element
value="/jbpm-jpdl/src/test/resources/org/jbpm/jbpm2818/processdefinition.xml"/>
+ </filesAndFolders>
+ </deployment>
+</root-container>
Property changes on:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/gpd.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/processdefinition.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/processdefinition.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/processdefinition.xml 2010-08-12
03:08:13 UTC (rev 6579)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition name="jbpm2818"
xmlns="urn:jbpm.org:jpdl-3.2">
+ <start-state name="start">
+ <transition to="super-state1" />
+ </start-state>
+
+ <super-state name="super-state1">
+ <transition to="end" />
+
+ <node name="node1">
+ <transition to="state1"/>
+ </node>
+ <state name="state1"/>
+ </super-state>
+
+ <end-state name="end" />
+</process-definition>
\ No newline at end of file
Property changes on:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2818/processdefinition.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/modelling.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/modelling.xml 2010-08-11
23:44:35 UTC (rev 6578)
+++
jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/modelling.xml 2010-08-12
03:08:13 UTC (rev 6579)
@@ -583,15 +583,16 @@
<para>
A super-state is a group of nodes. They can be nested
recursively and are used to add a hierarchy to the process
- definition. (For example, use this functionality
- to group all of the nodes belonging to a process in phases.)
+ definition. For example, this functionality is useful
+ to group the nodes belonging to a process in phases.
</para>
<para>
- Actions can be associated with super-state events. A consequence
- of this is that a token can be in multiple nested nodes at any
- given time. This can be convenient when checking if a process
- execution is in, for example, the start-up phase. One is free to
- group any set of nodes into a super-state.
+ Actions can be associated with super-state events. Events
+ fired by tokens in nested nodes bubble up the super-state
+ hierarchy up to the process definition. The token therefore
+ acts as being in every node in the hierarchy at the same
+ time. This can be convenient when checking if a process
+ execution is in, for example, the start-up phase.
</para>
<section id="superstatetransitions">
@@ -600,14 +601,18 @@
</title>
<para>
- Any of the transitions leaving a super-state can be taken by
- tokens in the nodes found within that same super state.
+ Any transition leaving a super-state can be taken by a
+ token positioned in any node within that super-state.
+ One use case for this feature is to model a <emphasis>
+ cancel</emphasis> transition which can be taken at any time.
+ </para>
+ <para>
Transitions can also arrive in super-states, in which case the
- token will be redirected to the first node in it.
+ token will be redirected to the first node in document order.
Furthermore, nodes which are outside the super-state can have
transitions directly to nodes that are inside it
- and vice versa. Finally, super-states can also be
- self-referential.
+ and viceversa. Finally, as any other node, super-states can
+ also self-transition.
</para>
</section>
@@ -621,8 +626,8 @@
<systemitem>superstate-enter</systemitem> and
<systemitem>superstate-leave</systemitem>. They will be
fired irrespective of which transitions the node has entered or
- left. (As long as a token takes transitions within the
- super-state, these events will not be fired.)
+ left. As long as a token takes transitions within the
+ super-state, these events will not be fired.
</para>
<note>
@@ -641,13 +646,13 @@
</title>
<para>
- Node names have to be unique (within their
- <firstterm>scope</firstterm>.) The scope of the node is its
- <firstterm>node-collection</firstterm>. (Both the process
- definition and the super-state are node collections.) To refer
+ Node names have to be unique within their
+ <firstterm>scope</firstterm>. The scope of the node is its
+ <firstterm>node-collection</firstterm>. Both the process
+ definition and the super-state are node collections. To refer
to nodes in super-states, specify the relative, slash
- (<code>/</code>) separated name. (The slash separates the node
- names. Use <code>.</code> to refer to an upper level.) The next
+ (<code>/</code>) separated name. The slash separates the node
+ names. Use <code>..</code> to refer to an upper level. The next
example shows how to refer to a node in a super-state:
</para>