[jbpm-commits] JBoss JBPM SVN: r3830 - in jbpm4/trunk/modules: enterprise/src/main/java/org/jbpm/enterprise/internal/ejb and 19 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Feb 11 07:12:09 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-02-11 07:12:09 -0500 (Wed, 11 Feb 2009)
New Revision: 3830
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/JobQuery.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MessageFinder.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/AutomaticActivity.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ContinuationTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/GenerateExceptionTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/Recorder.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/WaitState.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/Automatic.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/
jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetMessagesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTimersCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AutomaticActivity.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ContinuationTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveMessagesTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceMessageTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingMessageTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTestCase.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/Recorder.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/WaitState.java
jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/mgmt/ManagementServiceTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/AddCommentMessage.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/Automatic.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/MessageProcessingTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/ProcessExecutionTest.java
jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/process.jpdl.xml
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ManagementService.java
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java
jbpm4/trunk/modules/pvm/src/main/docs/module.dependencies.uml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorThread.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/svc/ManagementServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/test/JobTestHelper.java
jbpm4/trunk/modules/pvm/src/test/resources/logging.properties
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
jbpm4/trunk/modules/test-load/pom.xml
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/LoadTestCase.java
jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml
Log:
JBPM-1280 moved multithreaded job executor tests to test-load module
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/JobQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/JobQuery.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/JobQuery.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import org.jbpm.job.Job;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface JobQuery {
+
+ JobQuery messages();
+ JobQuery timers();
+
+ JobQuery processInstanceId(String processInstanceId);
+
+ JobQuery exception();
+
+ JobQuery orderAsc(String property);
+ JobQuery orderDesc(String property);
+
+ JobQuery page(int firstResult, int maxResults);
+
+ List<Job> execute();
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/JobQuery.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ManagementService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ManagementService.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ManagementService.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -21,13 +21,8 @@
*/
package org.jbpm;
-import java.util.List;
-import org.jbpm.job.Job;
-import org.jbpm.job.Message;
-import org.jbpm.job.Timer;
-
/** operations targeted to system operators that need to keep
* the process engine up and running. This functionality is typically
* exposed through a management web console.
@@ -36,22 +31,14 @@
*/
public interface ManagementService {
- /** all the messages which are waiting to be executed.
- * Messages that are already acquired will not show up in the list. */
- List<Message> getMessages(int firstResult, int maxResults);
-
- /** all the timers which are waiting for their due date.
- * Timers that are already acquired will not show up in the list. */
- List<Timer> getTimers(int firstResult, int maxResults);
-
- /** all jobs for which all the retry attempts have failed and
- * which are parked, waiting for operator intervention */
- List<Job> getJobsWithException(int firstResult, int maxResults);
-
/** resets the retry count, clears the exception and executes the job.
* An exception is thrown out of this method in case the execution
* of the job fails. In case the async command executor is configured
* for this service, failing job execution will not result into an
* exception coming out of this method. */
- void executeJob(String jobId);
+ void executeJob(long jobDbid);
+
+ /** search for jobs */
+ JobQuery createJobQuery();
+
}
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -43,7 +43,7 @@
import org.jbpm.cmd.Command;
import org.jbpm.job.Job;
import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.jobexecutor.ExecuteJobCmd;
+import org.jbpm.pvm.internal.cmd.ExecuteJobCmd;
/**
* Message driven command receiver.
Modified: jbpm4/trunk/modules/pvm/src/main/docs/module.dependencies.uml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/docs/module.dependencies.uml 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/main/docs/module.dependencies.uml 2009-02-11 12:12:09 UTC (rev 3830)
@@ -61,15 +61,15 @@
<XPD:REF name="DiagramOwner">mNlhQxH3RkCjxaH3VQBTwQAA</XPD:REF>
<XPD:OBJ name="DiagramView" type="UMLComponentDiagramView" guid="Ly6NXYaRhEOxVqp3jH5kgQAA">
<XPD:REF name="Diagram">P3SoCbzoDE6hYcPIUEpSNAAA</XPD:REF>
-<XPD:ATTR name="#OwnedViews" type="integer">35</XPD:ATTR>
+<XPD:ATTR name="#OwnedViews" type="integer">36</XPD:ATTR>
<XPD:OBJ name="OwnedViews[0]" type="UMLPackageView" guid="7gpcdFJdLEyTK/UY/CuWfgAA">
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Courier New</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">12</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">50</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">240</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">200</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">70</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">505</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">160</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">121</XPD:ATTR>
<XPD:REF name="Model">5TvqnjB1jkG25vsTu+A0XgAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="dp6Ei5LmwUK7Gm5YrkOB/AAA">
@@ -88,11 +88,11 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Courier New</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">12</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">265</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">110</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">491</XPD:ATTR>
-<XPD:ATTR name="Height" type="integer">391</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">65</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">100</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">356</XPD:ATTR>
+<XPD:ATTR name="Height" type="integer">366</XPD:ATTR>
<XPD:REF name="Model">tfl5FprffUy9SE+AmL+zpQAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="NlT0a5NumEyWnqIha2n/8QAA">
<XPD:OBJ name="NameLabel" type="LabelView" guid="tSximKu16E6V7ne50DVjiAAA">
@@ -110,10 +110,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">400</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">160</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">103</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">110</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">135</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">89</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">Ois8O253kUadM8pwQY3z1AAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="hNVtOPEDiUeVRTg/RcehGgAA">
@@ -137,10 +137,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">395</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">280</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">115</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">103</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">260</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">97</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">F/VKixV7K02VlwQlQmAvKwAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="Ok6AsWY7DEq0NFgv+JRDPgAA">
@@ -164,9 +164,9 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">310</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">350</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">170</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">330</XPD:ATTR>
<XPD:ATTR name="Width" type="integer">115</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">AXGT6sG/YkWAzbne6BYH9gAA</XPD:REF>
@@ -191,10 +191,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">75</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">305</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">163</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">80</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">560</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">137</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">rN2k9cfQlk2UzNSPqqPOegAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="y6tXNO0XVEmE4S8cz/JZzwAA">
@@ -218,10 +218,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFB9</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">230</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">550</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">158</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">260</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">610</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">132</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">MsVxfbvaTkidMyurdVALEAAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="w5f7JGC/hUGxNQi+v+vWNwAA">
@@ -245,10 +245,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFB9</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">400</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">550</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">139</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">260</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">555</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">131</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">kwDBvXNU5ECCKv4hB67TCgAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="qQbpeM449UyU4IOJYERcSAAA">
@@ -272,10 +272,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFB9</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">60</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">550</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">155</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">75</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">650</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">129</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">Ti77WPS+TES4vmhJCWTIqAAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="Pi3oXqbiR0u8yHfBhG0migAA">
@@ -299,10 +299,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">395</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">440</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">109</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">105</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">400</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">94</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">Bs15lMzAj0mz+NvzVS7E4QAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="dJnh7tU3dU2NiM5LIrSRHQAA">
@@ -326,8 +326,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">452,280;451,204</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">152,260;154,179</XPD:ATTR>
<XPD:REF name="Model">UzW89zVUMkOD2XR49GKBSwAA</XPD:REF>
<XPD:REF name="Head">92NqScYMQkimi4w+8NuFxQAA</XPD:REF>
<XPD:REF name="Tail">kL0ifBLH8k2M0PxjEkWXUwAA</XPD:REF>
@@ -354,8 +354,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">394,350;425,324</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">203,330;175,304</XPD:ATTR>
<XPD:REF name="Model">USrXc+RVC06k6g8JDBkKtQAA</XPD:REF>
<XPD:REF name="Head">kL0ifBLH8k2M0PxjEkWXUwAA</XPD:REF>
<XPD:REF name="Tail">Gv5w/Hcm0k61rZhkNLQGtQAA</XPD:REF>
@@ -382,8 +382,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">449,440;452,324</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">151,400;151,304</XPD:ATTR>
<XPD:REF name="Model">Y4WLKpAHrUilfBgG5ABxQgAA</XPD:REF>
<XPD:REF name="Head">kL0ifBLH8k2M0PxjEkWXUwAA</XPD:REF>
<XPD:REF name="Tail">uaMGdUZ3rUGciJaxG5vJyAAA</XPD:REF>
@@ -410,8 +410,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">237,314;290,305;395,303</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">93,560;55,545;55,340;115,304</XPD:ATTR>
<XPD:REF name="Model">3soARAGPkkK23DUBcA3VbAAA</XPD:REF>
<XPD:REF name="Head">kL0ifBLH8k2M0PxjEkWXUwAA</XPD:REF>
<XPD:REF name="Tail">0Vw/eC4690OaqgqTJ+R97QAA</XPD:REF>
@@ -438,8 +438,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">336,550;421,484</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">260,622;245,620;245,490;181,444</XPD:ATTR>
<XPD:REF name="Model">1CXs2RCBIEmDFPmyngQ7wQAA</XPD:REF>
<XPD:REF name="Head">uaMGdUZ3rUGciJaxG5vJyAAA</XPD:REF>
<XPD:REF name="Tail">WMFeUrRaqkmSFaxxGYhliQAA</XPD:REF>
@@ -450,9 +450,10 @@
<XPD:REF name="Model">1CXs2RCBIEmDFPmyngQ7wQAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="StereotypeLabel" type="EdgeLabelView" guid="qx+nvFgOpEmfpqN0d8S+ygAA">
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Visible" type="boolean">False</XPD:ATTR>
<XPD:ATTR name="Alpha" type="real">-3,3733085417589</XPD:ATTR>
<XPD:ATTR name="Distance" type="real">21,9317121994613</XPD:ATTR>
-<XPD:ATTR name="Text" type="string"><<runtime>></XPD:ATTR>
<XPD:REF name="Model">1CXs2RCBIEmDFPmyngQ7wQAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="PropertyLabel" type="EdgeLabelView" guid="eH/awcIp+k6tEkVnEeqKmQAA">
@@ -466,8 +467,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">465,550;453,484</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">260,571;245,570;245,490;181,444</XPD:ATTR>
<XPD:REF name="Model">JmpD2e0w4UycQJFvCIIURQAA</XPD:REF>
<XPD:REF name="Head">uaMGdUZ3rUGciJaxG5vJyAAA</XPD:REF>
<XPD:REF name="Tail">os/ZpLf6E0C9OkWrF0aPPwAA</XPD:REF>
@@ -478,8 +479,9 @@
<XPD:REF name="Model">JmpD2e0w4UycQJFvCIIURQAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="StereotypeLabel" type="EdgeLabelView" guid="HXVe8usV8kO191DDCVY/WgAA">
-<XPD:ATTR name="Alpha" type="real">2,7430715600805</XPD:ATTR>
-<XPD:ATTR name="Distance" type="real">9,21954445729289</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Alpha" type="real">-0,259331685062154</XPD:ATTR>
+<XPD:ATTR name="Distance" type="real">50,6951674225463</XPD:ATTR>
<XPD:ATTR name="Text" type="string"><<runtime>></XPD:ATTR>
<XPD:REF name="Model">JmpD2e0w4UycQJFvCIIURQAA</XPD:REF>
</XPD:OBJ>
@@ -494,8 +496,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">150,550;290,305;395,303</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">81,650;55,640;55,340;115,304</XPD:ATTR>
<XPD:REF name="Model">KGxkaAq6n0iaJ5qJnbuCiAAA</XPD:REF>
<XPD:REF name="Head">kL0ifBLH8k2M0PxjEkWXUwAA</XPD:REF>
<XPD:REF name="Tail">m19PobYTBkqfijmLqUHsGgAA</XPD:REF>
@@ -522,10 +524,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFB9</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">550</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">550</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">153</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">265</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">500</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">128</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">ldE/OPmI/UqAVOba04r45QAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="YT8uROkxlU6fR+/+ywr8ZgAA">
@@ -549,8 +551,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">591,550;484,484</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">265,517;245,515;245,490;181,444</XPD:ATTR>
<XPD:REF name="Model">gNdjs1FEbkyttFXd3t0sNQAA</XPD:REF>
<XPD:REF name="Head">uaMGdUZ3rUGciJaxG5vJyAAA</XPD:REF>
<XPD:REF name="Tail">NR+DCad5w0aNy08gEmohjgAA</XPD:REF>
@@ -561,9 +563,10 @@
<XPD:REF name="Model">gNdjs1FEbkyttFXd3t0sNQAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="StereotypeLabel" type="EdgeLabelView" guid="JInfIiF+yUWGEwRuC/fBbQAA">
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Visible" type="boolean">False</XPD:ATTR>
<XPD:ATTR name="Alpha" type="real">3,54584433817258</XPD:ATTR>
<XPD:ATTR name="Distance" type="real">26,3058928759318</XPD:ATTR>
-<XPD:ATTR name="Text" type="string"><<runtime>></XPD:ATTR>
<XPD:REF name="Model">gNdjs1FEbkyttFXd3t0sNQAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="PropertyLabel" type="EdgeLabelView" guid="bW5E7jctskGxAqy4fBJsUwAA">
@@ -577,9 +580,9 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00E8E8E8</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">275</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">30</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">55</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">25</XPD:ATTR>
<XPD:ATTR name="Width" type="integer">111</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">7b0gCEntNUmxlyQ1YVGDvwAA</XPD:REF>
@@ -604,10 +607,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">570</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">280</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">158</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">230</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">260</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">131</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">RnhmSXHjpkqPifkoBI0xMQAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="QhSleJX7IUih8ZGA9w7ViAAA">
@@ -631,9 +634,9 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00E8E8E8</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">535</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">30</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">200</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">25</XPD:ATTR>
<XPD:ATTR name="Width" type="integer">96</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">fTUNxe8WmEWd/zpINe6SCQAA</XPD:REF>
@@ -658,8 +661,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">421,280;330,215;330,74</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">129,260;80,210;80,80;90,69</XPD:ATTR>
<XPD:REF name="Model">b+gX8dz5uEe/vDyX6nczwgAA</XPD:REF>
<XPD:REF name="Head">3fKHNq8HbU6ne7o9d0+49QAA</XPD:REF>
<XPD:REF name="Tail">kL0ifBLH8k2M0PxjEkWXUwAA</XPD:REF>
@@ -686,9 +689,9 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00E8E8E8</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">665</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">30</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">330</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">25</XPD:ATTR>
<XPD:ATTR name="Width" type="integer">96</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">q2sDsF5njUmjPrBEjAya2AAA</XPD:REF>
@@ -713,8 +716,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">668,280;695,250;695,140;708,74</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">333,260;385,230;385,120;379,69</XPD:ATTR>
<XPD:REF name="Model">j1GCNWMKW0CgQEXmzVa7bQAA</XPD:REF>
<XPD:REF name="Head">okCq8TeiSkSTXxYO7BUdpgAA</XPD:REF>
<XPD:REF name="Tail">1ltfrrUBG0q0sFN/n22amgAA</XPD:REF>
@@ -741,8 +744,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">668,280;695,250;695,135;612,74</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">333,260;385,230;385,115;292,69</XPD:ATTR>
<XPD:REF name="Model">ATdgO9ALgEG91h9rrbmQpgAA</XPD:REF>
<XPD:REF name="Head">rbLmK4jPbkGOYpeFKoIgSgAA</XPD:REF>
<XPD:REF name="Tail">1ltfrrUBG0q0sFN/n22amgAA</XPD:REF>
@@ -753,8 +756,9 @@
<XPD:REF name="Model">ATdgO9ALgEG91h9rrbmQpgAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="StereotypeLabel" type="EdgeLabelView" guid="dKb6ieet20GTJwk4JpHUcgAA">
-<XPD:ATTR name="Alpha" type="real">-5,724585237714</XPD:ATTR>
-<XPD:ATTR name="Distance" type="real">113,207773584679</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Alpha" type="real">-5,60702717702113</XPD:ATTR>
+<XPD:ATTR name="Distance" type="real">110,258786497948</XPD:ATTR>
<XPD:ATTR name="Text" type="string"><<provided>></XPD:ATTR>
<XPD:REF name="Model">ATdgO9ALgEG91h9rrbmQpgAA</XPD:REF>
</XPD:OBJ>
@@ -769,8 +773,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">429,440;387,394</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">175,400;203,374</XPD:ATTR>
<XPD:REF name="Model">ITZTIh3Yc06xCgHd+5qbvAAA</XPD:REF>
<XPD:REF name="Head">Gv5w/Hcm0k61rZhkNLQGtQAA</XPD:REF>
<XPD:REF name="Tail">uaMGdUZ3rUGciJaxG5vJyAAA</XPD:REF>
@@ -797,8 +801,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">309,594;310,615;715,615;715,375;668,324</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">391,630;405,630;405,355;328,304</XPD:ATTR>
<XPD:REF name="Model">qYZxI+u2T0KrBKsT29viVAAA</XPD:REF>
<XPD:REF name="Head">1ltfrrUBG0q0sFN/n22amgAA</XPD:REF>
<XPD:REF name="Tail">WMFeUrRaqkmSFaxxGYhliQAA</XPD:REF>
@@ -825,8 +829,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">625,594;625,615;715,615;715,375;668,324</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">392,520;405,520;405,355;328,304</XPD:ATTR>
<XPD:REF name="Model">QA6wifJqU0uoQEOC7wjPbgAA</XPD:REF>
<XPD:REF name="Head">1ltfrrUBG0q0sFN/n22amgAA</XPD:REF>
<XPD:REF name="Tail">NR+DCad5w0aNy08gEmohjgAA</XPD:REF>
@@ -853,8 +857,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">470,594;470,615;715,615;715,375;668,324</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">390,575;405,575;405,355;328,304</XPD:ATTR>
<XPD:REF name="Model">Ybqb/Q8TQUqgiUYrvmAmKgAA</XPD:REF>
<XPD:REF name="Head">1ltfrrUBG0q0sFN/n22amgAA</XPD:REF>
<XPD:REF name="Tail">os/ZpLf6E0C9OkWrF0aPPwAA</XPD:REF>
@@ -881,8 +885,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">659,280;675,250;675,170;530,170;502,174</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">325,260;365,230;365,150;220,150;198,152</XPD:ATTR>
<XPD:REF name="Model">0G9IV2lOwEGquFmnHxVYQgAA</XPD:REF>
<XPD:REF name="Head">92NqScYMQkimi4w+8NuFxQAA</XPD:REF>
<XPD:REF name="Tail">1ltfrrUBG0q0sFN/n22amgAA</XPD:REF>
@@ -909,10 +913,10 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Left" type="integer">540</XPD:ATTR>
-<XPD:ATTR name="Top" type="integer">195</XPD:ATTR>
-<XPD:ATTR name="Width" type="integer">122</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Left" type="integer">250</XPD:ATTR>
+<XPD:ATTR name="Top" type="integer">185</XPD:ATTR>
+<XPD:ATTR name="Width" type="integer">89</XPD:ATTR>
<XPD:ATTR name="Height" type="integer">45</XPD:ATTR>
<XPD:REF name="Model">cmkpYh9kWUe54vVNch7vwgAA</XPD:REF>
<XPD:OBJ name="NameCompartment" type="UMLNameCompartmentView" guid="Fv0gvo7OiUW8zm+HtL8LzQAA">
@@ -936,8 +940,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">636,280;613,239</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">295,260;294,229</XPD:ATTR>
<XPD:REF name="Model">+zYUHfvAdES31I2z2CHbmQAA</XPD:REF>
<XPD:REF name="Head">9h9tg46+zEqxK6eZGIVN3wAA</XPD:REF>
<XPD:REF name="Tail">1ltfrrUBG0q0sFN/n22amgAA</XPD:REF>
@@ -964,8 +968,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">490,280;562,239</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">193,260;252,229</XPD:ATTR>
<XPD:REF name="Model">/soSCHK5oECw23ApKZpFJQAA</XPD:REF>
<XPD:REF name="Head">9h9tg46+zEqxK6eZGIVN3wAA</XPD:REF>
<XPD:REF name="Tail">kL0ifBLH8k2M0PxjEkWXUwAA</XPD:REF>
@@ -992,8 +996,8 @@
<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
-<XPD:ATTR name="FontSize" type="integer">11</XPD:ATTR>
-<XPD:ATTR name="Points" type="Points">509,302;570,302</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">199,282;230,282</XPD:ATTR>
<XPD:REF name="Model">CvL1H2cfL0aBb2DIsO3Z/QAA</XPD:REF>
<XPD:REF name="Head">1ltfrrUBG0q0sFN/n22amgAA</XPD:REF>
<XPD:REF name="Tail">kL0ifBLH8k2M0PxjEkWXUwAA</XPD:REF>
@@ -1016,8 +1020,37 @@
<XPD:REF name="Model">CvL1H2cfL0aBb2DIsO3Z/QAA</XPD:REF>
</XPD:OBJ>
</XPD:OBJ>
+<XPD:OBJ name="OwnedViews[35]" type="UMLDependencyView" guid="M29407aZXUuJm2P05+NgVgAA">
+<XPD:ATTR name="LineColor" type="string">clMaroon</XPD:ATTR>
+<XPD:ATTR name="FillColor" type="string">$00B9FFFF</XPD:ATTR>
+<XPD:ATTR name="FontFace" type="string">Verdana</XPD:ATTR>
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Points" type="Points">216,575;220,575;220,500;170,444</XPD:ATTR>
+<XPD:REF name="Model">KVrn3WbJ9kukPyN/3xu9qQAA</XPD:REF>
+<XPD:REF name="Head">uaMGdUZ3rUGciJaxG5vJyAAA</XPD:REF>
+<XPD:REF name="Tail">0Vw/eC4690OaqgqTJ+R97QAA</XPD:REF>
+<XPD:OBJ name="NameLabel" type="EdgeLabelView" guid="rxUyd/KQiEKe50ZrgKXVsgAA">
+<XPD:ATTR name="Visible" type="boolean">False</XPD:ATTR>
+<XPD:ATTR name="Alpha" type="real">1,5707963267949</XPD:ATTR>
+<XPD:ATTR name="Distance" type="real">15</XPD:ATTR>
+<XPD:REF name="Model">KVrn3WbJ9kukPyN/3xu9qQAA</XPD:REF>
</XPD:OBJ>
+<XPD:OBJ name="StereotypeLabel" type="EdgeLabelView" guid="iDzZrTOIVUeZoq5clonoOAAA">
+<XPD:ATTR name="FontSize" type="integer">9</XPD:ATTR>
+<XPD:ATTR name="Alpha" type="real">-5,8420051300339</XPD:ATTR>
+<XPD:ATTR name="Distance" type="real">39,8120584747888</XPD:ATTR>
+<XPD:ATTR name="Text" type="string"><<test>></XPD:ATTR>
+<XPD:REF name="Model">KVrn3WbJ9kukPyN/3xu9qQAA</XPD:REF>
</XPD:OBJ>
+<XPD:OBJ name="PropertyLabel" type="EdgeLabelView" guid="l6iyGMrOJUmJ0ciSj+X15AAA">
+<XPD:ATTR name="Visible" type="boolean">False</XPD:ATTR>
+<XPD:ATTR name="Alpha" type="real">-1,5707963267949</XPD:ATTR>
+<XPD:ATTR name="Distance" type="real">15</XPD:ATTR>
+<XPD:REF name="Model">KVrn3WbJ9kukPyN/3xu9qQAA</XPD:REF>
+</XPD:OBJ>
+</XPD:OBJ>
+</XPD:OBJ>
+</XPD:OBJ>
<XPD:OBJ name="OwnedDiagrams[2]" type="UMLComponentDiagram" guid="taMwNEcyNEONZh4emW/4wwAA">
<XPD:ATTR name="Name" type="string">User code dependencies</XPD:ATTR>
<XPD:REF name="DiagramOwner">mNlhQxH3RkCjxaH3VQBTwQAA</XPD:REF>
@@ -1439,7 +1472,7 @@
</XPD:OBJ>
</XPD:OBJ>
</XPD:OBJ>
-<XPD:ATTR name="#OwnedElements" type="integer">52</XPD:ATTR>
+<XPD:ATTR name="#OwnedElements" type="integer">53</XPD:ATTR>
<XPD:OBJ name="OwnedElements[0]" type="UMLComponent" guid="Ois8O253kUadM8pwQY3z1AAA">
<XPD:ATTR name="Name" type="string">jbpm-api</XPD:ATTR>
<XPD:REF name="Namespace">mNlhQxH3RkCjxaH3VQBTwQAA</XPD:REF>
@@ -1473,8 +1506,8 @@
<XPD:ATTR name="#SupplierDependencies" type="integer">4</XPD:ATTR>
<XPD:REF name="SupplierDependencies[0]">Y4WLKpAHrUilfBgG5ABxQgAA</XPD:REF>
<XPD:REF name="SupplierDependencies[1]">KGxkaAq6n0iaJ5qJnbuCiAAA</XPD:REF>
-<XPD:REF name="SupplierDependencies[2]">3soARAGPkkK23DUBcA3VbAAA</XPD:REF>
-<XPD:REF name="SupplierDependencies[3]">USrXc+RVC06k6g8JDBkKtQAA</XPD:REF>
+<XPD:REF name="SupplierDependencies[2]">USrXc+RVC06k6g8JDBkKtQAA</XPD:REF>
+<XPD:REF name="SupplierDependencies[3]">3soARAGPkkK23DUBcA3VbAAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="OwnedElements[2]" type="UMLComponent" guid="AXGT6sG/YkWAzbne6BYH9gAA">
<XPD:ATTR name="Name" type="string">jbpm-task</XPD:ATTR>
@@ -1493,8 +1526,9 @@
<XPD:ATTR name="#Views" type="integer">2</XPD:ATTR>
<XPD:REF name="Views[0]">0Vw/eC4690OaqgqTJ+R97QAA</XPD:REF>
<XPD:REF name="Views[1]">4QPtyjldhUunEN0gz7mavgAA</XPD:REF>
-<XPD:ATTR name="#ClientDependencies" type="integer">1</XPD:ATTR>
+<XPD:ATTR name="#ClientDependencies" type="integer">2</XPD:ATTR>
<XPD:REF name="ClientDependencies[0]">3soARAGPkkK23DUBcA3VbAAA</XPD:REF>
+<XPD:REF name="ClientDependencies[1]">KVrn3WbJ9kukPyN/3xu9qQAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="OwnedElements[4]" type="UMLComponent" guid="MsVxfbvaTkidMyurdVALEAAA">
<XPD:ATTR name="Name" type="string">jbpm-examples</XPD:ATTR>
@@ -1540,11 +1574,12 @@
<XPD:REF name="ClientDependencies[1]">ITZTIh3Yc06xCgHd+5qbvAAA</XPD:REF>
<XPD:REF name="ClientDependencies[2]">G2xeWXCBOEGWVsaaT++RSAAA</XPD:REF>
<XPD:REF name="ClientDependencies[3]">IVVD7BW6MkCqjmD6+TzTfAAA</XPD:REF>
-<XPD:ATTR name="#SupplierDependencies" type="integer">4</XPD:ATTR>
+<XPD:ATTR name="#SupplierDependencies" type="integer">5</XPD:ATTR>
<XPD:REF name="SupplierDependencies[0]">1CXs2RCBIEmDFPmyngQ7wQAA</XPD:REF>
<XPD:REF name="SupplierDependencies[1]">JmpD2e0w4UycQJFvCIIURQAA</XPD:REF>
<XPD:REF name="SupplierDependencies[2]">gNdjs1FEbkyttFXd3t0sNQAA</XPD:REF>
<XPD:REF name="SupplierDependencies[3]">/M/x3rnebUe2dGXfP6ErHwAA</XPD:REF>
+<XPD:REF name="SupplierDependencies[4]">KVrn3WbJ9kukPyN/3xu9qQAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="OwnedElements[8]" type="UMLDependency" guid="UzW89zVUMkOD2XR49GKBSwAA">
<XPD:REF name="Namespace">mNlhQxH3RkCjxaH3VQBTwQAA</XPD:REF>
@@ -1587,7 +1622,6 @@
<XPD:REF name="Views[3]">yCBx070VyUSE7L6mIiqZ6gAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="OwnedElements[12]" type="UMLDependency" guid="1CXs2RCBIEmDFPmyngQ7wQAA">
-<XPD:ATTR name="StereotypeName" type="string">runtime</XPD:ATTR>
<XPD:REF name="Namespace">mNlhQxH3RkCjxaH3VQBTwQAA</XPD:REF>
<XPD:REF name="Client">MsVxfbvaTkidMyurdVALEAAA</XPD:REF>
<XPD:REF name="Supplier">Bs15lMzAj0mz+NvzVS7E4QAA</XPD:REF>
@@ -1630,7 +1664,6 @@
<XPD:REF name="ClientDependencies[2]">TC2p7E/uqEKL4MYpl3vDjgAA</XPD:REF>
</XPD:OBJ>
<XPD:OBJ name="OwnedElements[16]" type="UMLDependency" guid="gNdjs1FEbkyttFXd3t0sNQAA">
-<XPD:ATTR name="StereotypeName" type="string">runtime</XPD:ATTR>
<XPD:REF name="Namespace">mNlhQxH3RkCjxaH3VQBTwQAA</XPD:REF>
<XPD:REF name="Client">ldE/OPmI/UqAVOba04r45QAA</XPD:REF>
<XPD:REF name="Supplier">Bs15lMzAj0mz+NvzVS7E4QAA</XPD:REF>
@@ -1970,7 +2003,18 @@
<XPD:REF name="Views[2]">CN6zyu45XUWna7JwqXyDSAAA</XPD:REF>
<XPD:REF name="Views[3]">iicoPDgFQ0qMQebeFzttaQAA</XPD:REF>
</XPD:OBJ>
+<XPD:OBJ name="OwnedElements[52]" type="UMLDependency" guid="KVrn3WbJ9kukPyN/3xu9qQAA">
+<XPD:ATTR name="StereotypeName" type="string">test</XPD:ATTR>
+<XPD:REF name="Namespace">mNlhQxH3RkCjxaH3VQBTwQAA</XPD:REF>
+<XPD:REF name="Client">rN2k9cfQlk2UzNSPqqPOegAA</XPD:REF>
+<XPD:REF name="Supplier">Bs15lMzAj0mz+NvzVS7E4QAA</XPD:REF>
+<XPD:ATTR name="#Views" type="integer">4</XPD:ATTR>
+<XPD:REF name="Views[0]">M29407aZXUuJm2P05+NgVgAA</XPD:REF>
+<XPD:REF name="Views[1]">rxUyd/KQiEKe50ZrgKXVsgAA</XPD:REF>
+<XPD:REF name="Views[2]">iDzZrTOIVUeZoq5clonoOAAA</XPD:REF>
+<XPD:REF name="Views[3]">l6iyGMrOJUmJ0ciSj+X15AAA</XPD:REF>
</XPD:OBJ>
+</XPD:OBJ>
<XPD:OBJ name="OwnedElements[3]" type="UMLModel" guid="D4U+Tw7Eg0mlnh0cjb2/cQAA">
<XPD:ATTR name="Name" type="string">Implementation Model</XPD:ATTR>
<XPD:ATTR name="StereotypeProfile" type="string">UMLStandard</XPD:ATTR>
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java (from rev 3816, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,103 @@
+/*
+ * 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.cmd;
+
+import java.util.Date;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.env.Environment;
+import org.jbpm.env.Transaction;
+import org.jbpm.job.Job;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
+import org.jbpm.pvm.internal.jobexecutor.JobExceptionHandler;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExecuteJobCmd implements Command<Job> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = Log.getLog(ExecuteJobCmd.class.getName());
+
+ protected long jobDbid;
+
+ public ExecuteJobCmd(long jobDbid) {
+ this.jobDbid = jobDbid;
+ }
+
+ public Job execute(Environment environment) throws Exception {
+ JobDbSession session = environment.get(JobDbSession.class);
+ if (session==null) {
+ throw new JbpmException("no job session configured to get job "+jobDbid+" for execution");
+ }
+ JobImpl<?> job = (JobImpl<?>) session.get(JobImpl.class, jobDbid);
+
+ // in case of exclusive jobs, the job might have been deleted
+ // before we execute it (they are in a list)
+ if (job != null) {
+ try {
+ log.debug("executing job "+job+"...");
+ job.execute(environment);
+ log.debug("executed job "+job);
+
+ // if this job is locked too long, it could be unlocked by the lockmonitor and
+ // executed by another thread.
+ Date lockExpirationDate = job.getLockExpirationTime();
+ // can be null if it was rescheduled
+ if (lockExpirationDate != null) {
+ long lockExpiration = lockExpirationDate.getTime();
+ long currentTime = System.currentTimeMillis();
+ if (currentTime>lockExpiration) {
+ throw new JbpmException("job took too long: lock expired "+(currentTime-lockExpiration)+"ms ago");
+ }
+ }
+ } catch (Throwable exception) {
+ log.error("exception while executing '"+job+"'", exception);
+ handleJobExecutionException(environment, job, exception);
+ }
+
+ } else {
+ log.debug("job " + jobDbid + " no longer exists");
+ }
+ return job;
+ }
+
+ /** This transaction will be marked for rollback. A command will be associated with the
+ * Transaction.EVENT_AFTERCOMPLETION (after the job locks of the current transaction are
+ * released). Then the command will update the job with the exception details in a separate
+ * transaction. */
+ protected void handleJobExecutionException(Environment environment, JobImpl<?> job, Throwable exception) {
+ Transaction transaction = environment.get(Transaction.class);
+ transaction.setRollbackOnly();
+
+ CommandService commandService = (CommandService) environment.get(CommandService.class);
+ JobExceptionHandler jobExceptionHandler = new JobExceptionHandler(job.getDbid(), exception, commandService);
+ transaction.registerSynchronization(jobExceptionHandler);
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetMessagesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetMessagesCmd.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetMessagesCmd.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,47 +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.cmd;
-
-import java.util.List;
-
-import org.jbpm.env.Environment;
-import org.jbpm.job.Message;
-import org.jbpm.session.PvmDbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class GetMessagesCmd extends QueryCommand<List<Message>> {
-
- private static final long serialVersionUID = 1L;
-
- public GetMessagesCmd(int firstResult, int maxResults) {
- super(firstResult, maxResults);
- }
-
- public List<Message> execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- return pvmDbSession.findMessages(firstResult, maxResults);
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTimersCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTimersCmd.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTimersCmd.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,45 +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.cmd;
-
-import java.util.List;
-
-import org.jbpm.env.Environment;
-import org.jbpm.job.Timer;
-import org.jbpm.session.PvmDbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class GetTimersCmd extends QueryCommand<List<Timer>> {
-
- private static final long serialVersionUID = 1L;
-
- public GetTimersCmd(int firstResult, int maxResults) {
- super(firstResult, maxResults);
- }
-
- public List<Timer> execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- return pvmDbSession.findTimers(firstResult, maxResults);
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,102 +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.jobexecutor;
-
-import java.util.Date;
-
-import org.hibernate.Session;
-import org.jbpm.JbpmException;
-import org.jbpm.cmd.Command;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.env.Environment;
-import org.jbpm.env.Transaction;
-import org.jbpm.job.Job;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.job.JobImpl;
-
-
-
-/**
- * @author Tom Baeyens
- */
-public class ExecuteJobCmd implements Command<Job> {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log = Log.getLog(ExecuteJobCmd.class.getName());
-
- protected long jobDbid;
-
- public ExecuteJobCmd(long jobDbid) {
- this.jobDbid = jobDbid;
- }
-
- public Job execute(Environment environment) throws Exception {
- JobDbSession session = environment.get(JobDbSession.class);
- if (session==null) {
- throw new JbpmException("no job session configured to get job "+jobDbid+" for execution");
- }
- JobImpl<?> job = (JobImpl<?>) session.get(JobImpl.class, jobDbid);
-
- // in case of exclusive jobs, the job might have been deleted
- // before we execute it (they are in a list)
- if (job != null) {
- try {
- log.debug("executing job "+job+"...");
- job.execute(environment);
- log.debug("executed job "+job);
-
- // if this job is locked too long, it could be unlocked by the lockmonitor and
- // executed by another thread.
- Date lockExpirationDate = job.getLockExpirationTime();
- // can be null if it was rescheduled
- if (lockExpirationDate != null) {
- long lockExpiration = lockExpirationDate.getTime();
- long currentTime = System.currentTimeMillis();
- if (currentTime>lockExpiration) {
- throw new JbpmException("job took too long: lock expired "+(currentTime-lockExpiration)+"ms ago");
- }
- }
- } catch (Throwable exception) {
- log.error("exception while executing '"+job+"'", exception);
- handleJobExecutionException(environment, job, exception);
- }
-
- } else {
- log.debug("job " + jobDbid + " no longer exists");
- }
- return job;
- }
-
- /** This transaction will be marked for rollback. A command will be associated with the
- * Transaction.EVENT_AFTERCOMPLETION (after the job locks of the current transaction are
- * released). Then the command will update the job with the exception details in a separate
- * transaction. */
- protected void handleJobExecutionException(Environment environment, JobImpl<?> job, Throwable exception) {
- Transaction transaction = environment.get(Transaction.class);
- transaction.setRollbackOnly();
-
- CommandService commandService = (CommandService) environment.get(CommandService.class);
- JobExceptionHandler jobExceptionHandler = new JobExceptionHandler(job.getDbid(), exception, commandService);
- transaction.registerSynchronization(jobExceptionHandler);
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorThread.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorThread.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorThread.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -26,6 +26,7 @@
import org.jbpm.cmd.CommandService;
import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.cmd.ExecuteJobCmd;
/**
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-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -579,7 +579,7 @@
throw new JbpmException("no message-session configured to send asynchronous continuation message");
}
MessageImpl<?> asyncMessage = operation.createAsyncMessage(this);
- lock("async continuation message "+asyncMessage);
+ lock(Execution.STATE_ASYNC);
messageSession.send(asyncMessage);
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,116 @@
+/*
+ * 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.query;
+
+import java.util.List;
+
+import org.hibernate.Query;
+import org.jbpm.JobQuery;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.job.Job;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.job.TimerImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JobQueryImpl extends AbstractQuery implements JobQuery {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean messagesOnly = false;
+ protected boolean timersOnly = false;
+ protected String processInstanceId = null;
+ protected boolean exception = false;
+
+ public JobQueryImpl(CommandService commandService) {
+ super(commandService);
+ }
+
+ public String hql() {
+ StringBuffer hql = new StringBuffer();
+ hql.append("select j ");
+ hql.append("from ");
+ if (messagesOnly) {
+ hql.append(MessageImpl.class.getName());
+ } else if (timersOnly) {
+ hql.append(TimerImpl.class.getName());
+ } else {
+ hql.append(JobImpl.class.getName());
+ }
+ hql.append(" j ");
+
+ if (processInstanceId!=null) {
+ appendWhereClause("j.processInstance.id = '"+processInstanceId+"' ", hql);
+ }
+
+ if (exception) {
+ appendWhereClause("j.exception is not null ", hql);
+ }
+
+ return hql.toString();
+ }
+
+ protected void applyParameters(Query query) {
+ }
+
+ public List<Job> execute() {
+ return (List<Job>) commandService.execute(this);
+ }
+
+ public JobQuery messages() {
+ this.messagesOnly = true;
+ return this;
+ }
+
+ public JobQuery timers() {
+ this.timersOnly = true;
+ return this;
+ }
+
+ public JobQuery exception() {
+ this.exception = true;
+ return this;
+ }
+
+ public JobQuery orderAsc(String property) {
+ addOrderByClause("j."+property+" asc");
+ return this;
+ }
+
+ public JobQuery orderDesc(String property) {
+ addOrderByClause("j."+property+" asc");
+ return this;
+ }
+
+ public JobQuery page(int firstResult, int maxResults) {
+ this.page = new Page(firstResult, maxResults);
+ return this;
+ }
+
+ public JobQuery processInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ return this;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ManagementServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ManagementServiceImpl.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ManagementServiceImpl.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -21,15 +21,11 @@
*/
package org.jbpm.pvm.internal.svc;
-import java.util.List;
-
+import org.jbpm.JobQuery;
import org.jbpm.ManagementService;
import org.jbpm.cmd.CommandService;
-import org.jbpm.job.Job;
-import org.jbpm.job.Message;
-import org.jbpm.job.Timer;
-import org.jbpm.pvm.internal.cmd.GetMessagesCmd;
-import org.jbpm.pvm.internal.cmd.GetTimersCmd;
+import org.jbpm.pvm.internal.cmd.ExecuteJobCmd;
+import org.jbpm.pvm.internal.query.JobQueryImpl;
/**
@@ -39,21 +35,11 @@
protected CommandService commandService;
- public void executeJob(String jobId) {
- // TODO
+ public void executeJob(long jobDbid) {
+ commandService.execute(new ExecuteJobCmd(jobDbid));
}
- public List<Job> getJobsWithException(int firstResult, int maxResults) {
- // TODO
- return null;
+ public JobQuery createJobQuery() {
+ return new JobQueryImpl(commandService);
}
-
- public List<Message> getMessages(int firstResult, int maxResults) {
- return commandService.execute(new GetMessagesCmd(firstResult, maxResults));
- }
-
- public List<Timer> getTimers(int firstResult, int maxResults) {
- return commandService.execute(new GetTimersCmd(firstResult, maxResults));
- }
-
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/test/JobTestHelper.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/test/JobTestHelper.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/test/JobTestHelper.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -28,9 +28,9 @@
import org.jbpm.cmd.CommandService;
import org.jbpm.env.Environment;
import org.jbpm.job.Job;
+import org.jbpm.pvm.internal.cmd.ExecuteJobCmd;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.job.TimerImpl;
-import org.jbpm.pvm.internal.jobexecutor.ExecuteJobCmd;
/** helper class for testing that executes messages and timers
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.jobexecutor;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.model.OpenProcessDefinition;
+import org.jbpm.pvm.activities.AutomaticActivity;
+import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AsyncContinuationsTest extends DbTestCase {
+
+ public void testContinuations() {
+ deployProcess();
+
+ Execution execution = executionService.startExecutionByKey("continuations");
+
+ assertEquals("start", execution.getActivityName());
+ assertEquals(Execution.STATE_ASYNC, execution.getState());
+
+ executeAsyncMessage(execution);
+ execution = executionService.findExecution(execution.getId());
+
+ assertEquals("a", execution.getActivityName());
+ assertEquals(Execution.STATE_ASYNC, execution.getState());
+
+ executeAsyncMessage(execution);
+ execution = executionService.findExecution(execution.getId());
+
+ assertEquals("b", execution.getActivityName());
+ assertEquals(Execution.STATE_ASYNC, execution.getState());
+
+ executeAsyncMessage(execution);
+ execution = executionService.findExecution(execution.getId());
+
+ assertEquals("c", execution.getActivityName());
+ assertEquals(Execution.STATE_ASYNC, execution.getState());
+
+ executeAsyncMessage(execution);
+
+ assertNull(executionService.findExecution(execution.getId()));
+ }
+
+ public void deployProcess() {
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ OpenProcessDefinition processDefinition = ProcessDefinitionBuilder.startProcess("continuations")
+ .key("continuations")
+ .startActivity("start", AutomaticActivity.class)
+ .initial()
+ .asyncExecute()
+ .flow("a")
+ .endActivity()
+ .startActivity("a", AutomaticActivity.class)
+ .asyncExecute()
+ .flow("b")
+ .endActivity()
+ .startActivity("b", AutomaticActivity.class)
+ .asyncExecute()
+ .flow("c")
+ .endActivity()
+ .startActivity("c", AutomaticActivity.class)
+ .asyncExecute()
+ .flow("end")
+ .endActivity()
+ .startActivity("end", AutomaticActivity.class)
+ .endActivity()
+ .endProcess();
+
+ Session session = environment.get(Session.class);
+ session.save(processDefinition);
+ return null;
+ }
+ });
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AutomaticActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AutomaticActivity.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AutomaticActivity.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.jobexecutor;
-
-import org.jbpm.activity.ActivityBehaviour;
-import org.jbpm.activity.ActivityExecution;
-
-/** a activity behaviour implementation that records its execution and then
- * just proceeds.
- *
- * @author Tom Baeyens
- */
-public class AutomaticActivity implements ActivityBehaviour {
-
- private static final long serialVersionUID = 1L;
-
- public AutomaticActivity() {
- }
-
- public void execute(ActivityExecution execution) throws Exception {
- ContinuationTest.recorder.record(execution.getDbid(), "execute("+execution.getActivity().getName()+")");
- }
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ContinuationTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ContinuationTest.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ContinuationTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,107 +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.jobexecutor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-
-/**
- * @author Tom Baeyens
- */
-public class ContinuationTest extends JobExecutorTestCase {
-
- // private static final Log log = Log.getLog(ContinuationTest.class.getName());
-
- static Recorder recorder = new Recorder();
-
- int nbrOfExecutions = 1;
-
- public void testContinuations() {
-
- try {
- deployProcess();
- startExecutions();
- jobExecutor.start();
- waitTillNoMoreMessages();
-
- } finally {
- jobExecutor.stop(true);
- }
-
- List<String> expectedLogs = new ArrayList<String>();
- expectedLogs.add("execute(start)");
- expectedLogs.add("execute(a)");
- expectedLogs.add("execute(b)");
- expectedLogs.add("execute(c)");
- expectedLogs.add("execute(end)");
-
- assertEquals(nbrOfExecutions, recorder.executionEvents.size());
- for (List<String> executionLogs : recorder.executionEvents.values()) {
- assertEquals(expectedLogs, executionLogs);
- }
- }
-
- public void deployProcess() {
- commandService.execute(new Command<Object>() {
- public Object execute(Environment environment) throws Exception {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder.startProcess("continuations")
- .key("continuations")
- .startActivity("start", AutomaticActivity.class)
- .initial()
- .asyncExecute()
- .flow("a")
- .endActivity()
- .startActivity("a", AutomaticActivity.class)
- .asyncExecute()
- .flow("b")
- .endActivity()
- .startActivity("b", AutomaticActivity.class)
- .asyncExecute()
- .flow("c")
- .endActivity()
- .startActivity("c", AutomaticActivity.class)
- .asyncExecute()
- .flow("end")
- .endActivity()
- .startActivity("end", WaitState.class)
- .endActivity()
- .endProcess();
-
- Session session = environment.get(Session.class);
- session.save(processDefinition);
- return null;
- }
- });
- }
-
- public void startExecutions() {
- for (int i = 0; i < nbrOfExecutions; i++) {
- executionService.startExecutionByKey("continuations");
- }
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveMessagesTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveMessagesTest.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveMessagesTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,133 +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.jobexecutor;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.hibernate.Session;
-import org.jbpm.Execution;
-import org.jbpm.activity.ActivityExecution;
-import org.jbpm.activity.ExternalActivityBehaviour;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.session.MessageSession;
-
-/**
- * @author Tom Baeyens
- */
-public class ExclusiveMessagesTest extends JobExecutorTestCase {
-
- static Map<String, Set<Long>> exclusiveThreadIds;
-
- static int nbrOfTestMessagesPerExecution = 5;
- static int nbrOfTestExecutions = 5;
-
- public void setUp() throws Exception {
- super.setUp();
-
- exclusiveThreadIds = new HashMap<String, Set<Long>>();
- }
-
- public void testExclusiveMessageProcessing() {
- insertExclusiveTestMessages();
-
- JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
- jobExecutor.start();
- try {
-
- waitTillNoMoreMessages();
-
- } finally {
- jobExecutor.stop(true);
- }
-
- commandService.execute(new Command<Object>() {
-
- public Object execute(Environment environment) throws Exception {
- // exclusiveMessageIds maps execution keys to a set of thread ids.
- // the idea is that for each execution, all the exclusive jobs will
- // be executed by 1 thread sequentially.
-
- for (int i = 0; i < nbrOfTestExecutions; i++) {
- String executionKey = "execution-" + i;
- Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
- assertNotNull("no thread id set for " + executionKey + " in: " + exclusiveThreadIds, threadIds);
- assertEquals("exclusive messages for " + executionKey + " have been executed by multiple threads: " + threadIds, 1, threadIds.size());
- }
- return null;
- }
- });
- }
-
- public static class WaitState implements ExternalActivityBehaviour {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) throws Exception {
- execution.waitForSignal();
- }
- public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception {
- execution.take(signalName);
- }
- }
-
- public void insertExclusiveTestMessages() {
- commandService.execute(new Command<Object>() {
- public Object execute(Environment environment) throws Exception {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess("excl")
- .startActivity("wait", WaitState.class)
- .initial()
- .endActivity()
- .endProcess();
- processDefinition.setId("excl:1");
-
- Session session = environment.get(Session.class);
- session.save(processDefinition);
- return null;
- }
- });
-
- commandService.execute(new Command<Object>() {
-
- public Object execute(Environment environment) throws Exception {
- MessageSession messageSession = environment.get(MessageSession.class);
- for (int i = 0; i < nbrOfTestExecutions; i++) {
- Execution execution = new StartExecutionCmd("excl:1", null, "execution-" + i).execute(environment);
-
- for (int j = 0; j < nbrOfTestMessagesPerExecution; j++) {
- CommandMessage exclusiveTestMessage = ExclusiveTestCommand.createMessage(execution);
- messageSession.send(exclusiveTestMessage);
- }
- }
- return null;
- }
- });
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,99 +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.jobexecutor;
-
-import java.util.HashSet;
-import java.util.Random;
-import java.util.Set;
-
-import org.hibernate.Session;
-import org.jbpm.Execution;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.wire.descriptor.LongDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ExclusiveTestCommand implements Command<Object> {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(ExclusiveTestCommand.class.getName());
- static Random random = new Random();
-
- long executionId;
-
- public ExclusiveTestCommand() {
- }
-
- public static CommandMessage createMessage(Execution execution) {
- CommandMessage commandMessage = new CommandMessage();
- commandMessage.setExecution((ExecutionImpl) execution);
- commandMessage.setExclusive(true);
-
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(ExclusiveTestCommand.class);
- commandDescriptor.addInjection("executionId", new LongDescriptor(execution.getDbid()));
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
- }
-
- public Object execute(Environment environment) throws Exception {
- Long threadId = Thread.currentThread().getId();
-
- Session session = environment.get(Session.class);
- ExecutionImpl execution = (ExecutionImpl) session.get(ExecutionImpl.class, executionId);
-
- String executionKey = execution.getKey();
-
- // exclusiveMessageIds maps execution keys to a set of thread ids.
- // the idea is that for each execution, all the exclusive jobs will
- // be executed by 1 thread sequentially.
-
- // in the end, each set should contain exactly 1 element
-
- Set<Long> groupMessages = ExclusiveMessagesTest.exclusiveThreadIds.get(executionKey);
- if (groupMessages==null) {
- groupMessages = new HashSet<Long>();
- ExclusiveMessagesTest.exclusiveThreadIds.put(executionKey, groupMessages);
- }
- groupMessages.add(threadId);
-
- /*
- // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
- int workTime = random.nextInt(150);
- log.debug("executing exclusive message for "+execution+". this is going to take "+workTime+"ms");
- try {
- Thread.sleep(workTime);
- } catch (RuntimeException e) {
- log.debug("sleeping was interrupted");
- }
- */
-
- return null;
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceMessageTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceMessageTest.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceMessageTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,107 +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.jobexecutor;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.log.Log;
-import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.session.MessageSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FailOnceMessageTest extends JobExecutorTestCase {
-
- private static final Log log = Log.getLog(FailOnceMessageTest.class.getName());
-
- static long nbrOfTestMessages = 1;
-
- static List<Integer> failOnceMessageIds = Collections.synchronizedList(new ArrayList<Integer>());
-
- public void testFailOnceMessages() {
- failOnceMessageIds.clear();
-
- jobExecutor.start();
- try {
- insertFailOnceTestMessages();
- waitTillNoMoreMessages();
-
- } finally {
- log.debug("stopping job executor");
- jobExecutor.stop(true);
- }
-
- for (int i = 0; i < nbrOfTestMessages; i++) {
- assertTrue("message " + i + " is not failed once: " + failOnceMessageIds, failOnceMessageIds.contains(i));
- }
- assertEquals(nbrOfTestMessages, failOnceMessageIds.size());
-
- log.debug("==== all messages processed, now checking if all messages have arrived exactly once ====");
-
- commandService.execute(new Command<Object>() {
-
- public Object execute(Environment environment) throws Exception {
- Session session = environment.get(Session.class);
- List<Comment> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
-
- for (Comment comment : comments) {
- log.debug("retrieved message: "+comment.getMessage());
- Integer messageId = new Integer(comment.getMessage());
- assertTrue("message " + messageId + " committed twice", failOnceMessageIds.remove(messageId));
- }
-
- assertTrue("not all messages made a successful commit: " + failOnceMessageIds, failOnceMessageIds.isEmpty());
- return null;
- }
- });
- }
-
- public static class InsertFailOnceTestMsgCmd implements Command<Object> {
- private static final long serialVersionUID = 1L;
- int i;
- public InsertFailOnceTestMsgCmd(int i) {
- this.i = i;
- }
- public Object execute(Environment environment) throws Exception {
- MessageSession messageSession = environment.get(MessageSession.class);
- CommandMessage commandMessage = FailOnceTestCommand.createMessage(i);
- messageSession.send(commandMessage);
- return null;
- }
- }
-
- void insertFailOnceTestMessages() {
- for (int i = 0; i < nbrOfTestMessages; i++) {
- commandService.execute(new InsertFailOnceTestMsgCmd(i));
- }
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,84 +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.jobexecutor;
-
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.log.Log;
-import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.session.DbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FailOnceTestCommand implements Command<Object> {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(FailOnceTestCommand.class.getName());
-
- int messageId;
-
- public FailOnceTestCommand() {
- }
-
- public static CommandMessage createMessage(int messageId) {
- CommandMessage commandMessage = new CommandMessage();
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(FailOnceTestCommand.class);
- commandDescriptor.addInjection("messageId", new IntegerDescriptor(messageId));
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
- }
-
- public Object execute(Environment environment) throws Exception {
- DbSession dbSession = environment.get(DbSession.class);
-
- // this message execution should be rolled back
- Comment comment = new CommentImpl(Integer.toString(messageId));
- dbSession.save(comment);
-
- if (!FailOnceMessageTest.failOnceMessageIds.contains(messageId)) {
- // registering the failed message in a non-transactional resource
- // so the messageId will still be added even after the transaction has rolled back
- log.debug("adding failonce message "+messageId);
- FailOnceMessageTest.failOnceMessageIds.add(messageId);
-
- throw new RuntimeException("failing once");
- }
-
- try {
- Thread.sleep(700);
- } catch (Exception e) {
- log.error(e.toString());
- }
-
- log.debug("message "+messageId+" now succeeds");
-
- return null;
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingMessageTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingMessageTest.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingMessageTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,77 +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.jobexecutor;
-
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.env.Environment;
-import org.jbpm.job.Job;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.session.MessageSession;
-import org.jbpm.session.PvmDbSession;
-import org.jbpm.test.DbTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FailingMessageTest extends JobExecutorTestCase {
-
-
- public void testFailedMessageProcessing() {
- jobExecutor.start();
- try {
- commandService.execute(new Command<Object>() {
-
- public Object execute(Environment environment) throws Exception {
- MessageSession messageSession = environment.get(MessageSession.class);
- CommandMessage commandMessage = FailingTestCommand.createMessage();
- messageSession.send(commandMessage);
- return null;
- }
- });
-
- waitTillNoMoreMessages();
-
- } finally {
- jobExecutor.stop(true);
- }
-
- commandService.execute(new Command<Object>() {
-
- public Object execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- List<Job> deadJobs = pvmDbSession.findJobsWithException(0, 10);
- assertEquals("there should be one dead job", 1, deadJobs.size());
-
- Session session = environment.get(Session.class);
- List commands = session.createQuery("from " + CommentImpl.class.getName()).list();
- assertTrue("command insertion should have been rolled back", commands.isEmpty());
- return null;
- }
- });
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,57 +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.jobexecutor;
-
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.session.DbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FailingTestCommand implements Command<Object> {
-
- private static final long serialVersionUID = 1L;
-
- public Object execute(Environment environment) throws Exception {
- DbSession dbSession = environment.get(DbSession.class);
-
- // this message execution should be rolled back
- Comment comment = new CommentImpl("failing update");
- dbSession.save(comment);
-
- throw new RuntimeException("ooops");
- }
-
- public static CommandMessage createMessage() {
- CommandMessage commandMessage = new CommandMessage();
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(FailingTestCommand.class);
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,66 +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.jobexecutor;
-
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-
-
-/**
- * @author Tom Baeyens
- * @author Guillaume Porcher
- *
- * Simple command that will create an exception during execution.
- * The exception will generate a stacktrace with variable length
- * (controlled by the length parameter).
- *
- * This class is to test the persistence of exception stacktrace in jobs.
- */
-public class GenerateExceptionTestCommand implements Command<Object> {
-
- private static final long serialVersionUID = 1L;
-
- int length;
-
- public GenerateExceptionTestCommand() {
- }
-
- public static CommandMessage createMessage(int recursionInitialDepth) {
- CommandMessage commandMessage = new CommandMessage();
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(GenerateExceptionTestCommand.class);
- commandDescriptor.addInjection("length", new IntegerDescriptor(recursionInitialDepth));
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
- }
-
- public Object execute(Environment environment) throws Exception {
- StringBuilder stringBuilder = new StringBuilder();
- while (stringBuilder.length() < length) {
- stringBuilder.append("This is a long test message. ");
- }
- throw new RuntimeException(stringBuilder.toString());
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTestCase.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTestCase.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTestCase.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,114 +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.jobexecutor;
-
-import java.util.Date;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.test.DbTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JobExecutorTestCase extends DbTestCase {
-
- static long timeoutMillis = 20 * 1000; // 10 seconds
- static long checkInterval = 200;
-
- static String jobsAvailableQueryText =
- "select count(*) "+
- "from "+JobImpl.class.getName()+" as job "+
- "where ( (job.dueDate is null) or (job.dueDate <= :now) ) "+
- " and ( job.retries > 0 )";
-
- protected CommandService commandService;
- protected JobExecutor jobExecutor;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- commandService = processEngine.get(CommandService.class);
- jobExecutor = processEngine.get(JobExecutor.class);
- }
-
- protected void waitTillNoMoreMessages() {
-
- // install a timer that will interrupt if it takes too long
- // if that happens, it will lead to an interrupted exception and the test
- // will fail
- TimerTask interruptTask = new TimerTask() {
-
- Thread testThread = Thread.currentThread();
-
- public void run() {
- log.debug("test " + getName() + " took too long. going to interrupt..." + testThread);
- testThread.interrupt();
- }
- };
- Timer timer = new Timer();
- timer.schedule(interruptTask, timeoutMillis);
-
- try {
- boolean jobsAvailable = true;
- while (jobsAvailable) {
- log.debug("going to sleep for " + checkInterval + " millis, waiting for the job executor to process more jobs");
- Thread.sleep(checkInterval);
- jobsAvailable = areJobsAvailable();
- }
-
- } catch (InterruptedException e) {
- fail("test execution exceeded treshold of " + timeoutMillis + " milliseconds");
- } finally {
- timer.cancel();
- }
- }
-
- public boolean areJobsAvailable() {
- return commandService.execute(new Command<Boolean>() {
- public Boolean execute(Environment environment) {
- Session session = environment.get(Session.class);
-
- Query query = session.createQuery(jobsAvailableQueryText);
- query.setDate("now", new Date());
-
- Long jobs = (Long) query.uniqueResult();
-
- if (jobs.longValue()>0) {
- log.debug("found "+jobs+" more jobs to process");
- return true;
- }
- log.debug("no more jobs to process");
-
- return false;
- }
- });
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageCommand.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,65 +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.jobexecutor;
-
-import java.util.Random;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-
-/**
- * @author Tom Baeyens
- */
-public class NormalMessageCommand implements Command<Void> {
-
- private static final long serialVersionUID = 1L;
- static Random random = new Random();
-
- int messageId;
-
- public NormalMessageCommand() {
- }
-
- public NormalMessageCommand(int messageId) {
- this.messageId = messageId;
- }
-
- public static CommandMessage createMessage(int messageId) {
- CommandMessage commandMessage = new CommandMessage();
- ObjectDescriptor commandDescriptor = new ObjectDescriptor(NormalMessageCommand.class);
- commandDescriptor.addInjection("messageId", new IntegerDescriptor(messageId));
- commandMessage.setCommandDescriptor(commandDescriptor);
- return commandMessage;
- }
-
- public Void execute(Environment environment) throws Exception {
- CommentImpl comment = new CommentImpl(Integer.toString(messageId));
- Session session = environment.get(Session.class);
- session.save(comment);
- return null;
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageTest.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,103 +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.jobexecutor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.session.MessageSession;
-import org.jbpm.test.Db;
-
-/**
- * @author Tom Baeyens
- */
-public class NormalMessageTest extends JobExecutorTestCase {
-
- static long nbrOfTestMessages = 5;
-
- static long timeoutMillis = 30 * 1000; // 30 seconds
- static long checkInterval = 400;
-
-
- protected void setUp() throws Exception {
- super.setUp();
- Db.clean(processEngine);
- }
-
- public void testNormalMessageProcessing() {
- JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
- jobExecutor.start();
-
- try {
- // insert ${nbrOfTestMessages} messages...
- for (int i = 0; i < nbrOfTestMessages; i++) {
- commandService.execute(new InsertNormalMessageCmd(i));
- }
-
- // wait till all messages are processed
- waitTillNoMoreMessages();
-
- } finally {
- jobExecutor.stop(true);
- }
-
- List<Integer> processedMessageNumbers = commandService.execute(new Command<List<Integer>>() {
- public List<Integer> execute(Environment environment) {
- List<Integer> processedMessageNumbers = new ArrayList<Integer>();
- Session session = environment.get(Session.class);
- List<Comment> comments = session.createCriteria(CommentImpl.class).list();
- for (Comment comment: comments) {
- int processedMessageNumber = Integer.parseInt(comment.getMessage());
- processedMessageNumbers.add(processedMessageNumber);
- // make sure the db stays clean
- session.delete(comment);
- }
- return processedMessageNumbers;
- }
- });
-
- for (int i = 0; i < nbrOfTestMessages; i++) {
- assertTrue("message " + i + " is not processed: " + processedMessageNumbers, processedMessageNumbers.contains(i));
- }
- }
-
- public static class InsertNormalMessageCmd implements Command<Object> {
- private static final long serialVersionUID = 1L;
- int i;
- public InsertNormalMessageCmd(int i) {
- this.i = i;
- }
- public Object execute(Environment environment) throws Exception {
- MessageSession messageSession = environment.get(MessageSession.class);
- CommandMessage commandMessage = NormalMessageCommand.createMessage(i);
- messageSession.send(commandMessage);
- return null;
- }
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/Recorder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/Recorder.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/Recorder.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -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.jobexecutor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Tom Baeyens
- */
-public class Recorder {
-
- public Map<Object, List<String>> executionEvents = null;
-
- public synchronized void record(long executionDbid, String event) {
- if (executionEvents==null) {
- executionEvents = new HashMap<Object, List<String>>();
- }
- List<String> events = executionEvents.get(executionDbid);
- if (events == null) {
- events = new ArrayList<String>();
- executionEvents.put(executionDbid, events);
- }
- events.add(event);
- }
-
- public void reset() {
- executionEvents = null;
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/WaitState.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/WaitState.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/WaitState.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,46 +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.jobexecutor;
-
-import java.util.Map;
-
-import org.jbpm.activity.ActivityExecution;
-import org.jbpm.activity.ExternalActivityBehaviour;
-
-/**
- * @author Tom Baeyens
- */
-public class WaitState implements ExternalActivityBehaviour {
-
- private static final long serialVersionUID = 1L;
-
- public WaitState() {
- }
-
- public void execute(ActivityExecution execution) throws Exception {
- ContinuationTest.recorder.record(execution.getDbid(), "execute("+execution.getActivity().getName()+")");
- }
-
- public void signal(ActivityExecution execution, String signal, Map<String, Object> parameters) throws Exception {
- throw new UnsupportedOperationException();
- }
-}
\ No newline at end of file
Modified: jbpm4/trunk/modules/pvm/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/logging.properties 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/pvm/src/test/resources/logging.properties 2009-02-11 12:12:09 UTC (rev 3830)
@@ -4,7 +4,7 @@
redirect.commons.logging = enabled
-java.util.logging.ConsoleHandler.level = SEVERE
+java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.jbpm.log.LogFormatter
# org.jbpm.util.ErrorTriggeredFileHandler.size = 500
@@ -14,7 +14,7 @@
# For example, set the com.xyz.foo logger to only log SEVERE messages:
# com.xyz.foo.level = SEVERE
-org.jbpm.level=INFO
+org.jbpm.level=FINE
# org.jbpm.pvm.internal.tx.level=FINE
# org.jbpm.pvm.internal.wire.level=FINE
# org.jbpm.pvm.internal.util.level=FINE
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -34,6 +34,7 @@
import org.jbpm.ProcessService;
import org.jbpm.TaskService;
import org.jbpm.cmd.CommandService;
+import org.jbpm.job.Job;
import org.jbpm.task.Task;
/**
@@ -210,6 +211,24 @@
}
return null;
}
+
+ public void executeAsyncMessage(Execution execution) {
+ List<Job> jobs = managementService
+ .createJobQuery()
+ .messages()
+ .processInstanceId(execution.getId())
+ .execute();
+
+ if (jobs.isEmpty()) {
+ fail("no async message");
+ }
+
+ if (jobs.size()>1) {
+ fail("more then one async message");
+ }
+
+ managementService.executeJob(jobs.get(0).getDbid());
+ }
public static void assertContainsTask(List<Task> taskList, String taskName, String assignee) {
if (getTask(taskList, taskName, assignee)==null) {
Added: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MessageFinder.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MessageFinder.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MessageFinder.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class MessageFinder {
+
+ protected DbTestCase dbTestCase;
+
+ public MessageFinder(DbTestCase dbTestCase) {
+ this.dbTestCase = dbTestCase;
+ }
+
+
+
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/MessageFinder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/mgmt/ManagementServiceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/mgmt/ManagementServiceTest.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-db/src/main/java/org/jbpm/test/mgmt/ManagementServiceTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test.mgmt;
-
-import org.jbpm.test.DbTestCase;
-
-/**
- * @author Tom Baeyens
- */
-public class ManagementServiceTest extends DbTestCase {
-
- public void testGetJobs() {
- assertEquals(0, managementService.getTimers(0, 10).size());
- assertEquals(0, managementService.getMessages(0, 10).size());
- }
-
-}
Modified: jbpm4/trunk/modules/test-load/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-load/pom.xml 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-load/pom.xml 2009-02-11 12:12:09 UTC (rev 3830)
@@ -72,8 +72,52 @@
</excludes>
</configuration>
</plugin>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack.jbpm.db</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <classifier>config</classifier>
+ <overWrite>true</overWrite>
+ </artifactItem>
+ </artifactItems>
+ <excludeTransitive>true</excludeTransitive>
+ <outputDirectory>target/jpdl-config</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install.hibernate.database.properties</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <copy file="target/jpdl-config/hibernate.cfg.${database}.xml"
+ tofile="target/test-classes/hibernate.cfg.xml"
+ overwrite="true" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
-
</project>
\ No newline at end of file
Deleted: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/AddCommentMessage.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/AddCommentMessage.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/AddCommentMessage.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -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.test.load;
-
-import org.hibernate.Session;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.model.CommentImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class AddCommentMessage extends MessageImpl<Void> {
-
- private static final long serialVersionUID = 1L;
-
- public AddCommentMessage() {
- }
-
- public AddCommentMessage(String message) {
- this.info = message;
- }
-
- public Void execute(Environment environment) throws Exception {
- CommentImpl comment = new CommentImpl(info);
- Session session = environment.get(Session.class);
- session.save(comment);
- session.delete(this);
- MessageProcessingTest.commentAdded();
- return null;
- }
-}
Deleted: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/Automatic.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/Automatic.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/Automatic.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test.load;
-
-/**
- * @author Tom Baeyens
- */
-public class Automatic {
-
- public void doNothing() {
- }
-}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/LoadTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/LoadTestCase.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/LoadTestCase.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -41,25 +41,25 @@
*/
public class LoadTestCase extends DbTestCase {
- static final long SECOND = 1000;
- static final long MINUTE = 60 * SECOND;
- static final long HOUR = 60 * MINUTE;
+ protected static final long SECOND = 1000;
+ protected static final long MINUTE = 60 * SECOND;
+ protected static final long HOUR = 60 * MINUTE;
- static long checkInterval = 200;
+ protected static long checkInterval = 2000;
- static String jobsAvailableQueryText =
+ protected static String jobsAvailableQueryText =
"select count(*) "+
"from "+JobImpl.class.getName()+" as job "+
"where ( (job.dueDate is null) or (job.dueDate <= :now) ) "+
" and ( job.retries > 0 )";
- static boolean measureMemory = true;
+ protected static boolean measureMemory = true;
protected CommandService commandService;
protected JobExecutor jobExecutor;
- long startTime = -1;
- long stopTime = -1;
- PrintWriter logFileWriter;
+ protected long startTime = -1;
+ protected long stopTime = -1;
+ protected PrintWriter logFileWriter;
public void setUp() throws Exception {
Deleted: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/MessageProcessingTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/MessageProcessingTest.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/MessageProcessingTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test.load;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.job.Message;
-import org.jbpm.log.Log;
-import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.cmd.CompositeCmd;
-import org.jbpm.pvm.internal.cmd.SendMessageCmd;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
-import org.jbpm.pvm.internal.model.CommentImpl;
-
-/**
- * @author Tom Baeyens
- * @author Guillaume Porcher
- */
-public class MessageProcessingTest extends LoadTestCase {
-
- private static final Log log = Log.getLog(MessageProcessingTest.class.getName());
-
- static long nbrOfTestMessages = 10000; // nbrOfTestMessages must be dividable by insertGroupSize
- static long insertGroupSize = 100;
-
- static int commentsAdded = 0;
-
- public static synchronized void commentAdded() {
- commentsAdded++;
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- if ( (nbrOfTestMessages % insertGroupSize) != 0 ) {
- fail("nbrOfTestMessages ("+nbrOfTestMessages+") is not dividable by insertGroupSize ("+insertGroupSize+")");
- }
- }
-
- protected void logColumnTitles() {
- logFileWriter.println("Used Memory\tProcessed Messages\tTime");
- }
-
- public void logStatus() {
- String measuredTime = getMeasuredTime();
- logFileWriter.println(getUsedMemory()+"\t"+commentsAdded+"\t"+measuredTime);
- logFileWriter.flush();
- log.info(commentsAdded+" msgs in "+measuredTime);
- }
-
- public void testMessageProcessing() throws Exception {
- JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
-
- try {
- int messageIndex = 0;
- // insert ${nbrOfTestMessages} messages...
- for (int i = 0; i < nbrOfTestMessages; i+=insertGroupSize) {
- CompositeCmd compositeCmd = new CompositeCmd();
- // ...in groups of ${insertGroupSize}
- for (int j = 0; j <insertGroupSize ; j++) {
- Message message = new AddCommentMessage(Integer.toString(messageIndex));
- SendMessageCmd sendMessageCmd = new SendMessageCmd(message);
- compositeCmd.addCommand(sendMessageCmd);
-
- messageIndex++;
- }
- commandService.execute(compositeCmd);
-
- log.info("added "+messageIndex+" messages");
- }
-
- startMeasuringTime();
-
- jobExecutor.start();
-
- // wait till all messages are processed
- waitTillNoMoreMessages(jobExecutor);
-
- } finally {
- stopMeasuringTime();
-
- jobExecutor.stop(true);
- }
-
- log.info("processing "+nbrOfTestMessages+" messages took "+getMeasuredTime());
-
- List<Integer> processedMessageNumbers = commandService.execute(new Command<List<Integer>>() {
- public List<Integer> execute(Environment environment) {
- List<Integer> processedMessageNumbers = new ArrayList<Integer>();
- Session session = environment.get(Session.class);
- List<Comment> comments = session.createCriteria(CommentImpl.class).list();
- for (Comment comment: comments) {
- int processedMessageNumber = Integer.parseInt(comment.getMessage());
- processedMessageNumbers.add(processedMessageNumber);
- // make sure the db stays clean
- session.delete(comment);
- }
- return processedMessageNumbers;
- }
- });
-
- for (int i = 0; i < nbrOfTestMessages; i++) {
- assertTrue("message " + i + " is not processed: " + processedMessageNumbers, processedMessageNumbers.contains(i));
- }
- }
-
-}
Deleted: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/ProcessExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/ProcessExecutionTest.java 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/ProcessExecutionTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,113 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test.load;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.Execution;
-import org.jbpm.log.Log;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProcessExecutionTest extends LoadTestCase {
-
- private static Log log = Log.getLog(ProcessExecutionTest.class.getName());
-
- static int processes = 10000;
- static int threads = 5;
-
- Throwable exception;
- int finished;
-
- public void logStatus() {
- String measuredTime = getMeasuredTime();
- logFileWriter.println(getUsedMemory()+"\t"+finished+"\t"+measuredTime);
- logFileWriter.flush();
- log.info(finished+" executions in "+measuredTime);
- }
-
- protected void logColumnTitles() {
- logFileWriter.println("Used Memory\tFinished Executions\tTime");
- logFileWriter.flush();
- }
-
- public void testExecuteProcesses() throws Exception {
- deployJpdlResource("org/jbpm/test/load/process.jpdl.xml");
-
- startMeasuringTime();
-
- List<Thread> threadList = new ArrayList<Thread>();
- for (int i=0; i<threads; i++) {
- Thread thread = new ProcessExecutor();
- thread.start();
- threadList.add(thread);
- }
-
-
- for (Thread thread: threadList) {
- while (thread.isAlive()) {
- try {
- thread.join(checkInterval);
- } catch (InterruptedException e) {
- log.info(e.toString());
- }
- logStatus();
- }
- if (exception!=null) {
- break;
- }
- }
-
- if (exception!=null) {
- throw new Exception("thread threw: "+exception.getMessage(), exception);
- } else {
- log.info(finished+" executions in "+getMeasuredTime());
- }
- }
-
- public class ProcessExecutor extends Thread {
- public void run() {
- try {
- for (int i=0; i<processes; i++) {
- executeProcess();
- }
- } catch (Throwable t) {
- exception = t;
- }
- }
- public void executeProcess() {
- Execution execution = executionService.startExecutionByKey("Process");
- assertEquals("c", execution.getActivityName());
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId);
- assertTrue(execution.isEnded());
- processFinished();
- }
- }
-
- public synchronized void processFinished() {
- finished++;
- }
-}
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/AutomaticActivity.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AutomaticActivity.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/AutomaticActivity.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/AutomaticActivity.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import org.jbpm.activity.ActivityBehaviour;
+import org.jbpm.activity.ActivityExecution;
+
+/** a activity behaviour implementation that records its execution and then
+ * just proceeds.
+ *
+ * @author Tom Baeyens
+ */
+public class AutomaticActivity implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ public AutomaticActivity() {
+ }
+
+ public void execute(ActivityExecution execution) throws Exception {
+ ContinuationTest.recorder.record(execution.getDbid(), "execute("+execution.getActivity().getName()+")");
+ }
+}
\ No newline at end of file
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ContinuationTest.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ContinuationTest.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ContinuationTest.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ContinuationTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.model.OpenProcessDefinition;
+import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ContinuationTest extends JobExecutorTestCase {
+
+ // private static final Log log = Log.getLog(ContinuationTest.class.getName());
+
+ static Recorder recorder = new Recorder();
+
+ int nbrOfExecutions = 100;
+
+ public void testContinuations() {
+
+ try {
+ deployProcess();
+ startExecutions();
+ jobExecutor.start();
+ waitTillNoMoreMessages();
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+ List<String> expectedLogs = new ArrayList<String>();
+ expectedLogs.add("execute(start)");
+ expectedLogs.add("execute(a)");
+ expectedLogs.add("execute(b)");
+ expectedLogs.add("execute(c)");
+ expectedLogs.add("execute(end)");
+
+ assertEquals(nbrOfExecutions, recorder.executionEvents.size());
+ for (List<String> executionLogs : recorder.executionEvents.values()) {
+ assertEquals(expectedLogs, executionLogs);
+ }
+ }
+
+ public void deployProcess() {
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ OpenProcessDefinition processDefinition = ProcessDefinitionBuilder.startProcess("continuations")
+ .key("continuations")
+ .startActivity("start", AutomaticActivity.class)
+ .initial()
+ .asyncExecute()
+ .flow("a")
+ .endActivity()
+ .startActivity("a", AutomaticActivity.class)
+ .asyncExecute()
+ .flow("b")
+ .endActivity()
+ .startActivity("b", AutomaticActivity.class)
+ .asyncExecute()
+ .flow("c")
+ .endActivity()
+ .startActivity("c", AutomaticActivity.class)
+ .asyncExecute()
+ .flow("end")
+ .endActivity()
+ .startActivity("end", WaitState.class)
+ .endActivity()
+ .endProcess();
+
+ Session session = environment.get(Session.class);
+ session.save(processDefinition);
+ return null;
+ }
+ });
+ }
+
+ public void startExecutions() {
+ for (int i = 0; i < nbrOfExecutions; i++) {
+ executionService.startExecutionByKey("continuations");
+ }
+ }
+}
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveMessagesTest.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.activity.ExternalActivityBehaviour;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
+import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.session.MessageSession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveMessagesTest extends JobExecutorTestCase {
+
+ static Map<String, Set<Long>> exclusiveThreadIds;
+
+ static int nbrOfTestMessagesPerExecution = 5;
+ static int nbrOfTestExecutions = 20;
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ exclusiveThreadIds = new HashMap<String, Set<Long>>();
+ }
+
+ public void testExclusiveMessageProcessing() {
+ insertExclusiveTestMessages();
+
+ JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
+ jobExecutor.start();
+ try {
+
+ waitTillNoMoreMessages();
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+ commandService.execute(new Command<Object>() {
+
+ public Object execute(Environment environment) throws Exception {
+ // exclusiveMessageIds maps execution keys to a set of thread ids.
+ // the idea is that for each execution, all the exclusive jobs will
+ // be executed by 1 thread sequentially.
+
+ for (int i = 0; i < nbrOfTestExecutions; i++) {
+ String executionKey = "execution-" + i;
+ Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
+ assertNotNull("no thread id set for " + executionKey + " in: " + exclusiveThreadIds, threadIds);
+ assertEquals("exclusive messages for " + executionKey + " have been executed by multiple threads: " + threadIds, 1, threadIds.size());
+ }
+ return null;
+ }
+ });
+ }
+
+ public static class WaitState implements ExternalActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ execution.waitForSignal();
+ }
+ public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception {
+ execution.take(signalName);
+ }
+ }
+
+ public void insertExclusiveTestMessages() {
+ commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
+ .startProcess("excl")
+ .startActivity("wait", WaitState.class)
+ .initial()
+ .endActivity()
+ .endProcess();
+ processDefinition.setId("excl:1");
+
+ Session session = environment.get(Session.class);
+ session.save(processDefinition);
+ return null;
+ }
+ });
+
+ commandService.execute(new Command<Object>() {
+
+ public Object execute(Environment environment) throws Exception {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ for (int i = 0; i < nbrOfTestExecutions; i++) {
+ Execution execution = new StartExecutionCmd("excl:1", null, "execution-" + i).execute(environment);
+
+ for (int j = 0; j < nbrOfTestMessagesPerExecution; j++) {
+ CommandMessage exclusiveTestMessage = ExclusiveTestCommand.createMessage(execution);
+ messageSession.send(exclusiveTestMessage);
+ }
+ }
+ return null;
+ }
+ });
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveTestCommand.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveTestCommand.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveTestCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.wire.descriptor.LongDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveTestCommand implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(ExclusiveTestCommand.class.getName());
+ static Random random = new Random();
+
+ long executionId;
+
+ public ExclusiveTestCommand() {
+ }
+
+ public static CommandMessage createMessage(Execution execution) {
+ CommandMessage commandMessage = new CommandMessage();
+ commandMessage.setExecution((ExecutionImpl) execution);
+ commandMessage.setExclusive(true);
+
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(ExclusiveTestCommand.class);
+ commandDescriptor.addInjection("executionId", new LongDescriptor(execution.getDbid()));
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ Long threadId = Thread.currentThread().getId();
+
+ Session session = environment.get(Session.class);
+ ExecutionImpl execution = (ExecutionImpl) session.get(ExecutionImpl.class, executionId);
+
+ String executionKey = execution.getKey();
+
+ // exclusiveMessageIds maps execution keys to a set of thread ids.
+ // the idea is that for each execution, all the exclusive jobs will
+ // be executed by 1 thread sequentially.
+
+ // in the end, each set should contain exactly 1 element
+
+ Set<Long> groupMessages = ExclusiveMessagesTest.exclusiveThreadIds.get(executionKey);
+ if (groupMessages==null) {
+ groupMessages = new HashSet<Long>();
+ ExclusiveMessagesTest.exclusiveThreadIds.put(executionKey, groupMessages);
+ }
+ groupMessages.add(threadId);
+
+ /*
+ // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
+ int workTime = random.nextInt(150);
+ log.debug("executing exclusive message for "+execution+". this is going to take "+workTime+"ms");
+ try {
+ Thread.sleep(workTime);
+ } catch (RuntimeException e) {
+ log.debug("sleeping was interrupted");
+ }
+ */
+
+ return null;
+ }
+
+}
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceMessageTest.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.session.MessageSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FailOnceMessageTest extends JobExecutorTestCase {
+
+ private static final Log log = Log.getLog(FailOnceMessageTest.class.getName());
+
+ static long nbrOfTestMessages = 50;
+
+ static List<Integer> failOnceMessageIds = Collections.synchronizedList(new ArrayList<Integer>());
+
+ public void testFailOnceMessages() {
+ failOnceMessageIds.clear();
+
+ jobExecutor.start();
+ try {
+ insertFailOnceTestMessages();
+ waitTillNoMoreMessages();
+
+ } finally {
+ log.debug("stopping job executor");
+ jobExecutor.stop(true);
+ }
+
+ for (int i = 0; i < nbrOfTestMessages; i++) {
+ assertTrue("message " + i + " is not failed once: " + failOnceMessageIds, failOnceMessageIds.contains(i));
+ }
+ assertEquals(nbrOfTestMessages, failOnceMessageIds.size());
+
+ log.debug("==== all messages processed, now checking if all messages have arrived exactly once ====");
+
+ commandService.execute(new Command<Object>() {
+
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ List<Comment> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
+
+ for (Comment comment : comments) {
+ log.debug("retrieved message: "+comment.getMessage());
+ Integer messageId = new Integer(comment.getMessage());
+ assertTrue("message " + messageId + " committed twice", failOnceMessageIds.remove(messageId));
+ }
+
+ assertTrue("not all messages made a successful commit: " + failOnceMessageIds, failOnceMessageIds.isEmpty());
+ return null;
+ }
+ });
+ }
+
+ public static class InsertFailOnceTestMsgCmd implements Command<Object> {
+ private static final long serialVersionUID = 1L;
+ int i;
+ public InsertFailOnceTestMsgCmd(int i) {
+ this.i = i;
+ }
+ public Object execute(Environment environment) throws Exception {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ CommandMessage commandMessage = FailOnceTestCommand.createMessage(i);
+ messageSession.send(commandMessage);
+ return null;
+ }
+ }
+
+ void insertFailOnceTestMessages() {
+ for (int i = 0; i < nbrOfTestMessages; i++) {
+ commandService.execute(new InsertFailOnceTestMsgCmd(i));
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FailOnceTestCommand implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(FailOnceTestCommand.class.getName());
+
+ int messageId;
+
+ public FailOnceTestCommand() {
+ }
+
+ public static CommandMessage createMessage(int messageId) {
+ CommandMessage commandMessage = new CommandMessage();
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(FailOnceTestCommand.class);
+ commandDescriptor.addInjection("messageId", new IntegerDescriptor(messageId));
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ DbSession dbSession = environment.get(DbSession.class);
+
+ // this message execution should be rolled back
+ Comment comment = new CommentImpl(Integer.toString(messageId));
+ dbSession.save(comment);
+
+ if (!FailOnceMessageTest.failOnceMessageIds.contains(messageId)) {
+ // registering the failed message in a non-transactional resource
+ // so the messageId will still be added even after the transaction has rolled back
+ log.debug("adding failonce message "+messageId);
+ FailOnceMessageTest.failOnceMessageIds.add(messageId);
+
+ throw new RuntimeException("failing once");
+ }
+
+ try {
+ Thread.sleep(700);
+ } catch (Exception e) {
+ log.error(e.toString());
+ }
+
+ log.debug("message "+messageId+" now succeeds");
+
+ return null;
+ }
+
+}
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingMessageTest.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.env.Environment;
+import org.jbpm.job.Job;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.session.MessageSession;
+import org.jbpm.session.PvmDbSession;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FailingMessageTest extends JobExecutorTestCase {
+
+
+ public void testFailedMessageProcessing() {
+ jobExecutor.start();
+ try {
+ commandService.execute(new Command<Object>() {
+
+ public Object execute(Environment environment) throws Exception {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ CommandMessage commandMessage = FailingTestCommand.createMessage();
+ messageSession.send(commandMessage);
+ return null;
+ }
+ });
+
+ waitTillNoMoreMessages();
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+ commandService.execute(new Command<Object>() {
+
+ public Object execute(Environment environment) throws Exception {
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ List<Job> deadJobs = pvmDbSession.findJobsWithException(0, 10);
+ assertEquals("there should be one dead job", 1, deadJobs.size());
+
+ Session session = environment.get(Session.class);
+ List commands = session.createQuery("from " + CommentImpl.class.getName()).list();
+ assertTrue("command insertion should have been rolled back", commands.isEmpty());
+ return null;
+ }
+ });
+ }
+}
Property changes on: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -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.test.load.async;
+
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FailingTestCommand implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ public Object execute(Environment environment) throws Exception {
+ DbSession dbSession = environment.get(DbSession.class);
+
+ // this message execution should be rolled back
+ Comment comment = new CommentImpl("failing update");
+ dbSession.save(comment);
+
+ throw new RuntimeException("ooops");
+ }
+
+ public static CommandMessage createMessage() {
+ CommandMessage commandMessage = new CommandMessage();
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(FailingTestCommand.class);
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+
+}
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/GenerateExceptionTestCommand.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/GenerateExceptionTestCommand.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/GenerateExceptionTestCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ * @author Guillaume Porcher
+ *
+ * Simple command that will create an exception during execution.
+ * The exception will generate a stacktrace with variable length
+ * (controlled by the length parameter).
+ *
+ * This class is to test the persistence of exception stacktrace in jobs.
+ */
+public class GenerateExceptionTestCommand implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ int length;
+
+ public GenerateExceptionTestCommand() {
+ }
+
+ public static CommandMessage createMessage(int recursionInitialDepth) {
+ CommandMessage commandMessage = new CommandMessage();
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(GenerateExceptionTestCommand.class);
+ commandDescriptor.addInjection("length", new IntegerDescriptor(recursionInitialDepth));
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ StringBuilder stringBuilder = new StringBuilder();
+ while (stringBuilder.length() < length) {
+ stringBuilder.append("This is a long test message. ");
+ }
+ throw new RuntimeException(stringBuilder.toString());
+ }
+
+}
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTestCase.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JobExecutorTestCase extends DbTestCase {
+
+ long timeoutMillis = 20 * 1000; // 20 seconds
+ long checkInterval = 400;
+
+ static String jobsAvailableQueryText =
+ "select count(*) "+
+ "from "+JobImpl.class.getName()+" as job "+
+ "where ( (job.dueDate is null) or (job.dueDate <= :now) ) "+
+ " and ( job.retries > 0 )";
+
+ protected CommandService commandService;
+ protected JobExecutor jobExecutor;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ commandService = processEngine.get(CommandService.class);
+ jobExecutor = processEngine.get(JobExecutor.class);
+ }
+
+ protected void waitTillNoMoreMessages() {
+
+ // install a timer that will interrupt if it takes too long
+ // if that happens, it will lead to an interrupted exception and the test
+ // will fail
+ TimerTask interruptTask = new TimerTask() {
+
+ Thread testThread = Thread.currentThread();
+
+ public void run() {
+ log.debug("test " + getName() + " took too long. going to interrupt..." + testThread);
+ testThread.interrupt();
+ }
+ };
+ Timer timer = new Timer();
+ timer.schedule(interruptTask, timeoutMillis);
+
+ try {
+ boolean jobsAvailable = true;
+ while (jobsAvailable) {
+ log.debug("going to sleep for " + checkInterval + " millis, waiting for the job executor to process more jobs");
+ Thread.sleep(checkInterval);
+ jobsAvailable = areJobsAvailable();
+ }
+
+ } catch (InterruptedException e) {
+ fail("test execution exceeded treshold of " + timeoutMillis + " milliseconds");
+ } finally {
+ timer.cancel();
+ }
+ }
+
+ public boolean areJobsAvailable() {
+ return commandService.execute(new Command<Boolean>() {
+ public Boolean execute(Environment environment) {
+ Session session = environment.get(Session.class);
+
+ Query query = session.createQuery(jobsAvailableQueryText);
+ query.setDate("now", new Date());
+
+ Long jobs = (Long) query.uniqueResult();
+
+ if (jobs.longValue()>0) {
+ log.debug("found "+jobs+" more jobs to process");
+ return true;
+ }
+ log.debug("no more jobs to process");
+
+ return false;
+ }
+ });
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/JobExecutorTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageCommand.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.Random;
+
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+
+/**
+ * @author Tom Baeyens
+ */
+public class NormalMessageCommand implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+ static Random random = new Random();
+
+ int messageId;
+
+ public NormalMessageCommand() {
+ }
+
+ public NormalMessageCommand(int messageId) {
+ this.messageId = messageId;
+ }
+
+ public static CommandMessage createMessage(int messageId) {
+ CommandMessage commandMessage = new CommandMessage();
+ ObjectDescriptor commandDescriptor = new ObjectDescriptor(NormalMessageCommand.class);
+ commandDescriptor.addInjection("messageId", new IntegerDescriptor(messageId));
+ commandMessage.setCommandDescriptor(commandDescriptor);
+ return commandMessage;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ CommentImpl comment = new CommentImpl(Integer.toString(messageId));
+ Session session = environment.get(Session.class);
+ session.save(comment);
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/NormalMessageTest.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.session.MessageSession;
+import org.jbpm.test.Db;
+
+/**
+ * @author Tom Baeyens
+ */
+public class NormalMessageTest extends JobExecutorTestCase {
+
+ static long nbrOfTestMessages = 100;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Db.clean(processEngine);
+ }
+
+ public void testNormalMessageProcessing() {
+ JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
+ jobExecutor.start();
+
+ try {
+ // insert ${nbrOfTestMessages} messages...
+ for (int i = 0; i < nbrOfTestMessages; i++) {
+ commandService.execute(new InsertNormalMessageCmd(i));
+ }
+
+ // wait till all messages are processed
+ waitTillNoMoreMessages();
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+ List<Integer> processedMessageNumbers = commandService.execute(new Command<List<Integer>>() {
+ public List<Integer> execute(Environment environment) {
+ List<Integer> processedMessageNumbers = new ArrayList<Integer>();
+ Session session = environment.get(Session.class);
+ List<Comment> comments = session.createCriteria(CommentImpl.class).list();
+ for (Comment comment: comments) {
+ int processedMessageNumber = Integer.parseInt(comment.getMessage());
+ processedMessageNumbers.add(processedMessageNumber);
+ // make sure the db stays clean
+ session.delete(comment);
+ }
+ return processedMessageNumbers;
+ }
+ });
+
+ for (int i = 0; i < nbrOfTestMessages; i++) {
+ assertTrue("message " + i + " is not processed: " + processedMessageNumbers, processedMessageNumbers.contains(i));
+ }
+ }
+
+ public static class InsertNormalMessageCmd implements Command<Object> {
+ private static final long serialVersionUID = 1L;
+ int i;
+ public InsertNormalMessageCmd(int i) {
+ this.i = i;
+ }
+ public Object execute(Environment environment) throws Exception {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ CommandMessage commandMessage = NormalMessageCommand.createMessage(i);
+ messageSession.send(commandMessage);
+ return null;
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/Recorder.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/Recorder.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/Recorder.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/Recorder.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Tom Baeyens
+ */
+public class Recorder {
+
+ public Map<Object, List<String>> executionEvents = null;
+
+ public synchronized void record(long executionDbid, String event) {
+ if (executionEvents==null) {
+ executionEvents = new HashMap<Object, List<String>>();
+ }
+ List<String> events = executionEvents.get(executionDbid);
+ if (events == null) {
+ events = new ArrayList<String>();
+ executionEvents.put(executionDbid, events);
+ }
+ events.add(event);
+ }
+
+ public void reset() {
+ executionEvents = null;
+ }
+}
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/WaitState.java (from rev 3816, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/WaitState.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/WaitState.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/WaitState.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.async;
+
+import java.util.Map;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.activity.ExternalActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public class WaitState implements ExternalActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ public WaitState() {
+ }
+
+ public void execute(ActivityExecution execution) throws Exception {
+ ContinuationTest.recorder.record(execution.getDbid(), "execute("+execution.getActivity().getName()+")");
+ }
+
+ public void signal(ActivityExecution execution, String signal, Map<String, Object> parameters) throws Exception {
+ throw new UnsupportedOperationException();
+ }
+}
\ No newline at end of file
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/Automatic.java (from rev 3816, jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/Automatic.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/Automatic.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/Automatic.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.executions;
+
+/**
+ * @author Tom Baeyens
+ */
+public class Automatic {
+
+ public void doNothing() {
+ }
+}
Property changes on: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/Automatic.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java (from rev 3816, jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/ProcessExecutionTest.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.executions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.Execution;
+import org.jbpm.log.Log;
+import org.jbpm.test.load.LoadTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessExecutionTest extends LoadTestCase {
+
+ private static Log log = Log.getLog(ProcessExecutionTest.class.getName());
+
+ static int processes = 1000;
+ static int threads = 5;
+
+ Throwable exception;
+ int finished;
+
+ public void logStatus() {
+ String measuredTime = getMeasuredTime();
+ logFileWriter.println(getUsedMemory()+"\t"+finished+"\t"+measuredTime);
+ logFileWriter.flush();
+ log.info(finished+" executions in "+measuredTime);
+ }
+
+ protected void logColumnTitles() {
+ logFileWriter.println("Used Memory\tFinished Executions\tTime");
+ logFileWriter.flush();
+ }
+
+ public void testExecuteProcesses() throws Exception {
+ deployJpdlResource("org/jbpm/test/load/executions/process.jpdl.xml");
+
+ startMeasuringTime();
+
+ List<Thread> threadList = new ArrayList<Thread>();
+ for (int i=0; i<threads; i++) {
+ Thread thread = new ProcessExecutor();
+ thread.start();
+ threadList.add(thread);
+ }
+
+
+ for (Thread thread: threadList) {
+ while (thread.isAlive()) {
+ try {
+ thread.join(checkInterval);
+ } catch (InterruptedException e) {
+ log.info(e.toString());
+ }
+ logStatus();
+ }
+ if (exception!=null) {
+ break;
+ }
+ }
+
+ if (exception!=null) {
+ throw new Exception("thread threw: "+exception.getMessage(), exception);
+ } else {
+ log.info(finished+" executions in "+getMeasuredTime());
+ }
+ }
+
+ public class ProcessExecutor extends Thread {
+ public void run() {
+ try {
+ for (int i=0; i<processes; i++) {
+ executeProcess();
+ }
+ } catch (Throwable t) {
+ exception = t;
+ }
+ }
+ public void executeProcess() {
+ Execution execution = executionService.startExecutionByKey("Process");
+ assertEquals("c", execution.getActivityName());
+ String executionId = execution.getId();
+ execution = executionService.signalExecutionById(executionId);
+ assertTrue(execution.isEnded());
+ processFinished();
+ }
+ }
+
+ public synchronized void processFinished() {
+ finished++;
+ }
+}
Property changes on: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/executions/ProcessExecutionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java (from rev 3816, jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/AddCommentMessage.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.messages;
+
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.model.CommentImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class AddCommentCmd implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String message;
+
+ public Void execute(Environment environment) throws Exception {
+ CommentImpl comment = new CommentImpl(message);
+ Session session = environment.get(Session.class);
+ session.save(comment);
+ MessageProcessingTest.commentAdded();
+ return null;
+ }
+}
Copied: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java (from rev 3816, jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/MessageProcessingTest.java)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.load.messages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.cmd.CompositeCmd;
+import org.jbpm.pvm.internal.cmd.SendMessageCmd;
+import org.jbpm.pvm.internal.job.CommandMessage;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
+import org.jbpm.test.load.LoadTestCase;
+
+/**
+ * @author Tom Baeyens
+ * @author Guillaume Porcher
+ */
+public class MessageProcessingTest extends LoadTestCase {
+
+ private static final Log log = Log.getLog(MessageProcessingTest.class.getName());
+
+ static long nbrOfTestMessages = 1000; // nbrOfTestMessages must be dividable by insertGroupSize
+ static long insertGroupSize = 100;
+
+ static int commentsAdded = 0;
+
+ public static synchronized void commentAdded() {
+ commentsAdded++;
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ if ( (nbrOfTestMessages % insertGroupSize) != 0 ) {
+ fail("nbrOfTestMessages ("+nbrOfTestMessages+") is not dividable by insertGroupSize ("+insertGroupSize+")");
+ }
+ }
+
+ protected void logColumnTitles() {
+ logFileWriter.println("Used Memory\tProcessed Messages\tTime");
+ }
+
+ public void logStatus() {
+ String measuredTime = getMeasuredTime();
+ logFileWriter.println(getUsedMemory()+"\t"+commentsAdded+"\t"+measuredTime);
+ logFileWriter.flush();
+ log.info(commentsAdded+" msgs in "+measuredTime);
+ }
+
+ public void testMessageProcessing() throws Exception {
+ JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
+
+ try {
+ int messageIndex = 0;
+ // insert ${nbrOfTestMessages} messages...
+ for (int i = 0; i < nbrOfTestMessages; i+=insertGroupSize) {
+ CompositeCmd compositeCmd = new CompositeCmd();
+ // ...in groups of ${insertGroupSize}
+ for (int j = 0; j <insertGroupSize ; j++) {
+ String messageText = Integer.toString(messageIndex);
+
+ ObjectDescriptor cmdDescriptor = new ObjectDescriptor(AddCommentCmd.class);
+ cmdDescriptor.addInjection("message", new StringDescriptor(messageText));
+ CommandMessage commandMessage = new CommandMessage(cmdDescriptor);
+ SendMessageCmd sendMessageCmd = new SendMessageCmd(commandMessage);
+
+ compositeCmd.addCommand(sendMessageCmd);
+
+ messageIndex++;
+ }
+ commandService.execute(compositeCmd);
+
+ log.info("added "+messageIndex+" messages");
+ }
+
+ startMeasuringTime();
+
+ jobExecutor.start();
+
+ // wait till all messages are processed
+ waitTillNoMoreMessages(jobExecutor);
+
+ } finally {
+ stopMeasuringTime();
+
+ jobExecutor.stop(true);
+ }
+
+ log.info("processing "+nbrOfTestMessages+" messages took "+getMeasuredTime());
+
+ List<Integer> processedMessageNumbers = commandService.execute(new Command<List<Integer>>() {
+ public List<Integer> execute(Environment environment) {
+ List<Integer> processedMessageNumbers = new ArrayList<Integer>();
+ Session session = environment.get(Session.class);
+ List<Comment> comments = session.createCriteria(CommentImpl.class).list();
+ for (Comment comment: comments) {
+ int processedMessageNumber = Integer.parseInt(comment.getMessage());
+ processedMessageNumbers.add(processedMessageNumber);
+ // make sure the db stays clean
+ session.delete(comment);
+ }
+ return processedMessageNumbers;
+ }
+ });
+
+ for (int i = 0; i < nbrOfTestMessages; i++) {
+ assertTrue("message " + i + " is not processed: " + processedMessageNumbers, processedMessageNumbers.contains(i));
+ }
+ }
+
+}
Modified: jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml 2009-02-11 12:12:09 UTC (rev 3830)
@@ -24,16 +24,7 @@
<standard-transaction-interceptor />
</command-service>
- <hibernate-configuration>
- <properties resource="hibernate.properties" />
- <mapping resource="jbpm.pvm.typedefs.hbm.xml" />
- <mapping resource="jbpm.pvm.wire.hbm.xml" />
- <mapping resource="jbpm.pvm.definition.hbm.xml" />
- <mapping resource="jbpm.pvm.execution.hbm.xml" />
- <mapping resource="jbpm.pvm.variable.hbm.xml" />
- <mapping resource="jbpm.pvm.job.hbm.xml" />
- <mapping resource="jbpm.jpdl.hbm.xml" />
- <mapping resource="jbpm.load.hbm.xml" />
+ <hibernate-configuration resource="hibernate.cfg.xml">
<cache-configuration resource="jbpm.pvm.cache.xml"
usage="nonstrict-read-write" />
</hibernate-configuration>
Copied: jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml (from rev 3816, jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/process.jpdl.xml)
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml 2009-02-11 12:12:09 UTC (rev 3830)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Process" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="a" />
+ </start>
+
+ <java name="a"
+ class="org.jbpm.test.load.executions.Automatic"
+ method="doNothing">
+ <flow to="b" />
+ </java>
+
+ <java name="b"
+ class="org.jbpm.test.load.executions.Automatic"
+ method="doNothing">
+ <flow to="c" />
+ </java>
+
+ <state name="c">
+ <flow to="d" />
+ </state>
+
+ <java name="d"
+ class="org.jbpm.test.load.executions.Automatic"
+ method="doNothing">
+ <flow to="e" />
+ </java>
+
+ <java name="e"
+ class="org.jbpm.test.load.executions.Automatic"
+ method="doNothing">
+ <flow to="end" />
+ </java>
+
+ <end name="end" />
+
+</process>
Property changes on: jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/executions/process.jpdl.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/process.jpdl.xml 2009-02-11 09:49:06 UTC (rev 3829)
+++ jbpm4/trunk/modules/test-load/src/test/resources/org/jbpm/test/load/process.jpdl.xml 2009-02-11 12:12:09 UTC (rev 3830)
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="Process" xmlns="http://jbpm.org/4/jpdl">
-
- <start>
- <flow to="a" />
- </start>
-
- <java name="a"
- class="org.jbpm.test.load.Automatic"
- method="doNothing">
- <flow to="b" />
- </java>
-
- <java name="b"
- class="org.jbpm.test.load.Automatic"
- method="doNothing">
- <flow to="c" />
- </java>
-
- <state name="c">
- <flow to="d" />
- </state>
-
- <java name="d"
- class="org.jbpm.test.load.Automatic"
- method="doNothing">
- <flow to="e" />
- </java>
-
- <java name="e"
- class="org.jbpm.test.load.Automatic"
- method="doNothing">
- <flow to="end" />
- </java>
-
- <end name="end" />
-
-</process>
More information about the jbpm-commits
mailing list