[jbpm-commits] JBoss JBPM SVN: r3589 - in jbpm4/trunk/modules/enterprise: scripts and 24 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jan 7 05:06:58 EST 2009


Author: alex.guizar at jboss.com
Date: 2009-01-07 05:06:58 -0500 (Wed, 07 Jan 2009)
New Revision: 3589

Added:
   jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbLocalCommandService.java
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbTimerSession.java
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/
   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/EjbTimerSessionBinding.java
   jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandExecutorTest.java
   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/java/org/jbpm/test/
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ArchiveDeployer.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestSetup.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/JBossArchiveDeployer.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ObjectNameFactory.java
   jbpm4/trunk/modules/enterprise/src/test/resources/META-INF/
   jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/
   jbpm4/trunk/modules/enterprise/src/test/resources/environment.cfg.xml
   jbpm4/trunk/modules/enterprise/src/test/resources/hibernate.properties
   jbpm4/trunk/modules/enterprise/src/test/resources/org/
   jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/
   jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/enterprise/
   jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/enterprise/internal/
   jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/enterprise/internal/custom/
   jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/enterprise/internal/custom/mappings.hbm.xml
Removed:
   jbpm4/trunk/modules/enterprise/scripts/build-jars-pvm.xml
   jbpm4/trunk/modules/enterprise/src/main/etc/ear/META-INF/
   jbpm4/trunk/modules/enterprise/src/main/etc/ejbjar/META-INF/
   jbpm4/trunk/modules/enterprise/src/main/etc/war/WEB-INF/
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseTimerSession.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/Phrase.hbm.xml
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandExecutorTest.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/
Modified:
   jbpm4/trunk/modules/enterprise/pom.xml
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandExecutorSLSB.java
   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/InsertPhraseCmd.java
   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/Phrase.java
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemovePhraseCmd.java
   jbpm4/trunk/modules/enterprise/src/test/resources/META-INF/application.xml
Log:
JBPM-1411: arrange enterprise module for automated test module deployment
provide enterprise wire bindings

Modified: jbpm4/trunk/modules/enterprise/pom.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/pom.xml	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/pom.xml	2009-01-07 10:06:58 UTC (rev 3589)
@@ -18,7 +18,7 @@
   <name>jBPM 4 - Enterprise</name>
   <groupId>org.jbpm.jbpm4</groupId>
   <artifactId>jbpm-enterprise</artifactId>
-  <packaging>jar</packaging>
+  <packaging>ejb</packaging>
 
   <!-- Parent -->
   <parent>
@@ -102,33 +102,28 @@
           <showDeprecation>false</showDeprecation>
         </configuration>
       </plugin>
-      <!-- 
       <plugin>
-        <artifactId>maven-ear-plugin</artifactId>
-        <configuration>
-          <applicationXml>${basedir}/src/main/etc/ear/META-INF/application.xml</applicationXml>
-        </configuration>
+        <artifactId>maven-ejb-plugin</artifactId>
       </plugin>
       <plugin>
         <artifactId>maven-antrun-plugin</artifactId>
         <executions>
           <execution>
-            <id>build-jars</id>
             <phase>test-compile</phase>
             <goals>
               <goal>run</goal>
             </goals>
             <configuration>
               <tasks>
-                <property name="tests.output.dir" value="${project.build.directory}" />
-                <property name="tests.resources.dir" value="${basedir}/src/test/resources" />
-                <ant antfile="scripts/build-jars-pvm.xml" target="build-jars-pvm" />
+                <property name="build.dir" value="${project.build.directory}" />
+                <property name="test.resources.dir" value="${build.dir}/test-classes" />
+                <property name="artifact.name" value="${project.build.finalName}.jar" />
+                <ant antfile="scripts/antrun-test-jars.xml" target="build-jars" />
               </tasks>
             </configuration>
           </execution>
         </executions>
       </plugin>
-       -->
     </plugins>
   </build>
 

Copied: jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml (from rev 3587, jbpm4/trunk/modules/enterprise/scripts/build-jars-pvm.xml)
===================================================================
--- jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!--  JBoss, the OpenSource J2EE webOS                            -->
+<!--  Distributable under LGPL license.                           -->
+<!--  See terms of license at http://www.gnu.org.                 -->
+<!-- ============================================================ -->
+
+<!-- $Id$ -->
+
+<project>
+
+	<description>PVM test archive</description>
+
+	<target name="build-jars" description="Build the test modules.">
+
+		<war destfile="${build.dir}/jbpm-enterprise-test.war" webxml="${test.resources.dir}/WEB-INF/web.xml">
+			<webinf dir="${test.resources.dir}/WEB-INF">
+				<exclude name="web.xml" />
+			</webinf>
+		  <classes dir="${build.dir}/test-classes">
+		    <include name="org/jbpm/test/enterprise/*" />
+		    <include name="org/jbpm/enterprise/internal/ejb/*" />
+		  </classes>
+		</war>
+
+	  <jar destfile="${build.dir}/jbpm-enterprise-config.jar">
+	    <fileset dir="${build.dir}/test-classes">
+	      <include name="org/jbpm/enterprise/internal/custom/*" />
+	      <include name="environment.cfg.xml" />
+	      <include name="hibernate.properties" />
+	    </fileset>
+	  </jar>
+
+	  <ear destfile="${build.dir}/jbpm-enterprise-test.ear" appxml="${test.resources.dir}/META-INF/application.xml">
+			<fileset dir="${build.dir}">
+				<include name="${artifact.name}" />
+				<include name="jbpm-enterprise-test.war" />
+			  <include name="jbpm-enterprise-config.jar" />
+			</fileset>
+		</ear>
+
+		<!-- Please add alphabetically -->
+
+	</target>
+
+</project>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Deleted: jbpm4/trunk/modules/enterprise/scripts/build-jars-pvm.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/scripts/build-jars-pvm.xml	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/scripts/build-jars-pvm.xml	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ============================================================ -->
-<!--  JBoss, the OpenSource J2EE webOS                            -->
-<!--  Distributable under LGPL license.                           -->
-<!--  See terms of license at http://www.gnu.org.                 -->
-<!-- ============================================================ -->
-
-<!-- $Id$ -->
-
-<project>
-
-   <description>PVM test archive</description>
-
-   <target name="build-jars-pvm" description="Build the deployments.">
-
-      <mkdir dir="${tests.output.dir}/test-libs"/>
-
-      <!-- enterprise tests -->
-      <war warfile="${tests.output.dir}/test-libs/pvm-test-enterprise-war.war"
-           webxml="${tests.resources.dir}/enterprise/WEB-INF/web.xml">
-         <webinf dir="${tests.resources.dir}/enterprise/WEB-INF">
-            <include name="jboss-web.xml"/>
-         </webinf>
-      </war>
-
-      <jar jarfile="${tests.output.dir}/test-libs/pvm-test-enterprise-ejb.jar">
-         <metainf dir="${tests.resources.dir}/enterprise/META-INF">
-            <include name="ejb-jar.xml"/>
-            <include name="jboss.xml"/>
-            <include name="jboss-cmp-jdbc.xml"/>
-         </metainf>         
-      </jar>
-
-      <ear destfile="${tests.output.dir}/test-libs/pvm-test-enterprise.ear"
-           appxml="${tests.resources.dir}/enterprise/META-INF/application.xml">
-         <fileset dir="${tests.output.dir}/test-libs">
-            <include name="pvm-test-enterprise-ejb.jar"/>
-            <include name="pvm-test-enterprise-war.war"/>
-         </fileset>
-      </ear>
-
-      <!-- Please add alphabetically -->
-
-   </target>
-
-</project>
\ No newline at end of file

Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandExecutorSLSB.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandExecutorSLSB.java	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandExecutorSLSB.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -31,7 +31,6 @@
 import javax.naming.NamingException;
 
 import org.jbpm.Configuration;
-import org.jbpm.cfg.JbpmConfiguration;
 import org.jbpm.cmd.Command;
 import org.jbpm.env.Environment;
 import org.jbpm.env.EnvironmentFactory;
