[jbpm-commits] JBoss JBPM SVN: r1748 - in jbpm4/pvm/trunk/modules/core/src: main/java/org/jbpm/pvm/internal/log and 20 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jul 29 09:25:51 EDT 2008


Author: tom.baeyens at jboss.com
Date: 2008-07-29 09:25:51 -0400 (Tue, 29 Jul 2008)
New Revision: 1748

Added:
   jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicFeaturesTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring/SpringTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/cron/
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/svc/
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/spring/
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/jobexecutor/
Removed:
   jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironmentFactory.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/PvmClientTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/db/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/env/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/expr/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/ExpressionTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/spring/
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/db/
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/spring/
Modified:
   jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/log/LogFormatter.java
   jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java
   jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/JbpmTestCase.java
   jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/wire.xsd
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/CheckInTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/NonDbTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/DbSvcTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/BasicEnvironmentTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentClassLoaderTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentSearchOrderTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentTypeLookupTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/NestedEnvironmentTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/cron/CronExpression.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/cron/CronTrigger.java
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/spring/spring.beans.xml
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/jobexecutor/environment.cfg.xml
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/jobexecutor/mappings.hbm.xml
Log:
test suite clean up

Copied: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironmentFactory.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.env;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.pvm.internal.spring.SpringEnvironment;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/** this environment factory will see only the singleton beans.
+ * 
+ * The created {@link SpringEnvironment}s will see the prototype 
+ * beans and it will cache them.
+ *  
+ * @author Tom Baeyens
+ */
+public class SpringEnvironmentFactory extends EnvironmentFactory implements ApplicationContextAware {
+  
+  // TODO pull up the common behaviour between this class and the SpringEnvironmentContext
+  
+  private static final long serialVersionUID = 1L;
+  
+  ApplicationContext applicationContext;
+  
+  public SpringEnvironment openEnvironment() {
+    return new SpringEnvironment(this);
+  }
+
+  public boolean has(String key) {
+    return applicationContext.isSingleton(key);
+  }
+
+  public Object get(String key) {
+    if (has(key)) {
+      return applicationContext.getBean(key);
+    }
+    return null;
+  }
+
+  public <T> T get(Class<T> type) {
+    String name = ReflectUtil.getUnqualifiedClassName(type);
+    name = name.substring(0, 1).toLowerCase() + name.substring(1);
+    return (T) get(name);
+  }
+
+  public Set<String> keys() {
+    HashSet<String> keys = new HashSet<String>();
+    for (String key : applicationContext.getBeanDefinitionNames()) {
+      if (has(key)) {
+        keys.add(key);
+      }
+    }
+    return keys;
+  }
+  
+  public ApplicationContext getApplicationContext() {
+    return applicationContext;
+  }
+
+  public void setApplicationContext(ApplicationContext applicationContext) {
+    this.applicationContext = applicationContext;
+  }
+
+  
+  public void close() {
+  }
+
+  public String getName() {
+    return null;
+  }
+
+  public Object set(String key, Object value) {
+    return null;
+  }
+}


Property changes on: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/log/LogFormatter.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/log/LogFormatter.java	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/log/LogFormatter.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -75,7 +75,7 @@
     return indentation;
   }
 
-  public void resetIndentation() {
+  public static void resetIndentation() {
     indentations = new HashMap<Integer, Integer>();
   }
 }

Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -28,6 +28,7 @@
 import org.jbpm.pvm.env.Context;
 import org.jbpm.pvm.env.Environment;
 import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.env.SpringEnvironmentFactory;
 import org.jbpm.pvm.env.Transaction;
 import org.springframework.context.ApplicationContext;
 

Deleted: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironmentFactory.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironmentFactory.java	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironmentFactory.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.spring;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/** this environment factory will see only the singleton beans.
- * 
- * The created {@link SpringEnvironment}s will see the prototype 
- * beans and it will cache them.
- *  
- * @author Tom Baeyens
- */
-public class SpringEnvironmentFactory extends EnvironmentFactory implements ApplicationContextAware {
-  
-  // TODO pull up the common behaviour between this class and the SpringEnvironmentContext
-  
-  private static final long serialVersionUID = 1L;
-  
-  ApplicationContext applicationContext;
-  
-  public SpringEnvironment openEnvironment() {
-    return new SpringEnvironment(this);
-  }
-
-  public boolean has(String key) {
-    return applicationContext.isSingleton(key);
-  }
-
-  public Object get(String key) {
-    if (has(key)) {
-      return applicationContext.getBean(key);
-    }
-    return null;
-  }
-
-  public <T> T get(Class<T> type) {
-    String name = ReflectUtil.getUnqualifiedClassName(type);
-    name = name.substring(0, 1).toLowerCase() + name.substring(1);
-    return (T) get(name);
-  }
-
-  public Set<String> keys() {
-    HashSet<String> keys = new HashSet<String>();
-    for (String key : applicationContext.getBeanDefinitionNames()) {
-      if (has(key)) {
-        keys.add(key);
-      }
-    }
-    return keys;
-  }
-  
-  public ApplicationContext getApplicationContext() {
-    return applicationContext;
-  }
-
-  public void setApplicationContext(ApplicationContext applicationContext) {
-    this.applicationContext = applicationContext;
-  }
-
-  
-  public void close() {
-  }
-
-  public String getName() {
-    return null;
-  }
-
-  public Object set(String key, Object value) {
-    return null;
-  }
-}

Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/JbpmTestCase.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/JbpmTestCase.java	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/JbpmTestCase.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -29,6 +29,7 @@
 import org.jbpm.pvm.env.PvmEnvironmentFactory;
 import org.jbpm.pvm.internal.log.Jdk14LogFactory;
 import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.log.LogFormatter;
 
 public abstract class JbpmTestCase extends TestCase {
 
@@ -37,6 +38,7 @@
   }
 
   public void setUp() throws Exception {
+    LogFormatter.resetIndentation();
     log.info("=== starting "+getName()+" =============================");
   }
 

Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/wire.xsd
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/wire.xsd	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/wire.xsd	2008-07-29 13:25:51 UTC (rev 1748)
@@ -827,7 +827,7 @@
   </element>
 
   <element name="transaction-ref">
