[jbpm-commits] JBoss JBPM SVN: r2155 - in jbpm3/trunk/modules: core/src/main/java/org/jbpm/graph/node and 7 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Sep 10 02:02:27 EDT 2008
Author: alex.guizar at jboss.com
Date: 2008-09-10 02:02:26 -0400 (Wed, 10 Sep 2008)
New Revision: 2155
Added:
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java
Removed:
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/GetCurrentTime.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/AsyncProcessingTest.java
Modified:
jbpm3/trunk/modules/console/src/main/webapp/WEB-INF/web.xml
jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml
jbpm3/trunk/modules/enterprise/ear/pom.xml
jbpm3/trunk/modules/enterprise/jar/pom.xml
jbpm3/trunk/modules/enterprise/jar/src/main/resources/META-INF/ejb-jar.xml
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/ActionRecorder.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/Recorder.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java
Log:
[JBPM-1717] removed duplicate artifacts in enterprise installation
added new methods to jms message service test case
revised console and enterprise deployment descriptors
Modified: jbpm3/trunk/modules/console/src/main/webapp/WEB-INF/web.xml
===================================================================
--- jbpm3/trunk/modules/console/src/main/webapp/WEB-INF/web.xml 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/console/src/main/webapp/WEB-INF/web.xml 2008-09-10 06:02:26 UTC (rev 2155)
@@ -4,8 +4,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
- <!-- Enable the JSF servlet. See faces-config.xml for Faces-specific configuration -->
<servlet>
+ <description>Enable the JSF servlet. See faces-config.xml for Faces-specific configuration</description>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
@@ -23,14 +23,14 @@
<url-pattern>/sa/pi/*</url-pattern>
</servlet-mapping>
- <!-- Use Documents Saved as *.xhtml -->
<context-param>
+ <description> Use Documents Saved as *.xhtml </description>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
- <!-- Facelets debug output -->
<context-param>
+ <description> Facelets debug output </description>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
</context-param>
@@ -40,8 +40,8 @@
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
- <!-- This is the GDP's deployer servlet -->
<servlet>
+ <description> This is the GDP's deployer servlet </description>
<servlet-name>GDP Deployer Servlet</servlet-name>
<servlet-class>org.jbpm.web.ProcessUploadServlet</servlet-class>
<load-on-startup>1</load-on-startup>
@@ -64,11 +64,11 @@
</security-role>
<!--
- Security constraints - uncomment and optionally customize the role name to require
+ Security constraints - optionally customize the role name to require
a login before access is allowed to the application.
Also, be sure to edit jboss-web.xml to configure the security domain if you are
- deploying inside JBossAS.
+ deploying inside JBoss AS.
-->
<security-constraint>
<web-resource-collection>
@@ -81,7 +81,6 @@
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
- <!-- end security constraints -->
<!-- Example Login page - lists user names -->
<login-config>
@@ -91,7 +90,6 @@
<form-error-page>/ua/login-example.jsf?error=true</form-error-page>
</form-login-config>
</login-config>
- <!-- End Example Login page - lists user names -->
<!-- Login configuration option #1 - use the login page ==>
<login-config>
@@ -101,16 +99,16 @@
<form-error-page>/ua/login.jsf?error=true</form-error-page>
</form-login-config>
</login-config>
- <!== End Login configuration option #1 -->
+ <!== Login configuration option #1 -->
<!-- Login configuration option #2 - use basic auth ==>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>jBPM Administration Console</realm-name>
</login-config>
- <!== End Login configuration option #2 -->
+ <!== Login configuration option #2 -->
- <!-- Job executor launcher (begin) ===
+ <!-- Job executor launcher ==>
<listener>
<description>
Starts the job executor on servlet context initialization and stops it on
@@ -118,7 +116,7 @@
</description>
<listener-class>org.jbpm.web.JobExecutorLauncher</listener-class>
</listener>
- ==== Job executor launcher (end) -->
+ <!== Job executor launcher -->
<listener>
<description>
@@ -129,7 +127,7 @@
<listener-class>org.jbpm.web.JbpmConfigurationCloser</listener-class>
</listener>
- <!-- Job executor servlet (begin) ===
+ <!-- Job executor servlet ==>
<servlet>
<description>
This servlet has the purpose of executing pending jobs. Deprecated,
@@ -143,52 +141,51 @@
<servlet-name>JobExecutorServlet</servlet-name>
<url-pattern>/jobs</url-pattern>
</servlet-mapping>
- ==== Job executor servlet (end) -->
+ <!== Job executor servlet -->
- <resource-ref>
- <description>
+ <resource-ref>
+ <description>
Logical name of the data source that provides connections to the persistence service.
Must match the hibernate.connection.datasource property in the Hibernate
configuration file.
- </description>
- <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <res-auth>Container</res-auth>
- </resource-ref>
+ </description>
+ <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
- <!-- This section is so that the web console can deploy in the jbpm-enterprise.ear module -->
- <resource-ref>
- <description>
+ <resource-ref>
+ <description>
Logical name of the factory that provides JMS connections to the message service.
Required for processes that contain asynchronous continuations.
- </description>
- <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
- <res-type>javax.jms.ConnectionFactory</res-type>
- <res-auth>Container</res-auth>
- </resource-ref>
+ </description>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
+ <res-type>javax.jms.ConnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
- <ejb-local-ref>
- <description>
+ <ejb-local-ref>
+ <description>
Link to the local entity bean that implements the scheduler service. Required for
processes that contain timers.
- </description>
- <ejb-ref-name>ejb/TimerEntityBean</ejb-ref-name>
- <ejb-ref-type>Entity</ejb-ref-type>
- <local-home>org.jbpm.ejb.LocalTimerEntityHome</local-home>
- <local>org.jbpm.ejb.LocalTimerEntity</local>
- <ejb-link>TimerEntityBean</ejb-link>
- </ejb-local-ref>
+ </description>
+ <ejb-ref-name>ejb/TimerEntityBean</ejb-ref-name>
+ <ejb-ref-type>Entity</ejb-ref-type>
+ <local-home>org.jbpm.ejb.LocalTimerEntityHome</local-home>
+ <local>org.jbpm.ejb.LocalTimerEntity</local>
+ <ejb-link>TimerEntityBean</ejb-link>
+ </ejb-local-ref>
- <message-destination-ref>
- <description>
+ <message-destination-ref>
+ <description>
The message service sends job messages to the queue referenced here. To ensure
this is the same queue from which the JobListenerBean receives messages, the
message-destination-link element points to a common logical destination, JobQueue.
</description>
- <message-destination-ref-name>jms/JobQueue</message-destination-ref-name>
- <message-destination-type>javax.jms.Queue</message-destination-type>
- <message-destination-usage>Produces</message-destination-usage>
- <message-destination-link>JobQueue</message-destination-link>
- </message-destination-ref>
+ <message-destination-ref-name>jms/JobQueue</message-destination-ref-name>
+ <message-destination-type>javax.jms.Queue</message-destination-type>
+ <message-destination-usage>Produces</message-destination-usage>
+ <message-destination-link>JobQueue</message-destination-link>
+ </message-destination-ref>
</web-app>
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2008-09-10 06:02:26 UTC (rev 2155)
@@ -70,15 +70,6 @@
}
}
- String getConditionExpression(Element conditionElement) {
- String expression = conditionElement.attributeValue("expression");
- if (expression!=null) {
- return expression;
- } else {
- return conditionElement.getText();
- }
- }
-
public void execute(ExecutionContext executionContext) {
Transition transition = null;
Modified: jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml 2008-09-10 06:02:26 UTC (rev 2155)
@@ -9,7 +9,7 @@
<appversion>@{product.version}</appversion>
<uninstaller name="remove.task" write="yes" />
</info>
- <guiprefs width="600" height="480" resizable="no">
+ <guiprefs width="600" height="440" resizable="yes">
<!--
<laf name="kunststoff">
<os family="unix" />
@@ -153,11 +153,6 @@
<pack name="jBPM3 Server Components" required="yes" preselected="yes">
<description>The jBPM3 Server Components</description>
- <!-- jbpm -->
- <fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm" override="true">
- <include name="jbpm-enterprise.jar" />
- </fileset>
-
<!-- jbpm/jbpm-service.sar -->
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
override="true">
@@ -170,8 +165,7 @@
<!-- jbpm/jbpm-enterprise.ear -->
<file src="@{deploy.artifacts.dir}/lib/jbpm-enterprise-archive.zip" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-enterprise-archive.ear"
- unpack="true" override="true">
- </file>
+ unpack="true" override="true" />
<!-- jbpm/jbpm-userguide.war -->
<file src="@{deploy.artifacts.dir}/lib/jbpm-userguide.zip" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-userguide.war"
Modified: jbpm3/trunk/modules/enterprise/ear/pom.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/ear/pom.xml 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/enterprise/ear/pom.xml 2008-09-10 06:02:26 UTC (rev 2155)
@@ -33,6 +33,12 @@
<artifactId>jbpm-enterprise-beans</artifactId>
<version>${version}</version>
<type>ejb</type>
+ <exclusions>
+ <exclusion>
+ <artifactId>jbpm-core</artifactId>
+ <groupId>org.jboss.jbpm</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.jbpm</groupId>
@@ -40,33 +46,6 @@
<version>${version}</version>
<type>war</type>
</dependency>
- <dependency>
- <groupId>org.jboss.jbpm</groupId>
- <artifactId>jbpm-core</artifactId>
- <version>${version}</version>
- <exclusions>
- <exclusion>
- <groupId>bsh</groupId>
- <artifactId>bsh</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
<!-- Plugins -->
@@ -78,10 +57,6 @@
<generateApplicationXml>true</generateApplicationXml>
<version>1.4</version>
<modules>
- <jarModule>
- <groupId>org.jboss.jbpm</groupId>
- <artifactId>jbpm-core</artifactId>
- </jarModule>
<ejbModule>
<groupId>org.jboss.jbpm</groupId>
<artifactId>jbpm-enterprise-beans</artifactId>
Modified: jbpm3/trunk/modules/enterprise/jar/pom.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/pom.xml 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/enterprise/jar/pom.xml 2008-09-10 06:02:26 UTC (rev 2155)
@@ -16,7 +16,7 @@
<name>JBoss jBPM - Enterprise Beans</name>
<groupId>org.jboss.jbpm</groupId>
<artifactId>jbpm-enterprise-beans</artifactId>
- <packaging>ejb</packaging>
+ <packaging>jar</packaging>
<!-- Parent -->
<parent>
@@ -161,20 +161,11 @@
<configuration>
<excludes>
<exclude>jbpm.cfg.xml</exclude>
- <exclude>hibernate.*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- https://jira.jboss.org/jira/browse/JBPM-1708 -->
- <exclude>org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java</exclude>
- <!-- https://jira.jboss.org/jira/browse/JBPM-1709 -->
- <exclude>org/jbpm/msg/jms/AsyncProcessingTest.java</exclude>
- </excludes>
- </configuration>
</plugin>
</plugins>
</build>
Modified: jbpm3/trunk/modules/enterprise/jar/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/main/resources/META-INF/ejb-jar.xml 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/enterprise/jar/src/main/resources/META-INF/ejb-jar.xml 2008-09-10 06:02:26 UTC (rev 2155)
@@ -21,7 +21,8 @@
<ejb-class>org.jbpm.ejb.impl.CommandServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
- <!--
+
+ <!-- Configuration resource ==>
<env-entry>
<description>
The classpath resource from which to read the jBPM configuration. Optional, defaults to
@@ -31,7 +32,8 @@
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>jbpm.cfg.xml</env-entry-value>
</env-entry>
- -->
+ <!== Configuration resource -->
+
<ejb-local-ref>
<description>
Link to the local entity bean that implements the scheduler service. Required for
@@ -43,6 +45,8 @@
<local>org.jbpm.ejb.LocalTimerEntity</local>
<ejb-link>TimerEntityBean</ejb-link>
</ejb-local-ref>
+
+ <!-- Timer service bean ==>
<ejb-local-ref>
<description>
Link to the local session bean that implements the scheduler service. Deprecated, replaced
@@ -54,6 +58,8 @@
<local>org.jbpm.scheduler.ejbtimer.LocalTimerService</local>
<ejb-link>TimerServiceBean</ejb-link>
</ejb-local-ref>
+ <!== Timer service bean -->
+
<resource-ref>
<description>
Logical name of the data source that provides connections to the persistence service. Must
@@ -63,6 +69,7 @@
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
+
<resource-ref>
<description>
Logical name of the factory that provides JMS connections to the message service. Required
@@ -72,6 +79,7 @@
<res-type>javax.jms.ConnnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
+
<message-destination-ref>
<description>
The message service sends job messages to the queue referenced here. To ensure this is the
@@ -85,6 +93,7 @@
</message-destination-ref>
</session>
+ <!-- Timer service bean ==>
<session>
<description>
Interacts with the EJB timer service to schedule jBPM timers. Deprecated, replaced by the
@@ -97,6 +106,7 @@
<ejb-class>org.jbpm.scheduler.ejbtimer.TimerServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
+
<ejb-local-ref>
<description>
Link to the session bean that executes timers on a separate context.
@@ -108,6 +118,7 @@
<ejb-link>CommandServiceBean</ejb-link>
</ejb-local-ref>
</session>
+ <!== Timer service bean -->
<message-driven>
<description>
@@ -118,6 +129,7 @@
<ejb-class>org.jbpm.ejb.impl.CommandListenerBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
+
<ejb-local-ref>
<description>
Link to the local session bean that executes commands on a separate context.
@@ -128,6 +140,7 @@
<local>org.jbpm.ejb.LocalCommandService</local>
<ejb-link>CommandServiceBean</ejb-link>
</ejb-local-ref>
+
<resource-ref>
<description>
Logical name of the factory that provides JMS connections for producing result messages.
@@ -137,6 +150,7 @@
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
+
<message-destination-ref>
<description>
Messages which do not contain a command are sent to the queue referenced here. Optional;
@@ -159,6 +173,7 @@
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-link>JobQueue</message-destination-link>
+
<ejb-local-ref>
<description>
Link to the local session bean that executes jobs on a separate context.
@@ -169,6 +184,7 @@
<local>org.jbpm.ejb.LocalCommandService</local>
<ejb-link>CommandServiceBean</ejb-link>
</ejb-local-ref>
+
<resource-ref>
<description>
Logical name of the factory that provides JMS connections for producing result messages.
@@ -178,6 +194,7 @@
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
+
<message-destination-ref>
<description>
Messages which do not contain a job ID are sent to the queue referenced here. Optional; if
@@ -217,6 +234,7 @@
<field-name>discriminator</field-name>
</cmp-field>
<primkey-field>timerId</primkey-field>
+
<ejb-local-ref>
<description>
Link to the session bean that executes timers on a separate context.
@@ -227,6 +245,7 @@
<local>org.jbpm.ejb.LocalCommandService</local>
<ejb-link>CommandServiceBean</ejb-link>
</ejb-local-ref>
+
<query>
<description>Retrieve all timers by token identifier</description>
<query-method>
@@ -241,6 +260,7 @@
where obj.tokenId = ?1 and obj.discriminator = 84
]]></ejb-ql>
</query>
+
<query>
<description>Retrieve all timers by token identifier and name</description>
<query-method>
@@ -256,6 +276,7 @@
where obj.tokenId = ?1 and obj.name = ?2 and obj.discriminator = 84
]]></ejb-ql>
</query>
+
<query>
<description>Retrieve all timers by process instance identifier</description>
<query-method>
@@ -284,6 +305,7 @@
<trans-attribute>Required</trans-attribute>
</container-transaction>
+ <!-- Timer service bean ==>
<container-transaction>
<method>
<ejb-name>TimerServiceBean</ejb-name>
@@ -291,6 +313,7 @@
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
+ <!== Timer service bean -->
<container-transaction>
<method>
Modified: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/ActionRecorder.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/ActionRecorder.java 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/ActionRecorder.java 2008-09-10 06:02:26 UTC (rev 2155)
@@ -28,7 +28,7 @@
private static final long serialVersionUID = 1L;
- public void record(String processInstanceId, ExecutionContext executionContext) {
+ public void record(long processInstanceId, ExecutionContext executionContext) {
Action action = executionContext.getAction();
String actionName = action.getName();
collectedResults.add(processInstanceId+actionName);
Deleted: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/GetCurrentTime.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/GetCurrentTime.java 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/GetCurrentTime.java 2008-09-10 06:02:26 UTC (rev 2155)
@@ -1,34 +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.enterprise.test;
-
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.util.Clock;
-
-public class GetCurrentTime implements ActionHandler {
- String variable;
- private static final long serialVersionUID = 1L;
- public void execute(ExecutionContext executionContext) throws Exception {
- executionContext.setVariable(variable, Clock.getCurrentTime());
- }
-}
\ No newline at end of file
Modified: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/Recorder.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/Recorder.java 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/test/Recorder.java 2008-09-10 06:02:26 UTC (rev 2155)
@@ -32,7 +32,7 @@
public class Recorder implements ActionHandler {
private static final long serialVersionUID = 1L;
-
+
public static Set collectedProcessInstanceIds = null;
public static Set collectedResults = null;
public volatile static int executions = 0;
@@ -47,12 +47,12 @@
synchronized (Recorder.class) {
executions++;
}
- String id = (String) Long.toString(executionContext.getProcessInstance().getId());
- collectedProcessInstanceIds.add(id);
- record(id, executionContext);
+ long processInstanceId = executionContext.getProcessInstance().getId();
+ collectedProcessInstanceIds.add(new Long(processInstanceId));
+ record(processInstanceId, executionContext);
}
- public void record(String processInstanceId, ExecutionContext executionContext) {
+ public void record(long processInstanceId, ExecutionContext executionContext) {
String nodeName = executionContext.getNode().getName();
collectedResults.add(processInstanceId+nodeName);
executionContext.leaveNode();
Deleted: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/AsyncProcessingTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/AsyncProcessingTest.java 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/AsyncProcessingTest.java 2008-09-10 06:02:26 UTC (rev 2155)
@@ -1,208 +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.msg.jms;
-
-import java.rmi.RemoteException;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.TreeSet;
-
-import javax.naming.InitialContext;
-
-import junit.framework.Test;
-
-import org.apache.cactus.ServletTestCase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Session;
-import org.jbpm.IntegrationTestSetup;
-import org.jbpm.JbpmContext;
-import org.jbpm.command.Command;
-import org.jbpm.command.DeployProcessCommand;
-import org.jbpm.command.StartProcessInstanceCommand;
-import org.jbpm.ejb.RemoteCommandService;
-import org.jbpm.ejb.RemoteCommandServiceHome;
-import org.jbpm.enterprise.test.ActionRecorder;
-import org.jbpm.enterprise.test.Recorder;
-
-public class AsyncProcessingTest extends ServletTestCase {
-
- private RemoteCommandService commandService;
-
- static int nbrOfConcurrentProcessExecutions = 20;
- static int maxWaitTime = 30000;
-
- public static Test suite() throws Exception {
- return new IntegrationTestSetup(AsyncProcessingTest.class, "enterprise-test.war, enterprise-test.jar");
- }
-
- protected void setUp() throws Exception {
- InitialContext initialContext = new InitialContext();
- RemoteCommandServiceHome localCommandServiceHome = (RemoteCommandServiceHome) initialContext.lookup("ejb/CommandServiceBean");
- commandService = localCommandServiceHome.create();
- }
-
- public void testBulkJobs() throws RemoteException {
- Recorder.resetCollections();
- deleteAllJobs();
- deployProcess();
- launchProcesses();
- processAllJobs(maxWaitTime);
- Set expectedResults = createExpectedResults();
- assertEquals(Recorder.collectedProcessInstanceIds.toString()+" wasn't the expected size: "+nbrOfConcurrentProcessExecutions, nbrOfConcurrentProcessExecutions, Recorder.collectedProcessInstanceIds.size());
- assertEquals(expectedResults, Recorder.collectedResults);
- }
-
- protected void deleteAllJobs() throws RemoteException {
- execute( new Command() {
- private static final long serialVersionUID = 1L;
- public Object execute(JbpmContext jbpmContext) throws Exception {
- Session session = jbpmContext.getSession();
- session.createQuery("delete from org.jbpm.job.Job").executeUpdate();
- return null;
- }
- });
- }
-
- protected Object execute(Command command) throws RemoteException {
- return commandService.execute(command);
- }
-
-
- protected void deployProcess() throws RemoteException {
- log.debug("start deploy process");
- execute(new DeployProcessCommand(
- "<process-definition name='bulk messages'>" +
- " <start-state>" +
- " <transition to='a' />" +
- " </start-state>" +
- " <node name='a' async='true'>" +
- " <action class='"+Recorder.class.getName()+"' />" +
- " <transition to='b' />" +
- " </node>" +
- " <node name='b' async='true'>" +
- " <event type='node-enter'>" +
- " <action name='X' async='true' class='"+ActionRecorder.class.getName()+"' />" +
- " </event>" +
- " <action class='"+Recorder.class.getName()+"' />" +
- " <transition to='c' />" +
- " </node>" +
- " <node name='c' async='true'>" +
- " <action class='"+Recorder.class.getName()+"' />" +
- " <transition to='d'>" +
- " <action name='Y' async='true' class='"+ActionRecorder.class.getName()+"' />" +
- " </transition>" +
- " </node>" +
- " <node name='d' async='true'>" +
- " <action class='"+Recorder.class.getName()+"' />" +
- " <transition to='e' />" +
- " <event type='node-leave'>" +
- " <action name='Z' async='true' class='"+ActionRecorder.class.getName()+"' />" +
- " </event>" +
- " </node>" +
- " <node name='e' async='true'>" +
- " <action class='"+Recorder.class.getName()+"' />" +
- " <transition to='end' />" +
- " </node>" +
- " <end-state name='end'/>" +
- "</process-definition>"));
- }
-
- protected void launchProcesses() throws RemoteException {
- for (int i=0; i<nbrOfConcurrentProcessExecutions; i++) {
- StartProcessInstanceCommand command = new StartProcessInstanceCommand();
- command.setProcessName("bulk messages");
- execute(command);
- }
- }
-
- protected Set createExpectedResults() {
- Set expectedResults = new TreeSet();
- Iterator iter = Recorder.collectedProcessInstanceIds.iterator();
- while (iter.hasNext()) {
- String id = (String) iter.next();
- expectedResults.add(id+"a");
- expectedResults.add(id+"b");
- expectedResults.add(id+"c");
- expectedResults.add(id+"d");
- expectedResults.add(id+"e");
- expectedResults.add(id+"X");
- expectedResults.add(id+"Y");
- expectedResults.add(id+"Z");
- }
- return expectedResults;
- }
-
- private void processAllJobs(final long maxWait) throws RemoteException {
- boolean jobsAvailable = true;
-
- // 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.interrupt();
- }
- };
- Timer timer = new Timer();
- timer.schedule(interruptTask, maxWait);
-
- try {
- while (jobsAvailable) {
- log.debug("going to sleep for 200 millis, waiting for the job executor to process more jobs");
- Thread.sleep(200);
- jobsAvailable = areJobsAvailable();
- }
-
- } catch (InterruptedException e) {
- fail("test execution exceeded treshold of "+maxWait+" milliseconds");
- } finally {
- timer.cancel();
- }
- }
-
- protected int getNbrOfJobsAvailable() throws RemoteException {
- Integer nbrOfJobsAvailable = (Integer) execute( new Command() {
- private static final long serialVersionUID = 1L;
- public Object execute(JbpmContext jbpmContext) throws Exception {
- Integer nbrOfJobsAvailable = null;
- Session session = jbpmContext.getSession();
- Number jobs = (Number) session.createQuery("select count(*) from org.jbpm.job.Job").uniqueResult();
- log.debug("there are '"+jobs+"' jobs currently in the job table");
- if (jobs!=null) {
- nbrOfJobsAvailable = new Integer(jobs.intValue());
- }
- return nbrOfJobsAvailable;
- }
- });
- return nbrOfJobsAvailable.intValue();
- }
-
- protected boolean areJobsAvailable() throws RemoteException {
- return (getNbrOfJobsAvailable()>0);
- }
-
- private static Log log = LogFactory.getLog(AsyncProcessingTest.class);
-}
Copied: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java (from rev 2154, jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/AsyncProcessingTest.java)
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java (rev 0)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java 2008-09-10 06:02:26 UTC (rev 2155)
@@ -0,0 +1,338 @@
+/*
+ * 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.msg.jms;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.TreeSet;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jbpm.IntegrationTestSetup;
+import org.jbpm.JbpmContext;
+import org.jbpm.command.Command;
+import org.jbpm.command.DeployProcessCommand;
+import org.jbpm.command.StartProcessInstanceCommand;
+import org.jbpm.ejb.LocalCommandService;
+import org.jbpm.ejb.LocalCommandServiceHome;
+import org.jbpm.enterprise.test.ActionRecorder;
+import org.jbpm.enterprise.test.EventCallback;
+import org.jbpm.enterprise.test.Recorder;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * Exercises for the {@linkplain JmsMessageServiceImpl JMS message service}.
+ * @author Alejandro Guizar
+ */
+public class JmsMessageTest extends ServletTestCase {
+
+ private LocalCommandService commandService;
+
+ private static LocalCommandServiceHome commandServiceHome;
+
+ static final int processExecutionCount = 20;
+ static final int maxWaitTime = 30000;
+
+ public static Test suite() throws Exception {
+ return new IntegrationTestSetup(JmsMessageTest.class, "enterprise-test.war, enterprise-test.jar");
+ }
+
+ protected void setUp() throws Exception {
+ if (commandServiceHome == null) {
+ Context initialContext = new InitialContext();
+ try {
+ commandServiceHome = (LocalCommandServiceHome) initialContext.lookup("java:comp/env/ejb/CommandServiceBean");
+ }
+ finally {
+ initialContext.close();
+ }
+ }
+ commandService = commandServiceHome.create();
+ log.info("### " + getName() + " started ###");
+ }
+
+ protected void tearDown() throws Exception {
+ log.info("### " + getName() + " done ###");
+ commandService = null;
+ }
+
+ public void testAsyncNode() {
+ deployProcess("<process-definition name='node'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state name='start'>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <node name='a' async='true'>"
+ + " <transition to='end' />"
+ + " </node>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("node").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ public void testAsyncAction() {
+ Recorder.resetCollections();
+ deleteAllJobs();
+ deployProcess("<process-definition name='action'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state name='start'>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <node name='a'>"
+ + " <event type='node-enter'>"
+ + " <action name='X' async='true' class='" + ActionRecorder.class.getName() + "' />"
+ + " </event>"
+ + " <transition to='end' />"
+ + " </node>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("action").getId();
+ assertTrue(isProcessFinished(processId));
+ // action continues in the background
+ processAllJobs(maxWaitTime);
+ assertEquals(Collections.singleton(processId + "X"), Recorder.collectedResults);
+ }
+
+ public void testAsyncSequence() {
+ deployProcess("<process-definition name='sequence'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <node name='a' async='true'>"
+ + " <transition to='b' />"
+ + " </node>"
+ + " <node name='b' async='true'>"
+ + " <transition to='c' />"
+ + " </node>"
+ + " <node name='c' async='true'>"
+ + " <transition to='d' />"
+ + " </node>"
+ + " <node name='d' async='true'>"
+ + " <transition to='e' />"
+ + " </node>"
+ + " <node name='e' async='true'>"
+ + " <transition to='end' />"
+ + " </node>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("sequence").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ public void testAsyncFork() {
+ deployProcess("<process-definition name='fork'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state>"
+ + " <transition to='f' />"
+ + " </start-state>"
+ + " <fork name='f'>"
+ + " <transition name='a' to='a' />"
+ + " <transition name='b' to='b' />"
+ + " <transition name='c' to='c' />"
+ + " <transition name='d' to='d' />"
+ + " <transition name='e' to='e' />"
+ + " </fork>"
+ + " <node name='a' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <node name='b' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <node name='c' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <node name='d' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <node name='e' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <join name='j'>"
+ + " <transition to='end' />"
+ + " </join>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("fork").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ public void testAsyncExecutions() {
+ Recorder.resetCollections();
+ deleteAllJobs();
+ deployProcess("<process-definition name='executions'>" +
+ " <start-state>" +
+ " <transition to='a' />" +
+ " </start-state>" +
+ " <node name='a' async='true'>" +
+ " <action class='"+Recorder.class.getName()+"' />" +
+ " <transition to='b' />" +
+ " </node>" +
+ " <node name='b' async='true'>" +
+ " <event type='node-enter'>" +
+ " <action name='X' async='true' class='"+ActionRecorder.class.getName()+"' />" +
+ " </event>" +
+ " <action class='"+Recorder.class.getName()+"' />" +
+ " <transition to='c' />" +
+ " </node>" +
+ " <node name='c' async='true'>" +
+ " <action class='"+Recorder.class.getName()+"' />" +
+ " <transition to='d'>" +
+ " <action name='Y' async='true' class='"+ActionRecorder.class.getName()+"' />" +
+ " </transition>" +
+ " </node>" +
+ " <node name='d' async='true'>" +
+ " <action class='"+Recorder.class.getName()+"' />" +
+ " <transition to='e' />" +
+ " <event type='node-leave'>" +
+ " <action name='Z' async='true' class='"+ActionRecorder.class.getName()+"' />" +
+ " </event>" +
+ " </node>" +
+ " <node name='e' async='true'>" +
+ " <action class='"+Recorder.class.getName()+"' />" +
+ " <transition to='end' />" +
+ " </node>" +
+ " <end-state name='end'/>" +
+ "</process-definition>");
+ launchProcesses("executions");
+ processAllJobs(maxWaitTime);
+ Set expectedResults = new TreeSet();
+ for (Iterator i = Recorder.collectedProcessInstanceIds.iterator(); i.hasNext();) {
+ Long processInstanceId = (Long) i.next();
+ expectedResults.add(processInstanceId+"a");
+ expectedResults.add(processInstanceId+"b");
+ expectedResults.add(processInstanceId+"c");
+ expectedResults.add(processInstanceId+"d");
+ expectedResults.add(processInstanceId+"e");
+ expectedResults.add(processInstanceId+"X");
+ expectedResults.add(processInstanceId+"Y");
+ expectedResults.add(processInstanceId+"Z");
+ }
+ assertEquals(processExecutionCount, Recorder.collectedProcessInstanceIds.size());
+ assertEquals(expectedResults, Recorder.collectedResults);
+ }
+
+ private ProcessDefinition deployProcess(String xml) {
+ return (ProcessDefinition) commandService.execute(new DeployProcessCommand(xml));
+ }
+
+ private ProcessInstance launchProcess(String processName) {
+ StartProcessInstanceCommand command = new StartProcessInstanceCommand();
+ command.setProcessName(processName);
+ command.setVariables(Collections.singletonMap("eventCallback", new EventCallback()));
+ return (ProcessInstance) commandService.execute(command);
+ }
+
+ private void launchProcesses(String processName) {
+ for (int i=0; i<processExecutionCount; i++) {
+ launchProcess(processName);
+ }
+ }
+
+ private boolean isProcessFinished(final long processId) {
+ Boolean isFinished = (Boolean) commandService.execute(new Command() {
+ private static final long serialVersionUID = 1L;
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ return jbpmContext.loadProcessInstance(processId).hasEnded();
+ }
+ });
+ return isFinished.booleanValue();
+ }
+
+ private void deleteAllJobs() {
+ commandService.execute(new Command() {
+ private static final long serialVersionUID = 1L;
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ int jobCount = jbpmContext.getSession()
+ .createQuery("delete from org.jbpm.job.Job")
+ .executeUpdate();
+ log.debug(jobCount + " jobs deleted");
+ return null;
+ }
+ });
+ }
+
+ private void processAllJobs(long maxWait) {
+ // 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: interrupting...");
+ testThread.interrupt();
+ }
+ };
+ Timer timer = new Timer();
+ timer.schedule(interruptTask, maxWait);
+
+ try {
+ while (getAvailableJobCount() > 0) {
+ log.debug("waiting for job listener to process more jobs");
+ Thread.sleep(200);
+ }
+ } catch (InterruptedException e) {
+ fail("test execution exceeded treshold of "+maxWait+" milliseconds");
+ } finally {
+ timer.cancel();
+ }
+ }
+
+ private int getAvailableJobCount() {
+ Number jobCount = (Number) commandService.execute(new Command() {
+ private static final long serialVersionUID = 1L;
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ Object jobCount = jbpmContext.getSession()
+ .createQuery("select count(*) from org.jbpm.job.Job")
+ .uniqueResult();
+ log.debug(jobCount + " jobs remaining");
+ return jobCount;
+ }
+ });
+ return jobCount.intValue();
+ }
+
+ private static Log log = LogFactory.getLog(JmsMessageTest.class);
+}
Property changes on: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/jms/JmsMessageTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java 2008-09-09 14:49:37 UTC (rev 2154)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java 2008-09-10 06:02:26 UTC (rev 2155)
@@ -40,12 +40,15 @@
import org.jbpm.ejb.LocalCommandService;
import org.jbpm.ejb.LocalCommandServiceHome;
import org.jbpm.enterprise.test.EventCallback;
-import org.jbpm.enterprise.test.GetCurrentTime;
import org.jbpm.graph.def.Event;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
+/**
+ * Exercises for the {@linkplain EntitySchedulerService EJB scheduler service}.
+ * @author Alejandro Guizar
+ */
public class EjbSchedulerTest extends ServletTestCase {
private LocalCommandService commandService;
@@ -103,16 +106,10 @@
+ " <action expression='#{eventCallback.processEnd}'/>"
+ " </event>"
+ " <start-state name='start'>"
- + " <transition to='a'>"
- + " <action class='"
- + GetCurrentTime.class.getName()
- + "'>"
- + " <variable>now</variable>"
- + " </action>"
- + " </transition>"
+ + " <transition to='a' />"
+ " </start-state>"
+ " <state name='a'>"
- + " <timer duedate='#{now} - 10 seconds' transition='timeout' />"
+ + " <timer duedate='-1 second' transition='timeout' />"
+ " <transition name='timeout' to='end' />"
+ " </state>"
+ " <end-state name='end' />"
@@ -167,15 +164,15 @@
// repeated expiration
EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
assertEquals("a", getProcessState(processId));
- cancelTimer("a", process.getRootToken().getId());
// no more expirations
+ cancelTimer("a", process.getRootToken().getId());
EventCallback.waitForEvent(Event.EVENTTYPE_TIMER, 2000);
signalProcess(processId);
assertTrue(isProcessFinished(processId));
}
- public void testScheduleMultiple() throws Exception {
- deployProcess("<process-definition name='multiple'>"
+ public void testScheduleSequence() throws Exception {
+ deployProcess("<process-definition name='sequence'>"
+ " <event type='process-end'>"
+ " <action expression='#{eventCallback.processEnd}'/>"
+ " </event>"
@@ -186,28 +183,28 @@
+ " <transition to='a' />"
+ " </start-state>"
+ " <state name='a'>"
- + " <timer duedate='500 milliseconds' transition='next' />"
- + " <transition name='next' to='b' />"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='b' />"
+ " </state>"
+ " <state name='b'>"
- + " <timer duedate='500 milliseconds' transition='next' />"
- + " <transition name='next' to='c' />"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='c' />"
+ " </state>"
+ " <state name='c'>"
- + " <timer duedate='500 milliseconds' transition='next' />"
- + " <transition name='next' to='d' />"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='d' />"
+ " </state>"
+ " <state name='d'>"
- + " <timer duedate='500 milliseconds' transition='next' />"
- + " <transition name='next' to='e' />"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='e' />"
+ " </state>"
+ " <state name='e'>"
- + " <timer duedate='500 milliseconds' transition='next' />"
- + " <transition name='next' to='end' />"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='end' />"
+ " </state>"
+ " <end-state name='end' />"
+ "</process-definition>");
- long processId = launchProcess("multiple").getId();
+ long processId = launchProcess("sequence").getId();
char state = 'b';
for (int i = 0; i < 4; i++) {
EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
@@ -217,8 +214,8 @@
assertTrue(isProcessFinished(processId));
}
- public void testScheduleConcurrent() throws InterruptedException {
- deployProcess("<process-definition name='concurrent'>"
+ public void testScheduleFork() throws InterruptedException {
+ deployProcess("<process-definition name='fork'>"
+ " <event type='process-end'>"
+ " <action expression='#{eventCallback.processEnd}'/>"
+ " </event>"
@@ -257,23 +254,23 @@
+ " </join>"
+ " <end-state name='end' />"
+ "</process-definition>");
- long processId = launchProcess("concurrent").getId();
+ long processId = launchProcess("fork").getId();
EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
assertTrue(isProcessFinished(processId));
}
- protected ProcessDefinition deployProcess(String xml) {
+ private ProcessDefinition deployProcess(String xml) {
return (ProcessDefinition) commandService.execute(new DeployProcessCommand(xml));
}
- protected ProcessInstance launchProcess(final String processName) {
+ private ProcessInstance launchProcess(String processName) {
StartProcessInstanceCommand command = new StartProcessInstanceCommand();
command.setProcessName(processName);
command.setVariables(Collections.singletonMap("eventCallback", new EventCallback()));
return (ProcessInstance) commandService.execute(command);
}
- protected void signalProcess(final long processId) {
+ private void signalProcess(final long processId) {
commandService.execute(new Command() {
private static final long serialVersionUID = 1L;
public Object execute(JbpmContext jbpmContext) throws Exception {
@@ -283,7 +280,7 @@
});
}
- protected String getProcessState(final long processId) {
+ private String getProcessState(final long processId) {
return (String) commandService.execute(new Command() {
private static final long serialVersionUID = 1L;
public Object execute(JbpmContext jbpmContext) throws Exception {
@@ -292,7 +289,7 @@
});
}
- protected boolean isProcessFinished(final long processId) {
+ private boolean isProcessFinished(final long processId) {
Boolean isFinished = (Boolean) commandService.execute(new Command() {
private static final long serialVersionUID = 1L;
public Object execute(JbpmContext jbpmContext) throws Exception {
@@ -302,7 +299,7 @@
return isFinished.booleanValue();
}
- protected void cancelTimer(final String timerName, final long tokenId) {
+ private void cancelTimer(final String timerName, final long tokenId) {
commandService.execute(new Command() {
private static final long serialVersionUID = 1L;
public Object execute(JbpmContext jbpmContext) throws Exception {
More information about the jbpm-commits
mailing list