@@ -165,7 +164,7 @@
   }
 
   private static String getConfigResource(Context context) throws NamingException {
-    String resource = "enterprise.environment.cfg.xml";
+    String resource = "environment.cfg.xml";
     try {
       resource = (String) context.lookup("java:comp/env/ConfigurationResource");
     }

Copied: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbLocalCommandService.java (from rev 3587, jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java)
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbLocalCommandService.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbLocalCommandService.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.enterprise.internal.ejb;
+
+import javax.ejb.CreateException;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
+
+/**
+ * Local, stateless session bean implementation of the command service.
+ * 
+ * @author Tom Baeyens
+ */
+public class EjbLocalCommandService implements CommandService {
+
+  // injected
+  private LocalCommandExecutorHome commandExecutorHome;
+
+  private LocalCommandExecutor commandExecutor;
+
+  public LocalCommandExecutor getCommandExecutor() {
+    if (commandExecutor == null) {
+      try {
+        commandExecutor = commandExecutorHome.create();
+      } catch (CreateException e) {
+        throw new JbpmException("error creating command executor", e);
+      }
+    }
+    return commandExecutor;
+  }
+
+  public <T> T execute(Command<T> command) {
+    return getCommandExecutor().execute(command);
+  }
+
+}


Property changes on: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbLocalCommandService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Copied: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbTimerSession.java (from rev 3587, jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseTimerSession.java)
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbTimerSession.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbTimerSession.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.enterprise.internal.ejb;
+
+import javax.ejb.FinderException;
+import javax.ejb.RemoveException;
+
+import org.jbpm.JbpmException;
+import org.jbpm.env.Environment;
+import org.jbpm.job.Timer;
+import org.jbpm.log.Log;
+import org.jbpm.session.DbSession;
+import org.jbpm.session.TimerSession;
+
+/**
+ * Timer session based on the EJB 2.1 timer service.
+ * @author Tom Baeyens
+ * @author Alejandro Guizar
+ */
+public class EjbTimerSession implements TimerSession {
+
+  // injected
+  private LocalTimerHome timerHome;
+
+  private static final Log log = Log.getLog(EjbTimerSession.class.getName());
+
+  public void schedule(Timer timer) {
+    log.debug("scheduling "+timer);
+
+    // flush timer to database
+    DbSession dbSession = Environment.getCurrent().get(DbSession.class);
+    dbSession.save(timer);
+    dbSession.flush();
+
+    // retrieve timer as entity bean, contact timer service
+    try {
+      LocalTimer timerBean = timerHome.findByPrimaryKey(timer.getDbid());
+      timerBean.schedule();
+    }
+    catch (FinderException e) {
+      throw new JbpmException("could not find bean for timer: " + timer);
+    }
+  }
+
+  public void cancel(Timer timer) {
+    try {
+      LocalTimer timerBean = timerHome.findByPrimaryKey(timer.getDbid());
+      log.debug("canceling " + timer);
+      /*
+       * EJB 2.1 section 22.4.4 If an entity bean is removed, the container must remove
+       * the timers for that bean
+       */
+      timerBean.remove();
+    }
+    catch (FinderException e) {
+      log.error("could not find bean for timer " + timer, e);
+    }
+    catch (RemoveException e) {
+      log.error("could not remove bean for timer " + timer, e);
+    }
+  }
+}


Property changes on: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbTimerSession.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Deleted: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,64 +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.ejb;
-
-import javax.ejb.CreateException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jbpm.JbpmException;
-import org.jbpm.cmd.Command;
-import org.jbpm.cmd.CommandService;
-
-/**
- * Local, stateless session bean implementation of the command service.
- * @author Tom Baeyens
- */
-public class EnterpriseLocalCommandService implements CommandService {
-
-  private LocalCommandExecutor commandExecutor;
-
-  public LocalCommandExecutor getCommandExecutor() {
-    if (commandExecutor == null) {
-      try {
-        Context context = new InitialContext();
-        LocalCommandExecutorHome commandExecutorHome = (LocalCommandExecutorHome) context.lookup("java:comp/env/ejb/LocalCommandExecutor");
-        context.close();
-
-        commandExecutor = commandExecutorHome.create();
-      }
-      catch (NamingException e) {
-        throw new JbpmException("error retrieving command executor home", e);
-      }
-      catch (CreateException e) {
-        throw new JbpmException("error creating command executor", e);
-      }
-    }
-    return commandExecutor;
-  }
-
-  public <T> T execute(Command<T> command) {
-    return getCommandExecutor().execute(command);
-  }
-
-}

Deleted: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseTimerSession.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseTimerSession.java	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseTimerSession.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,80 +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.ejb;
-
-import javax.ejb.FinderException;
-import javax.ejb.RemoveException;
-
-import org.jbpm.JbpmException;
-import org.jbpm.env.Environment;
-import org.jbpm.job.Timer;
-import org.jbpm.log.Log;
-import org.jbpm.session.DbSession;
-import org.jbpm.session.TimerSession;
-
-/**
- * Timer session based on the EJB 2.1 timer service.
- * @author Tom Baeyens
- * @author Alejandro Guizar
- */
-public class EnterpriseTimerSession implements TimerSession {
-
-  private LocalTimerHome timerHome;
-
-  private static final Log log = Log.getLog(EnterpriseTimerSession.class.getName());
-
-  public void schedule(Timer timer) {
-    log.debug("scheduling "+timer);
-
-    // flush timer to database
-    DbSession dbSession = Environment.getCurrent().get(DbSession.class);
-    dbSession.save(timer);
-    dbSession.flush();
-
-    // retrieve timer as entity bean, contact timer service
-    try {
-      LocalTimer timerBean = timerHome.findByPrimaryKey(timer.getDbid());
-      timerBean.schedule();
-    }
-    catch (FinderException e) {
-      throw new JbpmException("could not find bean for timer: " + timer);
-    }
-  }
-
-  public void cancel(Timer timer) {
-    try {
-      LocalTimer timerBean = timerHome.findByPrimaryKey(timer.getDbid());
-      log.debug("canceling " + timer);
-      /*
-       * EJB 2.1 section 22.4.4 If an entity bean is removed, the container must remove
-       * the timers for that bean
-       */
-      timerBean.remove();
-    }
-    catch (FinderException e) {
-      log.error("could not find bean for timer " + timer, e);
-    }
-    catch (RemoveException e) {
-      log.error("could not remove bean for timer " + timer, e);
-    }
-  }
-}

Added: 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	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbLocalCommandServiceBinding.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,49 @@
+/*
+ * 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.wire.binding;
+
+import org.jbpm.enterprise.internal.ejb.EjbLocalCommandService;
+import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
+import org.jbpm.pvm.internal.wire.descriptor.JndiDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class EjbLocalCommandServiceBinding extends WireDescriptorBinding {
+
+  public EjbLocalCommandServiceBinding() {
+    super("ejb-local-command-service");
+  }
+
+  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"));
+    return descriptor;
+  }
+
+}

Added: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbTimerSessionBinding.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbTimerSessionBinding.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbTimerSessionBinding.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,48 @@
+/*
+ * 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.wire.binding;
+
+import org.jbpm.enterprise.internal.ejb.EjbTimerSession;
+import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
+import org.jbpm.pvm.internal.wire.descriptor.JndiDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class EjbTimerSessionBinding extends WireDescriptorBinding {
+
+  public EjbTimerSessionBinding() {
+    super("ejb-timer-session");
+  }
+
+  public Object parse(Element element, Parse parse, Parser parser) {
+    ObjectDescriptor descriptor = new ObjectDescriptor(EjbTimerSession.class);
+    descriptor.addInjection("timerHome", new JndiDescriptor(
+        "java:comp/env/ejb/LocalTimer"));
+    return descriptor;
+  }
+
+}

Copied: jbpm4/trunk/modules/enterprise/src/main/resources/META-INF (from rev 3587, jbpm4/trunk/modules/enterprise/src/main/etc/ejbjar/META-INF)


Property changes on: jbpm4/trunk/modules/enterprise/src/main/resources/META-INF
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom (from rev 3587, jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom)

Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyActivity.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/HappyActivity.java	2009-01-05 21:43:54 UTC (rev 3587)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/HappyActivity.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -19,7 +19,7 @@
  * 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.custom;
+package org.jbpm.enterprise.internal.custom;
 
 import java.util.Date;
 

Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertPhraseCmd.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/InsertPhraseCmd.java	2009-01-05 21:43:54 UTC (rev 3587)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertPhraseCmd.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -19,7 +19,7 @@
  * 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.custom;
+package org.jbpm.enterprise.internal.custom;
 
 import java.sql.SQLException;
 

Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyActivity.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/NoisyActivity.java	2009-01-05 21:43:54 UTC (rev 3587)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/NoisyActivity.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -19,7 +19,7 @@
  * 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.custom;
+package org.jbpm.enterprise.internal.custom;
 
 import java.sql.SQLException;
 import java.util.Date;

Deleted: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/Phrase.hbm.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/Phrase.hbm.xml	2009-01-05 21:43:54 UTC (rev 3587)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/Phrase.hbm.xml	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<hibernate-mapping default-access="field" auto-import="false">
-  <class name="org.jbpm.pvm.enterprise.custom.Phrase" table="TEST_PHRASE">
-    <id name="id" column="ID_">
-      <generator class="native" />
-    </id>
-    <property name="text" column="TEXT_" />
-  </class>
-</hibernate-mapping>
\ No newline at end of file

Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/Phrase.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/Phrase.java	2009-01-05 21:43:54 UTC (rev 3587)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/Phrase.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -19,7 +19,7 @@
  * 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.custom;
+package org.jbpm.enterprise.internal.custom;
 
 /**
  * @author Alejandro Guizar

Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemovePhraseCmd.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/RemovePhraseCmd.java	2009-01-05 21:43:54 UTC (rev 3587)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemovePhraseCmd.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -19,7 +19,7 @@
  * 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.custom;
+package org.jbpm.enterprise.internal.custom;
 
 import java.util.List;
 

Copied: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandExecutorTest.java (from rev 3587, jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandExecutorTest.java)
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandExecutorTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandExecutorTest.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,122 @@
+/*
+ * 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.ejb;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestCase;
+
+import org.jbpm.enterprise.internal.custom.InsertPhraseCmd;
+import org.jbpm.enterprise.internal.custom.RemovePhraseCmd;
+import org.jbpm.enterprise.internal.ejb.CommandExecutorSLSB;
+import org.jbpm.enterprise.internal.ejb.LocalCommandExecutor;
+import org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome;
+import org.jbpm.log.Log;
+import org.jbpm.test.enterprise.IntegrationTestSetup;
+
+/**
+ * Server-side test for the {@linkplain CommandExecutorSLSB command executor}.
+ * The local interface is used.
+ * 
+ * @author Tom Baeyens
+ * @author Alejandro Guizar
+ */
+public class CommandExecutorTest extends ServletTestCase {
+
+  private LocalCommandExecutor commandExecutor;
+
+  private static final Log log = Log.getLog(CommandExecutorTest.class.getName());
+
+  private static LocalCommandExecutorHome commandExecutorHome;
+
+  public static Test suite() {
+    return new IntegrationTestSetup(CommandExecutorTest.class, "jbpm-enterprise-test.ear");
+  }
+
+  @Override
+  protected void setUp() throws Exception {
+    if (commandExecutorHome == null) {
+      // retrieve managed objects
+      InitialContext initialContext = new InitialContext();
+      try {
+        commandExecutorHome = (LocalCommandExecutorHome) initialContext.lookup("java:comp/env/ejb/LocalCommandExecutor");
+      } finally {
+        initialContext.close();
+      }
+    }
+    commandExecutor = commandExecutorHome.create();
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    commandExecutor = null;
+  }
+
+  /**
+   * This scenario tests a command that completes with no incident.
+   * <h3>Preconditions</h3>
+   * The TEST_PHRASE table does not contain any row with the specified text.
+   * <h3>Behavior</h3>
+   * The {@link InsertPhraseCmd} command creates a row with the specified text.
+   * <h3>Postconditions</h3>
+   * A new row with the specified text exists in the table. The
+   * {@link RemovePhraseCmd} command removes the row, and the return value confirms
+   * it was there.
+   */
+  public void testHappyCommand() throws CreateException {
+    String text = "been there, done that";
+    commandExecutor.execute(new InsertPhraseCmd(text));
+    // verify phrase was inserted
+    assertTrue(commandExecutor.execute(new RemovePhraseCmd(text)));
+  }
+
+  /**
+   * This scenario tests a command that throws a checked exception inside the
+   * {@link InsertPhraseCmd#execute(org.jbpm.env.Environment) execute} method.
+   * <h3>Preconditions</h3>
+   * The TEST_PHRASE table does not contain any row with the specified text.
+   * <h3>Behavior</h3>
+   * The {@link InsertPhraseCmd} command creates a row with the specified text. The
+   * command is configured to throw a checked exception before completing.
+   * <h3>Postconditions</h3>
+   * The command executor throws an {@link EJBException} and rolls back the
+   * managed transaction. No row with the specified text exists in the database.
+   * The {@link RemovePhraseCmd} command return value confirms the row was not
+   * there.
+   */
+  public void testNoisyCommand() throws CreateException {
+    String text = "houston, we have a problem";
+    // insert phrase via command
+    try {
+      commandExecutor.execute(new InsertPhraseCmd(text, /* fail? */true));
+      fail("expected: " + EJBException.class.getSimpleName());
+    } catch (EJBException e) {
+      log.info("noisy command threw exception", e);
+      // verify phrase was NOT inserted
+      assertFalse(commandExecutor.execute(new RemovePhraseCmd(text)));
+    }
+  }
+}

Copied: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandReceiverTest.java (from rev 3587, jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java)
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandReceiverTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/CommandReceiverTest.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,185 @@
+/*
+ * 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.ejb;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestCase;
+
+import org.jbpm.cmd.Command;
+import org.jbpm.enterprise.internal.custom.InsertPhraseCmd;
+import org.jbpm.enterprise.internal.custom.RemovePhraseCmd;
+import org.jbpm.enterprise.internal.ejb.CommandReceiverMDB;
+import org.jbpm.test.enterprise.IntegrationTestSetup;
+
+/**
+ * Server-side test for the {@linkplain CommandReceiverMDB command receiver}.
+ * 
+ * @author Alejandro Guizar
+ */
+public class CommandReceiverTest extends ServletTestCase {
+
+  private Connection jmsConnection;
+
+  private static final long TIMEOUT = 2000;
+
+  private static ConnectionFactory jmsConnectionFactory;
+  private static Destination commandQueue;
+
+  public static Test suite() {
+    return new IntegrationTestSetup(CommandReceiverTest.class, "jbpm-enterprise-test.ear");
+  }
+
+  @Override
+  protected void setUp() throws Exception {
+    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");
+      } finally {
+        initial.close();
+      }
+    }
+    jmsConnection = jmsConnectionFactory.createConnection();
+    jmsConnection.start();
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    if (jmsConnection != null) {
+      jmsConnection.stop();
+      jmsConnection.close();
+      jmsConnection = null;
+    }
+  }
+
+  /**
+   * This scenario tests a command message that completes with no incident.
+   * <h3>Preconditions</h3>
+   * The TEST_PHRASE table does not contain any row with the specified text.
+   * <h3>Behavior</h3>
+   * The {@link InsertPhraseCmd} command message creates a row with the specified
+   * text. Once the command completes, the command receiver sends the result to
+   * the reply queue.
+   * <h3>Postconditions</h3>
+   * A new row with the specified text exists in the table. The
+   * {@link RemovePhraseCmd} command message removes the row. The result sent to
+   * the reply queue confirms the row was there.
+   */
+  public void testHappyMessage() throws JMSException {
+    final String text = "been there, done that";
+    Session jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+    try {
+      // send insert command
+      Command<Void> insertCommand = new InsertPhraseCmd(text, /* fail? */false);
+      Message insertMessage = jmsSession.createObjectMessage(insertCommand);
+      Destination replyTo = jmsSession.createTemporaryQueue();
+      insertMessage.setJMSReplyTo(replyTo);
+      MessageProducer producer = jmsSession.createProducer(commandQueue);
+      producer.send(insertMessage);
+
+      // receive insertion response
+      MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + insertMessage.getJMSMessageID() + "'");
+      ObjectMessage responseMessage = (ObjectMessage) insertConsumer.receive(TIMEOUT);
+      assertNull(responseMessage.getObject());
+
+      // send remove command
+      Command<Boolean> removeCommand = new RemovePhraseCmd(text);
+      Message removeMessage = jmsSession.createObjectMessage(removeCommand);
+      removeMessage.setJMSReplyTo(replyTo);
+      producer.send(removeMessage);
+
+      // receive removal response
+      MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + removeMessage.getJMSMessageID() + "'");
+      responseMessage = (ObjectMessage) removeConsumer.receive(TIMEOUT);
+      // verify phrase was inserted
+      assertTrue((Boolean) responseMessage.getObject());
+    } finally {
+      jmsSession.close();
+    }
+  }
+
+  /**
+   * This scenario tests a command message that throws a checked exception
+   * inside the {@link InsertPhraseCmd#execute(org.jbpm.env.Environment) execute}
+   * method.
+   * <h3>Preconditions</h3>
+   * The TEST_PHRASE table does not contain any row with the specified text.
+   * <h3>Behavior</h3>
+   * The {@link InsertPhraseCmd} command message creates a row with the specified
+   * text. The command is configured to throw a checked exception before
+   * completing. The exception prevents the command receiver from sending the
+   * result to the reply queue.
+   * <h3>Postconditions</h3>
+   * The command receiver rolls back the managed transaction and puts the
+   * insertion message back in the command queue. No row with the specified
+   * exists in the database. The {@link RemovePhraseCmd} command result sent to the
+   * reply queue confirms the row was not there.
+   */
+  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);
+    try {
+      // send insert command
+      Command<Void> insertCommand = new InsertPhraseCmd(text, /* fail? */true);
+      Message insertMessage = jmsSession.createObjectMessage(insertCommand);
+      Destination replyTo = jmsSession.createTemporaryQueue();
+      insertMessage.setJMSReplyTo(replyTo);
+      MessageProducer producer = jmsSession.createProducer(commandQueue);
+      producer.send(insertMessage);
+
+      // receive insertion response
+      MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + insertMessage.getJMSMessageID() + "'");
+      ObjectMessage insertResponse = (ObjectMessage) insertConsumer.receive(TIMEOUT);
+      assertNull(insertResponse);
+
+      // send remove command
+      Command<Boolean> removeCommand = new RemovePhraseCmd(text);
+      Message removeMessage = jmsSession.createObjectMessage(removeCommand);
+      removeMessage.setJMSReplyTo(replyTo);
+      producer.send(removeMessage);
+
+      // receive removal response
+      MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + removeMessage.getJMSMessageID() + "'");
+      ObjectMessage removeResponse = (ObjectMessage) removeConsumer.receive(TIMEOUT);
+      // verify phrase was NOT inserted
+      assertFalse((Boolean) removeResponse.getObject());
+    } finally {
+      jmsSession.close();
+    }
+  }
+}

