[jbpm-commits] JBoss JBPM SVN: r3634 - in jbpm4/trunk: modules/api/src/main/java/org/jbpm and 18 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jan 13 13:22:21 EST 2009
Author: alex.guizar at jboss.com
Date: 2009-01-13 13:22:21 -0500 (Tue, 13 Jan 2009)
New Revision: 3634
Added:
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyListener.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyListener.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/WaitState.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/EnvironmentServletTestCase.java
jbpm4/trunk/modules/enterprise/src/test/resources/log4j.xml
Removed:
jbpm4/trunk/modules/enterprise/scripts/assembly-config.xml
jbpm4/trunk/modules/enterprise/src/main/etc/
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyActivity.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyActivity.java
jbpm4/trunk/modules/enterprise/src/test/resources/logging.properties
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/builder/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/display/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/
jbpm4/trunk/modules/pvm/src/test/resources/enterprise/
Modified:
jbpm4/trunk/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
jbpm4/trunk/modules/enterprise/pom.xml
jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml
jbpm4/trunk/modules/enterprise/scripts/assembly-test-dependencies.xml
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/TimerEB.java
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbLocalCommandServiceBinding.java
jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/ejb-jar.xml
jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/jboss.xml
jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/jbosscmp-jdbc.xml
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandReceiverTest.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java
jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/jboss-web.xml
jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/web.xml
jbpm4/trunk/modules/enterprise/src/test/resources/environment.cfg.xml
jbpm4/trunk/modules/enterprise/src/test/resources/hibernate.properties
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.hbm.xml
jbpm4/trunk/pom.xml
Log:
fix enterprise module
JBPM-1957
Property changes on: jbpm4/trunk
___________________________________________________________________
Name: svn:ignore
- .settings
profiles.xml
+ .settings
profiles.xml
target
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -70,6 +70,7 @@
Deployment addDirectoryCanonical(String directory);
Deployment addDirectory(File directory);
Deployment addDirectoryCanonical(File directory);
+ Deployment addObject(String name, Object object);
Deployment setFileType(String fileName, String fileType);
Modified: jbpm4/trunk/modules/enterprise/pom.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/pom.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/pom.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -41,36 +41,17 @@
<version>${version}</version>
</dependency>
- <!-- Provided Dependencies -->
+ <!-- Test Dependencies -->
<dependency>
- <groupId>org.apache.cactus</groupId>
- <artifactId>cactus.core.framework.wrapper.javaEE.14</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <artifactId>org.mortbay.jetty</artifactId>
- <groupId>org.mortbay.jetty</groupId>
- </exclusion>
- </exclusions>
+ <groupId>cactus</groupId>
+ <artifactId>cactus</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.cactus</groupId>
- <artifactId>cactus.integration.shared.api</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <artifactId>org.mortbay.jetty</artifactId>
- <groupId>org.mortbay.jetty</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.jboss.client</groupId>
<artifactId>jbossall-client</artifactId>
- <scope>test</scope>
+ <scope>runtime</scope>
</dependency>
-
- <!-- Test Dependencies -->
</dependencies>
<!-- Plugins -->
@@ -94,21 +75,6 @@
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>assembly-config</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>${project.build.finalName}</finalName>
- <appendAssemblyId>true</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-config.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
-
- <execution>
<id>assembly-test-dependencies</id>
<phase>generate-test-resources</phase>
<goals>
Modified: jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -33,14 +33,15 @@
<jar destfile="${build.dir}/test-libs/jbpm-enterprise-test.jar">
<fileset dir="${build.dir}/test-classes">
+ <include name="environment.cfg.xml" />
+ <include name="hibernate.properties" />
<include name="org/jbpm/enterprise/internal/custom/*" />
</fileset>
</jar>
<ear destfile="${build.dir}/test-libs/jbpm-enterprise-test.ear" appxml="${test.resources.dir}/META-INF/application.xml">
- <!-- artifacts -->
+ <!-- build artifact -->
<fileset dir="${build.dir}" includes="${build.finalName}.jar" />
- <zipfileset dir="${build.dir}" includes="${build.finalName}-config.jar" prefix="lib" />
<!-- test modules -->
<fileset dir="${build.dir}/test-libs" includes="jbpm-enterprise-test.war" />
<zipfileset dir="${build.dir}/test-libs" includes="jbpm-enterprise-test.jar" prefix="lib" />
Deleted: jbpm4/trunk/modules/enterprise/scripts/assembly-config.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/scripts/assembly-config.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/scripts/assembly-config.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -1,21 +0,0 @@
-<assembly xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">
-
- <id>config</id>
- <formats>
- <format>jar</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
- <directory>src/test/resources</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>environment.cfg.xml</include>
- <include>hibernate.properties</include>
- </includes>
- </fileSet>
- </fileSets>
-
-</assembly>
\ No newline at end of file
Modified: jbpm4/trunk/modules/enterprise/scripts/assembly-test-dependencies.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/scripts/assembly-test-dependencies.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/scripts/assembly-test-dependencies.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -14,10 +14,7 @@
<useStrictFiltering>true</useStrictFiltering>
<includes>
<include>aspectj:aspectjrt:jar</include>
- <include>org.apache.cactus:cactus.integration.shared.api</include>
- <include>org.apache.cactus:cactus.core.framework.wrapper.javaEE.14</include>
- <include>org.apache.cactus:cactus.core.framework.javaEE.13-14</include>
- <include>org.apache.cactus:cactus.core.framework.javaEE.12-13-14</include>
+ <include>cactus:cactus</include>
<include>junit:junit</include>
<include>org.jbpm.jbpm4:jbpm-api</include>
<include>org.jbpm.jbpm4:jbpm-pvm</include>
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-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -205,7 +205,7 @@
try {
Context context = new InitialContext();
LocalCommandExecutorHome commandExecutorHome = (LocalCommandExecutorHome) context.lookup("java:comp/env/ejb/LocalCommandExecutor");
- ConnectionFactory jmsConnectionFactory = (ConnectionFactory) context.lookup("java:comp/env/jms/CommandConnectionFactory");
+ ConnectionFactory jmsConnectionFactory = (ConnectionFactory) context.lookup("java:comp/env/jms/JbpmConnectionFactory");
try {
deadLetterQueue = (Destination) context.lookup("java:comp/env/jms/DeadLetterQueue");
}
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/TimerEB.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/TimerEB.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/TimerEB.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -37,6 +37,7 @@
import javax.naming.NamingException;
import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.job.TimerImpl;
/**
* @author Tom Baeyens
@@ -67,10 +68,7 @@
}
private void schedule(Date dueDate) {
- log.debug("registering timer #"
- + getDbid()
- + " due "
- + org.jbpm.pvm.internal.job.TimerImpl.formatDueDate(dueDate));
+ log.debug("registering timer #" + getDbid() + " due " + TimerImpl.formatDueDate(dueDate));
TimerService timerService = entityContext.getTimerService();
timerService.createTimer(dueDate, null);
}
@@ -90,9 +88,10 @@
public void ejbActivate() throws RemoteException {
try {
Context context = new InitialContext();
- LocalCommandExecutorHome commandExecutorHome = (LocalCommandExecutorHome) context.lookup("java:comp/env/ejb/LocalCommandExecutor");
+ LocalCommandExecutorHome commandExecutorHome = (LocalCommandExecutorHome) context
+ .lookup("java:comp/env/ejb/LocalCommandExecutor");
context.close();
-
+
commandExecutor = commandExecutorHome.create();
}
catch (NamingException e) {
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbLocalCommandServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbLocalCommandServiceBinding.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbLocalCommandServiceBinding.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -22,6 +22,7 @@
package org.jbpm.enterprise.internal.wire.binding;
import org.jbpm.enterprise.internal.ejb.EjbLocalCommandService;
+import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
import org.jbpm.pvm.internal.wire.descriptor.JndiDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -39,10 +40,15 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
- ObjectDescriptor descriptor = new ObjectDescriptor(
- EjbLocalCommandService.class);
- descriptor.addInjection("commandExecutorHome", new JndiDescriptor(
- "java:comp/env/ejb/LocalCommandExecutor"));
+ ObjectDescriptor descriptor = new ObjectDescriptor(EjbLocalCommandService.class);
+ // retrieve home name
+ String homeJndiName = "java:comp/env/ejb/LocalCommandExecutor";
+ Element homeElement = XmlUtil.element(element, "home");
+ if (homeElement != null && homeElement.hasAttribute("jndi-name")) {
+ homeJndiName = homeElement.getAttribute("jndi-name");
+ }
+ // inject home name
+ descriptor.addInjection("commandExecutorHome", new JndiDescriptor(homeJndiName));
return descriptor;
}
Modified: jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/ejb-jar.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/ejb-jar.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -11,8 +11,8 @@
<enterprise-beans>
<session>
- <description>JBoss jBPM Command Executor SLSB</description>
- <display-name>JBoss jBPM Command Executor SLSB</display-name>
+ <description>Executes commands in a separate context.</description>
+ <display-name>jBPM Command Executor</display-name>
<ejb-name>CommandExecutor</ejb-name>
<home>org.jbpm.enterprise.internal.ejb.RemoteCommandExecutorHome</home>
<remote>org.jbpm.enterprise.internal.ejb.RemoteCommandExecutor</remote>
@@ -21,35 +21,90 @@
<ejb-class>org.jbpm.enterprise.internal.ejb.CommandExecutorSLSB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
+
<ejb-local-ref>
+ <description>
+ Link to the local entity bean that implements the timer session.
+ Required for that contain timers.
+ </description>
<ejb-ref-name>ejb/LocalTimer</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>org.jbpm.enterprise.internal.ejb.LocalTimerHome</local-home>
<local>org.jbpm.enterprise.internal.ejb.LocalTimer</local>
<ejb-link>Timer</ejb-link>
</ejb-local-ref>
+
+ <resource-ref>
+ <description>
+ Logical name of the data source that provides connections to the database session.
+ Must match the hibernate.connection.datasource property.
+ </description>
+ <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
+ <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 session.
+ Required for processes that contain asynchronous continuations.
+ </description>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
+ <res-type>javax.jms.ConnnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+
+ <message-destination-ref>
+ <description>
+ The command listener bean receives messages from the queue referenced here. To ensure this
+ is the same queue to which command messages can be sent, the message-destination-link
+ element points to a common logical destination, CommandQueue.
+ </description>
+ <message-destination-ref-name>jms/CommandQueue</message-destination-ref-name>
+ <message-destination-type>javax.jms.Queue</message-destination-type>
+ <message-destination-usage>Produces</message-destination-usage>
+ <message-destination-link>CommandQueue</message-destination-link>
+ </message-destination-ref>
</session>
<message-driven>
- <description>JBoss jBPM Command Receiver MDB</description>
+ <description>
+ Listens for serialized commands and routes them to the command executor.
+ </description>
+ <display-name>jBPM Command Receiver</display-name>
<ejb-name>CommandReceiver</ejb-name>
<ejb-class>org.jbpm.enterprise.internal.ejb.CommandReceiverMDB</ejb-class>
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
+ <message-destination-link>CommandQueue</message-destination-link>
+
<ejb-local-ref>
+ <description>
+ Link to the local session bean that executes commands on a separate environment.
+ </description>
<ejb-ref-name>ejb/LocalCommandExecutor</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome</local-home>
<local>org.jbpm.enterprise.internal.ejb.LocalCommandExecutor</local>
<ejb-link>CommandExecutor</ejb-link>
</ejb-local-ref>
+
<resource-ref>
- <res-ref-name>jms/CommandConnectionFactory</res-ref-name>
+ <description>
+ Logical name of the factory that provides JMS connections for producing result messages.
+ Required for command messages that indicate a reply destination.
+ </description>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
+
<message-destination-ref>
+ <description>
+ Messages that do not contain a command are sent to the queue referenced here.
+ If absent, said messages are rejected, which may cause the container to redeliver.
+ </description>
<message-destination-ref-name>jms/DeadLetterQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Produces</message-destination-usage>
@@ -57,7 +112,8 @@
</message-driven>
<entity>
- <display-name>JBoss jBPM Timer EB</display-name>
+ <description>Interacts with the EJB timer service to schedule jBPM timers.</description>
+ <display-name>jBPM Timer</display-name>
<ejb-name>Timer</ejb-name>
<local-home>org.jbpm.enterprise.internal.ejb.LocalTimerHome</local-home>
<local>org.jbpm.enterprise.internal.ejb.LocalTimer</local>
@@ -74,12 +130,14 @@
<field-name>dueDate</field-name>
</cmp-field>
<!--
- <cmp-field>
+ <cmp-field>
<field-name>dbversion</field-name>
- </cmp-field>
+ </cmp-field>
-->
<primkey-field>dbid</primkey-field>
+
<ejb-local-ref>
+ <description>Link to the session bean that executes timers on a separate environment.</description>
<ejb-ref-name>ejb/LocalCommandExecutor</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome</local-home>
@@ -116,6 +174,10 @@
<trans-attribute>Required</trans-attribute>
</container-transaction>
+ <message-destination>
+ <message-destination-name>CommandQueue</message-destination-name>
+ </message-destination>
+
</assembly-descriptor>
</ejb-jar>
Modified: jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/jboss.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/jboss.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/jboss.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -10,13 +10,20 @@
<ejb-name>CommandExecutor</ejb-name>
<jndi-name>jbpm/CommandExecutor</jndi-name>
<local-jndi-name>java:jbpm/CommandExecutor</local-jndi-name>
+ <resource-ref>
+ <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
+ <jndi-name>java:DefaultDS</jndi-name>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
+ <jndi-name>java:JmsXA</jndi-name>
+ </resource-ref>
</session>
<message-driven>
<ejb-name>CommandReceiver</ejb-name>
- <destination-jndi-name>queue/JbpmCommandQueue</destination-jndi-name>
<resource-ref>
- <res-ref-name>jms/CommandConnectionFactory</res-ref-name>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
<jndi-name>java:JmsXA</jndi-name>
</resource-ref>
<message-destination-ref>
@@ -32,4 +39,13 @@
</enterprise-beans>
+ <assembly-descriptor>
+
+ <message-destination>
+ <message-destination-name>CommandQueue</message-destination-name>
+ <jndi-name>queue/tSestQueue</jndi-name>
+ </message-destination>
+
+ </assembly-descriptor>
+
</jboss>
Modified: jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/jbosscmp-jdbc.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/jbosscmp-jdbc.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/jbosscmp-jdbc.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -4,15 +4,13 @@
<jbosscmp-jdbc>
<defaults>
<datasource>java:DefaultDS</datasource>
- <datasource-mapping>Hypersonic SQL</datasource-mapping>
<create-table>false</create-table>
+ <remove-table>false</remove-table>
+ <pk-constraint>false</pk-constraint>
</defaults>
<enterprise-beans>
<entity>
<ejb-name>Timer</ejb-name>
- <!--
- <read-only>true</read-only>
- -->
<table-name>JBPM_JOB</table-name>
<cmp-field>
<field-name>dbid</field-name>
Deleted: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyActivity.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyActivity.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyActivity.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -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.enterprise.internal.custom;
-
-import java.util.Date;
-
-import org.jbpm.activity.Activity;
-import org.jbpm.activity.ActivityExecution;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.job.TimerImpl;
-
-/**
- * @author Alejandro Guizar
- */
-public class HappyActivity implements Activity {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log = Log.getLog(HappyActivity.class.getName());
- private static final Object lock = new Object();
- private static Date executionDate;
-
- public void execute(ActivityExecution execution) throws Exception {
- executionDate = new Date();
- log.info("executing on " + TimerImpl.formatDueDate(executionDate));
-
- synchronized (lock) {
- lock.notify();
- }
- }
-
- public static Date waitFor() {
- return waitFor(60000);
- }
-
- public static Date waitFor(long timeout) {
- executionDate = null;
- synchronized (lock) {
- try {
- lock.wait(timeout);
- } catch (InterruptedException e) {
- log.info("wait interrupted");
- }
- }
- return executionDate;
- }
-}
Copied: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyListener.java (from rev 3612, jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyActivity.java)
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyListener.java (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyListener.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -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.enterprise.internal.custom;
+
+import java.util.Date;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+import org.jbpm.listener.EventListener;
+import org.jbpm.listener.EventListenerExecution;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.job.TimerImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class HappyListener implements EventListener {
+
+ private static Date executionDate;
+ private static Semaphore semaphore = new Semaphore(0);
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(HappyListener.class.getName());
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ executionDate = new Date();
+ log.info("executing on " + TimerImpl.formatDueDate(executionDate));
+
+ semaphore.release();
+ }
+
+ public static Date waitFor() {
+ return waitFor(10000);
+ }
+
+ public static Date waitFor(long timeout) {
+ executionDate = null;
+ try {
+ semaphore.tryAcquire(timeout, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e) {
+ log.info("wait interrupted");
+ }
+ return executionDate;
+ }
+}
Property changes on: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyActivity.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyActivity.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyActivity.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -1,67 +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.internal.custom;
-
-import java.sql.SQLException;
-import java.util.Date;
-
-import org.jbpm.activity.Activity;
-import org.jbpm.activity.ActivityExecution;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.job.TimerImpl;
-
-/**
- * @author Alejandro Guizar
- */
-public class NoisyActivity implements Activity {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log = Log.getLog(NoisyActivity.class.getName());
- private static final Object lock = new Object();
- private static Date executionDate;
-
- public void execute(ActivityExecution execution) throws Exception {
- executionDate = new Date();
- log.info("executing on " + TimerImpl.formatDueDate(executionDate));
-
- execution.setVariable("executionDate", executionDate);
-
- synchronized (lock) {
- lock.notify();
- }
-
- throw new SQLException("simulated failure");
- }
-
- public static Date waitFor() {
- executionDate = null;
- synchronized (lock) {
- try {
- lock.wait(60000);
- } catch (InterruptedException e) {
- log.info("wait interrupted");
- }
- }
- return executionDate;
- }
-}
Copied: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyListener.java (from rev 3612, jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyActivity.java)
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyListener.java (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyListener.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -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.enterprise.internal.custom;
+
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+import org.jbpm.listener.EventListener;
+import org.jbpm.listener.EventListenerExecution;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.job.TimerImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class NoisyListener implements EventListener {
+
+ private static Date executionDate;
+ private static Semaphore semaphore = new Semaphore(0);
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(NoisyListener.class.getName());
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ executionDate = new Date();
+ execution.setVariable("executionDate", executionDate);
+ log.info("executing on " + TimerImpl.formatDueDate(executionDate));
+
+ semaphore.release();
+
+ throw new SQLException("simulated failure");
+ }
+
+ public static Date waitFor() {
+ executionDate = null;
+ try {
+ semaphore.tryAcquire(10000, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e) {
+ log.info("wait interrupted");
+ }
+ return executionDate;
+ }
+}
Property changes on: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/WaitState.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/WaitState.java (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/WaitState.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -0,0 +1,60 @@
+/*
+ * 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.internal.custom;
+
+import java.util.Map;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.activity.ExternalActivity;
+import org.jbpm.model.Node;
+import org.jbpm.model.Transition;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class WaitState implements ExternalActivity {
+
+ 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 {
+ if (parameters != null) {
+ execution.setVariables(parameters);
+ }
+
+ Node node = execution.getNode();
+ execution.fire(signalName, node);
+
+ Transition transition = node.findOutgoingTransition(signalName);
+ if (transition != null) {
+ execution.take(transition);
+ }
+ else {
+ execution.waitForSignal();
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/WaitState.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandReceiverTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandReceiverTest.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandReceiverTest.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -41,6 +41,7 @@
import org.jbpm.enterprise.internal.custom.InsertCommentCmd;
import org.jbpm.enterprise.internal.custom.RemoveCommentCmd;
import org.jbpm.enterprise.internal.ejb.CommandReceiverMDB;
+import org.jbpm.log.Log;
import org.jbpm.test.enterprise.IntegrationTestSetup;
/**
@@ -52,26 +53,26 @@
private Connection jmsConnection;
- private static final long TIMEOUT = 2000;
-
private static ConnectionFactory jmsConnectionFactory;
private static Destination commandQueue;
+ private static final long TIMEOUT = 2000;
+ private static final Log log = Log.getLog(CommandReceiverTest.class.getName());
+
public static Test suite() {
- return new IntegrationTestSetup(CommandReceiverTest.class,
- "jbpm-enterprise-test.ear");
+ return new IntegrationTestSetup(CommandReceiverTest.class, "jbpm-enterprise-test.ear");
}
@Override
protected void setUp() throws Exception {
+ log.info("=== starting " + getName() + " =============================");
if (jmsConnectionFactory == null) {
// retrieve managed objects
Context initial = new InitialContext();
try {
jmsConnectionFactory = (ConnectionFactory) initial
- .lookup("java:comp/env/jms/CommandConnectionFactory");
- commandQueue = (Destination) initial
- .lookup("java:comp/env/jms/CommandQueue");
+ .lookup("java:comp/env/jms/JbpmConnectionFactory");
+ commandQueue = (Destination) initial.lookup("java:comp/env/jms/CommandQueue");
}
finally {
initial.close();
@@ -88,6 +89,7 @@
jmsConnection.close();
jmsConnection = null;
}
+ log.info("=== ending " + getName() + " =============================");
}
/**
@@ -113,8 +115,7 @@
*/
public void testHappyMessage() throws JMSException {
final String text = "been there, done that";
- Session jmsSession = jmsConnection.createSession(false,
- Session.AUTO_ACKNOWLEDGE);
+ Session jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
try {
// send insert command
Command<Void> insertCommand = new InsertCommentCmd(text, /* fail? */false);
@@ -125,10 +126,10 @@
producer.send(insertMessage);
// receive insertion response
- MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo,
- "JMSCorrelationID = '" + insertMessage.getJMSMessageID() + "'");
- ObjectMessage responseMessage = (ObjectMessage) insertConsumer
- .receive(TIMEOUT);
+ MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '"
+ + insertMessage.getJMSMessageID()
+ + "'");
+ ObjectMessage responseMessage = (ObjectMessage) insertConsumer.receive(TIMEOUT);
assertNull(responseMessage.getObject());
// send remove command
@@ -138,8 +139,9 @@
producer.send(removeMessage);
// receive removal response
- MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo,
- "JMSCorrelationID = '" + removeMessage.getJMSMessageID() + "'");
+ MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '"
+ + removeMessage.getJMSMessageID()
+ + "'");
responseMessage = (ObjectMessage) removeConsumer.receive(TIMEOUT);
// verify phrase was inserted
assertTrue((Boolean) responseMessage.getObject());
@@ -177,8 +179,7 @@
public void testNoisyMessage() throws JMSException {
final String text = "houston, we have a problem";
// insert phrase via command
- Session jmsSession = jmsConnection.createSession(false,
- Session.AUTO_ACKNOWLEDGE);
+ Session jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
try {
// send insert command
Command<Void> insertCommand = new InsertCommentCmd(text, /* fail? */true);
@@ -189,10 +190,10 @@
producer.send(insertMessage);
// receive insertion response
- MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo,
- "JMSCorrelationID = '" + insertMessage.getJMSMessageID() + "'");
- ObjectMessage insertResponse = (ObjectMessage) insertConsumer
- .receive(TIMEOUT);
+ MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '"
+ + insertMessage.getJMSMessageID()
+ + "'");
+ ObjectMessage insertResponse = (ObjectMessage) insertConsumer.receive(TIMEOUT);
assertNull(insertResponse);
// send remove command
@@ -202,10 +203,10 @@
producer.send(removeMessage);
// receive removal response
- MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo,
- "JMSCorrelationID = '" + removeMessage.getJMSMessageID() + "'");
- ObjectMessage removeResponse = (ObjectMessage) removeConsumer
- .receive(TIMEOUT);
+ MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '"
+ + removeMessage.getJMSMessageID()
+ + "'");
+ ObjectMessage removeResponse = (ObjectMessage) removeConsumer.receive(TIMEOUT);
// verify phrase was NOT inserted
assertFalse((Boolean) removeResponse.getObject());
}
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -22,28 +22,26 @@
package org.jbpm.enterprise.internal.ejb;
import java.util.Date;
-import java.util.List;
import javax.ejb.CreateException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
import junit.framework.Test;
-import org.apache.cactus.ServletTestCase;
-import org.jbpm.ProcessDefinition;
+import org.jbpm.ExecutionService;
+import org.jbpm.ProcessService;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.cmd.Command;
-import org.jbpm.enterprise.internal.custom.HappyActivity;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.enterprise.internal.custom.HappyListener;
+import org.jbpm.enterprise.internal.custom.WaitState;
import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
import org.jbpm.pvm.internal.job.TimerImpl;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.session.DbSession;
import org.jbpm.session.TimerSession;
+import org.jbpm.test.enterprise.EnvironmentServletTestCase;
import org.jbpm.test.enterprise.IntegrationTestSetup;
/**
@@ -52,53 +50,41 @@
*
* @author Alejandro Guizar
*/
-public class EjbTimerSessionTest extends ServletTestCase {
+public class EjbTimerSessionTest extends EnvironmentServletTestCase {
- private LocalCommandExecutor commandExecutor;
- private static LocalCommandExecutorHome commandExecutorHome;
-
private String processDefinitionId;
-
private Date dueDate;
+
private static final int TIMEOUT = 2000;
public static Test suite() {
- return new IntegrationTestSetup(EjbTimerSessionTest.class,
- "jbpm-enterprise-test.ear");
+ return new IntegrationTestSetup(EjbTimerSessionTest.class, "jbpm-enterprise-test.ear");
}
protected void setUp() throws Exception {
- // lookup home in jndi
- if (commandExecutorHome == null) {
- Context initialContext = new InitialContext();
- try {
- commandExecutorHome = (LocalCommandExecutorHome) initialContext
- .lookup("java:comp/env/ejb/LocalCommandExecutor");
- }
- finally {
- initialContext.close();
- }
- }
- // create local bean
- commandExecutor = commandExecutorHome.create();
+ super.setUp();
// define process
dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
ClientProcessDefinition processDefinition = ProcessFactory.build(getName())
- .node()
- .initial()
- .timer(dueDate, null)
- .event("timeout")
- .listener(new ObjectDescriptor(HappyActivity.class))
- .done();
+ .node("start")
+ .initial()
+ .behaviour(new ObjectDescriptor(WaitState.class))
+ .timer(dueDate, "timeout")
+ .transition("timeout")
+ .listener(new ObjectDescriptor(HappyListener.class))
+ .to("end")
+ .node("end")
+ .behaviour(new ObjectDescriptor(WaitState.class))
+ .done();
// deploy process
- List<ProcessDefinition> processDefinitions = commandExecutor
- .execute(new DeployCmd(new DeploymentImpl(processDefinition)));
- assertEquals(1, processDefinitions.size());
- processDefinitionId = processDefinitions.get(0).getId();
+ environment.get(ProcessService.class).createDeployment().addObject(processDefinition.getName(),
+ processDefinition).deploy();
+ processDefinitionId = processDefinition.getId();
}
protected void tearDown() throws Exception {
- commandExecutor = null;
+ // environment.get(ProcessService.class).deleteProcessDefinition(processDefinitionId);
+ super.tearDown();
}
/**
@@ -114,7 +100,7 @@
* <p>
* The {@link ScheduleTimerCmd} command activates a timer. After that, the
* test waits for the activity to execute. Upon timeout, the
- * {@linkplain HappyActivity activity} notifies the test of its execution.
+ * {@linkplain HappyListener activity} notifies the test of its execution.
* </p>
* <h3>Postconditions</h3>
* <p>
@@ -123,11 +109,11 @@
*/
public void testSchedule() throws CreateException {
// start an execution
- commandExecutor.execute(new StartExecutionCmd(processDefinitionId, null,
- null));
+ environment.get(CommandService.class).execute(
+ new StartExecutionCmd(processDefinitionId, null, null));
// wait for activity to execute
- Date executionDate = HappyActivity.waitFor();
+ Date executionDate = HappyListener.waitFor();
assertTrue(dueDate.compareTo(executionDate) <= 0);
}
@@ -152,10 +138,10 @@
*/
public void testCancel() throws CreateException {
// start an execution
- commandExecutor.execute(new StartExecutionCmd(processDefinitionId, null,
- null));
+ environment.get(ExecutionService.class).startExecutionById(processDefinitionId);
- Date executionDate = HappyActivity.waitFor(2 * TIMEOUT);
+ // wait past the due date, ensure activity did not execute
+ Date executionDate = HappyListener.waitFor(2 * TIMEOUT);
assertNull(executionDate);
}
@@ -187,8 +173,7 @@
}
public Void execute(Environment environment) throws Exception {
- TimerImpl timer = environment.get(DbSession.class).get(TimerImpl.class,
- timerDbid);
+ TimerImpl timer = environment.get(DbSession.class).get(TimerImpl.class, timerDbid);
environment.get(TimerSession.class).cancel(timer);
return null;
}
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -22,35 +22,29 @@
package org.jbpm.enterprise.internal.ejb;
import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
import javax.ejb.CreateException;
import javax.naming.InitialContext;
import junit.framework.Test;
-import org.apache.cactus.ServletTestCase;
+import org.jbpm.Execution;
+import org.jbpm.ExecutionService;
+import org.jbpm.ProcessService;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.cmd.Command;
-import org.jbpm.enterprise.internal.custom.HappyActivity;
-import org.jbpm.enterprise.internal.custom.NoisyActivity;
-import org.jbpm.enterprise.internal.ejb.LocalCommandExecutor;
-import org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome;
-import org.jbpm.enterprise.internal.ejb.LocalTimer;
-import org.jbpm.enterprise.internal.ejb.LocalTimerHome;
-import org.jbpm.enterprise.internal.ejb.TimerEB;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.enterprise.internal.custom.HappyListener;
+import org.jbpm.enterprise.internal.custom.WaitState;
+import org.jbpm.enterprise.internal.custom.NoisyListener;
import org.jbpm.env.Environment;
import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.cmd.DeployCmd;
-import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
-import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
import org.jbpm.pvm.internal.job.TimerImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.session.DbSession;
+import org.jbpm.test.enterprise.EnvironmentServletTestCase;
import org.jbpm.test.enterprise.IntegrationTestSetup;
/**
@@ -59,55 +53,53 @@
*
* @author Alejandro Guizar
*/
-public class TimerTest extends ServletTestCase {
+public class TimerTest extends EnvironmentServletTestCase {
private ClientProcessDefinition processDefinition;
- private ObjectDescriptor activityDescriptor = new ObjectDescriptor();
+ private ObjectDescriptor listenerDescriptor = new ObjectDescriptor();
private Date dueDate;
- private LocalCommandExecutor commandExecutor;
-
private static final int TIMEOUT = 2000;
private static final int REPEAT = 1000;
private static final Log log = Log.getLog(TimerTest.class.getName());
private static LocalTimerHome timerHome;
- private static LocalCommandExecutorHome commandExecutorHome;
public static Test suite() {
return new IntegrationTestSetup(TimerTest.class, "jbpm-enterprise-test.ear");
}
protected void setUp() throws Exception {
- // lookup homes in jndi
- if (commandExecutorHome == null) {
+ super.setUp();
+ // lookup timer home in jndi
+ if (timerHome == null) {
InitialContext initialContext = new InitialContext();
try {
- commandExecutorHome = (LocalCommandExecutorHome) initialContext
- .lookup("java:comp/env/ejb/LocalCommandExecutor");
- timerHome = (LocalTimerHome) initialContext
- .lookup("java:comp/env/ejb/LocalTimer");
+ timerHome = (LocalTimerHome) initialContext.lookup("java:comp/env/ejb/LocalTimer");
}
finally {
initialContext.close();
}
}
- // create local bean
- commandExecutor = commandExecutorHome.create();
// define process
dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
processDefinition = ProcessFactory.build(getName())
- .node()
- .initial()
- .timer(dueDate, null)
- .event("timeout")
- .listener(activityDescriptor)
- .done();
+ .node()
+ .initial()
+ .behaviour(new ObjectDescriptor(WaitState.class))
+ .timer(dueDate, "timeout")
+ .transition("timeout")
+ .listener(listenerDescriptor)
+ .to("end")
+ .node("end")
+ .behaviour(new ObjectDescriptor(WaitState.class))
+ .done();
}
protected void tearDown() throws Exception {
- commandExecutor = null;
+ // environment.get(ProcessService.class).deleteProcessDefinition(processDefinition.getId());
+ super.tearDown();
}
/**
@@ -121,10 +113,10 @@
* </p>
* <h3>Behavior</h3>
* <p>
- * The {@link CreateTimerCmd} command subscribes a timer bean to the EJB
- * timer service. After that, the test waits for the activity to execute.
- * Upon timeout, the {@linkplain HappyActivity activity} notifies the test of
- * its execution.
+ * The {@link CreateTimerCmd} command subscribes a timer bean to the EJB timer
+ * service. After that, the test waits for the activity to execute. Upon
+ * timeout, the {@linkplain HappyListener activity} notifies the test of its
+ * execution.
* </p>
* <h3>Postconditions</h3>
* <p>
@@ -132,20 +124,21 @@
* </p>
*/
public void testHappyTimer() throws CreateException {
- activityDescriptor.setClassName(HappyActivity.class.getName());
- commandExecutor
- .execute(new DeployCmd(new DeploymentImpl(processDefinition)));
+ // deploy process
+ listenerDescriptor.setClassName(HappyListener.class.getName());
+ environment.get(ProcessService.class).createDeployment().addObject(processDefinition.getName(),
+ processDefinition).deploy();
+ // start execution
+ Execution execution = environment.get(ExecutionService.class).startExecutionById(
+ processDefinition.getId());
- ExecutionImpl execution = (ExecutionImpl) commandExecutor
- .execute(new StartExecutionCmd(processDefinition.getId(), null, null));
-
TimerImpl timer = new TimerImpl();
timer.setEventName("timeout");
timer.setDueDate(dueDate);
- timer.setExecution(execution);
- commandExecutor.execute(new CreateTimerCmd(timer));
+ timer.setExecution((ExecutionImpl) execution);
+ environment.get(CommandService.class).execute(new CreateTimerCmd(timer));
- Date executionDate = HappyActivity.waitFor();
+ Date executionDate = HappyListener.waitFor();
assertTrue(dueDate.compareTo(executionDate) <= 0);
}
@@ -162,7 +155,7 @@
* <p>
* The {@link CreateTimerCmd} command subscribes a timer bean to the EJB timer
* service. After that, the test waits for the activity to execute. Upon
- * timeout, the {@linkplain NoisyActivity activity} notifies the test of its
+ * timeout, the {@linkplain NoisyListener activity} notifies the test of its
* execution, sets a variable and throws a checked exception.
* </p>
* <h3>Postconditions</h3>
@@ -172,26 +165,26 @@
* </p>
*/
public void testNoisyTimer() throws CreateException {
- activityDescriptor.setClassName(NoisyActivity.class.getName());
- commandExecutor
- .execute(new DeployCmd(new DeploymentImpl(processDefinition)));
+ // deploy process
+ listenerDescriptor.setClassName(NoisyListener.class.getName());
+ environment.get(ProcessService.class).createDeployment().addObject(processDefinition.getName(),
+ processDefinition).deploy();
+ // start execution
+ ExecutionService executionService = environment.get(ExecutionService.class);
+ ExecutionImpl execution = (ExecutionImpl) executionService.startExecutionById(processDefinition
+ .getId());
- ExecutionImpl execution = (ExecutionImpl) commandExecutor
- .execute(new StartExecutionCmd(processDefinition.getId(), null, null));
-
TimerImpl timer = new TimerImpl();
timer.setEventName("timeout");
timer.setDueDate(dueDate);
timer.setExecution(execution);
- commandExecutor.execute(new CreateTimerCmd(timer));
+ CommandService commandService = environment.get(CommandService.class);
+ commandService.execute(new CreateTimerCmd(timer));
- Date executionDate = NoisyActivity.waitFor();
+ Date executionDate = NoisyListener.waitFor();
assertTrue(dueDate.compareTo(executionDate) <= 0);
- Set<String> variableNames = new HashSet<String>();
- variableNames.add("executionDate");
- Object variableValue = commandExecutor.execute(new GetVariablesCmd(
- execution.getId(), variableNames));
+ Object variableValue = executionService.getVariable(execution.getId(), "executionDate");
assertNull(variableValue);
}
@@ -209,7 +202,7 @@
* The {@link CreateTimerCmd} command subscribes a timer bean to the EJB timer
* service. After that, the test waits for the first execution of the
* activity, and then for the subsequent <em>n</em> executions of the
- * activity. Upon each timeout, the {@linkplain HappyActivity activity}
+ * activity. Upon each timeout, the {@linkplain HappyListener activity}
* notifies the test of its execution.
* </p>
* <h3>
@@ -221,33 +214,35 @@
* </p>
*/
public void testCyclicTimer() throws CreateException {
- activityDescriptor.setClassName(HappyActivity.class.getName());
- commandExecutor
- .execute(new DeployCmd(new DeploymentImpl(processDefinition)));
+ // deploy process
+ listenerDescriptor.setClassName(HappyListener.class.getName());
+ environment.get(ProcessService.class).createDeployment().addObject(processDefinition.getName(),
+ processDefinition).deploy();
+ // start execution
+ ExecutionImpl execution = (ExecutionImpl) environment.get(ExecutionService.class)
+ .startExecutionById(processDefinition.getId());
- ExecutionImpl execution = (ExecutionImpl) commandExecutor
- .execute(new StartExecutionCmd(processDefinition.getId(), null, null));
-
TimerImpl timer = new TimerImpl();
timer.setEventName("timeout");
timer.setDueDate(dueDate);
timer.setRepeat(REPEAT + " milliseconds");
timer.setExecution(execution);
- commandExecutor.execute(new CreateTimerCmd(timer));
+ CommandService commandService = environment.get(CommandService.class);
+ commandService.execute(new CreateTimerCmd(timer));
try {
- Date executionTime = HappyActivity.waitFor();
+ Date executionTime = HappyListener.waitFor();
assertTrue(dueDate.compareTo(executionTime) <= 0);
for (int i = 0; i < 5; i++) {
dueDate.setTime(dueDate.getTime() + REPEAT);
log.info("next execution due " + TimerImpl.formatDueDate(dueDate));
- executionTime = HappyActivity.waitFor();
+ executionTime = HappyListener.waitFor();
assertTrue(dueDate.compareTo(executionTime) <= 0);
}
}
finally {
- commandExecutor.execute(new CancelTimerCmd(timer.getDbid()));
+ commandService.execute(new CancelTimerCmd(timer.getDbid()));
}
}
Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/EnvironmentServletTestCase.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/EnvironmentServletTestCase.java (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/EnvironmentServletTestCase.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -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.enterprise;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cactus.ServletTestCase;
+import org.jbpm.Configuration;
+import org.jbpm.JbpmException;
+import org.jbpm.env.Environment;
+import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.log.Log;
+
+/**
+ * @author Alejandro Guizar
+ */
+public abstract class EnvironmentServletTestCase extends ServletTestCase {
+
+ private final String configResource;
+ protected Environment environment;
+ protected Log log = Log.getLog(getClass().getName());
+
+ private static final Map<String, EnvironmentFactory> environmentFactories = new HashMap<String, EnvironmentFactory>();
+
+ public EnvironmentServletTestCase() {
+ this("environment.cfg.xml");
+ }
+
+ public EnvironmentServletTestCase(String configResource) {
+ this.configResource = configResource;
+ }
+
+ protected void setUp() throws Exception {
+ log.info("=== starting " + getName() + " =============================");
+ openEnvironment();
+ }
+
+ protected void tearDown() throws Exception {
+ closeEnvironment();
+ log.info("=== ending " + getName() + " =============================");
+ }
+
+ void closeEnvironment() {
+ environment.close();
+ environment = null;
+ }
+
+ void openEnvironment() {
+ environment = getEnvironmentFactory().openEnvironment();
+ }
+
+ public EnvironmentFactory getEnvironmentFactory() {
+ EnvironmentFactory environmentFactory = environmentFactories.get(configResource);
+ if (environmentFactory == null) {
+ environmentFactory = createEnvironmentFactory(configResource);
+ }
+ return environmentFactory;
+ }
+
+ EnvironmentFactory createEnvironmentFactory(String configResource) {
+ try {
+ log.debug("creating environment factory for " + configResource);
+ EnvironmentFactory environmentFactory = (EnvironmentFactory) new Configuration().setResource(
+ configResource).buildProcessEngine();
+ environmentFactories.put(configResource, environmentFactory);
+ return environmentFactory;
+ }
+ catch (Exception e) {
+ throw new JbpmException("could not create environment factory for " + configResource, e);
+ }
+ }
+
+ void closeEnvironmentFactory(String configResource) {
+ EnvironmentFactory environmentFactory = environmentFactories.remove(configResource);
+ if (environmentFactory != null) {
+ log.debug("closing environment factory for " + configResource);
+ environmentFactory.close();
+ }
+ }
+}
Modified: jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/jboss-web.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/jboss-web.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/jboss-web.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -4,13 +4,8 @@
<jboss-web>
<resource-ref>
- <res-ref-name>jms/CommandConnectionFactory</res-ref-name>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
<jndi-name>java:ConnectionFactory</jndi-name>
</resource-ref>
- <message-destination-ref>
- <message-destination-ref-name>jms/CommandQueue</message-destination-ref-name>
- <jndi-name>queue/JbpmCommandQueue</jndi-name>
- </message-destination-ref>
-
</jboss-web>
Modified: jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/web.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/web.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/web.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -1,9 +1,6 @@
<?xml version="1.0"?>
-
-<web-app version="2.4"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee">
-
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" 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">
<servlet>
<servlet-name>ServletRedirector</servlet-name>
<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
@@ -31,7 +28,7 @@
</ejb-local-ref>
<resource-ref>
- <res-ref-name>jms/CommandConnectionFactory</res-ref-name>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
@@ -41,6 +38,6 @@
<message-destination-ref-name>jms/CommandQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Produces</message-destination-usage>
+ <message-destination-link>CommandQueue</message-destination-link>
</message-destination-ref>
-
-</web-app>
\ No newline at end of file
+</web-app>
Modified: jbpm4/trunk/modules/enterprise/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/environment.cfg.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/environment.cfg.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -3,9 +3,6 @@
<process-engine>
<deployer-manager>
- <assign-file-type>
- <file extension=".jpdl.xml" type="jpdl" />
- </assign-file-type>
<check-process />
<check-problems />
<save />
@@ -28,15 +25,25 @@
usage="nonstrict-read-write" />
</hibernate-configuration>
<hibernate-session-factory />
+
<id-generator />
-
<variable-types resource="jbpm.pvm.types.xml" />
+ <business-calendar>
+ <monday hours="9:00-12:00 and 12:30-17:00"/>
+ <tuesday hours="9:00-12:00 and 12:30-17:00"/>
+ <wednesday hours="9:00-12:00 and 12:30-17:00"/>
+ <thursday hours="9:00-12:00 and 12:30-17:00"/>
+ <friday hours="9:00-12:00 and 12:30-17:00"/>
+ <holiday period="01/07/2008 - 31/08/2008"/>
+ </business-calendar>
+
</process-engine>
<environment>
- <hibernate-session />
+ <hibernate-session current="true" />
<pvm-db-session />
+ <job-db-session />
<ejb-timer-session />
</environment>
Modified: jbpm4/trunk/modules/enterprise/src/test/resources/hibernate.properties
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/hibernate.properties 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/hibernate.properties 2009-01-13 18:22:21 UTC (rev 3634)
@@ -1,4 +1,6 @@
-hibernate.connection.datasource java:DefaultDS
-hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
-hibernate.format_sql true
-hibernate.use_sql_comments true
+hibernate.connection.datasource java\:comp/env/jdbc/JbpmDataSource
+hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
+hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
+hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
+hibernate.format_sql true
+hibernate.use_sql_comments true
Added: jbpm4/trunk/modules/enterprise/src/test/resources/log4j.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/log4j.xml (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/log4j.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <appender name="FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${project.build.directory}/test.log"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <param name="Threshold" value="INFO" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jbpm">
+ <priority value="DEBUG" />
+ </category>
+
+ <!-- Limit the org.hibernate category to INFO as its DEBUG is verbose -->
+ <category name="org.hibernate">
+ <priority value="INFO" />
+ </category>
+
+ <!-- hide optimistic locking failures
+ <category name="org.hibernate.event.def.AbstractFlushingEventListener">
+ <priority value="FATAL" />
+ </category>
+ -->
+
+ <!-- hide proxy narrowing warns -->
+ <category name="org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog">
+ <priority value="ERROR" />
+ </category>
+
+ <!-- show SQL DML statements as they are executed -->
+ <category name="org.hibernate.SQL">
+ <priority value="DEBUG" />
+ </category>
+
+ <!-- show JDBC parameters
+ <category name="org.hibernate.type">
+ <priority value="TRACE" />
+ </category>
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--appender-ref ref="CONSOLE"/-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: jbpm4/trunk/modules/enterprise/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/enterprise/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/logging.properties 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/logging.properties 2009-01-13 18:22:21 UTC (rev 3634)
@@ -1,28 +0,0 @@
-handlers= java.util.logging.ConsoleHandler
-# to add the error triggered file handler
-# handlers= java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler
-
-redirect.commons.logging = enabled
-
-java.util.logging.ConsoleHandler.level = FINEST
-java.util.logging.ConsoleHandler.formatter = org.jbpm.log.LogFormatter
-
-# org.jbpm.util.ErrorTriggeredFileHandler.size = 500
-# org.jbpm.util.ErrorTriggeredFileHandler.push = OFF
-# org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log
-
-# For example, set the com.xyz.foo logger to only log SEVERE messages:
-# com.xyz.foo.level = SEVERE
-
-org.jbpm.level=FINEST
-org.jbpm.pvm.internal.tx.level=FINE
-org.jbpm.pvm.internal.wire.level=FINE
-org.jbpm.pvm.internal.util.level=FINE
-
-org.hibernate.level=FINEST
-org.hibernate.cfg.HbmBinder.level=SEVERE
-org.hibernate.cfg.SettingsFactory.level=SEVERE
-# org.hibernate.SQL.level=FINEST
-# org.hibernate.type.level=FINEST
-# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
-# org.hibernate.transaction.level=FINEST
Modified: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -52,9 +52,9 @@
static boolean isLog4jAvailable(ClassLoader classLoader) {
try {
- classLoader.loadClass("org.apache.log4j.LogManager");
+ Class.forName("org.apache.log4j.LogManager", false, classLoader);
return true;
- } catch (Exception e) {
+ } catch (ClassNotFoundException e) {
return false;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -37,7 +37,6 @@
import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.util.Clock;
-import org.jbpm.session.DbSession;
/** a runtime timer instance.
*
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2009-01-13 18:22:21 UTC (rev 3634)
@@ -53,19 +53,23 @@
*
* @author Tom Baeyens
*/
-public abstract class XmlUtil {
+public class XmlUtil {
private static Log log = Log.getLog(XmlUtil.class.getName());
+ private XmlUtil() {
+ // hide default constructor to prevent instantiation
+ }
+
public static List<Element> elements(Element element, String tagName) {
if (element==null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
NodeList nodeList = element.getChildNodes();
if ( (nodeList == null)
|| (nodeList.getLength()==0)
) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<Element> elements = new ArrayList<Element>();
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -86,13 +90,13 @@
public static List<Element> elements(Element element, Set<String> allowedTagNames) {
if (element==null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
NodeList nodeList = element.getChildNodes();
if ( (nodeList == null)
|| (nodeList.getLength()==0)
) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<Element> elements = new ArrayList<Element>();
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -136,13 +140,13 @@
public static List<Element> elements(Element element) {
if (element==null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
NodeList nodeList = element.getChildNodes();
if ( (nodeList == null)
|| (nodeList.getLength()==0)
) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<Element> elements = new ArrayList<Element>();
if ((nodeList != null) && (nodeList.getLength() > 0)) {
@@ -159,13 +163,13 @@
public static List<Element> elements(Element element, String ns, String localName) {
if (element==null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
NodeList nodeList = element.getChildNodes();
if ( (nodeList == null)
|| (nodeList.getLength()==0)
) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<Element> matchingElements = new ArrayList<Element>();
NodeList nl = element.getChildNodes();
@@ -180,13 +184,13 @@
public static List<Element> elementsQName(Element element, Set<QName> allowedTagNames) {
if (element==null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
NodeList nodeList = element.getChildNodes();
if ( (nodeList == null)
|| (nodeList.getLength()==0)
) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<Element> elements = new ArrayList<Element>();
if (nodeList != null) {
@@ -268,7 +272,7 @@
public static List<Attr> attributes(Element element) {
NamedNodeMap attributeMap = element.getAttributes();
if ((attributeMap == null) || (attributeMap.getLength() == 0)) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<Attr> attributes = new ArrayList<Attr>();
@@ -281,8 +285,8 @@
public static List<Node> contents(Element element) {
NodeList nodeList = element.getChildNodes();
- if ((nodeList == null) && (nodeList.getLength() != 0)) {
- return Collections.EMPTY_LIST;
+ if ((nodeList == null) || (nodeList.getLength() == 0)) {
+ return Collections.emptyList();
}
List<Node> contents = new ArrayList<Node>();
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.hbm.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.hbm.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -5,206 +5,190 @@
<hibernate-mapping package="org.jbpm.pvm.internal.wire.descriptor" default-access="field">
<!-- ### DESCRIPTORS #################################################### -->
- <class name="AbstractDescriptor" table="JBPM_DESCRIPTOR" abstract="true" discriminator-value="abstract">
- <!--
- byte : ByteDescriptor
- string : StringDescriptor
- char : CharacterDescriptor
- class : ClassDescriptor
- double : DoubleDescriptor
+ <class name="AbstractDescriptor" table="JBPM_DESCRIPTOR" abstract="true"
+ discriminator-value="abstract">
+ <!--
+ byte : ByteDescriptor
+ string : StringDescriptor
+ char : CharacterDescriptor
+ class : ClassDescriptor
+ double : DoubleDescriptor
expr : ExpressionDescriptor
- float : FloatDescriptor
- long : LongDescriptor
- int : IntegerDescriptor
- short : ShortDescriptor
- coll : CollectionDescriptor
- map : MapDescriptor
- list : ListDescriptor
- set : SetDescriptor
- object : ObjectDescriptor
- ref : ReferenceDescriptor
- null : NullDescriptor
- true : TrueDescriptor
- false : FalseDescriptor
- provided : ProvidedObjectDescriptor
- -->
+ float : FloatDescriptor
+ long : LongDescriptor
+ int : IntegerDescriptor
+ short : ShortDescriptor
+ coll : CollectionDescriptor
+ map : MapDescriptor
+ list : ListDescriptor
+ set : SetDescriptor
+ object : ObjectDescriptor
+ ref : ReferenceDescriptor
+ null : NullDescriptor
+ true : TrueDescriptor
+ false : FalseDescriptor
+ provided : ProvidedObjectDescriptor
+ -->
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
- <discriminator column="CLASS_"/>
+ <discriminator column="CLASS_" />
<version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_" />
- <property name="init" column="INIT_" />
- <subclass name="NullDescriptor" discriminator-value="null_"/>
- <subclass name="TrueDescriptor" discriminator-value="true" />
- <subclass name="FalseDescriptor" discriminator-value="false" />
-
+ <property name="name" column="NAME_" />
+ <property name="init" column="INIT_" />
+
+ <subclass name="NullDescriptor" discriminator-value="null_" />
+ <subclass name="TrueDescriptor" discriminator-value="true" />
+ <subclass name="FalseDescriptor" discriminator-value="false" />
+
<subclass name="StringDescriptor" discriminator-value="string">
<property name="text" column="TEXT_" />
</subclass>
-
- <subclass name="CharacterDescriptor" discriminator-value="char">
- <property name="text" column="TEXT_" />
- </subclass>
- <subclass name="ClassDescriptor" discriminator-value="class">
- <property name="text" column="TEXT_" />
- </subclass>
- <subclass name="ReferenceDescriptor" discriminator-value="ref">
- <property name="text" column="TEXT_" />
- </subclass>
+ <subclass name="CharacterDescriptor" discriminator-value="char">
+ <property name="text" column="TEXT_" />
+ </subclass>
+ <subclass name="ClassDescriptor" discriminator-value="class">
+ <property name="text" column="TEXT_" />
+ </subclass>
+ <subclass name="ReferenceDescriptor" discriminator-value="ref">
+ <property name="text" column="TEXT_" />
+ </subclass>
- <subclass name="DoubleDescriptor" discriminator-value="double">
- <property name="doubleVal" column="DOUBLEVAL_" />
- </subclass>
- <subclass name="FloatDescriptor" discriminator-value="float">
- <property name="doubleVal" column="DOUBLEVAL_" />
- </subclass>
+ <subclass name="DoubleDescriptor" discriminator-value="double">
+ <property name="doubleVal" column="DOUBLEVAL_" />
+ </subclass>
+ <subclass name="FloatDescriptor" discriminator-value="float">
+ <property name="doubleVal" column="DOUBLEVAL_" />
+ </subclass>
-
<subclass name="LongDescriptor" discriminator-value="long">
<property name="longVal" column="LONGVAL_" />
</subclass>
- <subclass name="IntegerDescriptor" discriminator-value="int">
- <property name="longVal" column="LONGVAL_" />
- </subclass>
- <subclass name="ShortDescriptor" discriminator-value="short">
- <property name="longVal" column="LONGVAL_" />
- </subclass>
- <subclass name="ByteDescriptor" discriminator-value="byte">
- <property name="longVal" column="LONGVAL_" />
- </subclass>
-
+ <subclass name="IntegerDescriptor" discriminator-value="int">
+ <property name="longVal" column="LONGVAL_" />
+ </subclass>
+ <subclass name="ShortDescriptor" discriminator-value="short">
+ <property name="longVal" column="LONGVAL_" />
+ </subclass>
+ <subclass name="ByteDescriptor" discriminator-value="byte">
+ <property name="longVal" column="LONGVAL_" />
+ </subclass>
- <subclass name="CollectionDescriptor" discriminator-value="coll">
- <property name="className" column="CLASSNAME_" />
- <list name="valueDescriptors" cascade="all-delete-orphan">
- <key foreign-key="FK_DESCR_VALDESCR">
- <column name="VALUEDESCR_" index="IDX_DESCR_VALDESCR" />
+ <subclass name="CollectionDescriptor" discriminator-value="coll">
+ <property name="className" column="CLASSNAME_" />
+ <list name="valueDescriptors" cascade="all-delete-orphan">
+ <key foreign-key="FK_DESCR_VALDESCR">
+ <column name="VALUEDESCR_" index="IDX_DESCR_VALDESCR" />
</key>
- <list-index column="VALUEDESCR_IDX_" />
- <one-to-many class="AbstractDescriptor" />
- </list>
+ <list-index column="VALUEDESCR_IDX_" />
+ <one-to-many class="AbstractDescriptor" />
+ </list>
- <subclass name="MapDescriptor" discriminator-value="map">
- <list name="keyDescriptors" cascade="all-delete-orphan">
- <key column="KEYDESCR_" foreign-key="FK_DESCR_KEYDESCR"/>
- <list-index column="KEYDESCR_IDX_" />
- <one-to-many class="AbstractDescriptor" />
- </list>
- </subclass>
+ <subclass name="MapDescriptor" discriminator-value="map">
+ <list name="keyDescriptors" cascade="all-delete-orphan">
+ <key column="KEYDESCR_" foreign-key="FK_DESCR_KEYDESCR" />
+ <list-index column="KEYDESCR_IDX_" />
+ <one-to-many class="AbstractDescriptor" />
+ </list>
+ </subclass>
<subclass name="ListDescriptor" discriminator-value="list" />
<subclass name="SetDescriptor" discriminator-value="set" />
- </subclass>
+ </subclass>
- <subclass name="ObjectDescriptor" discriminator-value="object">
- <property name="className" column="TEXT_" />
- <property name="methodName" column="METHOD_" />
- <property name="isAutoWireEnabled" column="BOOLVAL_" />
- <property name="factoryObjectName" column="FACTORYNAME_" />
-
- <many-to-one name="factoryDescriptor"
- class="AbstractDescriptor"
- column="FACTORYDESCR_"
- foreign-key="FK_DESCR_ARG_REF"
- index="IDX_DESCR_ARG_REF"
- cascade="all"/>
+ <subclass name="ObjectDescriptor" discriminator-value="object">
+ <property name="className" column="TEXT_" />
+ <property name="methodName" column="METHOD_" />
+ <property name="isAutoWireEnabled" column="BOOLVAL_" />
+ <property name="factoryObjectName" column="FACTORYNAME_" />
- <list name="argDescriptors" cascade="all-delete-orphan" >
+ <many-to-one name="factoryDescriptor" class="AbstractDescriptor" column="FACTORYDESCR_"
+ foreign-key="FK_DESCR_ARG_REF" index="IDX_DESCR_ARG_REF" cascade="all" />
+
+ <list name="argDescriptors" cascade="all-delete-orphan">
<key foreign-key="FK_DESCR_ARGDESCR">
- <column name="OBJDESCR_" index="IDX_DESCR_ARGDESCR" />
+ <column name="OBJDESCR_" index="IDX_DESCR_ARGDESCR" />
</key>
- <list-index column="OBJDESCR_IDX_" />
- <one-to-many class="ArgDescriptor" />
- </list>
-
- <list name="operations" cascade="all-delete-orphan">
- <key foreign-key="FK_OPER_OBJDESCR">
- <column name="OBJDESCR_" index="IDX_OPER_OBJDESCR" />
+ <list-index column="OBJDESCR_IDX_" />
+ <one-to-many class="ArgDescriptor" />
+ </list>
+
+ <list name="operations" cascade="all-delete-orphan">
+ <key foreign-key="FK_OPER_OBJDESCR">
+ <column name="OBJDESCR_" index="IDX_OPER_OBJDESCR" />
</key>
- <list-index column="OBJDESCR_IDX" />
- <one-to-many class="org.jbpm.pvm.internal.wire.operation.AbstractOperation"/>
- </list>
- </subclass>
-
+ <list-index column="OBJDESCR_IDX_" />
+ <one-to-many class="org.jbpm.pvm.internal.wire.operation.AbstractOperation" />
+ </list>
+ </subclass>
+
<subclass name="ExpressionDescriptor" discriminator-value="expr">
<property name="expr" column="TEXT_" />
<property name="lang" column="METHOD_" />
</subclass>
-
+
<subclass name="ProvidedObjectDescriptor" discriminator-value="provided">
- <any name="providedObject" id-type="long" cascade="all">
- <column name="TEXT_" />
- <column name="LONGVAL_" />
- </any>
- <property name="exposeType" column="BOOLVAL_" />
+ <any name="providedObject" id-type="long" cascade="all">
+ <column name="TEXT_" />
+ <column name="LONGVAL_" />
+ </any>
+ <property name="exposeType" column="BOOLVAL_" />
</subclass>
<subclass name="EnvDescriptor" discriminator-value="env">
<property name="objectName" column="TEXT_" />
<property name="typeName" column="CLASSNAME_" />
</subclass>
-
- </class>
+ </class>
+
<!-- ### OPERATIONS ##################################################### -->
- <class name="org.jbpm.pvm.internal.wire.operation.AbstractOperation"
- abstract="true"
- table="JBPM_OPERATION"
- discriminator-value="oper">
+ <class name="org.jbpm.pvm.internal.wire.operation.AbstractOperation" abstract="true"
+ table="JBPM_OPERATION" discriminator-value="oper">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
- <discriminator column="CLASS_"/>
+ <discriminator column="CLASS_" />
<version name="dbversion" column="DBVERSION_" />
- <subclass name="org.jbpm.pvm.internal.wire.operation.FieldOperation" discriminator-value="field">
- <property name="fieldName" column="TEXT_" />
- <many-to-one name="descriptor"
- column="DESCR_"
- cascade="all"
- class="AbstractDescriptor"
- foreign-key="FK_OPER_DESC"
- index="IDX_OPER_DESC"/>
- </subclass>
+ <subclass name="org.jbpm.pvm.internal.wire.operation.FieldOperation"
+ discriminator-value="field">
+ <property name="fieldName" column="TEXT_" />
+ <many-to-one name="descriptor" column="DESCR_" cascade="all" class="AbstractDescriptor"
+ foreign-key="FK_OPER_DESC" index="IDX_OPER_DESC" />
+ </subclass>
- <subclass name="org.jbpm.pvm.internal.wire.operation.PropertyOperation" discriminator-value="prop">
- <property name="setterName" column="TEXT_" />
- <many-to-one name="descriptor"
- column="DESCR_"
- cascade="all"
- class="AbstractDescriptor"/>
- </subclass>
+ <subclass name="org.jbpm.pvm.internal.wire.operation.PropertyOperation"
+ discriminator-value="prop">
+ <property name="setterName" column="TEXT_" />
+ <many-to-one name="descriptor" column="DESCR_" cascade="all" class="AbstractDescriptor" />
+ </subclass>
- <subclass name="org.jbpm.pvm.internal.wire.operation.InvokeOperation" discriminator-value="invoke">
- <property name="methodName" column="TEXT_" />
- <list name="argDescriptors" cascade="all-delete-orphan">
- <key foreign-key="FK_ARGDSCR_OPER">
+ <subclass name="org.jbpm.pvm.internal.wire.operation.InvokeOperation"
+ discriminator-value="invoke">
+ <property name="methodName" column="TEXT_" />
+ <list name="argDescriptors" cascade="all-delete-orphan">
+ <key foreign-key="FK_ARGDSCR_OPER">
<column name="OPER_" index="IDX_ARGDSCR_OPER" />
</key>
- <list-index column="OPER_IDX_" />
- <one-to-many class="ArgDescriptor" />
- </list>
- </subclass>
- </class>
-
+ <list-index column="OPER_IDX_" />
+ <one-to-many class="ArgDescriptor" />
+ </list>
+ </subclass>
+ </class>
+
<!-- ### ARG DESCRIPTOR ################################################# -->
<class name="ArgDescriptor" table="JBPM_ARGDESCRIPTOR">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="typeName" column="TYPENAME_" />
- <many-to-one name="descriptor"
- column="DESCRIPTOR_"
- class="AbstractDescriptor"
- foreign-key="FK_ARGDESCR_DESCR"
- index="IDX_ARGDESCR_DESCR"
- cascade="all"/>
+ <property name="typeName" column="TYPENAME_" />
+ <many-to-one name="descriptor" column="DESCRIPTOR_" class="AbstractDescriptor"
+ foreign-key="FK_ARGDESCR_DESCR" index="IDX_ARGDESCR_DESCR" cascade="all" />
</class>
<!-- ### PROPERTIES ##################################################### -->
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-01-13 18:03:40 UTC (rev 3633)
+++ jbpm4/trunk/pom.xml 2009-01-13 18:22:21 UTC (rev 3634)
@@ -44,7 +44,7 @@
<!-- Properties -->
<properties>
- <cactus.version>1.8.0</cactus.version>
+ <cactus.version>13-1.7.1</cactus.version>
<hibernate.version>3.2.6.ga</hibernate.version>
<hsqldb.version>1.8.0.7</hsqldb.version>
<jboss.j2ee.version>4.2.2.GA</jboss.j2ee.version>
@@ -85,16 +85,11 @@
<!-- Please sort by groupid -->
<dependency>
- <groupId>org.apache.cactus</groupId>
- <artifactId>cactus.core.framework.wrapper.javaEE.14</artifactId>
+ <groupId>cactus</groupId>
+ <artifactId>cactus</artifactId>
<version>${cactus.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.cactus</groupId>
- <artifactId>cactus.integration.shared.api</artifactId>
- <version>${cactus.version}</version>
- </dependency>
- <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>${hibernate.version}</version>
@@ -487,6 +482,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
+ <version>5.0.8</version>
<scope>test</scope>
</dependency>
</dependencies>
More information about the jbpm-commits
mailing list