JBoss JBPM SVN: r4984 - jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-03 11:51:49 -0400 (Wed, 03 Jun 2009)
New Revision: 4984
Removed:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.png
Log:
JBPM-2216 add custom activity: removed empty process image
Deleted: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.png
===================================================================
(Binary files differ)
16 years, 11 months
JBoss JBPM SVN: r4983 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/custom and 3 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-03 11:49:54 -0400 (Wed, 03 Jun 2009)
New Revision: 4983
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/PrintDots.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.png
Modified:
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2216 add custom activity
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java 2009-06-03 15:49:54 UTC (rev 4983)
@@ -0,0 +1,57 @@
+/*
+ * 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.examples.custom;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomTest extends JbpmTestCase {
+
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/custom/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ super.tearDown();
+ }
+
+ public void testWaitStatesSequence() {
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("Custom");
+ Execution executionInPrintDots = processInstance.findActiveExecutionIn("print dots");
+ assertNotNull(executionInPrintDots);
+ String executionId = executionInPrintDots.getId();
+ executionService.signalExecutionById(executionId);
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/PrintDots.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/PrintDots.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/PrintDots.java 2009-06-03 15:49:54 UTC (rev 4983)
@@ -0,0 +1,68 @@
+/*
+ * 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.examples.custom;
+
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class PrintDots implements ExternalActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+ private static final String NEWLINE = System.getProperty("line.separator");
+
+ public void execute(ActivityExecution execution) {
+ String executionId = execution.getId();
+
+ String dots =
+ " "+".::::. " + NEWLINE +
+ " " +" " +" .:::::" +":::. " +
+ NEWLINE + " ::::::::::: " + NEWLINE +
+ " " + " ':::::::::::.. "
+ + NEWLINE +" ::::" +":::::::::::' " + NEWLINE +" ':::::::::::. " + NEWLINE +
+ " .::::::::" +"::::::' " + NEWLINE +" " +".:::::::::::... " + NEWLINE +
+ " ::::::::::::::''" +
+ " " + NEWLINE +" .:::. '::::::::'':::: " + NEWLINE +
+ " .::::::::. " +
+ " ':::::' ':::: " + NEWLINE +" "
+ +".::::':::::::. " +" ::::: '::::. " + NEWLINE +" .:::::' '::::"
+ +":::::. ::::: ':::. " + NEWLINE +" .:::::' ':::::::::.::::: " +" '::. " +
+ NEWLINE +" .::::'' ':::::::::::::: '::. " + NEWLINE +" .::'' ':::::"
+ +"::::::: :::... " + NEWLINE +" ..:::: ':::::::::' " +
+ " .:' '''' " + NEWLINE +" ..''''':' ':::::.' " + NEWLINE;
+
+ System.out.println(dots);
+
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution,
+ String signalName,
+ Map<String, ?> parameters) {
+ execution.take(signalName);
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/custom/PrintDots.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.jpdl.xml 2009-06-03 15:49:54 UTC (rev 4983)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Custom" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="print dots" />
+ </start>
+
+ <custom name="print dots"
+ class="org.jbpm.examples.custom.PrintDots"
+ g="96,16,127,52">
+
+ <transition to="end" />
+ </custom>
+
+ <end name="end" g="205,22,80,40"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/custom/process.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-03 14:32:39 UTC (rev 4982)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-03 15:49:54 UTC (rev 4983)
@@ -1675,7 +1675,63 @@
<para>The example test case also shows the other scenarios.
</para>
</section>
+ </section>
+
+ <!-- ### CUSTOM ####################################################### -->
+ <section id="custom">
+ <title><literal>custom</literal></title>
+
+ <para>Invokes user code that implements custom behaviour of an activity.
+ </para>
+
+ <para>A custom activity refers to user code. See <xref linkend="usercode" />
+ for more details on the specific attributes and elements. Let's look at
+ the example:
+ </para>
+
+ <programlisting><process name="Custom" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <start >
+ <transition to="print dots" />
+ </start>
+
+ <custom name="print dots"
+ class="org.jbpm.examples.custom.PrintDots">
+
+ <transition to="end" />
+ </custom>
+
+ <end name="end" />
+
+</process></programlisting>
+ <para>The custom activity behaviour class <literal>PrintDots</literal>
+ shows that it's possible to control the flow when implementing
+ custom activity behaviours. In this case the <literal>PrintDots</literal>
+ acitivity implementation will after printing dots wait in the activity until
+ a signal is given.
+ </para>
+ <programlisting>public class PrintDots implements ExternalActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ String executionId = execution.getId();
+
+ String dots = ...;
+
+ System.out.println(dots);
+
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution,
+ String signalName,
+ Map<String, ?> parameters) {
+ execution.take(signalName);
+ }
+}</programlisting>
+
</section>
</section>
@@ -2961,93 +3017,87 @@
<xref linkend="taskassignmenthandler" />. This section describes the
attributes and sub elements of those type of user code objects.
</para>
- <table><title>attributes:</title>
- <tgroup cols="5" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Attribute</entry>
- <entry>Type</entry>
- <entry>Default</entry>
- <entry>Required?</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>class</literal></entry>
- <entry>classname</entry>
- <entry></entry>
- <entry><emphasis role="bold">required</emphasis></entry>
- <entry>The fully qualified classname.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table><title>sub elements:</title>
- <tgroup cols="3" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Element</entry>
- <entry>Multiplicity</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>field</literal></entry>
- <entry>0..*</entry>
- <entry>describes a configuration value to be injected directly in
- a memberfield before this user class is used.</entry>
- </row>
- <row>
- <entry><literal>property</literal></entry>
- <entry>0..*</entry>
- <entry>describes a configuration value to injected through a setter
- method before this user object is used.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table><title><literal>field</literal> attributes:</title>
- <tgroup cols="5" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Attribute</entry>
- <entry>Type</entry>
- <entry>Default</entry>
- <entry>Required?</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>name</literal></entry>
- <entry>string</entry>
- <entry></entry>
- <entry><emphasis role="bold">required</emphasis></entry>
- <entry>the name of the field</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table><title><literal>field</literal> sub elements:</title>
- <tgroup cols="3" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Element</entry>
- <entry>Multiplicity</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>string</literal></entry>
- <entry>0..1</entry>
- <entry>represents a string value</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
+ <table><title>attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>class</literal></entry>
+ <entry>classname</entry>
+ <entry></entry>
+ <entry>one of {class|expr} is required</entry>
+ <entry>The fully qualified classname.</entry>
+ </row>
+ <row>
+ <entry><literal>expr</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>one of {class|expr} is required</entry>
+ <entry>The fully qualified classname.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title>sub elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>field</literal></entry>
+ <entry>0..*</entry>
+ <entry>describes a configuration value to be injected directly in
+ a memberfield before this user class is used.</entry>
+ </row>
+ <row>
+ <entry><literal>property</literal></entry>
+ <entry>0..*</entry>
+ <entry>describes a configuration value to injected through a setter
+ method before this user object is used.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title><literal>field</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>name</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>the name of the field</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>Inside <literal>field</literal> or <literal>property</literal> injections,
+ a lot of different value types can be specified, like <literal>string</literal>,
+ <literal>object</literal>, <literal>map</literal>, <literal>list</literal>
+ <literal>ref</literal> and so on. See jpdl schema docs for more options
+ </para>
</section>
</chapter>
16 years, 11 months
JBoss JBPM SVN: r4982 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/eventlistener and 4 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-03 10:32:39 -0400 (Wed, 03 Jun 2009)
New Revision: 4982
Modified:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/EndProcessInstanceTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/eventlistener/EventListenerTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/decision/expression/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/decision/handler/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/end/state/process.jpdl.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Services.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2252 update docs and examples to proper usage of API
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/EndProcessInstanceTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/EndProcessInstanceTest.java 2009-06-03 14:26:29 UTC (rev 4981)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/EndProcessInstanceTest.java 2009-06-03 14:32:39 UTC (rev 4982)
@@ -21,7 +21,7 @@
*/
package org.jbpm.examples.end.processinstance;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -47,7 +47,7 @@
}
public void testEndProcessInstance() {
- Execution execution = executionService.startProcessInstanceByKey("EndProcessInstance");
- assertTrue(execution.isEnded());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("EndProcessInstance");
+ assertTrue(processInstance.isEnded());
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/eventlistener/EventListenerTest.java 2009-06-03 14:26:29 UTC (rev 4981)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/eventlistener/EventListenerTest.java 2009-06-03 14:32:39 UTC (rev 4982)
@@ -4,6 +4,7 @@
import java.util.List;
import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -28,7 +29,9 @@
public void testEventListener() {
LogListener.logs = new ArrayList<String>();
- Execution execution = executionService.startProcessInstanceByKey("EventListener");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("EventListener");
+
+ Execution execution = processInstance.findActiveExecutionIn("wait");
executionService.signalExecutionById(execution.getId());
List<String> expectedLogs = new ArrayList<String>();
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/decision/expression/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/decision/expression/process.jpdl.xml 2009-06-03 14:26:29 UTC (rev 4981)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/decision/expression/process.jpdl.xml 2009-06-03 14:32:39 UTC (rev 4982)
@@ -3,17 +3,17 @@
<process name="DecisionExpression" xmlns="http://jbpm.org/4.0/jpdl">
<start g="16,102,48,48">
- <transition to="evaluate document" name=""/>
+ <transition to="evaluate document"/>
</start>
- <decision expr="#{content}" g="96,102,48,48" name="evaluate document">
- <transition g="120,60:-36,23" name="good" to="submit document"/>
- <transition g=":-15,-21" name="bad" to="try again"/>
- <transition g="120,189:-35,-41" name="ugly" to="give up"/>
+ <decision name="evaluate document" expr="#{content}" g="96,102,48,48">
+ <transition name="good" to="submit document" g="120,60:-36,23" />
+ <transition name="bad" to="try again" g=":-15,-21" />
+ <transition name="ugly" to="give up" g="120,189:-35,-41" />
</decision>
- <state g="175,35,122,52" name="submit document"/>
- <state g="176,100,122,52" name="try again"/>
- <state g="177,164,122,52" name="give up"/>
+ <state name="submit document" g="175,35,122,52" />
+ <state name="try again" g="176,100,122,52" />
+ <state name="give up" g="177,164,122,52" />
</process>
\ No newline at end of file
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/decision/handler/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/decision/handler/process.jpdl.xml 2009-06-03 14:26:29 UTC (rev 4981)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/decision/handler/process.jpdl.xml 2009-06-03 14:32:39 UTC (rev 4982)
@@ -6,15 +6,15 @@
<transition to="evaluate document" name=""/>
</start>
- <decision g="96,102,48,48" name="evaluate document">
+ <decision name="evaluate document" g="96,102,48,48">
<handler class="org.jbpm.examples.decision.handler.ContentEvaluation"/>
- <transition g="120,60:-37,22" name="good" to="submit document"/>
- <transition g=":-19,-22" name="bad" to="try again"/>
- <transition g="120,189:-33,-39" name="ugly" to="give up"/>
+ <transition name="good" to="submit document" g="120,60:-37,22" />
+ <transition name="bad" to="try again" g=":-19,-22" />
+ <transition name="ugly" to="give up" g="120,189:-33,-39" />
</decision>
- <state g="175,35,122,52" name="submit document"/>
- <state g="176,100,122,52" name="try again"/>
- <state g="177,164,122,52" name="give up"/>
+ <state name="submit document" g="175,35,122,52" />
+ <state name="try again" g="176,100,122,52" />
+ <state name="give up" g="177,164,122,52" />
</process>
\ No newline at end of file
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/end/state/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/end/state/process.jpdl.xml 2009-06-03 14:26:29 UTC (rev 4981)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/end/state/process.jpdl.xml 2009-06-03 14:32:39 UTC (rev 4982)
@@ -3,17 +3,17 @@
<process name="EndState" xmlns="http://jbpm.org/4.0/jpdl">
<start g="16,96,48,48">
- <transition to="get return code" name=""/>
+ <transition to="get return code"/>
</start>
- <state g="96,94,110,52" name="get return code">
- <transition g="150,63:-36,11" name="200" to="ok"/>
- <transition g=":-16,-27" name="400" to="bad request"/>
- <transition g="150,177:-33,-32" name="500" to="internal server error"/>
+ <state name="get return code" g="96,94,110,52">
+ <transition name="200" to="ok" g="150,63:-36,11"/>
+ <transition name="400" to="bad request" g=":-16,-27"/>
+ <transition name="500" to="internal server error" g="150,177:-33,-32"/>
</state>
- <end g="239,40,48,48" name="ok" state="completed"/>
- <end-cancel g="239,97,48,48" name="bad request"/>
- <end-error g="240,154,48,48" name="internal server error"/>
+ <end name="ok" state="completed" g="239,40,48,48"/>
+ <end-cancel name="bad request" g="239,97,48,48"/>
+ <end-error name="internal server error" g="240,154,48,48"/>
</process>
\ No newline at end of file
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Services.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Services.xml 2009-06-03 14:26:29 UTC (rev 4981)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Services.xml 2009-06-03 14:32:39 UTC (rev 4982)
@@ -244,7 +244,7 @@
<para>Simplest and most common way to start a new process instance for a process
definition is like this:
</para>
- <programlisting>executionService.startProcessInstanceByKey("ICL");</programlisting>
+ <programlisting>ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL");</programlisting>
<para>In this case, the service method will first look up the latest version of
the processes with key <literal>ICL</literal>. Then a new
process instance is started in that latest process definition.
@@ -260,7 +260,8 @@
<para>If instead you want to start a new process instance in a very
specific version, you can use the id of the process definition like this:
</para>
- <programlisting>executionService.startProcessInstanceById("ICL-1");</programlisting>
+ <programlisting>ProcessInstance processInstance =
+ executionService.startProcessInstanceById("ICL-1");</programlisting>
</section>
<section id="withakey">
@@ -271,7 +272,8 @@
to find such a key in the domain of the business process. For example, an
order id or an insurance claim number.
</para>
- <programlisting>executionService.startProcessInstanceByKey("ICL", "CL92837");</programlisting>
+ <programlisting>ProcessInstance processInstance =
+ executionService.startProcessInstanceByKey("ICL", "CL92837");</programlisting>
<para>The key is used to create the id of the process instance.
The format used is <literal>{process-key}.{execution-id}</literal>.
With a dot between process-key and execution-id.
@@ -280,8 +282,9 @@
</para>
<para>If no user defined key is provided, the DB primary key is taken
as the key. In that case, the id can be retrieved like this:
- <programlisting>Execution execution = executionService.startProcessInstanceByKey("ICL");
-String executionId = execution.getId();</programlisting>
+ <programlisting>ProcessInstance processInstance =
+ executionService.startProcessInstanceByKey("ICL");
+String pid = processInstance.getId();</programlisting>
</para>
<para>We recommend the use of a user defined keys. Typically in your application
code, you'll have the key available. By providing a user defined key, you can
@@ -297,51 +300,57 @@
instance between creation and start of the process instance.
</para>
<programlisting>Map<String,Object> variables = new HashMap<String,Object>();
-variables.put("customer", "John Doe");
-variables.put("type", "Accident");
-variables.put("amount", new Float(763.74));
+variables.put("customer", "John Doe");
+variables.put("type", "Accident");
+variables.put("amount", new Float(763.74));
-executionService.startProcessInstanceByKey("ICL", variables);</programlisting>
+ProcessInstance processInstance =
+ executionService.startProcessInstanceByKey("ICL", variables);</programlisting>
</section>
</section>
<section id="singallingawaitingexecution">
<title>Signalling a waiting execution</title>
- <para>A process definition describes what must be done in terms of activities.
- Each activity in a process is either to be performed by the process
- system or by an external participant. When an activity is to be performed
- by an external participant, then the execution must wait until the
- external participant notifies the process system that the activity is
- completed. So an execution is either executing or waiting on an external
- participant. Typically, you'll see that the processes are mostly
- waiting for external participations. Especially humans tend to be slow :-)
- The time consumed by the process system between two wait states is
- typically very small.
+ <para>When using a <literal>state</literal> activity, the execution (or process instance)
+ will wait when it arrives in the state, waiting for a signal (aka external trigger).
+ Methods <literal>signalExecution</literal> can be used for that. Executions are
+ referenced by an execution id (String).
</para>
- <para>A <literal>state</literal> is the basic activity that represents
- something has to be done by an external participant and the execution
- must wait until a signal (aka external trigger) is given.
+ <para>In some cases, the execution that arrives in a state will be the process instance
+ itself. But that is not always the case. In case of timers or concurrency, a process
+ is the root execution of a tree of executions. So you have to make sure that you signal
+ the right path of execution.
</para>
- <para>When an execution is in a wait state, it can be given an external trigger
- with one of the signal methods. The recommended way to reference an execution
- is by using the process definition and execution key. In the next code snippet,
- <literal>ICL</literal> refers to the process definition key and <literal>82436</literal>
- refers to the execution key.
+ <para>The preferred way to capture the right execution is by associating an event listener to
+ the state activity like this:
</para>
- <programlisting>executionService.signalExecutionByKey("ICL", "82436");</programlisting>
- <para>Alternatively, the execution that must be signaled can be referenced
- by a unique execution id. In the next snippet, <literal>ICL.82436</literal>
- refers to the executionId.</para>
- <programlisting>executionService.signalExecutionById("ICL.82436");</programlisting>
- <para>Optionally some data can be passed along with a signal: a <literal>signalName</literal>
- and <literal>parameters</literal>. How the signalName gets used depends on
- the execution's current activity. The parameters get stored as process variables.
+ <programlisting><state name="wait">
+ <on event="start">
+ <event-listener class="org.jbpm.examples.StartExternalWork" />
+ </on>
+ ...
+</state></programlisting>
+ <para>In event listener <literal>StartExternalWork</literal> you can kick off what needs to
+ be done externally. In that event listener you can also obtain the exact execution id
+ with <literal>execution.getId()</literal>. It's that executionId that you'll need to provide
+ the signal later on when the external work is done:
</para>
- <programlisting>Map<String,Object> parameters = new HashMap<String,Object>();
-parameters.put("quality", "a+");
-parameters.put("target", "profit");
+ <programlisting>executionService.signalExecutionById(executionId);</programlisting>
+ <para>There is an alternatively (less preferrable) way to obtain the executionId
+ when the execution arrives in the <literal>state</literal> activity.
+ It's only possible to obtain the execution id this way if you know after which jBPM
+ API call the execution will have entered the <literal>state</literal> activity:
+ </para>
+ <programlisting>// assume that we know that after the next call
+// the process instance will arrive in <literal>state</literal> external work
-executionService.signalExecutionById("ICL/82436", "Accept", parameters);</programlisting>
+ProcessInstance processInstance =
+ executionService.startProcessInstanceById(processDefinitionId);
+// or ProcessInstance processInstance =
+// executionService.signalProcessInstanceById(executionId);
+
+Execution execution = processInstance.findActiveExecutionIn("external work");
+String executionId = execution.getId();</programlisting>
</section>
<section id="taskservice">
@@ -370,26 +379,48 @@
a task means that this user will be set as the assignee. After that, other users
will be blocked from taking the task.
</para>
- <programlisting></programlisting>
- <para>
- People should not work on
- a task unless they are assigned to that task. The user interface should display
+ <para>People should not work on
+ a task unless they are assigned to that task. The user interface displays
forms and allow users to complete tasks if they are assigned to it.
For unassigned tasks for which the user is a candidate, the only action that
- should be exposed is 'take'. Since taking a task boiles down to setting the
- assignee to the current user, we didn't introduce a separate method for that.
+ should be exposed is 'take'.
</para>
- <para>More on tasks in <xref linkend="tasks" /> </para>
+ <para>More on tasks in <xref linkend="task" /> </para>
</section>
<section id="historyservice">
<title>HistoryService</title>
- <para>TODO</para>
+ <para>During runtime execution of process instances, events are generated. And from
+ those events, history information on both running and completed process executions are
+ collected in the history tables. The <literal>HistoryService</literal> provides
+ access to that information.
+ </para>
+ <para>Querying for all process instances for a specific process definition can be
+ done like this:</para>
+ <programlisting>List<HistoryProcessInstance> historyProcessInstances = historyService
+ .createHistoryProcessInstanceQuery()
+ .processDefinitionId("ICL-1")
+ .orderAsc(HistoryProcessInstanceQuery.PROPERTY_STARTTIME)
+ .list();</programlisting>
+ <para>Also individual activity executions are stored in the history information as
+ <literal>HistoryActivityInstance</literal>s.
+ </para>
+ <programlisting>List<HistoryActivityInstance> histActInsts = historyService
+ .createHistoryActivityInstanceQuery()
+ .processDefinitionId("ICL-1")
+ .activityName("a")
+ .list();</programlisting>
+ <para>Convenience methods <literal>avgDurationPerActivity</literal> and
+ <literal>choiceDistribution</literal> are also available. See javadocs for more
+ information on those methods.
+ </para>
</section>
<section id="managementservice">
<title>ManagementService</title>
- <para>TODO</para>
+ <para>The management service is mostly used to manage the jobs. See javadocs for
+ more information. This functionality is also exposed through the console.
+ </para>
</section>
</chapter>
\ No newline at end of file
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-03 14:26:29 UTC (rev 4981)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-03 14:32:39 UTC (rev 4982)
@@ -202,12 +202,21 @@
</process></programlisting>
<para>After you start an execution like this:</para>
- <programlisting>Execution execution = executionService.startProcessInstanceByKey("StateSequence");</programlisting>
+ <programlisting>ProcessInstance processInstance =
+ executionService.startProcessInstanceByKey("StateSequence");</programlisting>
<para>the created process instance will be positioned in
state <literal>a</literal>. Providing an external trigger can
be done with the <literal>signalExecution</literal> methods.</para>
- <programlisting>String executionId = execution.getId();
-execution = executionService.signalExecutionById(executionId);</programlisting>
+ <programlisting>Execution executionInA = processInstance.findActiveExecutionIn("a");
+assertNotNull(executionInA);
+
+processInstance = executionService.signalExecutionById(executionInA.getId());
+Execution executionInB = processInstance.findActiveExecutionIn("b");
+assertNotNull(executionInB);
+
+processInstance = executionService.signalExecutionById(executionInB.getId());
+Execution executionInC = processInstance.findActiveExecutionIn("c");
+assertNotNull(executionInC);</programlisting>
</section>
<section id="statechoice">
<title><literal>state</literal> choice</title>
@@ -236,14 +245,21 @@
</process></programlisting>
<para>Let's start a new process instance for this process definition:</para>
- <programlisting>Execution execution = executionService.startProcessInstanceByKey("StateSequence");</programlisting>
+ <programlisting>ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("StateChoice");</programlisting>
<para>Now, the execution is arrived in the <literal>wait for response</literal>.
The execution will wait there until an external trigger is given. In case
a <literal>state</literal> has multiple outgoing transitions, the signalName given
in the external trigger will be matched against the name of the outgoing transition
to take. So when we provide signalName <literal>accept</literal> like this:
</para>
- <programlisting>executionService.signalExecutionById(executionId, "accept");</programlisting>
+ <programlisting>String executionId = processInstance
+ .findActiveExecutionIn("wait for response")
+ .getId();
+
+processInstance = executionService.signalExecutionById(executionId, "accept");
+
+assertTrue(processInstance.isActive("submit document"));</programlisting>
<para>Then the execution will continue over the outgoing transition named
<literal>accept</literal>. Analogue, when signalName <literal>reject</literal>
is given in the signalExecutionXxx methods, the execution will continue over
@@ -329,6 +345,14 @@
<state name="give up" />
</process></programlisting>
+ <para>After starting a process instance with <literal>good content</literal></para>
+ <programlisting>Map<String, Object> variables = new HashMap<String, Object>();
+variables.put("content", "good");
+ProcessInstance processInstance =
+ executionService.startProcessInstanceByKey("DecisionConditions", variables);</programlisting>
+ <para>The activity <literal>submit document</literal> will be active</para>
+ <programlisting>assertTrue(processInstance.isActive("submit document"));</programlisting>
+ <para>See the example unit test for more scenarios.</para>
</section>
<section id="decisionexpression">
@@ -375,23 +399,32 @@
<title>The decision expression example process</title>
<mediaobject><imageobject><imagedata align="center" fileref="images/process.decision.png"/></imageobject></mediaobject>
</figure>
- <programlisting><process name="Poolcar">
- <start>
- <transition to="How far?" />
+ <programlisting><process name="DecisionExpression" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <start >
+ <transition to="evaluate document"/>
</start>
- <decision name="How far?" <emphasis role="bold">expr="#{distance}"</emphasis>>
- <transition name="far" to="Big car" />
- <transition name="nearby" to="Small car" />
+
+ <decision name="evaluate document" <emphasis role="bold">expr="#{content}"</emphasis> >
+ <transition <emphasis role="bold">name="good"</emphasis> to="submit document" />
+ <transition <emphasis role="bold">name="bad"</emphasis> to="try again" />
+ <transition <emphasis role="bold">name="ugly"</emphasis> to="give up" />
</decision>
- <state name="Big car" />
- <state name="Small car" />
+
+ <state name="submit document" />
+ <state name="try again" />
+ <state name="give up" />
+
</process></programlisting>
- <para>When you start an new process instance like this
+ <para>When you start an new process instance with good content like this
</para>
<programlisting>Map<String, Object> variables = new HashMap<String, Object>();
-variables.put("distance", "far");
-Execution execution = executionService.startProcessInstanceByKey("Poolcar", variables);</programlisting>
- <para>then the new execution will go to activity <literal>Big car</literal>.</para>
+variables.put("content", "good");
+ProcessInstance processInstance =
+ executionService.startProcessInstanceByKey("DecisionExpression", variables);</programlisting>
+
+ <para>then the new execution will go to activity <literal>submit document</literal>.</para>
+ <para>See the example unit test for the other scenarios.</para>
</section>
<section id="decisionhandler">
@@ -651,10 +684,9 @@
</programlisting>
<para>Now if we would start an execution and signal it to move out of the <literal>get return code</literal> wait state with the
following code, the execution would end with the <literal>bad request</literal> end event.</para>
- <programlisting>Execution execution = executionService.startProcessInstanceByKey("EndMultiple");
-String executionId = execution.getId();
-execution = executionService.signalExecutionById(executionId, "400");
- </programlisting>
+ <programlisting>ProcessInstance processInstance = executionService.startProcessInstanceByKey("EndMultiple");
+String pid = processInstance.getId();
+processInstance = executionService.signalExecutionById(pid, "400");</programlisting>
<para>Likewise, using the value <literal>200</literal> or <literal>500</literal> would cause the execution
to end with the <literal>ok</literal> or with the <literal>internal server error</literal> end events
respectively.</para>
@@ -717,9 +749,7 @@
</programlisting>
<para>This time, if we would start an execution and signal it to move out of the <literal>get return code</literal> wait state with the
following code, the execution would end with the <literal>cancel</literal> state.</para>
- <programlisting>Execution execution = executionService.startProcessInstanceByKey("EndState");
-String executionId = execution.getId();
-execution = executionService.signalExecutionById(executionId, "400");
+ <programlisting>TODO (paste the code snippit)
</programlisting>
<para>Similarly as above, using the value <literal>200</literal> or <literal>500</literal> would cause the execution
to end with the <literal>completed</literal> or with the <literal>error</literal> states
@@ -816,7 +846,7 @@
variable.</para>
<programlisting>Map<String, Object> variables = new HashMap<String, Object>();
variables.put("order", new Order("johndoe"));
-Execution execution = executionService
+ProcessInstance processInstance = executionService
.startProcessInstanceByKey("TaskAssignee", variables);</programlisting>
<para>Then the task list for <literal>johndoe</literal> can be obtained like this.</para>
<programlisting>List<Task> taskList = taskService.findPersonalTasks("johndoe");</programlisting>
@@ -2415,10 +2445,11 @@
}
}</programlisting>
<para>Next, we start a new process instance.</para>
- <programlisting>Execution execution = executionService.startProcessInstanceByKey("EventListener");</programlisting>
+ <programlisting>ProcessInstance processInstance = executionService.startProcessInstanceByKey("EventListener");</programlisting>
<para>Then the process instance executes up to the wait activity. So we provide a signal
and that will cause it to execute till the end.</para>
- <programlisting>executionService.signalExecutionById(execution.getId());</programlisting>
+ <programlisting>Execution execution = processInstance.findActiveExecutionIn("wait");
+executionService.signalExecutionById(execution.getId());</programlisting>
<para>The list of log messages will now look like this:</para>
<programlisting>[event(start) on process(EventListener),
event(start) on activity(wait),
16 years, 11 months
JBoss JBPM SVN: r4981 - jbpm4/trunk/modules/distro/src/main/files/db.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-03 10:26:29 -0400 (Wed, 03 Jun 2009)
New Revision: 4981
Modified:
jbpm4/trunk/modules/distro/src/main/files/db/build.xml
Log:
JBPM-2294 trying to fix postgres schema cleaning
Modified: jbpm4/trunk/modules/distro/src/main/files/db/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/db/build.xml 2009-06-03 11:00:29 UTC (rev 4980)
+++ jbpm4/trunk/modules/distro/src/main/files/db/build.xml 2009-06-03 14:26:29 UTC (rev 4981)
@@ -32,8 +32,8 @@
url="${jdbc.url}"
userid="${jdbc.username}"
password="${jdbc.password}"
- onerror="continue">
- <transaction src="${jbpm.home}/db/schema.scripts/jbpm.${database}.create.sql"/>
+ onerror="continue"
+ src="${jbpm.home}/db/schema.scripts/jbpm.${database}.create.sql">
<classpath>
<fileset dir="${jbpm.home}/lib">
<include name="*.jar"/>
@@ -50,8 +50,8 @@
url="${jdbc.url}"
userid="${jdbc.username}"
password="${jdbc.password}"
- onerror="continue">
- <transaction src="${jbpm.home}/db/schema.scripts/jbpm.${database}.drop.sql"/>
+ onerror="continue"
+ src="${jbpm.home}/db/schema.scripts/jbpm.${database}.drop.sql">
<classpath>
<fileset dir="${jbpm.home}/lib">
<include name="*.jar"/>
16 years, 11 months
JBoss JBPM SVN: r4980 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/identity and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-03 07:00:29 -0400 (Wed, 03 Jun 2009)
New Revision: 4980
Removed:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java
Log:
JBPM-2294 refactored identity tests so that no users are left in the db
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java 2009-06-03 10:38:53 UTC (rev 4979)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java 2009-06-03 11:00:29 UTC (rev 4980)
@@ -21,7 +21,9 @@
*/
package org.jbpm.test.identity;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.jbpm.api.identity.Group;
import org.jbpm.api.identity.User;
@@ -35,6 +37,102 @@
public void testSingleUser() throws Exception {
identityService.createUser("johndoe", "John", "Doe");
+ User user = identityService.findUserById("johndoe");
+
+ assertEquals("johndoe", user.getId());
+ assertEquals("John", user.getGivenName());
+ assertEquals("Doe", user.getFamilyName());
+
+ identityService.deleteUser("johndoe");
+ }
+
+ public void testCreateGroup() throws Exception {
+ String testGroupId = identityService.createGroup("testGroup", Group.TYPE_UNIT, null);
+
+ Group group = identityService.findGroupById(testGroupId);
+ assertEquals("testGroup", group.getName());
+ assertEquals(Group.TYPE_UNIT, group.getType());
+
+ identityService.deleteGroup(testGroupId);
+ }
+
+ public void testFindGroupsByUser() throws Exception {
+ String redhatGroupId = identityService.createGroup("redhat", Group.TYPE_UNIT, null);
+
+ identityService.createUser("jeffyu", "Jeff", "Yu");
+ identityService.createMembership("jeffyu", redhatGroupId);
+
+ List<Group> groups = identityService.findGroupsByUser("jeffyu");
+ assertTrue(groups.size() > 0);
+
+ Set<String> groupNames = new HashSet<String>();
+ for (Group group : groups) {
+ groupNames.add(group.getName());
+ }
+
+ Set<String> expectedGroupNames = new HashSet<String>();
+ expectedGroupNames.add("redhat");
+
+ assertEquals(expectedGroupNames, groupNames);
+
+ identityService.deleteUser("jeffyu");
+ identityService.deleteGroup(redhatGroupId);
+ }
+
+ public void testFindGroupByUserAndGroupType() throws Exception {
+
+ identityService.createUser("johndoe", "John", "Doe");
+ String redhatGroupId = identityService.createGroup("redhat", Group.TYPE_UNIT, null);
+ identityService.createMembership("johndoe", redhatGroupId, "Developer");
+
+ List<Group> groups = identityService.findGroupsByUserAndGroupType("johndoe", Group.TYPE_UNIT);
+ assertTrue(groups.size() > 0);
+
+ Set<String> groupNames = new HashSet<String>();
+ for (Group group : groups) {
+ groupNames.add(group.getName());
+ }
+
+ Set<String> expectedGroupNames = new HashSet<String>();
+ expectedGroupNames.add("redhat");
+
+ assertEquals(expectedGroupNames, groupNames);
+
+ identityService.deleteUser("johndoe");
+ identityService.deleteGroup(redhatGroupId);
+ }
+
+ public void testSingleGroup() throws Exception {
+ identityService.createUser("johndoe", "John", "Doe");
+ identityService.createUser("joesmoe", "Joe", "Smoe");
+ identityService.createUser("jackblack", "Jack", "Black");
+
+ String redhatGroupId = identityService.createGroup("redhat", Group.TYPE_UNIT, null);
+ String jbossId = identityService.createGroup("jboss", Group.TYPE_UNIT, redhatGroupId);
+ String jbpmId = identityService.createGroup("jbpm", Group.TYPE_UNIT, jbossId);
+
+ identityService.createMembership("johndoe", redhatGroupId, "Developer");
+ identityService.createMembership("joesmoe", jbpmId, "leader");
+ identityService.createMembership("jackblack", jbossId, "manager");
+
+ List<Group> groups = identityService.findGroupsByUserAndGroupType("johndoe", Group.TYPE_UNIT);
+
+ assertEquals(1, groups.size());
+ Group group = groups.get(0);
+ assertEquals("redhat", group.getName());
+
+ identityService.deleteGroup(jbpmId);
+ identityService.deleteGroup(jbossId);
+ identityService.deleteGroup(redhatGroupId);
+
+ identityService.deleteUser("johndoe");
+ identityService.deleteUser("joesmoe");
+ identityService.deleteUser("jackblack");
+ }
+
+ public void testSingleUser2() throws Exception {
+ identityService.createUser("johndoe", "John", "Doe");
+
List<User> users = identityService.findUsers();
assertNotNull(users);
assertEquals(1, users.size());
@@ -49,24 +147,4 @@
assertEquals(0, identityService.findUsers().size());
}
-
- public void testSingleGroup() throws Exception {
- identityService.createUser("johndoe", "John", "Doe");
- identityService.createUser("joesmoe", "Joe", "Smoe");
- identityService.createUser("jackblack", "Jack", "Black");
-
- String redhatId = identityService.createGroup("redhat", Group.TYPE_UNIT, null);
- String jbossId = identityService.createGroup("jboss", Group.TYPE_UNIT, "redhat");
- String jbpmId = identityService.createGroup("jbpm", Group.TYPE_UNIT, "jboss");
-
- identityService.createMembership("johndoe", jbpmId, "developer");
- identityService.createMembership("joesmoe", jbpmId, "developer");
- identityService.createMembership("jackblack", jbossId, "manager");
-
- List<Group> groups = identityService.findGroupsByUserAndGroupType("jackblack", Group.TYPE_UNIT);
-
- assertEquals(1, groups.size());
- Group group = groups.get(0);
- assertEquals("unit.jboss", group.getId());
- }
}
16 years, 11 months
JBoss JBPM SVN: r4979 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/api/activity and 33 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-03 06:38:53 -0400 (Wed, 03 Jun 2009)
New Revision: 4979
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Execution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/activity/ActivityExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientProcessDefinition.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/AsyncActivityTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/conditions/DecisionConditionsTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/expression/DecisionExpressionTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/DecisionHandlerTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/EndMultipleTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/EndStateTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskDispatcherPluginImpl.java
jbpm4/trunk/modules/integration/graphView-plugin/.project
jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/embedded/Loan.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/FindExecutionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskCandidatesTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/AutomaticDecisionTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/BasicExecutionFlowTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/EventTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExceptionHandlerTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExternalDecisionTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/FunctionalActivityTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/LoopingTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/SubProcessTest.java
jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionEventsTest.java
Log:
JBPM-2252 removed access to getActivityName from the Execution API
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Execution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Execution.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Execution.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -162,19 +162,12 @@
/** a globally unique identifier for this execution. */
String getId();
- /** represents the current position in the process by indicating the
- * name of the current activity. */
- String getActivityName();
-
/** the <a href="#state">state</a> of this execution. */
String getState();
/** is this a process instance */
boolean isProcessInstance();
- /** is this execution active ? This is the inverse of {@link #isLocked()}. */
- boolean isActive();
-
/** is this execution ended */
boolean isEnded();
@@ -203,7 +196,7 @@
/** the child executions in the <a href="package-summary.html#basicexecutionstructure">execution
* structure</a>. Can be null and can be an empty collection. */
- Collection<Execution> getExecutions();
+ Collection<? extends Execution> getExecutions();
/** maps child execution names to execution objects. In case multiple executions
* have the same name, the first one is taken. Can be null or can be an empty
@@ -227,6 +220,11 @@
* @see #findActiveExecutionIn(String) */
Set<String> findActiveActivityNames();
+ /** is the given activity active.
+ * This execution and its child executions are searched. If this is a
+ * process instance, this means that the whole process instance is searched. */
+ boolean isActive(String activityName);
+
/** id of the process definition used for this execution */
String getProcessDefinitionId();
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/activity/ActivityExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/activity/ActivityExecution.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/activity/ActivityExecution.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -36,6 +36,14 @@
*/
public interface ActivityExecution extends OpenExecution {
+ /** represents the current position in the process by indicating the
+ * name of the current activity. */
+ String getActivityName();
+
+ /** the current activity. */
+ Activity getActivity();
+
+
// wait state behaviour /////////////////////////////////////////////////////
/** makes this execution wait in the current activity until an external trigger is given
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientExecution.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientExecution.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -74,7 +74,7 @@
* <p>Typically a signal will cause the execution to start executing, but that is
* not a must. What happens with this signal is defined in the
* {@link ExternalActivityBehaviour#signal(Execution, String, Map)} of
- * the {@link #getActivity() current activity}. </p>
+ * the current activity. </p>
*
* @see #signal(String) */
void signal();
@@ -134,7 +134,7 @@
* <p>Typically a signal will cause the execution to start executing, but that is
* not a must. What happens with this signal is defined in the
* {@link ExternalActivityBehaviour#signal(Execution, String, Map)} of
- * the {@link #getActivity() current activity}. </p>
+ * the current activity. </p>
*
* @see #signal(String) */
void signal(Execution execution);
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientProcessDefinition.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientProcessDefinition.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -58,7 +58,7 @@
ClientProcessInstance createProcessInstance(String key, Execution superProcessExecution);
/** creates the process instance and immediately start its execution. */
- ClientExecution startProcessInstance();
+ ClientProcessInstance startProcessInstance();
/** creates the process instance with the given key and immediately start its
* execution.
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -47,9 +47,6 @@
/** the process definition for this execution.*/
OpenProcessDefinition getProcessDefinition();
- /** the current activity */
- Activity getActivity();
-
/** update the state */
void setState(String state);
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/AsyncActivityTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/AsyncActivityTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/AsyncActivityTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -53,7 +53,6 @@
String processInstanceId = processInstance.getId();
assertEquals(Execution.STATE_ASYNC, processInstance.getState());
- assertEquals("generate pdf", processInstance.getActivityName());
Job job = managementService.createJobQuery()
.processInstanceId(processInstanceId)
@@ -63,7 +62,6 @@
processInstance = executionService.findProcessInstanceById(processInstanceId);
assertEquals(Execution.STATE_ASYNC, processInstance.getState());
- assertEquals("calculate primes", processInstance.getActivityName());
job = managementService.createJobQuery()
.processInstanceId(processInstanceId)
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -21,11 +21,9 @@
*/
package org.jbpm.examples.concurrency.graphbased;
-import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import org.jbpm.api.Execution;
import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -60,7 +58,7 @@
expectedActivityNames.add("load truck");
expectedActivityNames.add("print shipping documents");
- assertEquals(expectedActivityNames, getActiveActivityNames(processInstance));
+ assertEquals(expectedActivityNames, processInstance.findActiveActivityNames());
assertNotNull(processInstance.findActiveExecutionIn("send invoice"));
assertNotNull(processInstance.findActiveExecutionIn("load truck"));
@@ -70,7 +68,7 @@
processInstance = executionService.signalExecutionById(sendInvoiceExecutionId);
expectedActivityNames.remove("send invoice");
- assertEquals(expectedActivityNames, getActiveActivityNames(processInstance));
+ assertEquals(expectedActivityNames, processInstance.findActiveActivityNames());
assertNotNull(processInstance.findActiveExecutionIn("load truck"));
assertNotNull(processInstance.findActiveExecutionIn("print shipping documents"));
@@ -79,7 +77,7 @@
processInstance = executionService.signalExecutionById(loadTruckExecutionId);
expectedActivityNames.remove("load truck");
- assertEquals(expectedActivityNames, getActiveActivityNames(processInstance));
+ assertEquals(expectedActivityNames, processInstance.findActiveActivityNames());
assertNotNull(processInstance.findActiveExecutionIn("print shipping documents"));
@@ -88,7 +86,7 @@
expectedActivityNames.remove("print shipping documents");
expectedActivityNames.add("drive truck to destination");
- assertEquals(expectedActivityNames, getActiveActivityNames(processInstance));
+ assertEquals(expectedActivityNames, processInstance.findActiveActivityNames());
assertNotNull(processInstance.findActiveExecutionIn("drive truck to destination"));
@@ -97,24 +95,4 @@
assertNull("execution "+pid+" should not exist", executionService.findExecutionById(pid));
}
-
- public Set<String> getActiveActivityNames(ProcessInstance processInstance) {
- return getActiveActivityNames(processInstance, new HashSet<String>());
- }
-
- public Set<String> getActiveActivityNames(Execution execution, Set<String> activityNames) {
- if (execution.isActive()) {
- activityNames.add(execution.getActivityName());
- }
- Collection<Execution> childExecutions = execution.getExecutions();
- if (childExecutions!=null) {
- for (Execution childExecution: childExecutions) {
- if (childExecution!=null) {
-
- }
- getActiveActivityNames(childExecution, activityNames);
- }
- }
- return activityNames;
- }
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/conditions/DecisionConditionsTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/conditions/DecisionConditionsTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/conditions/DecisionConditionsTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -25,6 +25,7 @@
import java.util.Map;
import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -52,22 +53,21 @@
public void testDecisionConditionsGood() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "good");
- Execution execution = executionService.startProcessInstanceByKey("DecisionConditions", variables);
- assertEquals("submit document", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionConditions", variables);
+ assertTrue(processInstance.isActive("submit document"));
}
public void testDecisionConditionsBad() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "bad");
- Execution execution = executionService.startProcessInstanceByKey("DecisionConditions", variables);
- assertEquals("try again", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionConditions", variables);
+ assertTrue(processInstance.isActive("try again"));
}
public void testDecisionConditionsUgly() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "ugly");
- Execution execution = executionService.startProcessInstanceByKey("DecisionConditions", variables);
- assertEquals("give up", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionConditions", variables);
+ assertTrue(processInstance.isActive("give up"));
}
-
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/expression/DecisionExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/expression/DecisionExpressionTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/expression/DecisionExpressionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -24,7 +24,7 @@
import java.util.HashMap;
import java.util.Map;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -52,21 +52,21 @@
public void testDecisionExpressionGood() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "good");
- Execution execution = executionService.startProcessInstanceByKey("DecisionExpression", variables);
- assertEquals("submit document", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionExpression", variables);
+ assertTrue(processInstance.isActive("submit document"));
}
public void testDecisionExpressionBad() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "bad");
- Execution execution = executionService.startProcessInstanceByKey("DecisionExpression", variables);
- assertEquals("try again", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionExpression", variables);
+ assertTrue(processInstance.isActive("try again"));
}
public void testDecisionExpressionUgly() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "ugly");
- Execution execution = executionService.startProcessInstanceByKey("DecisionExpression", variables);
- assertEquals("give up", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionExpression", variables);
+ assertTrue(processInstance.isActive("give up"));
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/DecisionHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/DecisionHandlerTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/DecisionHandlerTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -25,6 +25,7 @@
import java.util.Map;
import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -52,21 +53,21 @@
public void testDecisionHandlerGreat() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "you're great");
- Execution execution = executionService.startProcessInstanceByKey("DecisionHandler", variables);
- assertEquals("submit document", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionHandler", variables);
+ assertTrue(processInstance.isActive("submit document"));
}
public void testDecisionHandlerImprove() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "you gotta improve");
- Execution execution = executionService.startProcessInstanceByKey("DecisionHandler", variables);
- assertEquals("try again", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionHandler", variables);
+ assertTrue(processInstance.isActive("try again"));
}
public void testDecisionHandlerSuck() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("content", "you suck");
- Execution execution = executionService.startProcessInstanceByKey("DecisionHandler", variables);
- assertEquals("give up", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DecisionHandler", variables);
+ assertTrue(processInstance.isActive("give up"));
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/EndMultipleTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/EndMultipleTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/EndMultipleTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -21,7 +21,7 @@
*/
package org.jbpm.examples.end.multiple;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -47,26 +47,23 @@
}
public void testEndMultipleOk() {
- Execution execution = executionService.startProcessInstanceByKey("EndMultiple");
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId, "200");
- assertTrue(execution.isEnded());
- assertEquals("ok", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("EndMultiple");
+ String pid = processInstance.getId();
+ processInstance = executionService.signalExecutionById(pid, "200");
+ assertTrue(processInstance.isEnded());
}
public void testEndMultipleBadRequest() {
- Execution execution = executionService.startProcessInstanceByKey("EndMultiple");
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId, "400");
- assertTrue(execution.isEnded());
- assertEquals("bad request", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("EndMultiple");
+ String executionId = processInstance.getId();
+ processInstance = executionService.signalExecutionById(executionId, "400");
+ assertTrue(processInstance.isEnded());
}
public void testEndMultipleInternalServerError() {
- Execution execution = executionService.startProcessInstanceByKey("EndMultiple");
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId, "500");
- assertTrue(execution.isEnded());
- assertEquals("internal server error", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("EndMultiple");
+ String executionId = processInstance.getId();
+ processInstance = executionService.signalExecutionById(executionId, "500");
+ assertTrue(processInstance.isEnded());
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/EndStateTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/EndStateTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/EndStateTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -21,7 +21,7 @@
*/
package org.jbpm.examples.end.state;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -47,26 +47,26 @@
}
public void testEndStateCompleted() {
- Execution execution = executionService.startProcessInstanceByKey("EndState");
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId, "200");
- assertEquals("completed", execution.getState());
- assertEquals("ok", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("EndState");
+ String pid = processInstance.getId();
+ processInstance = executionService.signalExecutionById(pid, "200");
+ assertEquals("completed", processInstance.getState());
+ assertTrue(processInstance.isEnded());
}
public void testEndStateErrorBadRequest() {
- Execution execution = executionService.startProcessInstanceByKey("EndState");
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId, "400");
- assertEquals("cancel", execution.getState());
- assertEquals("bad request", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("EndState");
+ String pid = processInstance.getId();
+ processInstance = executionService.signalExecutionById(pid, "400");
+ assertEquals("cancel", processInstance.getState());
+ assertTrue(processInstance.isEnded());
}
public void testEndStateErrorInternalServerError() {
- Execution execution = executionService.startProcessInstanceByKey("EndState");
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId, "500");
- assertEquals("error", execution.getState());
- assertEquals("internal server error", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("EndState");
+ String executionId = processInstance.getId();
+ processInstance = executionService.signalExecutionById(executionId, "500");
+ assertEquals("error", processInstance.getState());
+ assertTrue(processInstance.isEnded());
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -56,7 +56,7 @@
processInstance = executionService.signalExecutionById(executionId, "accept");
- assertEquals("submit document", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("submit document"));
}
public void testStateChoiceReject() {
@@ -68,7 +68,7 @@
.getId();
processInstance = executionService.signalExecutionById(executionId, "reject");
-
- assertEquals("try again", processInstance.getActivityName());
+
+ assertTrue(processInstance.isActive("try again"));
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -25,7 +25,7 @@
import java.util.List;
import java.util.Map;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -54,8 +54,8 @@
public void testTaskAssignee() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("order", new Order("johndoe"));
- Execution execution = executionService.startProcessInstanceByKey("TaskAssignee", variables);
- String executionId = execution.getId();
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskAssignee", variables);
+ String pid = processInstance.getId();
List<Task> taskList = taskService.findPersonalTasks("johndoe");
assertEquals(1, taskList.size());
@@ -71,7 +71,7 @@
assertEquals(0, taskList.size());
// verify that process moved to the next state
- execution = executionService.findExecutionById(executionId);
- assertEquals("wait", execution.getActivityName());
+ processInstance = executionService.findProcessInstanceById(pid);
+ assertTrue(processInstance.isActive("wait"));
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -23,7 +23,7 @@
import java.util.List;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -66,8 +66,8 @@
}
public void testGroupCandidateAssignment() {
- Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
- String executionId = execution.getId();
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskCandidates");
+ String pid = processInstance.getId();
// both johndoe and joesmoe will see the task in their *group* task list
List<Task> taskList = taskService.findGroupTasks("johndoe");
@@ -117,7 +117,7 @@
assertEquals(0, taskList.size());
// verify that process moved to the next state
- execution = executionService.findExecutionById(executionId);
- assertEquals("wait", execution.getActivityName());
+ processInstance = executionService.findProcessInstanceById(pid);
+ assertTrue(processInstance.isActive("wait"));
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -79,7 +79,7 @@
processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertEquals("next step", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("next step"));
List<Job> jobs = managementService.createJobQuery()
.processInstanceId(processInstance.getId())
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -24,7 +24,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.api.job.Job;
import org.jbpm.test.JbpmTestCase;
@@ -50,7 +50,7 @@
}
public void testTimerTransitionTimerFires() {
- Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerTransition");
Job job = managementService.createJobQuery()
.timers()
@@ -59,21 +59,21 @@
managementService.executeJob(job.getDbid());
- processInstance = executionService.findExecutionById(processInstance.getId());
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertEquals("escalation", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("escalation"));
}
public void testTimerTransitionContinueBeforeTimerFires() {
- Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerTransition");
String executionId = processInstance.findActiveExecutionIn("guardedWait").getId();
executionService.signalExecutionById(executionId, "go on");
- processInstance = executionService.findExecutionById(processInstance.getId());
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertEquals("next step", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("next step"));
List<Job> jobs = managementService.createJobQuery()
.processInstanceId(processInstance.getId())
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -21,6 +21,11 @@
*/
package org.jbpm.integration.console;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
import org.jboss.bpm.console.client.model.ParticipantRef;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
@@ -35,11 +40,6 @@
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -59,7 +59,7 @@
}
- public static ProcessInstanceRef adoptExecution(OpenExecution e0)
+ public static ProcessInstanceRef adoptExecution(ExecutionImpl e0)
{
ProcessInstanceRef ref = new ProcessInstanceRef();
ref.setId( e0.getId() );
@@ -67,13 +67,13 @@
ref.setDefinitionId(e0.getProcessDefinition().getId() );
ref.setStartDate( new Date() ); // TODO: FIXME
- OpenExecution topLevelExecution = e0.getProcessInstance();
+ ExecutionImpl topLevelExecution = e0.getProcessInstance();
TokenReference tok = execution2TokenReference(topLevelExecution);
- Collection<Execution> childExecutions = topLevelExecution.getExecutions();
+ Collection<ExecutionImpl> childExecutions = (Collection)topLevelExecution.getExecutions();
if(childExecutions!=null)
{
- for(Execution childExecution : childExecutions)
+ for(ExecutionImpl childExecution : childExecutions)
{
TokenReference childTok = execution2TokenReference(childExecution);
tok.getChildren().add(childTok);
@@ -85,7 +85,7 @@
return ref;
}
- private static TokenReference execution2TokenReference(Execution topLevelExecution)
+ private static TokenReference execution2TokenReference(ExecutionImpl topLevelExecution)
{
TokenReference tok = new TokenReference();
tok.setName(topLevelExecution.getName());
@@ -95,7 +95,7 @@
// transitions
List<String> availableSignals = new ArrayList<String>();
- OpenExecution openTopLevelExecution = (OpenExecution) topLevelExecution;
+ ExecutionImpl openTopLevelExecution = (ExecutionImpl) topLevelExecution;
List<Transition> outTransitions = openTopLevelExecution.getActivity().getOutgoingTransitions();
if(outTransitions!=null) // crappy jBPM API
{
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -30,6 +30,7 @@
import org.jbpm.api.*;
import org.jbpm.api.history.HistoryProcessInstanceQuery;
import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
import java.io.InputStream;
import java.util.ArrayList;
@@ -163,7 +164,7 @@
if(processInstance.isProcessInstance()) // parent execution
{
- results.add( ModelAdaptor.adoptExecution((OpenExecution)processInstance) );
+ results.add( ModelAdaptor.adoptExecution((ExecutionImpl)processInstance) );
}
}
return results;
@@ -184,7 +185,7 @@
ProcessInstanceQuery query = execService.createProcessInstanceQuery();
query.processInstanceId(instanceId);
ProcessInstance processInstance = query.uniqueResult();
- return ModelAdaptor.adoptExecution( (OpenExecution)processInstance);
+ return ModelAdaptor.adoptExecution( (ExecutionImpl)processInstance);
}
finally
{
@@ -200,7 +201,7 @@
{
ExecutionService execService = this.processEngine.getExecutionService();
Execution exec = execService.startProcessInstanceById(definitionId);
- return ModelAdaptor.adoptExecution((OpenExecution)exec);
+ return ModelAdaptor.adoptExecution((ExecutionImpl)exec);
}
finally{
env.close();
Modified: jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskDispatcherPluginImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskDispatcherPluginImpl.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskDispatcherPluginImpl.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -150,7 +150,7 @@
// TODO: Fix when https://jira.jboss.org/jira/browse/JBPM-2220 is done
OutcomeDirective outcomeDirective = new OutcomeDirective();
List<Transition> transitions =
- ((OpenExecution) processInstance).getActivity().getOutgoingTransitions();
+ ((ExecutionImpl) processInstance).getActivity().getOutgoingTransitions();
for(Transition t : transitions)
{
String outcomeName = t.getName()!=null ? t.getName() : "to_"+t.getDestination().getName();
Modified: jbpm4/trunk/modules/integration/graphView-plugin/.project
===================================================================
--- jbpm4/trunk/modules/integration/graphView-plugin/.project 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/integration/graphView-plugin/.project 2009-06-03 10:38:53 UTC (rev 4979)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>integration-forms-plugin</name>
+ <name>integration-graphview-plugin</name>
<comment></comment>
<projects>
</projects>
Modified: jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -21,18 +21,26 @@
*/
package org.jbpm.integration.console.graphView;
-import org.jboss.bpm.console.server.plugin.GraphViewerPlugin;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.naming.InitialContext;
+
+import org.jboss.bpm.console.client.model.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.DiagramInfo;
-import org.jboss.bpm.console.client.model.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.DiagramNodeInfo;
-import org.jbpm.api.*;
-import org.jbpm.api.model.ActivityCoordinates;
+import org.jboss.bpm.console.server.plugin.GraphViewerPlugin;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.ProcessInstanceQuery;
+import org.jbpm.api.RepositoryService;
import org.jbpm.api.env.Environment;
import org.jbpm.api.env.EnvironmentFactory;
+import org.jbpm.api.model.ActivityCoordinates;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
-import javax.naming.InitialContext;
-import java.io.*;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -107,7 +115,7 @@
ExecutionService execService = this.processEngine.getExecutionService();
ProcessInstanceQuery query = execService.createProcessInstanceQuery();
query.processInstanceId(instanceId);
- ProcessInstance processInstance = query.uniqueResult();
+ ExecutionImpl processInstance = (ExecutionImpl) query.uniqueResult();
String currentActivity = processInstance.getProcessInstance().getActivityName();
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -26,7 +26,6 @@
import org.jbpm.api.model.Activity;
import org.jbpm.api.model.Transition;
import org.jbpm.pvm.internal.env.EnvironmentDefaults;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
/**
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -63,7 +63,7 @@
executions.add(execution);
- Collection<Execution> childExecutions = execution.getExecutions();
+ Collection<? extends Execution> childExecutions = execution.getExecutions();
if (childExecutions!=null) {
for (Execution childExecution: childExecutions) {
scanExecutions(childExecution, executions);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -792,13 +792,18 @@
);
}
+ public boolean isActive(String activityName) {
+ return findActiveActivityNames().contains(activityName);
+ }
+
public Set<String> findActiveActivityNames() {
return addActiveActivityNames(new HashSet<String>());
}
protected Set<String> addActiveActivityNames(Set<String> activityNames) {
- if ( (state.equals(STATE_ACTIVE_ROOT))
- && (activityName!=null)
+ if ( ( (state.equals(STATE_ACTIVE_ROOT)) || (state.equals(STATE_ACTIVE_CONCURRENT)) )
+ &&
+ (activityName!=null)
) {
activityNames.add(activityName);
}
@@ -1126,7 +1131,7 @@
public ObservableElementImpl getEventSource() {
return eventSource;
}
- public Collection<Execution> getExecutions() {
+ public Collection<ExecutionImpl> getExecutions() {
return (Collection) executions;
}
public String getName() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -25,7 +25,6 @@
import java.util.Map;
import org.jbpm.api.JbpmException;
-import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.api.model.Activity;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -45,7 +44,7 @@
ProcessDefinitionImpl lifeCycle = getLifeCycle(task);
Map<String, Object> lifeCycleVariables = new HashMap<String, Object>();
lifeCycleVariables.put("task", task);
- ClientProcessInstance lifeCycleExecution = lifeCycle.createProcessInstance();
+ ExecutionImpl lifeCycleExecution = (ExecutionImpl) lifeCycle.createProcessInstance();
lifeCycleExecution.setVariables(lifeCycleVariables);
lifeCycleExecution.start();
return lifeCycleExecution.getActivity().getName();
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/embedded/Loan.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/embedded/Loan.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/embedded/Loan.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -22,9 +22,9 @@
package org.jbpm.pvm.executionmode.embedded;
-import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
/**
* @author Tom Baeyens
@@ -66,7 +66,7 @@
long dbid;
String customer;
double amount;
- ClientExecution execution;
+ ExecutionImpl execution;
/** constructor for persistence */
protected Loan() {
@@ -75,7 +75,7 @@
public Loan(String customer, double amount) {
this.customer = customer;
this.amount = amount;
- this.execution = processDefinition.startProcessInstance();
+ this.execution = (ExecutionImpl) processDefinition.startProcessInstance();
}
public void approve() {
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/executionmode/object/ObjectExecutionModeTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -25,6 +25,7 @@
import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
+import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.pvm.activities.AutomaticActivity;
import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
@@ -53,13 +54,13 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("evaluate", execution.getActivityName());
+ assertTrue(processInstance.isActive("evaluate"));
- execution.signal("approve");
+ processInstance.signal("approve");
- execution.signal();
- assertEquals("end", execution.getActivityName());
+ processInstance.signal();
+ assertTrue(processInstance.isActive("end"));
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -52,21 +52,21 @@
public void testOneFeedbackLoop() {
ProcessInstance processInstance = executionService.startProcessInstanceByKey("GroupSimple");
String pid = processInstance.getId();
- assertEquals("distribute document", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("distribute document"));
processInstance = executionService.signalExecutionById(pid);
- assertEquals("collect feedback", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("collect feedback"));
processInstance = executionService.signalExecutionById(pid, "rejected");
- assertEquals("update document", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("update document"));
processInstance = executionService.signalExecutionById(pid);
- assertEquals("distribute document", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("distribute document"));
processInstance = executionService.signalExecutionById(pid);
- assertEquals("collect feedback", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("collect feedback"));
processInstance = executionService.signalExecutionById(pid, "approved");
- assertEquals("publish document", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("publish document"));
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -25,6 +25,7 @@
import java.util.Map;
import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -50,12 +51,12 @@
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("distance", "far");
- Execution execution = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertEquals("Big car", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("Big car"));
variables.put("distance", "nearby");
- execution = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertEquals("Small car", execution.getActivityName());
+ processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("Small car"));
}
public void testDecisionWithConditions() {
@@ -81,16 +82,15 @@
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("distance", new Integer(69));
- Execution execution = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertEquals("Big car", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("Big car"));
variables.put("distance", new Integer(6));
- execution = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertEquals("Small car", execution.getActivityName());
+ processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("Small car"));
variables.put("distance", new Integer(2));
- execution = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertEquals("No car", execution.getActivityName());
+ processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("No car"));
}
-
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -54,7 +54,7 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("Group");
- assertEquals("a", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("a"));
processInstance = executionService.signalExecutionById(processInstance.getId());
assertTrue(processInstance.isEnded());
@@ -78,7 +78,7 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("Group");
- assertEquals("a", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("a"));
processInstance = executionService.signalExecutionById(processInstance.getId());
assertTrue(processInstance.isEnded());
@@ -117,14 +117,14 @@
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("theWayToGo", "left");
ProcessInstance processInstance = executionService.startProcessInstanceByKey("Group", variables);
- assertEquals("a", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("a"));
processInstance = executionService.signalExecutionById(processInstance.getId());
assertTrue(processInstance.isEnded());
variables.put("theWayToGo", "right");
processInstance = executionService.startProcessInstanceByKey("Group", variables);
- assertEquals("b", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("b"));
processInstance = executionService.signalExecutionById(processInstance.getId());
assertTrue(processInstance.isEnded());
@@ -151,7 +151,7 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("Group");
- assertEquals("a", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("a"));
processInstance = executionService.signalExecutionById(processInstance.getId());
assertTrue(processInstance.isEnded());
@@ -175,8 +175,8 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("Group");
- assertEquals("a", processInstance.getActivityName());
-
+ assertTrue(processInstance.isActive("a"));
+
processInstance = executionService.signalExecutionById(processInstance.getId());
assertTrue(processInstance.isEnded());
}
@@ -208,18 +208,16 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("Group");
- assertEquals("a", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("a"));
processInstance = executionService.signalExecutionById(processInstance.getId(), "a");
assertTrue(processInstance.isEnded());
- assertEquals("endA", processInstance.getActivityName());
processInstance = executionService.startProcessInstanceByKey("Group");
- assertEquals("a", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("a"));
processInstance = executionService.signalExecutionById(processInstance.getId(), "b");
assertTrue(processInstance.isEnded());
- assertEquals("endB", processInstance.getActivityName());
}
public void testGroupDirectExitTransition() {
@@ -241,7 +239,7 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("Group");
- assertEquals("a", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("a"));
processInstance = executionService.signalExecutionById(processInstance.getId());
assertTrue(processInstance.isEnded());
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -62,16 +62,14 @@
ProcessInstance processInstance = executionService.startProcessInstanceByKey("Group");
assertEquals(Execution.STATE_INACTIVE_SCOPE, processInstance.getState());
- assertEquals("group", processInstance.getActivityName());
assertEquals(1, processInstance.getExecutions().size());
Execution groupExecution = processInstance.getExecutions().iterator().next();
assertEquals(Execution.STATE_ACTIVE_ROOT, groupExecution.getState());
- assertEquals("a", groupExecution.getActivityName());
+ assertTrue(groupExecution.isActive("a"));
processInstance = executionService.signalExecutionById(groupExecution.getId());
assertEquals(Execution.STATE_ACTIVE_ROOT, processInstance.getState());
- assertEquals("end", processInstance.getActivityName());
assertEquals(0, processInstance.getExecutions().size());
@@ -92,8 +90,7 @@
processInstance = executionService.findProcessInstanceById(processInstance.getId());
assertEquals(Execution.STATE_ACTIVE_ROOT, processInstance.getState());
- assertEquals("escalate", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("escalate"));
assertEquals(0, processInstance.getExecutions().size());
}
-
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -21,8 +21,8 @@
*/
package org.jbpm.test.activities;
-import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
/**
@@ -46,16 +46,15 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceById("ThreeStates-1");
- assertEquals("b", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceById("ThreeStates-1");
+ assertTrue(processInstance.isActive("b"));
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId);
- assertEquals("c", execution.getActivityName());
+ String executionId = processInstance.getId();
+ processInstance = executionService.signalExecutionById(executionId);
+ assertTrue(processInstance.isActive("c"));
- execution = executionService.signalExecutionById(executionId);
- assertEquals("d", execution.getActivityName());
- assertTrue(execution.isEnded());
+ processInstance = executionService.signalExecutionById(executionId);
+ assertTrue(processInstance.isEnded());
}
public void testExternalDecision() {
@@ -75,18 +74,18 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("p", "one");
- assertEquals("ed", execution.getActivityName());
- execution = executionService.signalExecutionById("p.one", "left");
- assertEquals("b", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("p", "one");
+ assertTrue(processInstance.isActive("ed"));
+ processInstance = executionService.signalExecutionById("p.one", "left");
+ assertTrue(processInstance.isActive("b"));
executionService.startProcessInstanceById("p-1", "two");
- execution = executionService.signalExecutionById("p.two", "middle");
- assertEquals("c", execution.getActivityName());
+ processInstance = executionService.signalExecutionById("p.two", "middle");
+ assertTrue(processInstance.isActive("c"));
executionService.startProcessInstanceById("p-1", "three");
- execution = executionService.signalExecutionById("p.three", "right");
- assertEquals("d", execution.getActivityName());
+ processInstance = executionService.signalExecutionById("p.three", "right");
+ assertTrue(processInstance.isActive("d"));
}
public void testDefaultSignalWithNamedTransitions() {
@@ -132,8 +131,8 @@
);
executionService.startProcessInstanceByKey("p", "one");
- Execution execution = executionService.signalExecutionById("p.one", "up");
- assertEquals("a", execution.getActivityName());
+ ProcessInstance processInstance = executionService.signalExecutionById("p.one", "up");
+ assertTrue(processInstance.isActive("a"));
}
public void testDefaultSignalWithoutTransitions() {
@@ -147,7 +146,7 @@
);
executionService.startProcessInstanceByKey("p", "one");
- Execution execution = executionService.signalExecutionById("p.one");
- assertEquals("a", execution.getActivityName());
+ ProcessInstance processInstance = executionService.signalExecutionById("p.one");
+ assertTrue(processInstance.isActive("a"));
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -66,7 +66,6 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("TwoAsyncStates");
- assertEquals("a", processInstance.getActivityName());
assertEquals(Execution.STATE_ASYNC, processInstance.getState());
assertFalse(doneSomething);
@@ -86,7 +85,6 @@
doneSomething = false;
processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertEquals("b", processInstance.getActivityName());
assertEquals(Execution.STATE_ASYNC, processInstance.getState());
jobs = managementService
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -46,8 +46,6 @@
public static class ProcessStartListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
- assertNotNull(execution.getActivity());
- assertSame(execution.getActivity(), execution.getProcessDefinition().getInitial());
isInvoked = true;
}
}
@@ -73,8 +71,6 @@
public static class ProcessEndListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
- assertNotNull(execution.getActivity());
- assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("end"));
isInvoked = true;
}
}
@@ -100,8 +96,6 @@
public static class ActivityStartListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
- assertNotNull(execution.getActivity());
- assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("s"));
isInvoked = true;
}
}
@@ -130,8 +124,6 @@
public static class ActivityEndListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
- assertNotNull(execution.getActivity());
- assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("s"));
isInvoked = true;
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/FindExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/FindExecutionTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/FindExecutionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -21,7 +21,7 @@
*/
package org.jbpm.test.execution;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
/**
@@ -39,12 +39,11 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("p");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("p");
// take the id and see if the execution service can still find it back
- execution = executionService.findExecutionById(execution.getId());
- assertNotNull(execution);
- assertEquals("a", execution.getActivityName());
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance);
+ assertTrue(processInstance.isActive("a"));
}
-
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -26,7 +26,7 @@
import java.util.Map;
import java.util.Set;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -51,17 +51,17 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL", "82436");
- assertEquals("a", execution.getActivityName());
+ assertTrue(processInstance.isActive("a"));
- execution = executionService.signalExecutionById("ICL.82436");
+ processInstance = executionService.signalExecutionById("ICL.82436");
- assertEquals("b", execution.getActivityName());
+ assertTrue(processInstance.isActive("b"));
- execution = executionService.signalExecutionById("ICL.82436");
+ processInstance = executionService.signalExecutionById("ICL.82436");
- assertEquals("c", execution.getActivityName());
+ assertTrue(processInstance.isActive("c"));
}
public void testSignalExecutionWithVariables() {
@@ -77,25 +77,25 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL", "82436");
Map<String,Object> variables = new HashMap<String,Object>();
variables.put("customer", "John Doe");
variables.put("type", "Accident");
variables.put("amount", new Float(763.74));
- execution = executionService.signalExecutionById("ICL.82436", variables);
+ processInstance = executionService.signalExecutionById("ICL.82436", variables);
- assertNotNull(execution);
- String executionId = execution.getId();
- assertEquals("b", execution.getActivityName());
+ assertNotNull(processInstance);
+ String pid = processInstance.getId();
+ assertTrue(processInstance.isActive("b"));
Map<String,Object> expectedVariables = new HashMap<String, Object>(variables);
Set<String> expectedVariableNames = new HashSet<String>(expectedVariables.keySet());
- Set<String> variableNames = new HashSet<String>(executionService.getVariableNames(executionId));
+ Set<String> variableNames = new HashSet<String>(executionService.getVariableNames(pid));
assertEquals(expectedVariableNames, variableNames);
- variables = executionService.getVariables(executionId, variableNames);
+ variables = executionService.getVariables(pid, variableNames);
assertEquals(expectedVariables, variables);
}
@@ -110,8 +110,8 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("p");
- execution = executionService.signalExecutionById(execution.getId());
- assertEquals("a", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("p");
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isActive("a"));
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -28,6 +28,7 @@
import org.jbpm.api.Execution;
import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -46,10 +47,10 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("ICL");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL");
- assertNotNull(execution);
- assertEquals("a", execution.getActivityName());
+ assertNotNull(processInstance);
+ assertTrue(processInstance.isActive("a"));
}
public void testStartNewExecutionInLatestProcessDefinition() {
@@ -62,10 +63,10 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("ICL");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL");
- assertNotNull(execution);
- assertEquals("a", execution.getActivityName());
+ assertNotNull(processInstance);
+ assertTrue(processInstance.isActive("a"));
deployJpdlXmlString(
"<process name='Insurance claim' key='ICL'>" +
@@ -76,10 +77,10 @@
"</process>"
);
- execution = executionService.startProcessInstanceByKey("ICL");
+ processInstance = executionService.startProcessInstanceByKey("ICL");
- assertNotNull(execution);
- assertEquals("b", execution.getActivityName());
+ assertNotNull(processInstance);
+ assertTrue(processInstance.isActive("b"));
}
public void testStartExecutionInLatestByNameWithVariables() {
@@ -107,16 +108,16 @@
variables.put("b", "text");
// feed the variables in
- Execution execution = executionService.startProcessInstanceByKey("ICL", variables);
- String executionId = execution.getId();
- assertEquals("b", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL", variables);
+ String executionId = processInstance.getId();
+ assertTrue(processInstance.isActive("b"));
// verify that the variables are actually set
assertEquals(new Integer(1), executionService.getVariable(executionId, "a"));
assertEquals("text", executionService.getVariable(executionId, "b"));
// in the generated id, we can see if the right process definition version was taken
- assertTrue(execution.getId().startsWith("ICL."));
+ assertTrue(processInstance.getId().startsWith("ICL."));
}
public void testStartNewProcessInstanceWithAKey() {
@@ -129,10 +130,10 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("ICL", "one");
+ Execution processInstance = executionService.startProcessInstanceByKey("ICL", "one");
- assertNotNull(execution);
- assertEquals("ICL.one", execution.getId());
+ assertNotNull(processInstance);
+ assertEquals("ICL.one", processInstance.getId());
}
public void testStartNewProcessInstanceWithVariables() {
@@ -150,11 +151,11 @@
variables.put("type", "Accident");
variables.put("amount", new Float(763.74));
- Execution execution = executionService.startProcessInstanceByKey("ICL", variables);
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL", variables);
- String executionId = execution.getId();
+ String executionId = processInstance.getId();
- assertNotNull(execution);
+ assertNotNull(processInstance);
Map<String,Object> expectedVariables = new HashMap<String, Object>(variables);
Set<String> expectedVariableNames = new HashSet<String>(expectedVariables.keySet());
@@ -176,20 +177,20 @@
);
// start an execution for the process with the given id
- Execution execution = executionService.startProcessInstanceById("ICL-1");
- assertNotNull(execution);
+ ProcessInstance processInstance = executionService.startProcessInstanceById("ICL-1");
+ assertNotNull(processInstance);
- // checking the state
- assertEquals("a", execution.getActivityName());
+ // checking the active activity
+ assertTrue(processInstance.isActive("a"));
// checking the generated id
- assertNull(execution.getName());
- assertNull(execution.getKey());
+ assertNull(processInstance.getName());
+ assertNull(processInstance.getKey());
// if there is no user defined name or key specified in the execution,
// the default id generator will create a unique id like this: processDefinitionId/execution.dbid
- assertTrue(execution.getId().startsWith("ICL."));
+ assertTrue(processInstance.getId().startsWith("ICL."));
// the last part of the execution key should be the dbid.
- Long.parseLong(execution.getId().substring(4));
+ Long.parseLong(processInstance.getId().substring(4));
}
public void testStartExecutionByIdWithVariables() {
@@ -208,8 +209,8 @@
variables.put("b", "text");
// provide the variables in the start execution method
- Execution execution = executionService.startProcessInstanceById("ICL-1", variables);
- String executionId = execution.getId();
+ ProcessInstance processInstance = executionService.startProcessInstanceById("ICL-1", variables);
+ String executionId = processInstance.getId();
assertEquals(new Integer(1), executionService.getVariable(executionId, "a"));
assertEquals("text", executionService.getVariable(executionId, "b"));
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -27,6 +27,7 @@
import org.jbpm.api.JbpmException;
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessDefinitionQuery;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -357,11 +358,9 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("minimal");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("minimal");
- assertEquals("end", execution.getActivityName());
- assertTrue(execution.isEnded());
- assertFalse(execution.isActive());
+ assertTrue(processInstance.isEnded());
}
public void testMostMinimalProcess() {
@@ -374,6 +373,5 @@
Execution execution = executionService.startProcessInstanceByKey("minimal");
assertTrue(execution.isEnded());
- assertFalse(execution.isActive());
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskCandidatesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskCandidatesTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskCandidatesTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -25,8 +25,8 @@
import java.util.List;
import java.util.Map;
-import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -50,8 +50,8 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
- String executionId = execution.getId();
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskCandidates");
+ String pid = processInstance.getId();
// both johndoe and joesmoe will see the task in their *group* task list
List<Task> taskList = taskService.findGroupTasks("johndoe");
@@ -101,8 +101,8 @@
assertEquals(0, taskList.size());
// verify that process moved to the next state
- execution = executionService.findExecutionById(executionId);
- assertEquals("wait", execution.getActivityName());
+ processInstance = executionService.findProcessInstanceById(pid);
+ assertTrue(processInstance.isActive("wait"));
}
public void testTaskCandidatesExpression() {
@@ -122,8 +122,8 @@
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("userone", "johndoe");
variables.put("usertwo", "joesmoe");
- Execution execution = executionService.startProcessInstanceByKey("TaskCandidates", variables);
- String executionId = execution.getId();
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskCandidates", variables);
+ String executionId = processInstance.getId();
// both johndoe and joesmoe will see the task in their *group* task list
List<Task> taskList = taskService.findGroupTasks("johndoe");
@@ -173,8 +173,8 @@
assertEquals(0, taskList.size());
// verify that process moved to the next state
- execution = executionService.findExecutionById(executionId);
- assertEquals("wait", execution.getActivityName());
+ processInstance = executionService.findProcessInstanceById(executionId);
+ assertTrue(processInstance.isActive("wait"));
}
public void testDoubleTake() {
@@ -191,8 +191,8 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("DoubleTake");
- String executionId = execution.getId();
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DoubleTake");
+ String pid = processInstance.getId();
// both johndoe and joesmoe will see the task in their *group* task list
long taskDbid = taskService.findGroupTasks("johndoe").get(0).getDbid();
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 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -24,7 +24,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.internal.log.Log;
import org.jbpm.test.load.LoadTestCase;
@@ -99,11 +99,11 @@
}
}
public void executeProcess() {
- Execution execution = executionService.startProcessInstanceByKey("Process");
- assertEquals("c", execution.getActivityName());
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId);
- assertTrue(execution.isEnded());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("Process");
+ assertTrue(processInstance.isActive("c"));
+ String executionId = processInstance.getId();
+ processInstance = executionService.signalExecutionById(executionId);
+ assertTrue(processInstance.isEnded());
processFinished();
}
}
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/AutomaticDecisionTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/AutomaticDecisionTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/AutomaticDecisionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -85,30 +85,30 @@
public void testGoodRating() {
ClientProcessDefinition processDefinition = createCreditProcess();
- ClientProcessInstance execution = processDefinition.createProcessInstance();
- execution.setVariable("creditRate", 7);
- execution.start();
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance();
+ processInstance.setVariable("creditRate", 7);
+ processInstance.start();
- assertEquals("priority delivery", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("priority delivery"));
}
public void testAverageRating() {
ClientProcessDefinition processDefinition = createCreditProcess();
- ClientProcessInstance execution = processDefinition.createProcessInstance();
- execution.setVariable("creditRate", 2);
- execution.start();
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance();
+ processInstance.setVariable("creditRate", 2);
+ processInstance.start();
- assertEquals("bulk delivery", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("bulk delivery"));
}
public void testBadRating() {
ClientProcessDefinition processDefinition = createCreditProcess();
- ClientProcessInstance execution = processDefinition.createProcessInstance();
- execution.setVariable("creditRate", -7);
- execution.start();
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance();
+ processInstance.setVariable("creditRate", -7);
+ processInstance.start();
- assertEquals("payment upfront", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("payment upfront"));
}
}
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/BasicExecutionFlowTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/BasicExecutionFlowTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/BasicExecutionFlowTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -95,31 +95,31 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
List<String> expectedEvents = new ArrayList<String>();
expectedEvents.add("execute[submit loan request]");
expectedEvents.add("execute[evaluate]");
- assertEquals("evaluate", execution.getActivityName());
+ assertTrue(processInstance.isActive("evaluate"));
assertEquals(expectedEvents, recordedEvents);
- execution.signal("approve");
+ processInstance.signal("approve");
expectedEvents.add("signal[evaluate]");
expectedEvents.add("execute[wire money]");
expectedEvents.add("execute[archive]");
- assertEquals("archive", execution.getActivityName());
+ assertTrue(processInstance.isActive("archive"));
assertEquals(expectedEvents, recordedEvents);
- execution.signal();
+ processInstance.signal();
expectedEvents.add("signal[archive]");
expectedEvents.add("execute[end]");
- assertEquals("end", execution.getActivityName());
+ assertTrue(processInstance.isActive("end"));
assertEquals(expectedEvents, recordedEvents);
}
@@ -163,7 +163,7 @@
expectedEvents.add("execute[submit loan request]");
expectedEvents.add("execute[evaluate]");
- assertEquals("evaluate", processInstance.getActivityName());
+ assertTrue(processInstance.isActive("evaluate"));
assertEquals(expectedEvents, recordedEvents);
}
}
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/EventTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/EventTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/EventTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -21,23 +21,20 @@
*/
package org.jbpm.test.activities;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Map;
+import org.apache.tools.ant.taskdefs.Exec;
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.activity.ExternalActivityBehaviour;
import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
+import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.listener.EventListenerExecution;
import org.jbpm.api.model.Activity;
import org.jbpm.api.model.Event;
-import org.jbpm.api.model.ObservableElement;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.test.BaseJbpmTestCase;
/** shows how actions are listeners to following processDefinition events:
@@ -59,7 +56,7 @@
public void notify(EventListenerExecution execution) {
execution.setVariable("msg", "Kilroy was here");
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(execution.isActive("initial"));
assertEquals("initial", execution.getEventSource().getName());
assertEquals("leave activity action test", execution.getProcessDefinition().getName());
assertEquals("end", execution.getTransition().getDestination().getName());
@@ -82,11 +79,11 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
- execution.signal();
- assertEquals("Kilroy was here", execution.getVariable("msg"));
+ assertTrue(processInstance.isActive("initial"));
+ processInstance.signal();
+ assertEquals("Kilroy was here", processInstance.getVariable("msg"));
}
// transition action ////////////////////////////////////////////////////////
@@ -96,7 +93,6 @@
public void notify(EventListenerExecution execution) throws Exception {
execution.setVariable("msg", "Kilroy was here");
- assertNull(execution.getActivity());
assertEquals("t", execution.getEventSource().getName());
assertEquals("transition action test", execution.getProcessDefinition().getName());
assertEquals("end", execution.getTransition().getDestination().getName());
@@ -119,11 +115,11 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
- execution.signal("t");
- assertEquals("Kilroy was here", execution.getVariable("msg"));
+ assertTrue(processInstance.isActive("initial"));
+ processInstance.signal("t");
+ assertEquals("Kilroy was here", processInstance.getVariable("msg"));
}
// activity enter action ////////////////////////////////////////////////////////
@@ -132,8 +128,8 @@
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) throws Exception {
execution.setVariable("msg", "Kilroy was here");
-
- assertEquals("end", execution.getActivity().getName());
+
+ assertTrue(execution.isActive("end"));
assertEquals("end", execution.getEventSource().getName());
assertEquals("enter activity action test", execution.getProcessDefinition().getName());
assertEquals("end", execution.getTransition().getDestination().getName());
@@ -156,11 +152,11 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientExecution processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
- execution.signal();
- assertEquals("Kilroy was here", execution.getVariable("msg"));
+ assertTrue(processInstance.isActive("initial"));
+ processInstance.signal();
+ assertEquals("Kilroy was here", processInstance.getVariable("msg"));
}
// custom event ////////////////////////////////////////////////////////////
@@ -187,7 +183,7 @@
public void notify(EventListenerExecution execution) throws Exception {
execution.setVariable("msg", "Kilroy was here");
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(execution.isActive("initial"));
assertEquals("initial", execution.getEventSource().getName());
assertEquals("custom activity action test", execution.getProcessDefinition().getName());
assertNull(execution.getTransition());
@@ -212,17 +208,17 @@
ClientExecution execution = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(execution.isActive("initial"));
assertNull(execution.getVariable("msg"));
execution.signal("end of riveter shift");
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(execution.isActive("initial"));
assertEquals("Kilroy was here", execution.getVariable("msg"));
execution.signal();
- assertEquals("end", execution.getActivity().getName());
+ assertTrue(execution.isActive("end"));
}
public static class EndState implements ActivityBehaviour {
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExceptionHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExceptionHandlerTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExceptionHandlerTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -27,6 +27,7 @@
import org.jbpm.api.activity.ExternalActivityBehaviour;
import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
+import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.listener.EventListenerExecution;
import org.jbpm.api.model.Event;
@@ -81,13 +82,13 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("initial"));
assertEquals(0, catcher.timesInvoked);
- execution.signal();
+ processInstance.signal();
assertEquals(1, catcher.timesInvoked);
- assertEquals("end", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("end"));
}
public void testExceptionHandlerOnEvent() {
@@ -108,13 +109,13 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("initial"));
assertEquals(0, catcher.timesInvoked);
- execution.signal();
+ processInstance.signal();
assertEquals(1, catcher.timesInvoked);
- assertEquals("end", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("end"));
}
public void testExceptionHandlerOnAction() {
@@ -135,13 +136,13 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("initial"));
assertEquals(0, catcher.timesInvoked);
- execution.signal();
+ processInstance.signal();
assertEquals(1, catcher.timesInvoked);
- assertEquals("end", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("end"));
}
public void testExceptionHandlerOnOtherActivity() {
@@ -162,12 +163,12 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("initial"));
assertEquals(0, catcher.timesInvoked);
try {
- execution.signal();
+ processInstance.signal();
fail("expected exception");
} catch (RuntimeException e) {
// OK
@@ -193,11 +194,11 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("initial"));
try {
- execution.signal();
+ processInstance.signal();
fail("expected exception");
} catch (RuntimeException e) {
// OK
@@ -228,11 +229,11 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("initial", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("initial"));
try {
- execution.signal();
+ processInstance.signal();
fail("expected exception");
} catch (RuntimeException e) {
// OK
@@ -265,10 +266,11 @@
.startActivity("end", new WaitState())
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
try {
- execution.signal();
+ processInstance.signal();
fail("expected exception");
} catch (RuntimeException e) {
assertTextPresent("greetz from the retrhowing catcher", e.getMessage());
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExternalDecisionTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExternalDecisionTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExternalDecisionTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -29,6 +29,7 @@
import org.jbpm.api.activity.ExternalActivityBehaviour;
import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
+import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
@@ -77,28 +78,28 @@
public void testGoodRating() {
ClientProcessDefinition processDefinition = createCreditProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- execution.signal("good");
+ processInstance.signal("good");
- assertEquals("priority delivery", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("priority delivery"));
}
public void testAverageRating() {
ClientProcessDefinition processDefinition = createCreditProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- execution.signal("average");
+ processInstance.signal("average");
- assertEquals("bulk delivery", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("bulk delivery"));
}
public void testBadRating() {
ClientProcessDefinition processDefinition = createCreditProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- execution.signal("bad");
+ processInstance.signal("bad");
- assertEquals("payment upfront", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("payment upfront"));
}
}
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/FunctionalActivityTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/FunctionalActivityTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/FunctionalActivityTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -90,7 +90,6 @@
List<String> expectedEvents = new ArrayList<String>();
- assertEquals("a", processInstance.getActivityName());
assertFalse(processInstance.isEnded());
assertEquals(expectedEvents, recordedEvents);
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/LoopingTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/LoopingTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/LoopingTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -7,8 +7,8 @@
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.activity.ExternalActivityBehaviour;
-import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
+import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
import org.jbpm.test.BaseJbpmTestCase;
@@ -98,12 +98,12 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
List<Object> expectedIndexes = new ArrayList<Object>();
for (int i=0; i<loops; i++) expectedIndexes.add(i);
assertEquals(expectedIndexes, recordedIndexes);
- assertEquals("end", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("end"));
}
}
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/SubProcessTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/SubProcessTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/SubProcessTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -28,6 +28,7 @@
import org.jbpm.api.activity.ExternalActivityBehaviour;
import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
+import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.test.BaseJbpmTestCase;
@@ -104,18 +105,17 @@
.endActivity()
.endProcess();
- ClientExecution superProcesInstance = superProcess.startProcessInstance();
- assertEquals("super2", superProcesInstance.getActivity().getName());
+ ClientProcessInstance superProcessInstance = superProcess.startProcessInstance();
+ assertTrue(superProcessInstance.isActive("super2"));
- ClientExecution subProcessInstance = (ClientExecution) superProcesInstance.getSubProcessInstance();
+ ClientProcessInstance subProcessInstance = (ClientProcessInstance) superProcessInstance.getSubProcessInstance();
assertNotNull(subProcessInstance);
- assertEquals("sub2", subProcessInstance.getActivity().getName());
+ assertTrue(subProcessInstance.isActive("sub2"));
subProcessInstance.signal();
- assertEquals("sub3", subProcessInstance.getActivity().getName());
assertTrue(subProcessInstance.isEnded());
- assertEquals("super3", superProcesInstance.getActivity().getName());
+ assertTrue(superProcessInstance.isActive("super3"));
}
}
Modified: jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionEventsTest.java
===================================================================
--- jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionEventsTest.java 2009-06-03 08:43:36 UTC (rev 4978)
+++ jbpm4/trunk/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionEventsTest.java 2009-06-03 10:38:53 UTC (rev 4979)
@@ -26,6 +26,7 @@
import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
+import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.listener.EventListenerExecution;
import org.jbpm.api.model.Event;
@@ -150,7 +151,7 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
assertEquals("[event(start) on process(p)]",
processListener.events.toString());
@@ -159,9 +160,9 @@
assertEquals(0, compositeListener.events.size());
assertEquals(0, insideListener.events.size());
- assertEquals("inside", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("inside"));
- execution.signal();
+ processInstance.signal();
assertEquals("[event(start) on process(p)]",
processListener.events.toString());
@@ -316,7 +317,7 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
assertEquals("[event(start) on process(p)]",
processListener.events.toString());
@@ -324,9 +325,9 @@
assertEquals(0, compositeListener.events.size());
assertEquals(0, insideListener.events.size());
- assertEquals("inside", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("inside"));
- execution.signal();
+ processInstance.signal();
assertEquals("[event(start) on process(p)]",
processListener.events.toString());
@@ -381,16 +382,16 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
assertEquals("[event(start) on process(p)]",
processListener.events.toString());
assertEquals(0, compositeListener.events.size());
- assertEquals("inside", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("inside"));
- execution.signal();
+ processInstance.signal();
assertEquals("[event(end) on activity(inside), " +
"event(take) on (inside)-->(inside), " +
@@ -468,7 +469,7 @@
.endActivity()
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
assertEquals("[event(start) on process(p)]",
processListener.events.toString());
@@ -477,9 +478,9 @@
assertEquals(0, compositeListener.events.size());
assertEquals(0, insideListener.events.size());
- assertEquals("inside", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("inside"));
- execution.signal();
+ processInstance.signal();
assertEquals("[event(start) on process(p)]",
processListener.events.toString());
@@ -585,11 +586,11 @@
.endProcess();
- ClientExecution execution = processDefinition.startProcessInstance();
+ ClientProcessInstance processInstance = processDefinition.startProcessInstance();
- assertEquals("source inside", execution.getActivity().getName());
+ assertTrue(processInstance.isActive("source inside"));
- execution.signal();
+ processInstance.signal();
assertEquals("[event(start) on process(p)]",
processListener.events.toString());
16 years, 11 months
JBoss JBPM SVN: r4978 - in jbpm4/branches/jimma/modules/migration: scripts and 4 other directories.
by do-not-reply@jboss.org
Author: jim.ma
Date: 2009-06-03 04:43:36 -0400 (Wed, 03 Jun 2009)
New Revision: 4978
Added:
jbpm4/branches/jimma/modules/migration/scripts/
jbpm4/branches/jimma/modules/migration/scripts/assembly-distro.xml
jbpm4/branches/jimma/modules/migration/src/test/resources/invalid.xml
Modified:
jbpm4/branches/jimma/modules/migration/pom.xml
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Reader.java
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverter.java
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverterTool.java
jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/util/StartStateConverter.java
jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/JpdlConverterToolTest.java
jbpm4/branches/jimma/modules/migration/src/test/resources/log4j.xml
Log:
Added test for system error message;Added 'distro' profile to package all jars in one directory : mvn install -Pdistro
Modified: jbpm4/branches/jimma/modules/migration/pom.xml
===================================================================
--- jbpm4/branches/jimma/modules/migration/pom.xml 2009-06-02 17:37:31 UTC (rev 4977)
+++ jbpm4/branches/jimma/modules/migration/pom.xml 2009-06-03 08:43:36 UTC (rev 4978)
@@ -31,7 +31,7 @@
<name>jBPM 4 - Migration - Tool</name>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>migration</artifactId>
+ <artifactId>jbpm-migration</artifactId>
<packaging>jar</packaging>
<!-- Parent -->
@@ -57,10 +57,6 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
- <!--
- exclusion> <groupId>bsh</groupId> <artifactId>bsh</artifactId>
- </exclusion
- -->
<exclusion>
<groupId>org.apache.jackrabbit</groupId>
@@ -101,6 +97,14 @@
</dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+
+
+
<!-- JBPM4 -->
<dependency>
@@ -150,16 +154,6 @@
<packageName>org.jbpm.jpdl4.model</packageName>
</configuration>
</plugin>
-
- <!--Add classpath to menifest -->
- <!--
- plugin> <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId> <configuration>
- <finalName>jbpm-migration</finalName> <archive> <manifest>
- <addClasspath>true</addClasspath> </manifest> </archive>
- </configuration> </plugin
- -->
-
</plugins>
</build>
@@ -180,6 +174,47 @@
<skipTests>true</skipTests>
</properties>
</profile>
+
+ <profile>
+ <id>distro</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <!--version>2.2-beta-3</version-->
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>scripts/assembly-distro.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--Add classpath to menifest -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>jbpm-migration</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <mainClass>org.jbpm.jpdl.internal.convert.JpdlConverterTool</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
Added: jbpm4/branches/jimma/modules/migration/scripts/assembly-distro.xml
===================================================================
--- jbpm4/branches/jimma/modules/migration/scripts/assembly-distro.xml (rev 0)
+++ jbpm4/branches/jimma/modules/migration/scripts/assembly-distro.xml 2009-06-03 08:43:36 UTC (rev 4978)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<assembly 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/xsd/assembly-1.1.0-SNAPSHOT.xsd">
+
+ <id>jbpm.migration</id>
+ <finalName>jbpm-migration-${version}</finalName>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>dir</format>
+ </formats>
+
+
+<!--fileSets>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>jbpm-migration-${version}</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+</fileSets-->
+
+
+<!-- Dependency Sets -->
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>jbpm-migration-${version}</outputDirectory>
+ <!-- useStrictFiltering>true</useStrictFiltering -->
+ <unpack>false</unpack>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Reader.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Reader.java 2009-06-02 17:37:31 UTC (rev 4977)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Reader.java 2009-06-03 08:43:36 UTC (rev 4978)
@@ -26,6 +26,7 @@
import org.jbpm.jpdl.xml.JpdlXmlReader;
import org.jbpm.jpdl.xml.Problem;
+import org.jbpm.jpdl.xml.ProblemListener;
import org.xml.sax.InputSource;
public class Jpdl3Reader extends JpdlXmlReader {
@@ -34,6 +35,10 @@
super(ins);
}
+ public Jpdl3Reader(InputSource inputSource, ProblemListener problemListener) {
+ super(inputSource, problemListener);
+ }
+
public boolean isValid() {
Iterator iter = problems.iterator();
while (iter.hasNext()) {
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverter.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverter.java 2009-06-02 17:37:31 UTC (rev 4977)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverter.java 2009-06-03 08:43:36 UTC (rev 4978)
@@ -75,10 +75,8 @@
private static final Log logger = LogFactory.getLog(JpdlConverter.class);
public Process run(URL url) throws ConvertException {
- Jpdl3Reader reader = new Jpdl3Reader(new InputSource(url.toString()));
+ Jpdl3Reader reader = new Jpdl3Reader(new InputSource(url.toString()), this);
ProcessDefinition processDef = reader.readProcessDefinition();
- //Added warning message to converter
- getProblems().addAll(reader.getProblems());
return mapProcessDef(processDef);
}
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverterTool.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverterTool.java 2009-06-02 17:37:31 UTC (rev 4977)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverterTool.java 2009-06-03 08:43:36 UTC (rev 4978)
@@ -35,40 +35,64 @@
ConverterContext context = null;
try {
context = converter.parseParam(args);
+ converter.validate(context);
} catch (IllegalCommandException e1) {
System.err.println(e1.getMessage());
System.err.println(converter.getUsage());
- }
-
- try {
- converter.validate(context);
+ return;
} catch (Exception e1) {
System.err.println(e1.getMessage());
+ return;
}
-
+ boolean verbose = false;
+ if (context.get(ConverterContext.VERBOSE) != null) {
+ verbose = true;
+ }
JpdlConverter jpdlConverter = new JpdlConverter();
Jpdl4Writer writer = new Jpdl4Writer();
try {
+ if (verbose) {
+ System.out.println("Loading process file from URL [" + context.get(context.PROCESS_FILE_URL) + "]...");
+ }
Process process = jpdlConverter.run((URL)context.get(context.PROCESS_FILE_URL));
- String outputFile = (String)context.get(context.OUPUTFILE);
- java.io.OutputStream out = new java.io.FileOutputStream(new File(outputFile));
+
+ if (verbose) {
+ System.out.println("Converting the process file to jPDL4 version....");
+ }
+
+ String outputFilePath = (String)context.get(context.OUPUTFILE);
+ File outputFile = new File(outputFilePath);
+ java.io.OutputStream out = new java.io.FileOutputStream(outputFile);
writer.write(process, out, true);
+
+ if (verbose) {
+ System.out.println("Generating converted file :" + (outputFile.isAbsolute() ? outputFile.getCanonicalPath() : outputFile.getName()));
+ }
+
} catch (Exception e) {
- if (context.get(ConverterContext.VERBOSE) != null) {
- for (Problem problem : jpdlConverter.getProblems()) {
- System.err.print(problem);
+
+ for (Problem problem : jpdlConverter.getProblems()) {
+ if (problem.getLevel() == problem.LEVEL_WARNING) {
+ System.err.println(problem);
}
- } else {
- System.err.print(e.getMessage());
+ if (problem.getLevel() < problem.LEVEL_WARNING) {
+ System.err.println(problem);
+ if (problem.getException() != null
+ && context.get(ConverterContext.VERBOSE) != null) {
+ problem.getException().printStackTrace(System.err);
+ System.err.println();
+ }
+ }
}
-
+
+
}
}
public ConverterContext parseParam(String[] args) throws IllegalCommandException {
ConverterContext context = new ConverterContext();
if (args.length == 0) {
- throw new IllegalCommandException("Please input the process file needs to be converted");
+ throw new IllegalCommandException("Missing process file needs to be converted");
}
for (int i = 0; i < args.length; i++) {
String token = args[i];
@@ -82,14 +106,14 @@
String outputFile = args[j];
context.put(ConverterContext.OUPUTFILE, args[j]);
} else {
- throw new IllegalCommandException("output file name is not defined");
+ throw new IllegalCommandException("Missing output file name");
}
} else if (token.startsWith("-")) {
throw new IllegalCommandException("Unknow flag [" + token +"]");
} else if(context.get(ConverterContext.PROCESS_FILE) == null) {
context.put(ConverterContext.PROCESS_FILE, token);
} else {
- throw new IllegalCommandException("Duplicate input process file defined");
+ throw new IllegalCommandException("Duplicate input process file");
}
}
@@ -110,7 +134,6 @@
//handle the output filename
if (context.get(ConverterContext.OUPUTFILE) == null) {
File tmpFile = new File(processURL.getFile());
- File outputDir = tmpFile.getParentFile();
String fileName = tmpFile.getName();
String baseName = fileName;
String extensionName = "";
@@ -125,7 +148,7 @@
String outputFileName = extensionName.equals("") ? baseName + ".converted.jpdl"
: baseName + ".converted.jpdl." + extensionName;
- File outFile = new File(outputDir, outputFileName);
+ File outFile = new File(".", outputFileName);
context.put(ConverterContext.OUPUTFILE, outFile.getAbsolutePath());
} else {
String outputFile = (String)context.get(ConverterContext.OUPUTFILE);
@@ -175,7 +198,7 @@
}
public String getUsage() {
- return "Usage : java org.jbpm.jpdl.internal.convert.JpdlConverterTool <file>/r/n"
+ return "Usage : java org.jbpm.jpdl.internal.convert.JpdlConverterTool <file>\r\n"
+ " java org.jbpm.jpdl.internal.convert.JpdlConverterTool -v -o <outputfile> <file>";
}
Modified: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/util/StartStateConverter.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/util/StartStateConverter.java 2009-06-02 17:37:31 UTC (rev 4977)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/util/StartStateConverter.java 2009-06-03 08:43:36 UTC (rev 4978)
@@ -25,13 +25,12 @@
import java.util.List;
import java.util.Map;
-import org.jbpm.graph.def.Action;
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.node.StartState;
import org.jbpm.jpdl.internal.convert.ProblemCollector;
import org.jbpm.jpdl4.model.On;
import org.jbpm.jpdl4.model.Process;
-import org.jbpm.taskmgmt.def.Task;
+
import org.jbpm.taskmgmt.def.TaskMgmtDefinition;
public class StartStateConverter {
Modified: jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/JpdlConverterToolTest.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/JpdlConverterToolTest.java 2009-06-02 17:37:31 UTC (rev 4977)
+++ jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/JpdlConverterToolTest.java 2009-06-03 08:43:36 UTC (rev 4978)
@@ -22,14 +22,41 @@
package org.jbpm.jpdl.internal.convert;
import java.io.File;
+import java.io.PrintStream;
import java.net.URL;
import junit.framework.Assert;
+
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
public class JpdlConverterToolTest {
JpdlConverterTool tool = new JpdlConverterTool();
+ java.io.ByteArrayOutputStream bout = null;
+ PrintStream oldOut = null;
+
+ java.io.ByteArrayOutputStream errorOut = null;
+ PrintStream oldError = null;
+
+ @Before
+ public void replaceSystemOut() {
+ oldOut = System.out;
+ bout = new java.io.ByteArrayOutputStream();
+ System.setOut(new java.io.PrintStream(bout));
+
+ oldError = System.err;
+ errorOut = new java.io.ByteArrayOutputStream();
+ System.setErr(new java.io.PrintStream(errorOut));
+ }
+
+ @After
+ public void restoreSystemOut() {
+ System.setErr(oldError);
+ System.setOut(oldOut);
+ }
+
@Test
public void wrongArgs1() {
String args[] = {"-v","-t"};
@@ -115,10 +142,6 @@
}
}
-
-
-
-
@Test
public void runConcretProcess() throws Exception {
String fileName = getResource("simple.xml");
@@ -143,6 +166,14 @@
Assert.assertTrue(outputfile.exists());
}
+ @Test
+ public void testErrorMessage() throws Exception {
+ String fileName = getResource("invalid.xml");
+ String args[] = new String[]{fileName};
+ JpdlConverterTool.main(args);
+ String str = new String(errorOut.toByteArray());
+ Assert.assertTrue(str.indexOf("[ERROR] cvc-complex-type.2.4.a:") > -1);
+ }
public String getResource(String file) throws Exception {
Added: jbpm4/branches/jimma/modules/migration/src/test/resources/invalid.xml
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/test/resources/invalid.xml (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/test/resources/invalid.xml 2009-06-03 08:43:36 UTC (rev 4978)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition
+ xmlns="urn:jbpm.org:jpdl-3.2"
+ name="simple">
+ <start-state name="start">
+ <transition name="to_state" to="first">
+ <action name="action" class="com.sample.action.MessageActionHandler">
+ <message>Going to the first state!</message>
+ </action>
+ </transition>
+ </start-state>
+ <state name="first">
+ <transition name="to_end" to="end">
+ <action name="action" class="com.sample.action.MessageActionHandler">
+ <message>About to finish!</message>
+ </action>
+ </transition>
+ </state>
+ <end-state1 name="end"></end-state1>
+</process-definition>
\ No newline at end of file
Modified: jbpm4/branches/jimma/modules/migration/src/test/resources/log4j.xml
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/test/resources/log4j.xml 2009-06-02 17:37:31 UTC (rev 4977)
+++ jbpm4/branches/jimma/modules/migration/src/test/resources/log4j.xml 2009-06-03 08:43:36 UTC (rev 4978)
@@ -9,7 +9,7 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
- <param name="Threshold" value="WARN" />
+ <param name="Threshold" value="ERROR" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
</layout>
16 years, 11 months
JBoss JBPM SVN: r4977 - in jbpm4/trunk/modules: examples/src/test/resources/org/jbpm/examples/java and 6 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-02 13:37:31 -0400 (Tue, 02 Jun 2009)
New Revision: 4977
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ResolveBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ResolveDescriptor.java
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2283 JBPM-2215 making the value types concrete and documenting the migration limitations
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-06-02 17:37:31 UTC (rev 4977)
@@ -439,6 +439,141 @@
<group name="wireObjectGroup">
<choice>
+ <!-- SPECIAL OBJECTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="null">
+ <annotation><documentation>the null value
+ </documentation></annotation>
+ </element>
+ <element name="ref">
+ <annotation><documentation>A 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>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="env-ref">
+ <annotation><documentation>The current environment.
+ </documentation></annotation>
+ </element>
+ <element name="jndi">
+ <annotation><documentation>A lookup from JNDI through the InitialContext
+ </documentation></annotation>
+ <complexType>
+ <attribute name="jndi-name" type="string" use="required" />
+ </complexType>
+ </element>
+
+ <!-- COLLECTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="list">
+ <annotation><documentation>A java.util.List</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <group ref="tns:wireObjectGroup" />
+ </choice>
+ <attribute name="class" type="string" default="java.util.ArrayList">
+ <annotation><documentation>Implementation class for this list.
+ </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>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="map">
+ <annotation><documentation>A java.util.Map</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="entry">
+ <complexType>
+ <choice minOccurs="0">
+ <element name="key" minOccurs="0">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ <element name="value" minOccurs="0">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ </choice>
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="class" type="string" default="java.util.HashMap">
+ <annotation><documentation>Implementation class for this map.
+ </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>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="set">
+ <annotation><documentation>A java.util.Set
+ </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>
+ </attribute>
+ <attribute name="class" type="string" default="java.util.HashList">
+ <annotation><documentation>Implementation class for this set.
+ </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>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="properties">
+ <annotation><documentation>A java.util.Properties</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="property">
+ <complexType>
+ <attribute name="name" type="string" use="required" />
+ <attribute name="value" type="string" use="required" />
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="file" type="string">
+ <annotation><documentation>A file on the file system</documentation></annotation>
+ </attribute>
+ <attribute name="resource" type="string">
+ <annotation><documentation>A file as a resource in the classpath</documentation></annotation>
+ </attribute>
+ <attribute name="url" type="string">
+ <annotation><documentation>the contents is fetched by loading a url</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>
+ </attribute>
+ </complexType>
+ </element>
+
+ <!-- OBJECT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="object" type="tns:wireObjectType" />
+
+ <!-- BASIC TYPES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
<element name="string">
<complexType>
<attribute name="name">
@@ -449,34 +584,240 @@
</attribute>
</complexType>
</element>
- <element name="object" type="tns:wireObjectType" />
+
+ <element name="byte">
+ <annotation><documentation>A java.lang.Byte</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>
+ </attribute>
+ <attribute name="value" type="byte" use="required" />
+ </complexType>
+ </element>
+ <element name="char">
+ <annotation><documentation>A java.lang.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>
+ </attribute>
+ <attribute name="value" use="required">
+ <simpleType>
+ <restriction base="string">
+ <maxLength value="1" />
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="double">
+ <annotation><documentation>A java.lang.Double</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>
+ </attribute>
+ <attribute name="value" type="double" use="required" />
+ </complexType>
+ </element>
+ <element name="false">
+ <annotation><documentation>java.lang.Boolean.FALSE
+ </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>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="float">
+ <annotation><documentation>A java.lang.Float
+ </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>
+ </attribute>
+ <attribute name="value" type="float" use="required" />
+ </complexType>
+ </element>
+ <element name="int">
+ <annotation><documentation>A java.lang.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>
+ </attribute>
+ <attribute name="value" type="int" use="required"/>
+ </complexType>
+ </element>
+ <element name="long">
+ <annotation><documentation>A java.lang.Long</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>
+ </attribute>
+ <attribute name="value" type="long" use="required"/>
+ </complexType>
+ </element>
+ <element name="short">
+ <annotation><documentation>a java.lang.Short
+ </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>
+ </attribute>
+ <attribute name="value" type="short" use="required"/>
+ </complexType>
+ </element>
+ <element name="true">
+ <annotation><documentation>java.lang.Boolean.TRUE
+ </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>
+ </attribute>
+ </complexType>
+ </element>
+
+
</choice>
</group>
<complexType name="wireObjectType">
- <sequence>
- <element name="field" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Field injections from the environment
- invocation.</documentation></annotation>
- <complexType >
+ <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>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="factory">
+ <annotation><documentation>Contains one element that describes the factory object.</documentation></annotation>
+ <complexType>
<group ref="tns:wireObjectGroup" />
- <attribute name="name" type="string">
- <annotation><documentation>Name of the field in which the value should be injected.
- </documentation></annotation>
+ </complexType>
+ </element>
+ <element name="constructor">
+ <annotation><documentation>Specifies the arguments to use for a non-default constructor.</documentation></annotation>
+ <complexType>
+ <choice maxOccurs="unbounded">
+ <element name="arg" type="tns:argType" />
+ </choice>
+ </complexType>
+ </element>
+ <element name="arg" type="tns:argType">
+ <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>
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ <attribute name="name">
+ <annotation><documentation>The member field name</documentation></annotation>
</attribute>
</complexType>
</element>
- </sequence>
- <attribute name="object" type="string">
- <annotation><documentation>Name of the object in the environment
+ <element name="property">
+ <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>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="invoke">
+ <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>
+ </attribute>
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="class" type="string">
+ <annotation><documentation>The fully qualified class name</documentation></annotation>
+ </attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The class to instantiate.
</documentation></annotation>
</attribute>
- <attribute name="class" type="string">
+ <attribute name="lang" type="string">
<annotation><documentation>The class to instantiate.
</documentation></annotation>
</attribute>
- <attribute name="name" type="string">
- <annotation><documentation>The name of this object.
+ <attribute name="factory" type="string">
+ <annotation><documentation>The name of the factory object</documentation></annotation>
+ </attribute>
+ <attribute name="method" type="string">
+ <annotation><documentation>The 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>
+ </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>
+ <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>
</attribute>
</complexType>
@@ -503,6 +844,16 @@
<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>
+ </attribute>
+ <attribute name="lang" type="string">
+ <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>
@@ -733,7 +1084,7 @@
<annotation><documentation>Reference to the email template</documentation></annotation>
</attribute>
</complexType>
-
+
<complexType name="taskType" >
<!--
<sequence>
@@ -781,42 +1132,16 @@
</attribute>
-->
</complexType>
-
- <!--
- <element name="timer">
- <annotation><documentation>A timer that will be bound to the most inner enclosing scope.
- Timers can give a signal to an activity instance. The signal will correspond to a transition
- or to an event being fired.
- </documentation></annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <group ref="tns:eventListenerGroup">
- <annotation><documentation>An inline list of event listeners
- on a timer is a short cut for defining the event separately.
- </documentation></annotation>
- </group>
- </choice>
- <attribute name="duedate" type="string" use="required" />
- <attribute name="signal" type="string" use="required">
- <annotation><documentation>Refers to the signal that will be used.
- If inline event listeners are declared, the signal name can not be
- the same as an event that is declared in this scope.
- </documentation></annotation>
- </attribute>
- <attribute name="repeat" type="string" />
- </complexType>
- </element>
- <simpleType name="priorityType">
+ <simpleType name="booleanValueType">
<restriction base="string">
- <enumeration value="highest"/>
- <enumeration value="high"/>
- <enumeration value="normal"/>
- <enumeration value="low"/>
- <enumeration value="lowest"/>
+ <enumeration value="true" />
+ <enumeration value="on" />
+ <enumeration value="enabled" />
+ <enumeration value="false" />
+ <enumeration value="off" />
+ <enumeration value="disabled" />
</restriction>
</simpleType>
- -->
-
</schema>
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml 2009-06-02 17:37:31 UTC (rev 4977)
@@ -24,8 +24,8 @@
var="hand"
g="96,16,127,52">
- <arg><resolve expr="#{joesmoe.handshakes.force}"/></arg>
- <arg><resolve expr="#{joesmoe.handshakes.duration}"/></arg>
+ <arg><object expr="#{joesmoe.handshakes.force}"/></arg>
+ <arg><object expr="#{joesmoe.handshakes.duration}"/></arg>
<transition to="wait" />
</java>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -68,7 +68,7 @@
} else if (element.hasAttribute("expr")) {
String expression = element.getAttribute("expr");
javaActivity.setTargetExpression(expression);
- javaActivity.setTargetLanguage(XmlUtil.attribute(element, "language"));
+ javaActivity.setTargetLanguage(XmlUtil.attribute(element, "lang"));
} else {
// parse.addProblem("no target specified in "+TAG+": must specify attribute 'class' or 'expr'", element);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -70,6 +70,7 @@
Parser wireParser = (Parser) parser;
String className = XmlUtil.attribute(element, "class");
+ String expr = XmlUtil.attribute(element, "expr");
String factoryObjectName = XmlUtil.attribute(element, "factory");
Element factoryElement = XmlUtil.element(element, "factory");
@@ -104,8 +105,13 @@
Descriptor factoryDescriptor = (Descriptor) parser.parseElement(factoryDescriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
descriptor.setFactoryDescriptor(factoryDescriptor);
+ } else if (expr!=null) {
+ descriptor.setExpr(expr);
+ String lang = XmlUtil.attribute(element, "lang");
+ descriptor.setLang(lang);
+
} else {
- parse.addProblem("element 'object' must have one of {attribute 'class', attribute 'factory' or element 'factory'}: "+XmlUtil.toString(element));
+ parse.addProblem("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}: "+XmlUtil.toString(element));
}
// method
@@ -115,12 +121,16 @@
List<Element> argElements = XmlUtil.elements(element, "arg");
List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
descriptor.setArgDescriptors(argDescriptors);
- } else if (className == null) {
+ } else if ( (factoryObjectName!=null)
+ || (factoryElement!=null)
+ ) {
parse.addProblem("element 'object' with a element 'factory' or a attribute 'factory' must have a attribute 'method': "+XmlUtil.toString(element));
}
- if( (className == null) && (XmlUtil.element(element, "constructor") != null)){
- parse.addProblem("element 'object' with a element 'factory' or a attribute 'factory' can't have a 'constructor' element: "+XmlUtil.toString(element));
+ if( (className == null)
+ && (XmlUtil.element(element, "constructor") != null)
+ ) {
+ parse.addProblem("element 'object' with a 'constructor' element must have 'class' attribute: "+XmlUtil.toString(element));
}
// read the operations elements
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ResolveBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ResolveBinding.java 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ResolveBinding.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -1,51 +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.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ResolveDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ResolveBinding extends WireDescriptorBinding {
-
- public ResolveBinding() {
- super("resolve");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- ResolveDescriptor resolveDescriptor = new ResolveDescriptor();
-
- String expr = XmlUtil.attribute(element, "expr");
- resolveDescriptor.setExpr(expr);
-
- String lang = XmlUtil.attribute(element, "lang");
- resolveDescriptor.setLang(lang);
-
- return resolveDescriptor;
- }
-}
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 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -11,6 +11,8 @@
import org.jbpm.api.JbpmException;
import org.jbpm.api.env.Environment;
import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
+import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
@@ -84,7 +86,7 @@
private static final long serialVersionUID = 1L;
private static Log log = Log.getLog(ObjectDescriptor.class.getName());
- String className = null;
+ protected String className = null;
/** specifies the object reference on which the method will be invoked.
* Either className, objectName or a descriptor has to be specified.
@@ -94,19 +96,23 @@
* */
String factoryObjectName = null;
+ protected String expr;
+
+ protected String lang;
+
/** specifies the object on which to invoke the method.
* Either className, objectName or a descriptor has to be specified. */
- Descriptor factoryDescriptor = null;
+ protected Descriptor factoryDescriptor = null;
- String methodName = null;
+ protected String methodName = null;
/** map to db as a component */
- List<ArgDescriptor> argDescriptors = null;
+ protected List<ArgDescriptor> argDescriptors = null;
/** list of operations to perform during initialization. */
- List<Operation> operations = null;
+ protected List<Operation> operations = null;
/** True if autowiring is enabled. */
- boolean isAutoWireEnabled = false;
+ protected boolean isAutoWireEnabled = false;
public ObjectDescriptor() {
}
@@ -169,6 +175,9 @@
if (object==null) {
throw new WireException("created factory object is null, can't invoke method '"+methodName+"' on it");
}
+ } else if (expr!=null) {
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ object = scriptManager.evaluateExpression(expr, lang);
}
if (methodName!=null) {
@@ -387,127 +396,61 @@
addOperation(operation);
}
- /**
- * Gets the class name of the object to create.
- * This name is defined only when creating objects from a constructor or when invoking static methods.
- * @return the name of the class of the object to create.
- */
+
+ // getters and setters //////////////////////////////////////////////////////
+
public String getClassName() {
return className;
}
-
- /**
- * Sets class name of the object to create.
- * This name is defined only when creating objects from a constructor or when invoking static methods.
- * If this name is set, the factoryObjectName and factoryDescriptor should not be set.
- * @see #setFactoryDescriptor(Descriptor)
- * @see #setFactoryObjectName(String)
- * @param className name of the class to use.
- */
public void setClassName(String className) {
this.className = className;
}
-
- /**
- * Gets the list of descriptors to use to create method arguments.
- * @return list of descriptors to use to create method arguments.
- */
public List<ArgDescriptor> getArgDescriptors() {
return argDescriptors;
}
-
- /**
- * Sets the list of descriptors to use to create method arguments.
- * @param argDescriptors list of descriptors to use to create method arguments.
- */
public void setArgDescriptors(List<ArgDescriptor> argDescriptors) {
this.argDescriptors = argDescriptors;
}
-
- /**
- * Gets the list of operations to perform during initialization.
- * @return list of operations to perform during initialization.
- */
public List<Operation> getOperations() {
return operations;
}
-
- /**
- * Sets the list of operations to perform during initialization.
- * @param operations list of operations to perform during initialization.
- */
public void setOperations(List<Operation> operations) {
this.operations = operations;
}
-
- /**
- * Gets the Descriptor from which the object should be created.
- * @return the Descriptor from which the object should be created.
- */
public Descriptor getFactoryDescriptor() {
return factoryDescriptor;
}
-
- /**
- * Sets the Descriptor from which the object should be created.
- * If this Descriptor is set, the className and factoryObjectName should not be set.
- * @see #setClassName(String)
- * @see #setFactoryObjectName(String)
- * @param factoryDescriptor the Descriptor from which the object should be created.
- */
public void setFactoryDescriptor(Descriptor factoryDescriptor) {
this.factoryDescriptor = factoryDescriptor;
}
-
-
- /**
- * Gets the name of the object to get from the WireContext.
- * @return name of the object to get from the WireContext.
- */
public String getFactoryObjectName() {
return factoryObjectName;
}
-
- /**
- * Sets name of the object to get from the WireContext.
- * If this name is set, the className and factoryDescriptor should not be set.
- * @see #setClassName(String)
- * @see #setFactoryDescriptor(Descriptor)
- * @param factoryObjectName name of the object to get from the WireContext.
- */
public void setFactoryObjectName(String factoryObjectName) {
this.factoryObjectName = factoryObjectName;
}
-
- /**
- * Gets the name of the method to invoke.
- * @return name of the method to invoke.
- */
public String getMethodName() {
return methodName;
}
-
- /**
- * Sets the name of the method to invoke.
- * @param methodName name of the method to invoke.
- */
public void setMethodName(String methodName) {
this.methodName = methodName;
}
-
- /**
- * Checks if auto-wiring is enabled
- * @return <code>true</code> if auto-wiring is enabled.
- */
public boolean isAutoWireEnabled() {
return isAutoWireEnabled;
}
-
- /**
- * Enables/Disables auto wiring mode.
- * @param isAutoWireEnabled <code>true</code> to enable auto-wiring.
- */
public void setAutoWireEnabled(boolean isAutoWireEnabled) {
this.isAutoWireEnabled = isAutoWireEnabled;
}
+ public String getExpr() {
+ return expr;
+ }
+ public void setExpr(String expr) {
+ this.expr = expr;
+ }
+ public String getLang() {
+ return lang;
+ }
+ public void setLang(String lang) {
+ this.lang = lang;
+ }
}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ResolveDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ResolveDescriptor.java 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ResolveDescriptor.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -1,56 +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.pvm.internal.wire.descriptor;
-
-import org.jbpm.pvm.internal.env.EnvironmentDefaults;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.internal.wire.WireContext;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ResolveDescriptor extends AbstractDescriptor {
-
- private static final long serialVersionUID = 1L;
-
- protected String expr;
- protected String lang;
-
- public Object construct(WireContext wireContext) {
- ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
- return scriptManager.evaluateExpression(expr, lang);
- }
-
- public String getExpr() {
- return expr;
- }
- public void setExpr(String expr) {
- this.expr = expr;
- }
- public String getLang() {
- return lang;
- }
- public void setLang(String lang) {
- this.lang = lang;
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml 2009-06-02 17:37:31 UTC (rev 4977)
@@ -32,7 +32,6 @@
<binding class="org.jbpm.pvm.internal.wire.binding.ContextRefBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.TransactionRefBinding" />
<!-- various specials -->
- <binding class="org.jbpm.pvm.internal.wire.binding.ResolveBinding"/>
<binding class="org.jbpm.pvm.internal.wire.binding.TransactionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobExecutorBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobTestHelperBinding" />
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -92,7 +92,7 @@
"</objects>"
);
assertNotNull(problems);
- assertTextPresent("element 'object' must have one of {attribute 'class', attribute 'factory' or element 'factory'}", problems.get(0).getMsg());
+ assertTextPresent("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}", problems.get(0).getMsg());
}
public void testInvalidObjectType() {
@@ -178,7 +178,7 @@
"</objects>"
);
assertNotNull(problems);
- assertTextPresent("element 'object' must have one of {attribute 'class', attribute 'factory' or element 'factory'}", problems.get(0).getMsg());
+ assertTextPresent("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}", problems.get(0).getMsg());
}
public static class StaticFactoryMethodWithoutParametersClass {
@@ -1021,7 +1021,7 @@
"</objects>"
);
assertNotNull(problems);
- assertTextPresent("element 'object' with a element 'factory' or a attribute 'factory' can't have a 'constructor' element: ", problems.get(0).getMsg());
+ assertTextPresent("element 'object' with a 'constructor' element must have 'class' attribute", problems.get(0).getMsg());
}
public void testConstructorAndFactoryElement(){
@@ -1036,7 +1036,7 @@
"</objects>"
);
assertNotNull(problems);
- assertTextPresent("element 'object' with a element 'factory' or a attribute 'factory' can't have a 'constructor' element: ", problems.get(0).getMsg());
+ assertTextPresent("element 'object' with a 'constructor' element must have 'class' attribute", problems.get(0).getMsg());
}
public void testFactoryAttributeUnknownObject(){
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml 2009-06-02 17:37:31 UTC (rev 4977)
@@ -49,4 +49,29 @@
</para>
</section>
+ <section>
+ <title>Migration from jBPM 3</title>
+ <para>Migration from jBPM 3 to jBPM 4 is not supported.
+ </para>
+ <para>jBPM 3 and jBPM 4 can be deployed on the same JVM and
+ on the same database. Packages are stricktly separated and database
+ table prefix is changed from <literal>JBPM_</literal> to <literal>JBPM4_</literal>
+ </para>
+ <itemizedlist>
+ <listitem><emphasis role="bold">jPDL process files</emphasis>: A process file
+ conversion tool is in the works. It will be shipped with the distribution
+ in one of the following releases.
+ </listitem>
+ <listitem><emphasis role="bold">API</emphasis>: The jBPM API has completely
+ changed. Where jBPM 3 exposed the internal object model and didn't have
+ a session facade API, the supported API of jBPM 4 are the services, which are
+ in fact session facades that can be used in any environment that we support.
+ </listitem>
+ <listitem><emphasis role="bold">Database</emphasis>: The jBPM database also
+ has drastically changed between version 3 and 4. There is no migration tool
+ to convert jBPM 3 runtime database contents to jBPM 4.
+ </listitem>
+ </itemizedlist>
+ </section>
+
</chapter>
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-02 17:37:31 UTC (rev 4977)
@@ -1764,8 +1764,8 @@
var="hand"
>
- <arg><resolve expr="#{joesmoe.handshakes.force}"/></arg>
- <arg><resolve expr="#{joesmoe.handshakes.duration}"/></arg>
+ <arg><object expr="#{joesmoe.handshakes.force}"/></arg>
+ <arg><object expr="#{joesmoe.handshakes.duration}"/></arg>
<transition to="wait" />
</java>
16 years, 11 months
JBoss JBPM SVN: r4976 - in projects/jbpm-esb-integration: doc and 8 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-02 07:41:04 -0400 (Tue, 02 Jun 2009)
New Revision: 4976
Added:
projects/jbpm-esb-integration/.classpath
projects/jbpm-esb-integration/.project
projects/jbpm-esb-integration/doc/
projects/jbpm-esb-integration/doc/esb.docbook.section.xml
projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml
projects/jbpm-esb-integration/pom.snippets.xml
projects/jbpm-esb-integration/src/
projects/jbpm-esb-integration/src/main/
projects/jbpm-esb-integration/src/main/java/
projects/jbpm-esb-integration/src/main/java/org/
projects/jbpm-esb-integration/src/main/java/org/jbpm/
projects/jbpm-esb-integration/src/main/java/org/jbpm/examples/
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java
projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
Log:
create jbpm-esb-integration into jbpm projects
Added: projects/jbpm-esb-integration/.classpath
===================================================================
--- projects/jbpm-esb-integration/.classpath (rev 0)
+++ projects/jbpm-esb-integration/.classpath 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Property changes on: projects/jbpm-esb-integration/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/.project
===================================================================
--- projects/jbpm-esb-integration/.project (rev 0)
+++ projects/jbpm-esb-integration/.project 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jbpm-esb-integration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: projects/jbpm-esb-integration/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/doc/esb.docbook.section.xml
===================================================================
--- projects/jbpm-esb-integration/doc/esb.docbook.section.xml (rev 0)
+++ projects/jbpm-esb-integration/doc/esb.docbook.section.xml 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,91 @@
+
+ <!-- ### ESB ########################################################### -->
+ <section id="esb">
+ <title><literal>esb</literal></title>
+ <para>An <literal>esb</literal> activity sends a message to a service over the ESB.
+ The attributes <literal>category</literal> and <literal>service</literal> identify the
+ service in the esb repository. The message is composed with the
+ <literal>part</literal> elements.
+ </para>
+ <table><title><literal>esb</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>category</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>the esb category where the service is defined.</entry>
+ </row>
+ <row>
+ <entry><literal>service</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>the esb name of the service
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title><literal>esb</literal> elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>part</literal></entry>
+ <entry>0..*</entry>
+ <entry>Parts of the message to be sent.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>For example</para>
+ <figure id="process.esb">
+ <title>The esb example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.esb.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="Esb" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <start >
+ <transition to="invoke esb service" />
+ </start>
+
+ <emphasis role="bold"><esb name="invoke esb service"
+ category="orderProcessing"
+ service="bookSold">
+
+ <part name="bookTitle" expr="#{title}" />
+ <part name="goal">
+ <string value="deliver asap" />
+ </part></emphasis>
+
+ <transition to="wait" />
+ <emphasis role="bold"></esb></emphasis>
+
+ <state name="wait" />
+
+</process></programlisting>
+ <para>When a new process is started, a message will be sent to the esb
+ service <literal>bookSold</literal> in category <literal>orderProcessing</literal>.
+ The message will have 2 parts: one named <literal>bookTitle</literal> containing
+ the title process variable. And one named <literal>goal</literal> which
+ contains the text 'deliver asap'.
+ </para>
+ </section>
+
Property changes on: projects/jbpm-esb-integration/doc/esb.docbook.section.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml
===================================================================
--- projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml (rev 0)
+++ projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,53 @@
+ <!-- ~~~ ESB ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="esb">
+ <annotation><documentation>Invokes a service over the ESB.
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:esbType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+
+ <complexType name="esbType">
+ <sequence>
+ <element name="part" minOccurs="0" maxOccurs="unbounded">
+ <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>
+ <complexType>
+ <choice minOccurs="0">
+ <group ref="tns:wireObjectGroup" />
+ </choice>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the message body part.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script text that will be evaluated and
+ used and the object in this message body part.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="category" type="string">
+ <annotation><documentation>The category of the service in the esb.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="service" type="string">
+ <annotation><documentation>The name of the service in the esb.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+
+ <element name="esb" type="tns:esbType" />
+
Property changes on: projects/jbpm-esb-integration/doc/esb.xsd.snippets.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/pom.snippets.xml
===================================================================
--- projects/jbpm-esb-integration/pom.snippets.xml (rev 0)
+++ projects/jbpm-esb-integration/pom.snippets.xml 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,44 @@
+main project parent pom:
+
+ <jbossesb.version>4.4.0.GA</jbossesb.version>
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>jbossesb-rosetta</artifactId>
+ <version>${jbossesb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>test-util</artifactId>
+ <version>${jbossesb.version}</version>
+ </dependency>
+
+from examples pom:
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>jbossesb-rosetta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>test-util</artifactId>
+ </dependency>
+
+
+from jpdl pom:
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4.dependencies.esb</groupId>
+ <artifactId>jbossesb-rosetta</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>provided</scope>
+ </dependency>
Property changes on: projects/jbpm-esb-integration/pom.snippets.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java
===================================================================
--- projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java (rev 0)
+++ projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,81 @@
+/*
+ * 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.internal.activity;
+
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExpressionEvaluator;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EsbActivity extends JpdlAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ private static Log log = Log.getLog(EsbActivity.class.getName());
+
+ protected String category = null;
+ protected String service = null;
+ protected ListDescriptor partsListDescriptor = null;
+
+ public void perform(OpenExecution execution) throws Exception {
+ Message message = MessageFactory.getInstance().getMessage();
+ Body body = message.getBody();
+
+ if (partsListDescriptor!=null) {
+ WireContext wireContext = new WireContext();
+ for (Descriptor descriptor: partsListDescriptor.getValueDescriptors()) {
+ String name = descriptor.getName();
+
+ Object object = wireContext.create(descriptor, true);
+ if (object instanceof ExpressionEvaluator) {
+ ExpressionEvaluator expressionEvaluator = (ExpressionEvaluator) object;
+ object = expressionEvaluator.evaluateExpression(execution);
+ }
+ body.add(name, object);
+ }
+ }
+
+ ServiceInvoker invoker = new ServiceInvoker(category, service);
+ log.debug("sending "+message.getBody()+" to service "+service+" in category "+category+" over the esb");
+ invoker.deliverAsync(message);
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+ public void setService(String service) {
+ this.service = service;
+ }
+ public void setPartsListDescriptor(ListDescriptor partsListDescriptor) {
+ this.partsListDescriptor = partsListDescriptor;
+ }
+}
Property changes on: projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
===================================================================
--- projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java (rev 0)
+++ projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java 2009-06-02 11:41:04 UTC (rev 4976)
@@ -0,0 +1,95 @@
+/*
+ * 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.internal.activity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EsbBinding extends JpdlBinding {
+
+ public static final String TAG = "esb";
+ private static final WireParser wireParser = WireParser.getInstance();
+
+ public EsbBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EsbActivity esbActivity = new EsbActivity();
+
+ String category = XmlUtil.attribute(element, "category", true, parse);
+ esbActivity.setCategory(category);
+
+ String service = XmlUtil.attribute(element, "service", true, parse);
+ esbActivity.setService(service);
+
+ List<Descriptor> partDescriptors = new ArrayList<Descriptor>();
+ List<Element> partElements = XmlUtil.elements(element, "part");
+ for (Element partElement: partElements) {
+ String name = XmlUtil.attribute(partElement, "name", true, parse);
+ AbstractDescriptor partDescriptor = getPartDescriptor(partElement, parse);
+ partDescriptor.setName(name);
+ partDescriptors.add(partDescriptor);
+ }
+ ListDescriptor partsListDescriptor = new ListDescriptor();
+ if (!partDescriptors.isEmpty()) {
+ partsListDescriptor.setValueDescriptors(partDescriptors);
+ }
+ esbActivity.setPartsListDescriptor(partsListDescriptor);
+
+ return esbActivity;
+ }
+
+ public AbstractDescriptor getPartDescriptor(Element partElement, Parse parse) {
+ String expression = XmlUtil.attribute(partElement, "expr");
+ Element descriptorElement = XmlUtil.element(partElement);
+
+ if ( ( (expression==null) && (descriptorElement==null) )
+ ||
+ ( (expression!=null) && (descriptorElement!=null) )
+ ) {
+ parse.addProblem("in <"+TAG+"...> an expr or exactly one child element is expected");
+ }
+
+ if (expression!=null) {
+ return new ExpressionEvaluatorDescriptor(expression, null);
+ }
+
+ AbstractDescriptor descriptor = (AbstractDescriptor) wireParser.parseElement(descriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
+ return descriptor;
+ }
+
+}
Property changes on: projects/jbpm-esb-integration/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 11 months
JBoss JBPM SVN: r4975 - projects.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-02 07:39:53 -0400 (Tue, 02 Jun 2009)
New Revision: 4975
Added:
projects/jbpm-esb-integration/
Log:
create jbpm-esb-integration into jbpm projects
16 years, 11 months