Copied: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java (from rev 3587, jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java)
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,165 @@
+/*
+ * 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.ejb;
+
+import java.util.Date;
+
+import javax.ejb.CreateException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestCase;
+import org.jbpm.cmd.Command;
+import org.jbpm.enterprise.internal.custom.HappyActivity;
+import org.jbpm.enterprise.internal.ejb.EjbTimerSession;
+import org.jbpm.enterprise.internal.ejb.LocalCommandExecutor;
+import org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome;
+import org.jbpm.env.Environment;
+import org.jbpm.model.OpenProcessDefinition;
+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.IntegrationTestSetup;
+
+/**
+ * Server-side test for the enterprise {@linkplain EjbTimerSession
+ * timerImpl session}.
+ * 
+ * @author Alejandro Guizar
+ */
+public class EjbTimerSessionTest extends ServletTestCase {
+
+  private LocalCommandExecutor commandExecutor;
+  private static LocalCommandExecutorHome commandExecutorHome;
+
+  private static final int TIMEOUT = 2000;
+
+  public static Test suite() {
+    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();
+    // deploy process
+    OpenProcessDefinition processDefinition = ProcessFactory.build(getName())
+        .timer(TIMEOUT + " milliseconds", null).event("timeout").listener(
+            new ObjectDescriptor(HappyActivity.class)).done();
+    commandExecutor
+        .execute(new DeployCmd(new DeploymentImpl(processDefinition)));
+  }
+
+  protected void tearDown() throws Exception {
+    commandExecutor = null;
+  }
+
+  /**
+   * This scenario schedules a non-repeating timerImpl whose referenced activity
+   * completes with no incident. <h3>Preconditions</h3> The activity has not
+   * executed. <h3>Behavior</h3> The {@link ScheduleTimerCmd} command activates
+   * a timerImpl. After that, the test waits for the activity to execute. Upon
+   * timeout, the {@linkplain HappyActivity activity} notifies the test of its
+   * execution. <h3>Postconditions</h3> The activity executes on or after the
+   * timerImpl's due date.
+   */
+  public void testSchedule() throws CreateException {
+    // start an execution
+    Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
+    commandExecutor
+        .execute(new StartExecutionCmd("timers included", null, null));
+
+    // wait for activity to execute
+    Date executionDate = HappyActivity.waitFor();
+    assertTrue(dueDate.compareTo(executionDate) <= 0);
+  }
+
+  /**
+   * This scenario schedules a non-repeating timerImpl and immediately cancels
+   * it. <h3>Preconditions</h3> The activity has not executed. <h3>Behavior</h3>
+   * The {@link ScheduleTimerCmd} command activates a timerImpl, which is
+   * immediately disabled by the {@link CancelTimerCmd} command. After that, the
+   * test waits past the timerImpl's due date. <h3>Postconditions</h3> The
+   * activity does not execute, ever.
+   */
+  public void testCancel() throws CreateException {
+    // start an execution
+    commandExecutor
+        .execute(new StartExecutionCmd("timers included", null, null));
+
+    Date executionDate = HappyActivity.waitFor(2 * TIMEOUT);
+    assertNull(executionDate);
+  }
+
+  static class ScheduleTimerCmd implements Command<Void> {
+
+    private final TimerImpl timer;
+
+    private static final long serialVersionUID = 1L;
+
+    ScheduleTimerCmd(TimerImpl timer) {
+      this.timer = timer;
+    }
+
+    public Void execute(Environment environment) throws Exception {
+      environment.get(DbSession.class).save(timer.getExecution());
+      environment.get(TimerSession.class).schedule(timer);
+      return null;
+    }
+  }
+
+  static class CancelTimerCmd implements Command<Void> {
+
+    private final long timerDbid;
+
+    private static final long serialVersionUID = 1L;
+
+    CancelTimerCmd(long timerDbid) {
+      this.timerDbid = timerDbid;
+    }
+
+    public Void execute(Environment environment) throws Exception {
+      TimerImpl timerImpl = environment.get(DbSession.class).get(
+          TimerImpl.class, timerDbid);
+      environment.get(TimerSession.class).cancel(timerImpl);
+      return null;
+    }
+  }
+
+}