-    <annotation><documentation>Reference to the org.jbpm.pvm.env.Transaction in the 
+    <annotation><documentation>Reference to the org.jbpm.pvm.api.env.Transaction in the 
     current environment. 
     </documentation></annotation>
   </element>

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/CheckInTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/CheckInTests.java	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/CheckInTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -30,7 +30,7 @@
 public class CheckInTests {
 
   public static Test suite() {
-    TestSuite suite = new TestSuite("Test for org.jbpm");
+    TestSuite suite = new TestSuite("check in tests");
     //$JUnit-BEGIN$
     suite.addTest(NonDbTests.suite());
     suite.addTest(DbTests.suite());

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -24,10 +24,11 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.jbpm.pvm.db.svc.DbSvcTests;
+import org.jbpm.pvm.api.db.svc.DbSvcTests;
+import org.jbpm.pvm.api.spring.SpringTests;
 import org.jbpm.pvm.internal.db.langext.DbLangExtTests;
 import org.jbpm.pvm.internal.db.model.DbModelTests;
-import org.jbpm.pvm.jobexecutor.JobExecutorTests;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutorTests;
 
 
 /**
@@ -36,13 +37,14 @@
 public class DbTests {
 
   public static Test suite() {
-    TestSuite suite = new TestSuite("Test for org.jbpm.pvm");
+    TestSuite suite = new TestSuite("db tests");
     //$JUnit-BEGIN$
     
     suite.addTest(DbLangExtTests.suite());
     suite.addTest(DbModelTests.suite());
     suite.addTest(DbSvcTests.suite());
     suite.addTest(JobExecutorTests.suite());
+    suite.addTest(SpringTests.suite());
     
     //$JUnit-END$
     return suite;

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/NonDbTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/NonDbTests.java	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/NonDbTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -24,8 +24,8 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.jbpm.pvm.api.basicfeatures.PvmClientTests;
-import org.jbpm.pvm.env.EnvironmentTests;
+import org.jbpm.pvm.api.basicfeatures.BasicFeaturesTests;
+import org.jbpm.pvm.api.env.EnvironmentTests;
 import org.jbpm.wire.WireTests;
 
 
@@ -35,10 +35,10 @@
 public class NonDbTests {
 
   public static Test suite() {
-    TestSuite suite = new TestSuite("Test for org.jbpm.pvm");
+    TestSuite suite = new TestSuite("non db tests");
     //$JUnit-BEGIN$
     suite.addTest(EnvironmentTests.suite());
-    suite.addTest(PvmClientTests.suite());
+    suite.addTest(BasicFeaturesTests.suite());
     suite.addTest(WireTests.suite());
     //$JUnit-END$
     return suite;

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicFeaturesTests.java (from rev 1742, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/PvmClientTests.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicFeaturesTests.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicFeaturesTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.api.basicfeatures;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class BasicFeaturesTests {
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite("org.jbpm.pvm.api.basicfeatures");
+    //$JUnit-BEGIN$
+    suite.addTestSuite(BasicExecutionFlowTest.class);
+    suite.addTestSuite(TransitionAsWaitStateTest.class);
+    suite.addTestSuite(TransitionBasedConcurrencyTest.class);
+    suite.addTestSuite(ScopeStateTest.class);
+    suite.addTestSuite(SubProcessTest.class);
+    suite.addTestSuite(ExecutionStateTest.class);
+    suite.addTestSuite(ExceptionHandlerTest.class);
+    suite.addTestSuite(FunctionalActivityTest.class);
+    suite.addTestSuite(ScopeVariableDeclarationTest.class);
+    suite.addTestSuite(LoopingTest.class);
+    suite.addTestSuite(TransitionEventsTest.class);
+    suite.addTestSuite(ExternalDecisionTest.class);
+    suite.addTestSuite(VariableTest.class);
+    suite.addTestSuite(ScopeVariableTest.class);
+    suite.addTestSuite(EventTest.class);
+    suite.addTestSuite(AutomaticDecisionTest.class);
+    suite.addTestSuite(EventPropagationTest.class);
+    //$JUnit-END$
+    return suite;
+  }
+
+}

Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/PvmClientTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/PvmClientTests.java	2008-07-29 12:13:03 UTC (rev 1747)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/PvmClientTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.api.basicfeatures;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * @author Tom Baeyens
- */
-public class PvmClientTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("Test for org.jbpm.pvm.client");
-    //$JUnit-BEGIN$
-    suite.addTestSuite(BasicExecutionFlowTest.class);
-    suite.addTestSuite(TransitionAsWaitStateTest.class);
-    suite.addTestSuite(TransitionBasedConcurrencyTest.class);
-    suite.addTestSuite(ScopeStateTest.class);
-    suite.addTestSuite(SubProcessTest.class);
-    suite.addTestSuite(ExecutionStateTest.class);
-    suite.addTestSuite(ExceptionHandlerTest.class);
-    suite.addTestSuite(FunctionalActivityTest.class);
-    suite.addTestSuite(ScopeVariableDeclarationTest.class);
-    suite.addTestSuite(LoopingTest.class);
-    suite.addTestSuite(TransitionEventsTest.class);
-    suite.addTestSuite(ExternalDecisionTest.class);
-    suite.addTestSuite(VariableTest.class);
-    suite.addTestSuite(ScopeVariableTest.class);
-    suite.addTestSuite(EventTest.class);
-    suite.addTestSuite(AutomaticDecisionTest.class);
-    suite.addTestSuite(EventPropagationTest.class);
-    //$JUnit-END$
-    return suite;
-  }
-
-}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/db/svc)

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/DbSvcTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/db/svc/DbSvcTests.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/DbSvcTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.db.svc;
+package org.jbpm.pvm.api.db.svc;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -31,7 +31,7 @@
 public class DbSvcTests {
 
   public static Test suite() {
-    TestSuite suite = new TestSuite("Test for org.jbpm.pvm.db.svc");
+    TestSuite suite = new TestSuite("org.jbpm.pvm.api.db.svc");
     //$JUnit-BEGIN$
     suite.addTestSuite(ExecutionServiceTest.class);
     suite.addTestSuite(ProcessServiceTest.class);

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/db/svc/ExecutionServiceTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.db.svc;
+package org.jbpm.pvm.api.db.svc;
 
 import java.util.ArrayList;
 import java.util.HashMap;

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/db/svc/ManagementServiceTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.db.svc;
+package org.jbpm.pvm.api.db.svc;
 
 import org.jbpm.pvm.test.base.ServiceTestCase;
 import org.jbpm.pvm.ManagementService;

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/db/svc/ProcessServiceTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.db.svc;
+package org.jbpm.pvm.api.db.svc;
 
 import java.util.ArrayList;
 import java.util.List;

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/env)

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/BasicEnvironmentTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/env/BasicEnvironmentTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/BasicEnvironmentTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.env;
+package org.jbpm.pvm.api.env;
 
 import org.jbpm.pvm.test.base.JbpmTestCase;
 import org.jbpm.pvm.env.Context;

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentClassLoaderTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/env/EnvironmentClassLoaderTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentClassLoaderTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.env;
+package org.jbpm.pvm.api.env;
 
 import org.jbpm.pvm.test.base.JbpmTestCase;
 import org.jbpm.pvm.env.Environment;

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentSearchOrderTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/env/EnvironmentSearchOrderTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentSearchOrderTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.env;
+package org.jbpm.pvm.api.env;
 
 import org.jbpm.pvm.test.base.JbpmTestCase;
 import org.jbpm.pvm.env.Environment;

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/env/EnvironmentTests.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.env;
+package org.jbpm.pvm.api.env;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -31,7 +31,7 @@
 public class EnvironmentTests {
 
   public static Test suite() {
-    TestSuite suite = new TestSuite("Test for org.jbpm.pvm.env");
+    TestSuite suite = new TestSuite("org.jbpm.pvm.api.env");
     //$JUnit-BEGIN$
     suite.addTestSuite(EnvironmentTypeLookupTest.class);
     suite.addTestSuite(NestedEnvironmentTest.class);

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentTypeLookupTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/env/EnvironmentTypeLookupTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/EnvironmentTypeLookupTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.env;
+package org.jbpm.pvm.api.env;
 
 import org.jbpm.pvm.test.base.JbpmTestCase;
 import org.jbpm.pvm.env.Environment;

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/NestedEnvironmentTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/env/NestedEnvironmentTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/env/NestedEnvironmentTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.env;
+package org.jbpm.pvm.api.env;
 
 import org.jbpm.pvm.test.base.JbpmTestCase;
 import org.jbpm.pvm.env.Environment;

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/spring)


Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/spring/SpringTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.spring;
+package org.jbpm.pvm.api.spring;
 
 import org.hibernate.Session;
 import org.jbpm.pvm.test.base.JbpmTestCase;
@@ -36,7 +36,7 @@
 public class SpringTest extends JbpmTestCase {
 
   public void testOne() {
-    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/jbpm/pvm/spring/spring.beans.xml");
+    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/jbpm/pvm/api/spring/spring.beans.xml");
     EnvironmentFactory environmentFactory = (EnvironmentFactory) applicationContext.getBean("environmentFactory");
     
     CommandService commandService = environmentFactory.get(CommandService.class);

Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring/SpringTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring/SpringTests.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/spring/SpringTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.api.spring;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SpringTests {
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite("org.jbpm.pvm.api.spring");
+    //$JUnit-BEGIN$
+    suite.addTestSuite(SpringTest.class);
+    //$JUnit-END$
+    return suite;
+  }
+
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/expr)


Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/ExpressionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/expr/ExpressionTest.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/ExpressionTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.expr;
-
-import javax.el.ExpressionFactory;
-
-import org.jbpm.pvm.samples.activities.WaitState;
-import org.jbpm.pvm.test.base.JbpmTestCase;
-import org.jbpm.pvm.client.ClientProcessInstance;
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.model.ProcessFactory;
-
-
-/**
- * @author Tom Baeyens
- * @author Pascal Verdage
- */
-public class ExpressionTest extends JbpmTestCase
-{
-  
-  public void testExpressionManagerParsing() {
-    EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
-        "<contexts>" +
-        "  <environment-factory>" +
-        "    <script-manager default-expression-language='juel'" +
-        "                    default-script-language='juel'" +
-        "                    read-contexts='execution, environment, environment-factory' " +
-        "                    write-context='execution'>" +
-        "      <script-language name='juel' factory='com.sun.script.juel.JuelScriptEngineFactory' />" +
-//        "      <script-language name='groovy' factory='com.sun.script.groovy.GroovyScriptEngineFactory' />" +
-        "    </script-manager>" +
-        "  </environment-factory>" +
-        "</contexts>"
-    );
-
-    ScriptManager scriptManager = environmentFactory.get(ScriptManager.class);
-    ClientProcessInstance execution =
-      ProcessFactory.build()
-        .node("unused").initial().behaviour(WaitState.class)
-      .done().beginProcessInstance();
-    execution.setVariable("pv", "hello");
-    Environment environment = environmentFactory.openEnvironment();
-    try {
-      assertEquals("hello", scriptManager.evaluateExpression("#{pv}", execution, null));
-      // assertEquals("hello", scriptManager.evaluateExpression("pv", execution, "groovy"));
-    } finally {
-      environment.close();
-    }
-  }
-}

Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.expr;
+
+import org.jbpm.pvm.client.ClientProcessInstance;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.env.PvmEnvironmentFactory;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.samples.activities.WaitState;
+import org.jbpm.pvm.test.base.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroovyExpressionTest extends JbpmTestCase {
+
+  public void testGroovyExpression() {
+    EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+        "<contexts>" +
+        "  <environment-factory>" +
+        "    <script-manager default-expression-language='juel'" +
+        "                    default-script-language='juel'" +
+        "                    read-contexts='execution, environment, environment-factory' " +
+        "                    write-context='execution'>" +
+        "      <script-language name='groovy' factory='com.sun.script.groovy.GroovyScriptEngineFactory' />" +
+        "    </script-manager>" +
+        "  </environment-factory>" +
+        "</contexts>"
+    );
+
+    ScriptManager scriptManager = environmentFactory.get(ScriptManager.class);
+    
+    ClientProcessInstance execution = ProcessFactory.build()
+      .node("unused").initial().behaviour(WaitState.class)
+    .done().beginProcessInstance();
+    
+    execution.setVariable("pv", "hello");
+    
+    Environment environment = environmentFactory.openEnvironment();
+    try {
+      assertEquals("hello", scriptManager.evaluateExpression("pv", execution, "groovy"));
+    } finally {
+      environment.close();
+    }
+  }
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/expr/ExpressionTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.expr;
+
+import org.jbpm.pvm.client.ClientProcessInstance;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.env.PvmEnvironmentFactory;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.samples.activities.WaitState;
+import org.jbpm.pvm.test.base.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JuelExpressionTest extends JbpmTestCase {
+  
+  public void testJuelExpression() {
+    EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+        "<contexts>" +
+        "  <environment-factory>" +
+        "    <script-manager default-expression-language='juel'" +
+        "                    default-script-language='juel'" +
+        "                    read-contexts='execution, environment, environment-factory' " +
+        "                    write-context='execution'>" +
+        "      <script-language name='juel' factory='com.sun.script.juel.JuelScriptEngineFactory' />" +
+        "    </script-manager>" +
+        "  </environment-factory>" +
+        "</contexts>"
+    );
+
+    ScriptManager scriptManager = environmentFactory.get(ScriptManager.class);
+    
+    ClientProcessInstance execution = ProcessFactory.build()
+      .node("unused").initial().behaviour(WaitState.class)
+    .done().beginProcessInstance();
+    
+    execution.setVariable("pv", "hello");
+    
+    Environment environment = environmentFactory.openEnvironment();
+    try {
+      assertEquals("hello", scriptManager.evaluateExpression("#{pv}", execution, null));
+    } finally {
+      environment.close();
+    }
+  }
+}


Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/ExclusiveTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.jobexecutor;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.model.OpenExecution;
+import org.jbpm.pvm.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveTestMessage extends MessageImpl<Object> {
+
+  private static final long serialVersionUID = 1L;
+  private static final Log log = Log.getLog(ExclusiveTestMessage.class.getName());
+  static Random random = new Random();
+
+  public ExclusiveTestMessage() {
+  }
+
+  public ExclusiveTestMessage(OpenExecution execution) {
+    this.execution = (ExecutionImpl) execution;
+    this.processInstance = (ExecutionImpl) execution.getProcessInstance();
+    this.isExclusive = true;
+  }
+
+  public Object execute(Environment environment) throws Exception {
+    Long threadId = Thread.currentThread().getId();
+    String executionKey = execution.getKey();
+
+    // exclusiveMessageIds maps execution keys to a set of thread ids.
+    // the idea is that for each execution, all the exclusive jobs will 
+    // be executed by 1 thread sequentially.  
+    
+    // in the end, each set should contain exactly 1 element  
+    Map<String, Set<Long>> exclusiveThreadIds = (Map<String, Set<Long>>) environment.get("exclusiveThreadIds");
+    Set<Long> groupMessages = exclusiveThreadIds.get(executionKey);
+    if (groupMessages==null) {
+      groupMessages = new HashSet<Long>();
+      exclusiveThreadIds.put(executionKey, groupMessages);
+    }
+    groupMessages.add(threadId);
+    
+    // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
+    int workTime = random.nextInt(150);
+    log.debug("executing exclusive message for "+execution+".  this is going to take "+workTime+"ms");
+    try {
+      Thread.sleep(workTime);
+    } catch (RuntimeException e) {
+      log.debug("sleeping was interrupted");
+    }
+    
+    DbSession dbSession = environment.get(DbSession.class);
+    dbSession.delete(this);
+    
+    return null;
+  }
+
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailOnceTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.jobexecutor;
+
+import java.util.List;
+
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.model.Comment;
+import org.jbpm.pvm.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FailOnceTestMessage extends MessageImpl<Object> {
+
+  private static final long serialVersionUID = 1L;
+  private static final Log log = Log.getLog(FailOnceTestMessage.class.getName());
+  
+  int messageId;
+  
+  public FailOnceTestMessage() {
+  }
+
+  public FailOnceTestMessage(int messageId) {
+    this.messageId = messageId;
+  }
+
+  public Object execute(Environment environment) throws Exception {
+    DbSession dbSession = environment.get(DbSession.class);
+
+    // this message execution should be rolled back
+    Comment comment = new CommentImpl(Integer.toString(messageId));
+    dbSession.save(comment);
+
+    dbSession.delete(this);
+
+    List<Integer> failOnceMessageIds = (List) environment.get("failOnceMessageIds");
+    if (!failOnceMessageIds.contains(messageId)) {
+      // registering the failed message in a non-transactional resource
+      // so the messageId will still be added even after the transaction has rolled back
+      log.debug("adding failonce message "+messageId);
+      failOnceMessageIds.add(messageId);
+      
+      throw new RuntimeException("failing once"); 
+    }
+
+    log.debug("message "+messageId+" now succeeds");
+
+    return null;
+  }
+
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailingTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.jobexecutor;
+
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.model.Comment;
+import org.jbpm.pvm.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FailingTestMessage extends MessageImpl<Object> {
+
+  private static final long serialVersionUID = 1L;
+
+  public Object execute(Environment environment) throws Exception {
+    DbSession dbSession = environment.get(DbSession.class);
+    
+    // this message execution should be rolled back
+    Comment comment = new CommentImpl("failing update");
+    dbSession.save(comment);
+    
+    dbSession.delete(this);
+    
+    throw new RuntimeException("ooops"); 
+  }
+
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,361 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.jobexecutor;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.hibernate.Session;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestCase;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.client.ClientProcessInstance;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.Transaction;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.job.Job;
+import org.jbpm.pvm.model.Comment;
+import org.jbpm.pvm.session.MessageSession;
+import org.jbpm.pvm.session.PvmDbSession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JobExecutorTest extends EnvironmentFactoryTestCase {
+  
+  private static final Log log = Log.getLog(JobExecutorTest.class.getName());
+
+  /**
+   * test the case where the jobExecutor is start and shortly after stopped.
+   * It can appears for example in other tests with auto-start activated
+   * if the test is too short.
+   * 
+   * The jobExecutor is registered as active when the run method is invoked.
+   * It happens only after a system context switching. If the jobExecutor is
+   * stopped before that, it won't really be stopped because it has not been
+   * started yet.
+   */
+  public void testImmediateJobExecutorShutdown() throws InterruptedException {
+
+    // if the test fail, there can be a live lock
+    // install a timer that will interrupt if it takes too long
+    // if that happens, it will lead to an interrupted exception and the test will fail
+    final Thread testThread = Thread.currentThread();
+    TimerTask interruptTask = new TimerTask() {
+      public void run() {
+        log.debug("test "+getName()+" took too long. going to interrupt..."+testThread);
+        testThread.interrupt();
+      }
+    };
+    Timer timer = new Timer();
+    timer.schedule(interruptTask, 10000);
+    
+    final JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+    jobExecutor.setIdleInterval(1000);
+    assertFalse(jobExecutor.isActive());
+    jobExecutor.start();
+    jobExecutor.stop();
+    Thread.sleep(800);
+    assertFalse(jobExecutor.isActive());
+  }
+
+  public void testSuccessfulMessageProcessing() {
+    int nbrOfTestMessages = 5;
+    int testTimeoutMillis = 10000;
+    int checkInterval = 500;
+    
+    List<Integer> processedMessageIds = (List<Integer>) getEnvironmentFactory().get("processedMessageIds");
+    processedMessageIds.clear();
+
+    JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+    jobExecutor.start();
+    try {
+      insertTestMessages(nbrOfTestMessages);
+      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+    } finally {
+      jobExecutor.stop(true);
+    }
+
+    for (int i=0; i<nbrOfTestMessages; i++) {
+      assertTrue("message "+i+" is not processed", processedMessageIds.contains(i));
+    }
+  }
+
+  public void testMessagesPresentUponJobExecutorStartUp() {
+    int nbrOfTestMessages = 2;
+    int testTimeoutMillis = 5000;
+    int checkInterval = 400;
+    
+    insertTestMessages(nbrOfTestMessages);
+
+    List<Integer> processedMessageIds = (List<Integer>) getEnvironmentFactory().get("processedMessageIds");
+    processedMessageIds.clear();
+    
+    JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+    jobExecutor.start();
+    try {
+      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+    } finally {
+      jobExecutor.stop(true);
+    }
+
+    for (int i=0; i<nbrOfTestMessages; i++) {
+      assertTrue("message "+i+" is not processed", processedMessageIds.contains(i));
+    }
+  }
+
+  public void testExclusiveMessageProcessing() {
+    int testTimeoutMillis = 10000;
+    int checkInterval = 500;
+    int nbrOfTestMessagesPerExecution = 5;
+    int nbrOfTestExecutions = 1;
+
+    insertExclusiveTestMessages(nbrOfTestExecutions, nbrOfTestMessagesPerExecution);
+
+    JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+    jobExecutor.start();
+    try {
+      
+      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+    } finally {
+      jobExecutor.stop(true);
+    }
+
+    
+    Environment environment = getEnvironmentFactory().openEnvironment();
+    try {
+      // exclusiveMessageIds maps execution keys to a set of thread ids.
+      // the idea is that for each execution, all the exclusive jobs will 
+      // be executed by 1 thread sequentially.  
+      
+      // in the end, each set should contain exactly 1 element  
+      Map<String, Set<Long>> exclusiveThreadIds = (Map) environment.get("exclusiveThreadIds");
+
+      for (int i=0; i<nbrOfTestExecutions; i++) {
+        String executionKey = "execution-"+i;
+        Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
+        assertNotNull("no thread id set for "+executionKey+" in: "+exclusiveThreadIds, threadIds);
+        assertEquals("exclusive messages for "+executionKey+" have been executed by multiple threads: "+threadIds, 
+                     1, 
+                     threadIds.size());
+      }
+    } finally {
+      environment.close();
+    }
+    
+  }
+
+  public void testFailOnceMessages() {
+    int nbrOfTestMessages = 7;
+    int testTimeoutMillis = 10000;
+    int checkInterval = 500;
+    
+    List<Integer> failOnceMessageIds = (List<Integer>) getEnvironmentFactory().get("failOnceMessageIds");
+    failOnceMessageIds.clear();
+
+    JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+    jobExecutor.start();
+    try {
+      insertFailOnceTestMessages(nbrOfTestMessages);
+      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+    } finally {
+      jobExecutor.stop(true);
+    }
+
+    for (int i=0; i<nbrOfTestMessages; i++) {
+      assertTrue("message "+i+" is not failed once: "+failOnceMessageIds, failOnceMessageIds.contains(i));
+    }
+    assertEquals(nbrOfTestMessages, failOnceMessageIds.size());
+    
+    Environment environment = getEnvironmentFactory().openEnvironment();
+    try {
+      Session session = environment.get(Session.class);
+      List<Comment> comments = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
+      
+      for (Comment comment: comments) {
+        Integer messageId = new Integer(comment.getMessage());
+        assertTrue("message "+messageId+" committed twice", failOnceMessageIds.remove(messageId));
+        // clean up for next tests
+        session.delete(comment);
+      }
+
+      assertTrue("not all messages made a successful commit: "+failOnceMessageIds, failOnceMessageIds.isEmpty());
+    } finally {
+      environment.close();
+    }
+  }
+
+  public void testFailedMessageProcessing() {
+    int testTimeoutMillis = 3000;
+    int checkInterval = 400;
+
+    JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+    jobExecutor.start();
+    try {
+      Environment environment = getEnvironmentFactory().openEnvironment();
+      try {
+        MessageSession messageSession = environment.get(MessageSession.class);
+        messageSession.send(new FailingTestMessage());
+      } finally {
+        environment.close();
+      }
+      
+      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+    } finally {
+      jobExecutor.stop(true);
+    }
+    
+    Environment environment = getEnvironmentFactory().openEnvironment();
+    try {
+      PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+      List<Job> deadJobs = pvmDbSession.findDeadJobs();
+      assertEquals("there should be one dead jobImpl", 1, deadJobs.size());
+
+      Session session = environment.get(Session.class);
+      List commands = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
+      assertTrue("command insertion should have been rolled back", commands.isEmpty());
+    } finally {
+      environment.close();
+    }
+  }
+
+  // helper methods ///////////////////////////////////////////////////////////
+
+  void insertTestMessages(int nbrOfTestMessages) {
+    Environment environment = getEnvironmentFactory().openEnvironment();
+    try {
+      MessageSession messageSession = environment.get(MessageSession.class);
+      for (int i=0; i<nbrOfTestMessages; i++) {
+        TestMessage testMessage = new TestMessage(i);
+        messageSession.send(testMessage);
+      }
+    } catch (RuntimeException e) {
+      environment.get(Transaction.class).setRollbackOnly();
+      throw e;
+    } finally {
+      environment.close();
+    }
+  }
+
+  void insertExclusiveTestMessages(int nbrOfTestExecutions, int nbrOfTestMessagesPerExecution) {
+    Environment environment = getEnvironmentFactory().openEnvironment();
+    try {
+      PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+      ClientProcessDefinition processDefinition = new ProcessDefinitionImpl();
+      pvmDbSession.save(processDefinition);
+      
+      MessageSession messageSession = environment.get(MessageSession.class);
+      for (int i=0; i<nbrOfTestExecutions; i++) {
+        ClientProcessInstance execution = processDefinition.beginProcessInstance("execution-"+i);
+        pvmDbSession.save(execution);
+        
+        for (int j=0; j<nbrOfTestMessagesPerExecution; j++) {
+          
+          ExclusiveTestMessage testMessage = new ExclusiveTestMessage(execution);
+          messageSession.send(testMessage);
+        }
+      }
+    } catch (RuntimeException e) {
+      environment.get(Transaction.class).setRollbackOnly();
+      throw e;
+    } finally {
+      environment.close();
+    }
+  }
+
+  void insertFailOnceTestMessages(int nbrOfTestMessages) {
+    Environment environment = getEnvironmentFactory().openEnvironment();
+    try {
+      MessageSession messageSession = environment.get(MessageSession.class);
+      for (int i=0; i<nbrOfTestMessages; i++) {
+        FailOnceTestMessage testMessage = new FailOnceTestMessage(i);
+        messageSession.send(testMessage);
+      }
+    } catch (RuntimeException e) {
+      environment.get(Transaction.class).setRollbackOnly();
+      throw e;
+    } finally {
+      environment.close();
+    }
+  }
+
+
+  private void waitTillNoMoreMessages(JobExecutor jobExecutor, int maxWait, int checkInterval) {
+
+    // install a timer that will interrupt if it takes too long
+    // if that happens, it will lead to an interrupted exception and the test will fail
+    TimerTask interruptTask = new TimerTask() {
+      Thread testThread = Thread.currentThread();
+      public void run() {
+        log.debug("test "+getName()+" took too long. going to interrupt..."+testThread);
+        testThread.interrupt();
+      }
+    };
+    Timer timer = new Timer();
+    timer.schedule(interruptTask, maxWait);
+    
+    try {
+      boolean jobsAvailable = true;
+      while (jobsAvailable) {
+        log.debug("going to sleep for "+checkInterval+" millis, waiting for the jobImpl executor to process more jobs");
+        Thread.sleep(checkInterval);
+        jobsAvailable = areJobsAvailable();
+      }
+      
+    } catch (InterruptedException e) {
+      fail("test execution exceeded treshold of "+maxWait+" milliseconds");
+    } finally {
+      timer.cancel();
+    }
+  }
+
+  boolean areJobsAvailable() {
+    Environment environment = getEnvironmentFactory().openEnvironment();
+    try {
+      JobDbSession jobDbSession = environment.get(JobDbSession.class);
+      
+      JobImpl<?> firstAcquirableJob = jobDbSession.findFirstAcquirableJob();
+      if (firstAcquirableJob!=null) {
+        log.debug("found more jobs to process");
+        return true;
+      }
+    } catch (RuntimeException e) {
+      environment.get(Transaction.class).setRollbackOnly();
+      throw e;
+    } finally {
+      environment.close();
+    }
+    log.debug("no more jobs to process");
+    return false;
+  }
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTests.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -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.pvm.internal.jobexecutor;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JobExecutorTests {
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite("Test for org.jbpm.pvm.jobexecutor");
+    //$JUnit-BEGIN$
+    suite.addTestSuite(JobExecutorTimerSessionTest.class);
+    suite.addTestSuite(JobExecutorTest.class);
+    //$JUnit-END$
+    return suite;
+  }
+
+}


Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTimerSessionTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,398 @@
+/**
+ * Copyright (C) 2007  Bull S. A. S.
+ * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
+ * This library 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
+ * version 2.1 of the License.
+ * This library 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
+ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA  02110-1301, USA.
+ **/
+package org.jbpm.pvm.internal.jobexecutor;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jbpm.pvm.test.base.DbTestCase;
+import org.jbpm.pvm.PvmException;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.job.TimerImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.job.Job;
+import org.jbpm.pvm.job.Timer;
+import org.jbpm.pvm.session.PvmDbSession;
+import org.jbpm.pvm.session.TimerSession;
+
+/**
+ * @author Pascal Verdage
+ */
+public class JobExecutorTimerSessionTest extends DbTestCase
+{
+
+  public void setUp() throws Exception {
+    super.setUp();
+    getVariables().clear();
+    // launch jobExecutor
+    Environment.getCurrent().get(JobExecutor.class).setIdleInterval(500000);
+    Environment.getCurrent().get(JobExecutor.class).start();
+  }
+ 
+  public void tearDown() throws Exception {
+    Environment.getCurrent().get(JobExecutor.class).stop();
+    super.tearDown();
+  }
+
+  /* GETTERS */
+  @SuppressWarnings("unchecked")
+  public static Map<String, Integer> getVariables() {
+    return (Map<String, Integer>) Environment.getCurrent()
+      .getEnvironmentFactory().get("timerVariables");
+  }
+
+  /** get TimerSession if an environment is open */
+  protected static TimerSession getTimerSession() {
+    assertNotNull(Environment.getCurrent());
+    return Environment.getCurrent().get(TimerSession.class);
+  }
+
+  /** get JobDbSession if an environment is open */
+  protected static JobDbSession getJobDbSession() {
+    assertNotNull(Environment.getCurrent());
+    return Environment.getCurrent().get(JobDbSession.class);
+  }
+
+  /** get PvmDbSession if an environment is open */
+  protected static PvmDbSession getPvmDbSession() {
+    assertNotNull(Environment.getCurrent());
+    return Environment.getCurrent().get(PvmDbSession.class);
+  }
+
+  /* Test assertion tools */
+  /** return the number of timers among active jobs */
+  private static int getNbTimer() {
+    int result = 0;
+    List<Timer> timers = getPvmDbSession().findTimers();
+    if (timers != null) {
+      for (Job job : timers) {
+        if (job instanceof TimerImpl) {
+          result++;
+        }
+      }
+    }
+  //    List<JobImpl<?>> deadJobs = getPvmDbSession().findAllJobs();
+  //    if (deadJobs != null) {
+  //      for (JobImpl<?> jobImpl : deadJobs) {
+  //        if (jobImpl instanceof TimerImpl) {
+  //          result++;
+  //        }
+  //      }
+  //    }
+    return result;
+  }
+  
+  private static int TIMEOUT = 60 * 1000; // 1 minutes
+
+  /** This method change the transaction */
+  protected void waitUntilNbTimerEquals(int expected) {
+    int rate = 500; // check every rate millis
+    int result = Integer.MAX_VALUE;
+
+    for (int i = 0; i < TIMEOUT / rate; i++) {
+      try {
+        Thread.sleep(rate);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+        fail();
+      }
+      newTransaction();
+      result = getNbTimer();
+      if (result == expected) {
+        break;
+      }
+    }
+    // if false, then the timeout occurred
+    assertEquals(expected, result);
+  }
+
+  protected static void assertNbTimersEquals(int expected) {
+    assertEquals(expected, getNbTimer());
+  }
+
+  /* TimerImpl manipulation tools */
+  
+  /** @return the first due timer or null if none */
+  protected TimerImpl findFirstDueTimer() {
+    TimerImpl result = null;
+    JobImpl<?> firstJob = getJobDbSession().findFirstDueJob();
+    if (firstJob instanceof TimerImpl) {
+      result = (TimerImpl) firstJob;
+    } else {
+      List<Timer> timers = getPvmDbSession().findTimers();
+      if (timers != null) {
+        Date dueDate = new Date(Long.MAX_VALUE);
+        for (Timer timer : timers) {
+          if (timer instanceof TimerImpl && timer.getDueDate().before(dueDate)) {
+            dueDate = timer.getDueDate();
+            result = (TimerImpl) timer;
+          }
+        }
+      }
+    }
+    return result;
+  }
+
+  /** create a timer that should not be executed */
+  private TimerImpl createForbiddenTimer(String name, long delay) {
+    return new TestTimer(name, delay, 0);
+  }
+  /** create a timer that should be executed once */
+  private TimerImpl createTimer(String name, Date dueDate) {
+    return new TestTimer(name, dueDate, 1);
+  }
+  /** create a timer that should be executed once */
+  private TimerImpl createTimer(String name, long delay) {
+    return new TestTimer(name, delay, 1);
+  }
+  /** create a timer that should be executed nbExecution times */
+  private TimerImpl createTimer(String name, long delay, long repeatDelay, int nbExecution) {
+    TimerImpl timerImpl = new TestTimer(name, delay, nbExecution);
+    timerImpl.setRepeat(Long.toString(repeatDelay) + " millis");
+    return timerImpl;
+  }
+  
+  /* Functionnal tests */
+
+  /** Test all use cases that should throw PvmException for method schedule */
+  public void testScheduleIllegalArgument() {
+    TimerSession timerSession = getTimerSession();
+    TimerImpl timerImpl;
+
+    // null TimerImpl
+    try {
+      timerSession.schedule(null);
+      fail("Should not happen");
+    } catch (PvmException e) {
+      assertTextPresent("null timer", e.getMessage());
+    }
+
+    // no execution
+    try {
+      timerImpl = new TimerImpl();
+      timerSession.schedule(timerImpl);
+      // clean before failure
+      timerSession.cancel(timerImpl);
+      fail("Should not happen");
+    } catch (PvmException e) {
+      assertTextPresent("no execution", e.getMessage());
+    }
+    
+    ExecutionImpl execution = new ExecutionImpl();
+    
+    // no signal or event
+    try {
+      timerImpl = new TimerImpl();
+      timerImpl.setExecution(execution);
+      timerSession.schedule(timerImpl);
+      // clean before failure
+      timerSession.cancel(timerImpl);
+      fail("Should not happen");
+    } catch (PvmException e) {
+      assertTextPresent("no signalName or eventName", e.getMessage());
+    }
+
+    // a signalName with no activityInstance to signal is valid
+
+    // null dueDate
+    try {
+      timerImpl = createTimer("schedule error 1", null);
+      timerImpl.setExecution(execution);
+
+      timerImpl.setSignalName("timeout");
+      timerSession.schedule(timerImpl);
+      // clean before failure
+      timerSession.cancel(timerImpl);
+      fail("Should not happen");
+    } catch (PvmException e) {
+      assertTextPresent("null date", e.getMessage());
+    }
+
+    // date.getTime() negative
+    try {
+      timerImpl = createTimer("schedule error 2", new Date(-10));
+      timerImpl.setExecution(execution);
+
+      timerImpl.setSignalName("timeout");
+      timerSession.schedule(timerImpl);
+      // clean before failure
+      timerSession.cancel(timerImpl);
+      fail("Should not happen");
+    } catch (PvmException e) {
+      assertTextPresent("negative date", e.getMessage());
+    }
+  }
+ 
+  /** Test the method cancel */
+  public void testCancel() {
+    TimerSession timerSession;
+    TimerImpl timerImpl;
+
+    // null jobImpl
+    try {
+      getTimerSession().cancel(null);
+      fail();
+    } catch (PvmException e) {
+      // OK
+    }
+
+    // non scheduled jobImpl
+    timerSession = getTimerSession();
+    timerImpl = createForbiddenTimer("cancel 1", 500);
+    timerSession.cancel(timerImpl);
+    assertNbTimersEquals(0);
+
+    // scheduled non-executed jobImpl
+    ExecutionImpl execution = new ExecutionImpl();
+    getPvmDbSession().save(execution);
+    
+    timerSession = getTimerSession();
+    timerImpl = createForbiddenTimer("cancel 2", 500);
+    timerImpl.setSignalName("timeout");
+    timerImpl.setExecution(execution);
+
+    timerSession.schedule(timerImpl);
+    newTransaction();
+    assertNbTimersEquals(1);
+    timerSession = getTimerSession();
+    timerSession.cancel(findFirstDueTimer());
+    
+    newTransaction();
+    assertNbTimersEquals(0);
+
+    execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+    getPvmDbSession().delete(execution);
+    
+    /* 
+     * scheduled jobImpl with repeat
+     * This is not necessary because in the test, a timer scheduled with
+     * a repeat will be deleted by the instance. So this case is covered
+     * by the test testScheduleRepeatDelay
+     */
+  }
+
+  /** Schedule a jobImpl in the past */
+  public void testSchedulePastJob() {
+    ExecutionImpl execution = new ExecutionImpl();
+    execution = reload(execution);
+    try {
+      TimerImpl timerImpl = createTimer("schedule past jobImpl", -500);
+      timerImpl.setExecution(execution);
+      timerImpl.setEventName("timeout");
+      getTimerSession().schedule(timerImpl);
+      assertNbTimersEquals(1);
+      newTransaction();
+      waitUntilNbTimerEquals(0);
+    } finally {
+      execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+      getPvmDbSession().delete(execution);
+      newTransaction();
+    }
+  }
+
+  /** Schedule a jobImpl in the future */
+  public void testScheduleFutureJob() {
+    ExecutionImpl execution = new ExecutionImpl();
+    execution = reload(execution);
+    try {
+      TimerImpl timerImpl = createTimer("schedule future jobImpl", 500);
+      timerImpl.setExecution(execution);
+      timerImpl.setEventName("timeout");
+      getTimerSession().schedule(timerImpl);
+      assertNbTimersEquals(1);
+      newTransaction();
+      waitUntilNbTimerEquals(0);
+    } finally {
+      execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+      getPvmDbSession().delete(execution);
+      newTransaction();
+    }
+  }
+
+  /** Test the method schedule with a repeated jobImpl */
+  public void testScheduleRepeatDelay() {
+    ExecutionImpl execution = new ExecutionImpl();
+    execution = reload(execution);
+    try {
+      TimerImpl timerImpl = createTimer("schedule repeat delay", 200, 400, 3);
+      timerImpl.setExecution(execution);
+      timerImpl.setEventName("timeout");
+      getTimerSession().schedule(timerImpl);
+      assertNbTimersEquals(1);
+      newTransaction();
+      waitUntilNbTimerEquals(0);
+    } finally {
+      execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+      getPvmDbSession().delete(execution);
+      newTransaction();
+    }
+  }
+
+  
+  /* Concurrent tests */
+  
+  /** create a timer that should be executed once and increment a variable */
+  private TimerImpl createIncrementingTimer(String name, Date dueDate, String variable) {
+    TestTimer timer = new TestTimer(name, dueDate, 1);
+    timer.setVariableName(variable);
+    timer.setEventName("incrementation");
+    return timer;
+  }
+
+  private void testManyTimers(int nbTimer, long delayBetweenTimers) {
+    ExecutionImpl execution = new ExecutionImpl();
+    execution = reload(execution);
+    try {
+      long startTime = System.currentTimeMillis();
+      for (int i=0; i<nbTimer; i++) {
+        Date dueDate = new Date(startTime + 1000 + i*delayBetweenTimers);
+        String name = "timer " + i;
+        TimerImpl timerImpl = createIncrementingTimer(name, dueDate, name);
+        timerImpl.setExecution(execution);
+        getTimerSession().schedule(timerImpl);
+      }
+  
+      newTransaction();
+      assertNbTimersEquals(nbTimer);
+      waitUntilNbTimerEquals(0);
+      int sum = 0;
+      Map<String, Integer> variables = getVariables();
+      if (variables != null) {
+        for (Entry<String, Integer> variable : variables.entrySet()) {
+          assertEquals(variable.getKey(), 1, (int)variable.getValue());
+          sum += variable.getValue();
+        }
+      }
+      assertEquals(nbTimer, sum);
+    } finally {
+      execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+      getPvmDbSession().delete(execution);
+      newTransaction();
+    }    
+  }
+
+  public void testSeveralTimer() {
+    testManyTimers(20, 100);
+  }
+
+  public void testSimultaneousTimer() {
+    testManyTimers(20, 0);
+  }
+  
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.jobexecutor;
+
+import java.util.List;
+import java.util.Random;
+
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.session.DbSession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TestMessage extends MessageImpl<Object> {
+  
+  private static final long serialVersionUID = 1L;
+  private static final Log log = Log.getLog(TestMessage.class.getName());
+  static Random random = new Random();
+  
+  int messageId;
+  
+  public TestMessage() {
+  }
+
+  public TestMessage(int messageId) {
+    this.messageId = messageId;
+  }
+
+  public Object execute(Environment environment) throws Exception {
+    List<Integer> messageNumberCollector = (List<Integer>) environment.get("processedMessageIds");
+    messageNumberCollector.add(messageId);
+    
+    // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
+    int workTime = random.nextInt(150);
+    log.debug("executing test message "+messageId+".  this is going to take "+workTime+"ms");
+    try {
+      Thread.sleep(workTime);
+    } catch (RuntimeException e) {
+      log.debug("sleeping was interrupted");
+    }
+    
+    DbSession dbSession = environment.get(DbSession.class);
+    dbSession.delete(this);
+    return null;
+  }
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestTimer.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java	                        (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.jobexecutor;
+
+import java.util.Date;
+import java.util.Map;
+
+import org.jbpm.pvm.test.base.JbpmTestCase;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.job.TimerImpl;
+import org.jbpm.pvm.session.TimerSession;
+
+/**
+ * @author Tom Baeyens
+ * @author Pascal Verdage
+ */
+public class TestTimer extends TimerImpl {
+  private static final long serialVersionUID = 1L;
+
+  private String name;
+  private int nbMaxExecution;
+  // used to increment a variable
+  private String variableName;
+
+  private int nbExecution = 0;
+
+  protected TestTimer() {}
+
+  public TestTimer(String name, long delay, int nbMaxExecution) {
+    this(name, new Date(System.currentTimeMillis() + delay), nbMaxExecution);
+  }
+
+  public TestTimer(String name, Date dueDate, int nbMaxExecution) {
+    this.name = name;
+    this.dueDate = dueDate;
+    this.nbMaxExecution = nbMaxExecution;
+  }
+  
+  public Boolean execute(Environment environment) throws Exception {
+    Date now = new Date();
+    JbpmTestCase.assertTrue(name+" is executing too soon", now.after(dueDate));
+    nbExecution++;
+    JbpmTestCase.assertTrue(name+" should not be executed",
+        nbExecution <= nbMaxExecution);
+    
+    if (variableName != null) {
+      Map<String, Integer> variables =
+        JobExecutorTimerSessionTest.getVariables();
+      if (variables != null) {
+        Integer n = variables.get(variableName);
+        if (n == null) {
+          n = 0;
+        }
+        n++;
+        variables.put(variableName, n);
+      }
+    }
+    
+    // reschedule if necessary
+    boolean deleteThisJob = super.execute(environment);
+    
+    // cancel the timer if necessary
+    if (nbExecution == nbMaxExecution) {
+      JbpmTestCase.assertNotNull(Environment.getCurrent());
+      TimerSession timerSession = Environment.getCurrent().get(TimerSession.class);
+      JbpmTestCase.assertNotNull(timerSession);
+      timerSession.cancel(this);
+    }
+      
+    return deleteThisJob;
+  }
+  
+  public void setVariableName(String variableName) {
+    this.variableName = variableName;
+  }
+}

Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/cron (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron)

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/cron/CronExpression.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/CronExpression.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/cron/CronExpression.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -1,4 +1,4 @@
-package org.jbpm.pvm.jobexecutor.cron;
+package org.jbpm.pvm.internal.jobexecutor.cron;
 
 import java.io.Serializable;
 import java.text.ParseException;

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/cron/CronTrigger.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/CronTrigger.java	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/cron/CronTrigger.java	2008-07-29 13:25:51 UTC (rev 1748)
@@ -18,7 +18,7 @@
 /*
  * Previously Copyright (c) 2001-2004 James House
  */
-package org.jbpm.pvm.jobexecutor.cron;
+package org.jbpm.pvm.internal.jobexecutor.cron;
 
 import java.text.ParseException;
 import java.util.Calendar;

Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/svc (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/db/svc)

Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/spring (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/spring)


Property changes on: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/spring
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/spring/spring.beans.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/spring/spring.beans.xml	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/spring/spring.beans.xml	2008-07-29 13:25:51 UTC (rev 1748)
@@ -28,7 +28,7 @@
   </bean>
 
   <bean id="environmentFactory" 
-        class="org.jbpm.pvm.internal.spring.SpringEnvironmentFactory"
+        class="org.jbpm.pvm.env.SpringEnvironmentFactory"
         scope="singleton" />
 
   <bean id="sessionFactory" 

Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/jobexecutor (from rev 1741, jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor)

Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/jobexecutor/environment.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/environment.cfg.xml	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/jobexecutor/environment.cfg.xml	2008-07-29 13:25:51 UTC (rev 1748)
@@ -12,7 +12,7 @@
     <hibernate-configuration>
       <properties resource="hibernate.properties" />
       <mappings resource="org/jbpm/pvm/pvm.hibernate.mappings.xml" />
-      <mapping resource="org/jbpm/pvm/jobexecutor/mappings.hbm.xml" />
+      <mapping resource="org/jbpm/pvm/internal/jobexecutor/mappings.hbm.xml" />
       <cache-configuration resource="org/jbpm/pvm/pvm.cache.xml" usage="nonstrict-read-write" />
     </hibernate-configuration>
     
@@ -39,6 +39,5 @@
     <message-session />
     <timer-session />
 
-  </environment>
-
+  </environment> 
 </contexts>

Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/jobexecutor/mappings.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/mappings.hbm.xml	2008-07-29 08:34:34 UTC (rev 1741)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/jobexecutor/mappings.hbm.xml	2008-07-29 13:25:51 UTC (rev 1748)
@@ -4,7 +4,7 @@
       "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
       "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 
-<hibernate-mapping package="org.jbpm.pvm.jobexecutor" default-access="field">
+<hibernate-mapping package="org.jbpm.pvm.internal.jobexecutor" default-access="field">
 
 	<subclass name="TestMessage" extends="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="T">
 		<property name="messageId" />




More information about the jbpm-commits mailing list