Copied: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java (from rev 3587, jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java)
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,263 @@
+/*
+ * 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.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.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.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.model.OpenProcessDefinition;
+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.IntegrationTestSetup;
+
+/**
+ * Server-side test for the {@linkplain TimerEB timerImpl bean}. The local
+ * interface is used.
+ * 
+ * @author Alejandro Guizar
+ */
+public class TimerTest extends ServletTestCase {
+
+  private OpenProcessDefinition processDefinition;
+  private ObjectDescriptor activityDescriptor = new ObjectDescriptor();
+
+  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) {
+      InitialContext initialContext = new InitialContext();
+      try {
+        commandExecutorHome = (LocalCommandExecutorHome) initialContext.lookup("java:comp/env/ejb/LocalCommandExecutor");
+        timerHome = (LocalTimerHome) initialContext.lookup("java:comp/env/ejb/LocalTimer");
+      } finally {
+        initialContext.close();
+      }
+    }
+    // create local bean
+    commandExecutor = commandExecutorHome.create();
+    // define process
+    processDefinition = ProcessFactory.build(getName())
+      .event("timeout")
+        .listener(activityDescriptor)
+      .done();
+  }
+
+  protected void tearDown() throws Exception {
+    commandExecutor = null;
+  }
+
+  /**
+   * This scenario tests a non-repeating timerImpl whose referenced activity
+   * completes with no incident.
+   * <h3>Preconditions</h3>
+   * The activity has not executed.
+   * <h3>Behavior</h3>
+   * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
+   * service. After that, the test waits for the activity to execute. Upon
+   * timeout, the {@linkplain HappyActivity activity} notifies the test of its
+   * execution.
+   * <h3>Postconditions</h3>
+   * The activity executes on or after the timerImpl's due date.
+   */
+  public void testHappyTimer() throws CreateException {
+    activityDescriptor.setClassName(HappyActivity.class.getName());
+    commandExecutor.execute(new DeployCmd(new DeploymentImpl(processDefinition)));
+
+    ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
+    
+    Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
+    TimerImpl timerImpl = new TimerImpl();
+    timerImpl.setEventName("timeout");
+    timerImpl.setDueDate(dueDate);
+    timerImpl.setExecution(execution);
+    commandExecutor.execute(new CreateTimerCmd(timerImpl));
+
+    Date executionDate = HappyActivity.waitFor();
+    assertTrue(dueDate.compareTo(executionDate) <= 0);
+  }
+
+  /**
+   * This scenario tests a non-repeating timerImpl whose referenced activity throws
+   * a checked exception.
+   * <h3>Preconditions</h3>
+   * The activity has not executed.
+   * <h3>Behavior</h3>
+   * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
+   * service. After that, the test waits for the activity to execute. Upon
+   * timeout, the {@linkplain NoisyActivity activity} notifies the test of its
+   * execution, sets a variable and throws a checked exception.
+   * <h3>Postconditions</h3>
+   * The activity executes on or after the timerImpl's due date. The EJB timerImpl
+   * service rolls back the managed transaction. The variable is unset.
+   */
+  public void testNoisyTimer() throws CreateException {
+    activityDescriptor.setClassName(NoisyActivity.class.getName());
+    commandExecutor.execute(new DeployCmd(new DeploymentImpl(processDefinition)));
+
+    ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
+    
+    Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
+    TimerImpl timerImpl = new TimerImpl();
+    timerImpl.setEventName("timeout");
+    timerImpl.setDueDate(dueDate);
+    timerImpl.setExecution(execution);
+    commandExecutor.execute(new CreateTimerCmd(timerImpl));
+
+    Date executionDate = NoisyActivity.waitFor();
+    assertTrue(dueDate.compareTo(executionDate) <= 0);
+
+    Set<String> variableNames = new HashSet<String>();
+    variableNames.add("executionDate");
+    Object variableValue = commandExecutor.execute(new GetVariablesCmd(execution.getId(), variableNames));
+    assertNull(variableValue);
+  }
+
+  /**
+   * This scenario tests a repeating timerImpl whose referenced activity completes
+   * with no incident.
+   * <h3>Preconditions</h3>
+   * The activity has not executed.
+   * <h3>Behavior</h3>
+   * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
+   * 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}
+   * notifies the test of its execution.
+   * <h3>Postconditions</h3>
+   * The first execution of the activity occurs on or after the timerImpl's due
+   * date. The subsequent <em>n</em> executions of the activity occur on or
+   * after the timerImpl's repeat interval.
+   */
+  public void testCyclicTimer() throws CreateException {
+    activityDescriptor.setClassName(HappyActivity.class.getName());
+    commandExecutor.execute(new DeployCmd(new DeploymentImpl(processDefinition)));
+
+    ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
+
+    Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
+    TimerImpl timerImpl = new TimerImpl();
+    timerImpl.setEventName("timeout");
+    timerImpl.setDueDate(dueDate);
+    timerImpl.setRepeat(REPEAT + " milliseconds");
+    timerImpl.setExecution(execution);
+    commandExecutor.execute(new CreateTimerCmd(timerImpl));
+
+    try {
+      Date executionTime = HappyActivity.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();
+        assertTrue(dueDate.compareTo(executionTime) <= 0);
+      }
+    } finally {
+      commandExecutor.execute(new CancelTimerCmd(timerImpl.getDbid()));
+    }
+  }
+
+  static class CreateTimerCmd implements Command<Void> {
+
+    private final TimerImpl timerImpl;
+
+    private static final long serialVersionUID = 1L;
+
+    CreateTimerCmd(TimerImpl timerImpl) {
+      this.timerImpl = timerImpl;
+    }
+
+    public Void execute(Environment environment) throws Exception {
+      DbSession dbSession = environment.get(DbSession.class);
+      dbSession.save(timerImpl);
+      dbSession.flush();
+
+      long timerDbid = timerImpl.getDbid();
+      log.info("scheduling " + timerImpl + " #" + timerDbid);
+      LocalTimer timerBean = timerHome.findByPrimaryKey(timerDbid);
+      timerBean.schedule();
+      return null;
+    }
+
+    public String toString() {
+      return CreateTimerCmd.class.getSimpleName() + '(' + timerImpl + ')';
+    }
+  }
+
+  static class CancelTimerCmd implements Command<Void> {
+
+    private final long timerDbid;
+
+    private static final long serialVersionUID = 1L;
+
+    CancelTimerCmd(long timerDbid) {
+      this.timerDbid = timerDbid;
+    }
+
+    public Void execute(Environment environment) throws Exception {
+      LocalTimer timerBean = timerHome.findByPrimaryKey(timerDbid);
+      timerBean.remove();
+      return null;
+    }
+
+    public String toString() {
+      return CancelTimerCmd.class.getSimpleName() + '(' + timerDbid + ')';
+    }
+  }
+}

Deleted: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandExecutorTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandExecutorTest.java	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandExecutorTest.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,115 +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 javax.ejb.CreateException;
-import javax.ejb.EJBException;
-import javax.naming.InitialContext;
-
-import org.apache.cactus.ServletTestCase;
-
-import org.jbpm.enterprise.internal.ejb.CommandExecutorSLSB;
-import org.jbpm.enterprise.internal.ejb.LocalCommandExecutor;
-import org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome;
-import org.jbpm.enterprise.test.custom.InsertPhraseCmd;
-import org.jbpm.enterprise.test.custom.RemovePhraseCmd;
-import org.jbpm.log.Log;
-
-/**
- * Server-side test for the {@linkplain CommandExecutorSLSB command executor}.
- * The local interface is used.
- * 
- * @author Tom Baeyens
- * @author Alejandro Guizar
- */
-public class CommandExecutorTest extends ServletTestCase {
-
-  private LocalCommandExecutor commandExecutor;
-
-  private static final Log log = Log.getLog(CommandExecutorTest.class.getName());
-
-  private static LocalCommandExecutorHome commandExecutorHome;
-
-  @Override
-  protected void setUp() throws Exception {
-    if (commandExecutorHome == null) {
-      // retrieve managed objects
-      InitialContext initialContext = new InitialContext();
-      try {
-        commandExecutorHome = (LocalCommandExecutorHome) initialContext.lookup("java:comp/env/ejb/LocalCommandExecutor");
-      } finally {
-        initialContext.close();
-      }
-    }
-    commandExecutor = commandExecutorHome.create();
-  }
-
-  @Override
-  protected void tearDown() throws Exception {
-    commandExecutor = null;
-  }
-
-  /**
-   * This scenario tests a command that completes with no incident.
-   * <h3>Preconditions</h3>
-   * The TEST_PHRASE table does not contain any row with the specified text.
-   * <h3>Behavior</h3>
-   * The {@link InsertPhraseCmd} command creates a row with the specified text.
-   * <h3>Postconditions</h3>
-   * A new row with the specified text exists in the table. The
-   * {@link RemovePhraseCmd} command removes the row, and the return value confirms
-   * it was there.
-   */
-  public void testHappyCommand() throws CreateException {
-    String text = "been there, done that";
-    commandExecutor.execute(new InsertPhraseCmd(text));
-    // verify phrase was inserted
-    assertTrue(commandExecutor.execute(new RemovePhraseCmd(text)));
-  }
-
-  /**
-   * This scenario tests a command that throws a checked exception inside the
-   * {@link InsertPhraseCmd#execute(org.jbpm.env.Environment) execute} method.
-   * <h3>Preconditions</h3>
-   * The TEST_PHRASE table does not contain any row with the specified text.
-   * <h3>Behavior</h3>
-   * The {@link InsertPhraseCmd} command creates a row with the specified text. The
-   * command is configured to throw a checked exception before completing.
-   * <h3>Postconditions</h3>
-   * The command executor throws an {@link EJBException} and rolls back the
-   * managed transaction. No row with the specified text exists in the database.
-   * The {@link RemovePhraseCmd} command return value confirms the row was not
-   * there.
-   */
-  public void testNoisyCommand() throws CreateException {
-    String text = "houston, we have a problem";
-    // insert phrase via command
-    try {
-      commandExecutor.execute(new InsertPhraseCmd(text, /* fail? */true));
-      fail("expected: " + EJBException.class.getSimpleName());
-    } catch (EJBException e) {
-      log.info("noisy command threw exception", e);
-      // verify phrase was NOT inserted
-      assertFalse(commandExecutor.execute(new RemovePhraseCmd(text)));
-    }
-  }
-}

Deleted: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,178 +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 javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.apache.cactus.ServletTestCase;
-
-import org.jbpm.cmd.Command;
-import org.jbpm.enterprise.internal.ejb.CommandReceiverMDB;
-import org.jbpm.enterprise.test.custom.InsertPhraseCmd;
-import org.jbpm.enterprise.test.custom.RemovePhraseCmd;
-
-/**
- * Server-side test for the {@linkplain CommandReceiverMDB command receiver}.
- * 
- * @author Alejandro Guizar
- */
-public class CommandReceiverTest extends ServletTestCase {
-
-  private Connection jmsConnection;
-
-  private static final long TIMEOUT = 2000;
-
-  private static ConnectionFactory jmsConnectionFactory;
-  private static Destination commandQueue;
-
-  @Override
-  protected void setUp() throws Exception {
-    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");
-      } finally {
-        initial.close();
-      }
-    }
-    jmsConnection = jmsConnectionFactory.createConnection();
-    jmsConnection.start();
-  }
-
-  @Override
-  protected void tearDown() throws Exception {
-    if (jmsConnection != null) {
-      jmsConnection.stop();
-      jmsConnection.close();
-      jmsConnection = null;
-    }
-  }
-
-  /**
-   * This scenario tests a command message that completes with no incident.
-   * <h3>Preconditions</h3>
-   * The TEST_PHRASE table does not contain any row with the specified text.
-   * <h3>Behavior</h3>
-   * The {@link InsertPhraseCmd} command message creates a row with the specified
-   * text. Once the command completes, the command receiver sends the result to
-   * the reply queue.
-   * <h3>Postconditions</h3>
-   * A new row with the specified text exists in the table. The
-   * {@link RemovePhraseCmd} command message removes the row. The result sent to
-   * the reply queue confirms the row was there.
-   */
-  public void testHappyMessage() throws JMSException {
-    final String text = "been there, done that";
-    Session jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-    try {
-      // send insert command
-      Command<Void> insertCommand = new InsertPhraseCmd(text, /* fail? */false);
-      Message insertMessage = jmsSession.createObjectMessage(insertCommand);
-      Destination replyTo = jmsSession.createTemporaryQueue();
-      insertMessage.setJMSReplyTo(replyTo);
-      MessageProducer producer = jmsSession.createProducer(commandQueue);
-      producer.send(insertMessage);
-
-      // receive insertion response
-      MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + insertMessage.getJMSMessageID() + "'");
-      ObjectMessage responseMessage = (ObjectMessage) insertConsumer.receive(TIMEOUT);
-      assertNull(responseMessage.getObject());
-
-      // send remove command
-      Command<Boolean> removeCommand = new RemovePhraseCmd(text);
-      Message removeMessage = jmsSession.createObjectMessage(removeCommand);
-      removeMessage.setJMSReplyTo(replyTo);
-      producer.send(removeMessage);
-
-      // receive removal response
-      MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + removeMessage.getJMSMessageID() + "'");
-      responseMessage = (ObjectMessage) removeConsumer.receive(TIMEOUT);
-      // verify phrase was inserted
-      assertTrue((Boolean) responseMessage.getObject());
-    } finally {
-      jmsSession.close();
-    }
-  }
-
-  /**
-   * This scenario tests a command message that throws a checked exception
-   * inside the {@link InsertPhraseCmd#execute(org.jbpm.env.Environment) execute}
-   * method.
-   * <h3>Preconditions</h3>
-   * The TEST_PHRASE table does not contain any row with the specified text.
-   * <h3>Behavior</h3>
-   * The {@link InsertPhraseCmd} command message creates a row with the specified
-   * text. The command is configured to throw a checked exception before
-   * completing. The exception prevents the command receiver from sending the
-   * result to the reply queue.
-   * <h3>Postconditions</h3>
-   * The command receiver rolls back the managed transaction and puts the
-   * insertion message back in the command queue. No row with the specified
-   * exists in the database. The {@link RemovePhraseCmd} command result sent to the
-   * reply queue confirms the row was not there.
-   */
-  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);
-    try {
-      // send insert command
-      Command<Void> insertCommand = new InsertPhraseCmd(text, /* fail? */true);
-      Message insertMessage = jmsSession.createObjectMessage(insertCommand);
-      Destination replyTo = jmsSession.createTemporaryQueue();
-      insertMessage.setJMSReplyTo(replyTo);
-      MessageProducer producer = jmsSession.createProducer(commandQueue);
-      producer.send(insertMessage);
-
-      // receive insertion response
-      MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + insertMessage.getJMSMessageID() + "'");
-      ObjectMessage insertResponse = (ObjectMessage) insertConsumer.receive(TIMEOUT);
-      assertNull(insertResponse);
-
-      // send remove command
-      Command<Boolean> removeCommand = new RemovePhraseCmd(text);
-      Message removeMessage = jmsSession.createObjectMessage(removeCommand);
-      removeMessage.setJMSReplyTo(replyTo);
-      producer.send(removeMessage);
-
-      // receive removal response
-      MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + removeMessage.getJMSMessageID() + "'");
-      ObjectMessage removeResponse = (ObjectMessage) removeConsumer.receive(TIMEOUT);
-      // verify phrase was NOT inserted
-      assertFalse((Boolean) removeResponse.getObject());
-    } finally {
-      jmsSession.close();
-    }
-  }
-}

Deleted: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,166 +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 java.util.Date;
-
-import javax.ejb.CreateException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.apache.cactus.ServletTestCase;
-import org.jbpm.Execution;
-import org.jbpm.cmd.Command;
-import org.jbpm.enterprise.internal.ejb.EnterpriseTimerSession;
-import org.jbpm.enterprise.internal.ejb.LocalCommandExecutor;
-import org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome;
-import org.jbpm.enterprise.test.custom.HappyActivity;
-import org.jbpm.env.Environment;
-import org.jbpm.model.OpenProcessDefinition;
-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;
-
-/**
- * Server-side test for the enterprise
- * {@linkplain EnterpriseTimerSession timerImpl session}.
- * 
- * @author Alejandro Guizar
- */
-public class EnterpriseTimerSessionTest extends ServletTestCase {
-
-  private LocalCommandExecutor commandExecutor;
-
-  private static final int TIMEOUT = 2000;
-
-  private static LocalCommandExecutorHome commandExecutorHome;
-
-  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();
-    // deploy process
-    OpenProcessDefinition processDefinition = ProcessFactory.build(getName())
-      .timer(TIMEOUT + " milliseconds", null)
-      .event("timeout")
-        .listener(new ObjectDescriptor(HappyActivity.class))
-      .done();
-    commandExecutor.execute(new DeployCmd(new DeploymentImpl(processDefinition)));
-  }
-
-  protected void tearDown() throws Exception {
-    commandExecutor = null;
-  }
-
-  /**
-   * This scenario schedules a non-repeating timerImpl whose referenced activity
-   * completes with no incident.
-   * <h3>Preconditions</h3>
-   * The activity has not executed.
-   * <h3>Behavior</h3>
-   * The {@link ScheduleTimerCmd} command activates a timerImpl. After that, the test
-   * waits for the activity to execute. Upon timeout, the
-   * {@linkplain HappyActivity activity} notifies the test of its execution.
-   * <h3>Postconditions</h3>
-   * The activity executes on or after the timerImpl's due date.
-   */
-  public void testSchedule() throws CreateException {
-    // start an execution
-    Execution execution = commandExecutor.execute(new StartExecutionCmd("timers included", null, null));
-    
-    /* TODO timers will have to be fetched with a call to the management service
-
-    Timer timer = execution.getTimers().iterator().next();
-
-    Date dueDate = timer.getDueDate();
-    Date executionDate = HappyActivity.waitFor();
-    assertTrue(dueDate.compareTo(executionDate) <= 0);
-    */
-  }
-
-  /**
-   * This scenario schedules a non-repeating timerImpl and immediately cancels it.
-   * <h3>Preconditions</h3>
-   * The activity has not executed.
-   * <h3>Behavior</h3>
-   * The {@link ScheduleTimerCmd} command activates a timerImpl, which is immediately
-   * disabled by the {@link CancelTimerCmd} command. After that, the test waits
-   * past the timerImpl's due date.
-   * <h3>Postconditions</h3>
-   * The activity does not execute, ever.
-   */
-  public void testCancel() throws CreateException {
-    // start an execution
-    commandExecutor.execute(new StartExecutionCmd("timers included", null, null));
-
-    Date executionDate = HappyActivity.waitFor(2 * TIMEOUT);
-    assertNull(executionDate);
-  }
-
-  static class ScheduleTimerCmd implements Command<Void> {
-
-    private final TimerImpl timer;
-
-    private static final long serialVersionUID = 1L;
-
-    ScheduleTimerCmd(TimerImpl timer) {
-      this.timer = timer;
-    }
-
-    public Void execute(Environment environment) throws Exception {
-      environment.get(DbSession.class).save(timer.getExecution());
-      environment.get(TimerSession.class).schedule(timer);
-      return null;
-    }
-  }
-
-  static class CancelTimerCmd implements Command<Void> {
-
-    private final long timerDbid;
-
-    private static final long serialVersionUID = 1L;
-
-    CancelTimerCmd(long timerDbid) {
-      this.timerDbid = timerDbid;
-    }
-
-    public Void execute(Environment environment) throws Exception {
-      TimerImpl timerImpl = environment.get(DbSession.class).get(TimerImpl.class, timerDbid);
-      environment.get(TimerSession.class).cancel(timerImpl);
-      return null;
-    }
-  }
-
-}

Deleted: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java	2009-01-06 02:09:11 UTC (rev 3588)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,256 +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 java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ejb.CreateException;
-import javax.naming.InitialContext;
-
-import org.apache.cactus.ServletTestCase;
-import org.jbpm.cmd.Command;
-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.enterprise.test.custom.HappyActivity;
-import org.jbpm.enterprise.test.custom.NoisyActivity;
-import org.jbpm.env.Environment;
-import org.jbpm.log.Log;
-import org.jbpm.model.OpenProcessDefinition;
-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;
-
-/**
- * Server-side test for the {@linkplain TimerEB timerImpl bean}. The local
- * interface is used.
- * 
- * @author Alejandro Guizar
- */
-public class TimerTest extends ServletTestCase {
-
-  private OpenProcessDefinition processDefinition;
-  private ObjectDescriptor activityDescriptor = new ObjectDescriptor();
-
-  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;
-
-  protected void setUp() throws Exception {
-    // lookup homes in jndi
-    if (commandExecutorHome == null) {
-      InitialContext initialContext = new InitialContext();
-      try {
-        commandExecutorHome = (LocalCommandExecutorHome) initialContext.lookup("java:comp/env/ejb/LocalCommandExecutor");
-        timerHome = (LocalTimerHome) initialContext.lookup("java:comp/env/ejb/LocalTimer");
-      } finally {
-        initialContext.close();
-      }
-    }
-    // create local bean
-    commandExecutor = commandExecutorHome.create();
-    // define process
-    processDefinition = ProcessFactory.build(getName())
-      .event("timeout")
-        .listener(activityDescriptor)
-      .done();
-  }
-
-  protected void tearDown() throws Exception {
-    commandExecutor = null;
-  }
-
-  /**
-   * This scenario tests a non-repeating timerImpl whose referenced activity
-   * completes with no incident.
-   * <h3>Preconditions</h3>
-   * The activity has not executed.
-   * <h3>Behavior</h3>
-   * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
-   * service. After that, the test waits for the activity to execute. Upon
-   * timeout, the {@linkplain HappyActivity activity} notifies the test of its
-   * execution.
-   * <h3>Postconditions</h3>
-   * The activity executes on or after the timerImpl's due date.
-   */
-  public void testHappyTimer() throws CreateException {
-    activityDescriptor.setClassName(HappyActivity.class.getName());
-    commandExecutor.execute(new DeployCmd(new DeploymentImpl(processDefinition)));
-
-    ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
-    
-    Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
-    TimerImpl timerImpl = new TimerImpl();
-    timerImpl.setEventName("timeout");
-    timerImpl.setDueDate(dueDate);
-    timerImpl.setExecution(execution);
-    commandExecutor.execute(new CreateTimerCmd(timerImpl));
-
-    Date executionDate = HappyActivity.waitFor();
-    assertTrue(dueDate.compareTo(executionDate) <= 0);
-  }
-
-  /**
-   * This scenario tests a non-repeating timerImpl whose referenced activity throws
-   * a checked exception.
-   * <h3>Preconditions</h3>
-   * The activity has not executed.
-   * <h3>Behavior</h3>
-   * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
-   * service. After that, the test waits for the activity to execute. Upon
-   * timeout, the {@linkplain NoisyActivity activity} notifies the test of its
-   * execution, sets a variable and throws a checked exception.
-   * <h3>Postconditions</h3>
-   * The activity executes on or after the timerImpl's due date. The EJB timerImpl
-   * service rolls back the managed transaction. The variable is unset.
-   */
-  public void testNoisyTimer() throws CreateException {
-    activityDescriptor.setClassName(NoisyActivity.class.getName());
-    commandExecutor.execute(new DeployCmd(new DeploymentImpl(processDefinition)));
-
-    ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
-    
-    Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
-    TimerImpl timerImpl = new TimerImpl();
-    timerImpl.setEventName("timeout");
-    timerImpl.setDueDate(dueDate);
-    timerImpl.setExecution(execution);
-    commandExecutor.execute(new CreateTimerCmd(timerImpl));
-
-    Date executionDate = NoisyActivity.waitFor();
-    assertTrue(dueDate.compareTo(executionDate) <= 0);
-
-    Set<String> variableNames = new HashSet<String>();
-    variableNames.add("executionDate");
-    Object variableValue = commandExecutor.execute(new GetVariablesCmd(execution.getId(), variableNames));
-    assertNull(variableValue);
-  }
-
-  /**
-   * This scenario tests a repeating timerImpl whose referenced activity completes
-   * with no incident.
-   * <h3>Preconditions</h3>
-   * The activity has not executed.
-   * <h3>Behavior</h3>
-   * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
-   * 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}
-   * notifies the test of its execution.
-   * <h3>Postconditions</h3>
-   * The first execution of the activity occurs on or after the timerImpl's due
-   * date. The subsequent <em>n</em> executions of the activity occur on or
-   * after the timerImpl's repeat interval.
-   */
-  public void testCyclicTimer() throws CreateException {
-    activityDescriptor.setClassName(HappyActivity.class.getName());
-    commandExecutor.execute(new DeployCmd(new DeploymentImpl(processDefinition)));
-
-    ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
-
-    Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
-    TimerImpl timerImpl = new TimerImpl();
-    timerImpl.setEventName("timeout");
-    timerImpl.setDueDate(dueDate);
-    timerImpl.setRepeat(REPEAT + " milliseconds");
-    timerImpl.setExecution(execution);
-    commandExecutor.execute(new CreateTimerCmd(timerImpl));
-
-    try {
-      Date executionTime = HappyActivity.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();
-        assertTrue(dueDate.compareTo(executionTime) <= 0);
-      }
-    } finally {
-      commandExecutor.execute(new CancelTimerCmd(timerImpl.getDbid()));
-    }
-  }
-
-  static class CreateTimerCmd implements Command<Void> {
-
-    private final TimerImpl timerImpl;
-
-    private static final long serialVersionUID = 1L;
-
-    CreateTimerCmd(TimerImpl timerImpl) {
-      this.timerImpl = timerImpl;
-    }
-
-    public Void execute(Environment environment) throws Exception {
-      DbSession dbSession = environment.get(DbSession.class);
-      dbSession.save(timerImpl);
-      dbSession.flush();
-
-      long timerDbid = timerImpl.getDbid();
-      log.info("scheduling " + timerImpl + " #" + timerDbid);
-      LocalTimer timerBean = timerHome.findByPrimaryKey(timerDbid);
-      timerBean.schedule();
-      return null;
-    }
-
-    public String toString() {
-      return CreateTimerCmd.class.getSimpleName() + '(' + timerImpl + ')';
-    }
-  }
-
-  static class CancelTimerCmd implements Command<Void> {
-
-    private final long timerDbid;
-
-    private static final long serialVersionUID = 1L;
-
-    CancelTimerCmd(long timerDbid) {
-      this.timerDbid = timerDbid;
-    }
-
-    public Void execute(Environment environment) throws Exception {
-      LocalTimer timerBean = timerHome.findByPrimaryKey(timerDbid);
-      timerBean.remove();
-      return null;
-    }
-
-    public String toString() {
-      return CancelTimerCmd.class.getSimpleName() + '(' + timerDbid + ')';
-    }
-  }
-}

Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ArchiveDeployer.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ArchiveDeployer.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ArchiveDeployer.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.enterprise;
+
+import java.net.URL;
+
+/**
+ * An archive deployer
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 16-May-2006
+ */
+public interface ArchiveDeployer {
+  /**
+   * Deploy the given archive
+   */
+  void deploy(URL archive) throws Exception;
+
+  /**
+   * Undeploy the given archive
+   */
+  void undeploy(URL archive) throws Exception;
+}


Property changes on: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ArchiveDeployer.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,191 @@
+/*
+ * 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.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Hashtable;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * An integration test helper that deals with test deployment/undeployment, etc.
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Oct-2004
+ */
+public class IntegrationTestHelper {
+  private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
+  private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
+
+  private static String testResourcesDir;
+  private static String testArchiveDir;
+
+  private static MBeanServerConnection server;
+  private String integrationTarget;
+
+  public void deploy(String archive) throws Exception {
+    URL url = getTestArchiveFile(archive).toURI().toURL();
+    deploy(url);
+  }
+
+  public void deploy(URL archive) throws Exception {
+    getDeployer().deploy(archive);
+  }
+
+  public void undeploy(String archive) throws Exception {
+    URL url = getTestArchiveFile(archive).toURI().toURL();
+    undeploy(url);
+  }
+
+  public void undeploy(URL archive) throws Exception {
+    getDeployer().undeploy(archive);
+  }
+
+  public boolean isTargetJBoss500() {
+    String target = getIntegrationTarget();
+    return target.startsWith("jboss500");
+  }
+
+  public boolean isTargetJBoss423() {
+    String target = getIntegrationTarget();
+    return target.startsWith("jboss423");
+  }
+
+  public boolean isTargetJBoss422() {
+    String target = getIntegrationTarget();
+    return target.startsWith("jboss422");
+  }
+
+  private String getIntegrationTarget() {
+    if (integrationTarget == null) {
+      String jbossVersion;
+      try {
+        ObjectName oname = ObjectNameFactory
+            .create("jboss.system:type=ServerConfig");
+        jbossVersion = (String) getServer().getAttribute(oname,
+            "SpecificationVersion");
+      } catch (Exception ex) {
+        throw new IllegalStateException("Cannot obtain jboss version", ex);
+      }
+
+      if (jbossVersion.startsWith("5.0.0"))
+        integrationTarget = "jboss500";
+      else if (jbossVersion.startsWith("4.2.3"))
+        integrationTarget = "jboss423";
+      else if (jbossVersion.startsWith("4.2.2"))
+        integrationTarget = "jboss422";
+      else
+        throw new IllegalStateException("Unsupported jboss version: "
+            + jbossVersion);
+    }
+    return integrationTarget;
+  }
+
+  public MBeanServerConnection getServer() {
+    if (server == null) {
+      Hashtable jndiEnv = null;
+      try {
+        InitialContext iniCtx = new InitialContext();
+        jndiEnv = iniCtx.getEnvironment();
+        server = (MBeanServerConnection) iniCtx
+            .lookup("jmx/invoker/RMIAdaptor");
+      } catch (NamingException ex) {
+        throw new RuntimeException(
+            "Cannot obtain MBeanServerConnection using jndi props: " + jndiEnv,
+            ex);
+      }
+    }
+    return server;
+  }
+
+  private ArchiveDeployer getDeployer() {
+    return new JBossArchiveDeployer(getServer());
+  }
+
+  /** Try to discover the URL for the test resource */
+  public URL getResourceURL(String resource) {
+    URL resURL = null;
+    try {
+      File resourceFile = getResourceFile(resource);
+      resURL = resourceFile.toURI().toURL();
+    } catch (MalformedURLException e) {
+      // ignore
+    }
+    return resURL;
+  }
+
+  /** Try to discover the File for the test resource */
+  public File getResourceFile(String resource) {
+    File file = new File(resource);
+    if (file.exists())
+      return file;
+
+    file = new File(getTestResourcesDir() + "/" + resource);
+    if (file.exists())
+      return file;
+
+    throw new IllegalArgumentException("Cannot obtain '"
+        + getTestResourcesDir() + "/" + resource + "'");
+  }
+
+  public String getTestResourcesDir() {
+    if (testResourcesDir == null)
+      testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY,
+          "target/test-classes");
+
+    return testResourcesDir;
+  }
+
+  /** Try to discover the URL for the deployment archive */
+  public URL getTestArchiveURL(String archive) throws MalformedURLException {
+    return getTestArchiveFile(archive).toURI().toURL();
+  }
+
+  /** Try to discover the File for the deployment archive */
+  public File getTestArchiveFile(String archive) {
+    File file = new File(archive);
+    if (file.exists())
+      return file;
+
+    file = new File(getTestArchiveDir() + "/" + archive);
+    if (file.exists())
+      return file;
+
+    String notSet = (getTestArchiveDir() == null ? " System property '"
+        + SYSPROP_TEST_ARCHIVE_DIRECTORY + "' not set." : "");
+    throw new IllegalArgumentException("Cannot obtain '" + getTestArchiveDir()
+        + "/" + archive + "'." + notSet);
+  }
+
+  public String getTestArchiveDir() {
+    if (testArchiveDir == null)
+      testArchiveDir = System.getProperty(SYSPROP_TEST_ARCHIVE_DIRECTORY,
+          "target/test-libs");
+
+    return testArchiveDir;
+  }
+}


Property changes on: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestSetup.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestSetup.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestSetup.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,127 @@
+/*
+ * 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.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.MBeanServerConnection;
+
+import junit.extensions.TestSetup;
+import junit.framework.TestSuite;
+
+import org.jbpm.log.Log;
+
+/**
+ * A test setup that deploys/undeploys archives
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Oct-2004
+ */
+public class IntegrationTestSetup extends TestSetup {
+  private IntegrationTestHelper delegate = new IntegrationTestHelper();
+  private String[] archives;
+  private ClassLoader originalClassLoader;
+
+  private static final Log log = Log.getLog(IntegrationTestSetup.class
+      .getName());
+
+  public IntegrationTestSetup(Class<?> testClass, String... archiveList) {
+    super(new TestSuite(testClass));
+    archives = archiveList != null ? archiveList : new String[0];
+  }
+
+  public File getArchiveFile(String archive) {
+    return delegate.getTestArchiveFile(archive);
+  }
+
+  public URL getArchiveURL(String archive) throws MalformedURLException {
+    return delegate.getTestArchiveFile(archive).toURI().toURL();
+  }
+
+  public boolean isTargetJBoss500() {
+    return delegate.isTargetJBoss500();
+  }
+
+  public boolean isTargetJBoss423() {
+    return delegate.isTargetJBoss423();
+  }
+
+  public boolean isTargetJBoss422() {
+    return delegate.isTargetJBoss422();
+  }
+
+  public MBeanServerConnection getServer() {
+    return delegate.getServer();
+  }
+
+  @Override
+  protected void setUp() throws Exception {
+    log.debug("### START SETUP " + getTest());
+
+    List<URL> clientJars = new ArrayList<URL>();
+    for (int i = 0; i < archives.length; i++) {
+      String archive = archives[i];
+      try {
+        delegate.deploy(archive);
+      } catch (Exception ex) {
+        ex.printStackTrace();
+        delegate.undeploy(archive);
+      }
+
+      if (archive.endsWith("-client.jar")) {
+        URL archiveURL = getArchiveURL(archive);
+        clientJars.add(archiveURL);
+      }
+    }
+
+    ClassLoader parent = Thread.currentThread().getContextClassLoader();
+    originalClassLoader = parent;
+
+    // add client jars to the class loader
+    if (!clientJars.isEmpty()) {
+      URL[] urls = new URL[clientJars.size()];
+      for (int i = 0; i < clientJars.size(); i++) {
+        urls[i] = clientJars.get(i);
+      }
+      URLClassLoader cl = new URLClassLoader(urls, parent);
+      Thread.currentThread().setContextClassLoader(cl);
+    }
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    try {
+      for (int i = 0; i < archives.length; i++) {
+        String archive = archives[archives.length - i - 1];
+        delegate.undeploy(archive);
+      }
+    } finally {
+      Thread.currentThread().setContextClassLoader(originalClassLoader);
+    }
+    log.debug("### END SETUP " + getTest());
+  }
+}


Property changes on: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestSetup.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/JBossArchiveDeployer.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/JBossArchiveDeployer.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/JBossArchiveDeployer.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,56 @@
+/*
+ * 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.net.URL;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+/**
+ * An archive deployer that deals with test deployment/undeployment, etc.
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Oct-2004
+ */
+public class JBossArchiveDeployer implements ArchiveDeployer {
+  private static final String MAIN_DEPLOYER = "jboss.system:service=MainDeployer";
+
+  private MBeanServerConnection server;
+
+  public JBossArchiveDeployer(MBeanServerConnection server) {
+    this.server = server;
+  }
+
+  public void deploy(URL url) throws Exception {
+    invokeMainDeployer("deploy", url);
+  }
+
+  public void undeploy(URL url) throws Exception {
+    invokeMainDeployer("undeploy", url);
+  }
+
+  private void invokeMainDeployer(String methodName, URL url) throws Exception {
+    server.invoke(new ObjectName(MAIN_DEPLOYER), methodName,
+        new Object[] { url }, new String[] { "java.net.URL" });
+  }
+}


Property changes on: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/JBossArchiveDeployer.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ObjectNameFactory.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ObjectNameFactory.java	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ObjectNameFactory.java	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,61 @@
+/*
+ * 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.Hashtable;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * A simple factory for creating safe object names.
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 08-May-2006
+ */
+public class ObjectNameFactory {
+  public static ObjectName create(String name) {
+    try {
+      return new ObjectName(name);
+    } catch (MalformedObjectNameException e) {
+      throw new IllegalArgumentException("Invalid ObjectName: " + name, e);
+    }
+  }
+
+  public static ObjectName create(String domain, String key, String value) {
+    try {
+      return new ObjectName(domain, key, value);
+    } catch (MalformedObjectNameException e) {
+      throw new IllegalArgumentException("Invalid ObjectName: " + domain + ","
+          + key + "," + value, e);
+    }
+  }
+
+  public static ObjectName create(String domain, Hashtable<String, String> table) {
+    try {
+      return new ObjectName(domain, table);
+    } catch (MalformedObjectNameException e) {
+      throw new IllegalArgumentException("Invalid ObjectName: " + domain + ","
+          + table, e);
+    }
+  }
+}


Property changes on: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/ObjectNameFactory.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: jbpm4/trunk/modules/enterprise/src/test/resources/META-INF (from rev 3587, jbpm4/trunk/modules/enterprise/src/main/etc/ear/META-INF)

Modified: jbpm4/trunk/modules/enterprise/src/test/resources/META-INF/application.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/etc/ear/META-INF/application.xml	2009-01-05 21:43:54 UTC (rev 3587)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/META-INF/application.xml	2009-01-07 10:06:58 UTC (rev 3589)
@@ -1,21 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <application version="1.4"
-  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
-  http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee">
 
   <display-name>JBoss jBPM enterprise beans</display-name>
 
   <module>
-    <ejb>pvm-test-enterprise-ejb.jar</ejb>
+    <ejb>${project.build.finalName}.jar</ejb>
   </module>
 
   <module>
     <web>
-      <web-uri>pvm-test-enterprise-war</web-uri>
-      <context-root>/pvm-enterprise-test</context-root>
+      <web-uri>jbpm-enterprise-test.war</web-uri>
+      <context-root>/jbpm-enterprise-test</context-root>
     </web>
   </module>
 
+  <module>
+    <java>jbpm-enterprise-test.jar</java>
+  </module>
+
 </application>

Copied: jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF (from rev 3587, jbpm4/trunk/modules/enterprise/src/main/etc/war/WEB-INF)

Added: jbpm4/trunk/modules/enterprise/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/environment.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/environment.cfg.xml	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,35 @@
+<jbpm-configuration>
+
+  <process-engine>
+
+    <hibernate-configuration>
+      <properties resource="hibernate.properties" />
+      <mapping resource="jbpm.pvm.typedefs.hbm.xml" />
+      <mapping resource="jbpm.pvm.wire.hbm.xml" />
+      <mapping resource="jbpm.pvm.definition.hbm.xml" />
+      <mapping resource="jbpm.pvm.execution.hbm.xml" />
+      <mapping resource="jbpm.pvm.variable.hbm.xml" />
+      <mapping resource="jbpm.pvm.job.hbm.xml" />
+      <mapping resource="org/jbpm/enterprise/internal/custom/mappings.hbm.xml" />
+      <cache-configuration resource="jbpm.pvm.cache.xml"
+        usage="nonstrict-read-write" />
+    </hibernate-configuration>
+
+    <hibernate-session-factory />
+
+    <variable-types resource="jbpm.pvm.types.xml" />
+
+    <ejb-local-command-service />
+
+  </process-engine>
+
+  <environment>
+
+    <hibernate-session />
+    <pvm-db-session />
+
+    <ejb-timer-session />
+
+  </environment>
+
+</jbpm-configuration>

Added: jbpm4/trunk/modules/enterprise/src/test/resources/hibernate.properties
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/hibernate.properties	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/hibernate.properties	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,11 @@
+hibernate.dialect                      org.hibernate.dialect.HSQLDialect
+hibernate.connection.driver_class      org.hsqldb.jdbcDriver
+hibernate.connection.url               jdbc:hsqldb:mem:.
+hibernate.connection.username          sa
+hibernate.connection.password
+hibernate.hbm2ddl.auto                 create-drop
+hibernate.cache.use_second_level_cache true
+hibernate.cache.provider_class         org.hibernate.cache.HashtableCacheProvider
+# hibernate.show_sql                     true
+# hibernate.format_sql                   true
+# hibernate.use_sql_comments             true


Property changes on: jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/enterprise/internal/custom
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/enterprise/internal/custom/mappings.hbm.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/enterprise/internal/custom/mappings.hbm.xml	                        (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/org/jbpm/enterprise/internal/custom/mappings.hbm.xml	2009-01-07 10:06:58 UTC (rev 3589)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.jbpm.enterprise.internal.custom" default-access="field">
+
+  <class name="Phrase" table="TEST_PHRASE">
+    <id name="id" column="ID_">
+      <generator class="native" />
+    </id>
+    <property name="text" column="TEXT_" />
+  </class>
+
+</hibernate-mapping>
\ No newline at end of file




More information about the jbpm-commits mailing list