[jbpm-commits] JBoss JBPM SVN: r2372 - in jbpm4/trunk/modules/pvm: src/main/java/org/jbpm/pvm/test/base and 13 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Sep 25 02:31:07 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-09-25 02:31:07 -0400 (Thu, 25 Sep 2008)
New Revision: 2372

Removed:
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/CheckInTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/DbTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/NonDbTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicFeaturesTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/DbSvcTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/TxTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/example03/EmbeddedTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/langext/DbLangExtTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/DbModelTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireTests.java
Modified:
   jbpm4/trunk/modules/pvm/pom.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/CommentDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/type/VariableCustomTypeTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
Log:
Remove test wrappers

Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/pom.xml	2008-09-25 06:31:07 UTC (rev 2372)
@@ -135,9 +135,14 @@
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <argLine>${surefire.jvm.args}</argLine>
-          <includes>
-            <include>org/jbpm/pvm/CheckInTests.java</include>
-          </includes>
+          <excludes>
+            <exclude>org/jbpm/pvm/api/timer/*Test.java</exclude>
+            <exclude>org/jbpm/pvm/enterprise/*Test.java</exclude>
+            <exclude>org/jbpm/pvm/internal/db/model/HibernateJobDbSessionTest.java</exclude>
+            <exclude>org/jbpm/pvm/internal/expr/*Test.java</exclude>
+            <exclude>org/jbpm/pvm/internal/xml/*Test.java</exclude>
+            <exclude>org/jbpm/pvm/samples/**/*Test.java</exclude>
+          </excludes>
         </configuration>
       </plugin>
       <plugin>

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -15,6 +15,8 @@
 
 import junit.extensions.TestSetup;
 import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
 
 /**
  * @author Guillaume Porcher
@@ -29,12 +31,23 @@
     this(test, "environment.cfg.xml");
   }
 
+  public EnvironmentFactoryTestSetup(Class<?> testClass)
+  {
+    this(new TestSuite(testClass), "environment.cfg.xml");
+  }
+
   public EnvironmentFactoryTestSetup(Test test, String configResource)
   {
     super(test);
     this.configResource = configResource;
   }
 
+  public EnvironmentFactoryTestSetup(Class<?> testClass, String configResource)
+  {
+    super(new TestSuite(testClass));
+    this.configResource = configResource;
+  }
+
   @Override
   protected void setUp() throws Exception
   {
@@ -45,7 +58,7 @@
   @Override
   protected void tearDown() throws Exception
   {
-    EnvironmentFactoryTestCase.closeEnvironmentFactory(configResource);
+    //EnvironmentFactoryTestCase.closeEnvironmentFactory(configResource);
     super.tearDown();
   }
 }

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

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/DbTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/DbTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/DbTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,69 +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;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jbpm.pvm.api.db.continuation.ContinuationTests;
-import org.jbpm.pvm.api.db.svc.DbSvcTests;
-import org.jbpm.pvm.api.spring.SpringTests;
-import org.jbpm.pvm.api.tx.TxTests;
-import org.jbpm.pvm.example03.EmbeddedTests;
-import org.jbpm.pvm.internal.db.langext.DbLangExtTests;
-import org.jbpm.pvm.internal.db.model.DbModelTests;
-import org.jbpm.pvm.internal.db.type.VariableCustomTypeTest;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutorTests;
-import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DbTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("db tests");
-    //$JUnit-BEGIN$
-    
-    TestSuite defaultConfigTests = new TestSuite("default config tests");
-    defaultConfigTests.addTest(DbModelTests.suite());
-    defaultConfigTests.addTest(DbSvcTests.suite());
-    defaultConfigTests.addTest(JobExecutorTests.suite());
-    defaultConfigTests.addTest(ContinuationTests.suite());
-    defaultConfigTests.addTest(TxTests.suite());
-    
-    suite.addTest(new EnvironmentFactoryTestSetup(defaultConfigTests, "environment.cfg.xml"));
-    suite.addTest(new EnvironmentFactoryTestSetup(DbLangExtTests.suite(), "org/jbpm/pvm/internal/db/langext/environment.cfg.xml"));
-    
-    TestSuite variableTypeTests = new TestSuite(VariableCustomTypeTest.class);
-    suite.addTest(new EnvironmentFactoryTestSetup(variableTypeTests, "org/jbpm/pvm/internal/db/type/environmentCustomTypes.cfg.xml"));
-
-    // These tests do not use EnvironmentFactoryTestCase
-    suite.addTest(SpringTests.suite());
-    suite.addTest(EmbeddedTests.suite());
-
-    //$JUnit-END$
-    return suite;
-  }
-
-}

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/NonDbTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/NonDbTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/NonDbTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,49 +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;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jbpm.pvm.api.basicfeatures.BasicFeaturesTests;
-import org.jbpm.pvm.api.env.EnvironmentTests;
-import org.jbpm.pvm.internal.type.VariableAutoTypeResolutionTest;
-import org.jbpm.pvm.internal.wire.WireTests;
-
-
-/**
- * @author Tom Baeyens
- */
-public class NonDbTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("non db tests");
-    //$JUnit-BEGIN$
-    suite.addTest(EnvironmentTests.suite());
-    suite.addTest(BasicFeaturesTests.suite());
-    suite.addTest(WireTests.suite());
-    suite.addTestSuite(VariableAutoTypeResolutionTest.class);
-    //$JUnit-END$
-    return suite;
-  }
-
-}

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicFeaturesTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicFeaturesTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicFeaturesTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,58 +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.TestCase;
-import junit.framework.TestSuite;
-
-
-/**
- * @author Tom Baeyens
- */
-public class BasicFeaturesTests extends TestCase {
-
-  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;
-  }
-
-}

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -28,9 +28,11 @@
 import java.util.Timer;
 import java.util.TimerTask;
 
+import junit.framework.Test;
+
 import org.hibernate.Session;
+import org.jbpm.pvm.client.ClientExecution;
 import org.jbpm.pvm.client.ClientProcessDefinition;
-import org.jbpm.pvm.client.ClientExecution;
 import org.jbpm.pvm.env.Environment;
 import org.jbpm.pvm.env.EnvironmentFactory;
 import org.jbpm.pvm.internal.cmd.Command;
@@ -42,32 +44,43 @@
 import org.jbpm.pvm.session.DbSession;
 import org.jbpm.pvm.session.PvmDbSession;
 import org.jbpm.pvm.test.base.DbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Tom Baeyens
  */
-public class ContinuationTest extends DbTestCase {
-  
+public class ContinuationTest extends DbTestCase
+{
+
   private static final Log log = Log.getLog(ContinuationTest.class.getName());
-  
-  static Recorder recorder = new Recorder(); 
-  
-  public void testContinuations() {
+
+  static Recorder recorder = new Recorder();
+
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(ContinuationTest.class);
+  }
+
+  public void testContinuations()
+  {
     int nbrOfExecutions = 20;
     int testTimeoutMillis = 20000;
     int checkInterval = 500;
-    
+
     EnvironmentFactory environmentFactory = getEnvironmentFactory();
-    
+
     Set<Integer> expected = new HashSet<Integer>();
     JobExecutor jobExecutor = environmentFactory.get(JobExecutor.class);
-    try {
+    try
+    {
       deployProcess(environmentFactory);
       startExecutions(nbrOfExecutions, environmentFactory, expected);
       jobExecutor.start();
       waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval, environmentFactory);
 
-    } finally {
+    }
+    finally
+    {
       jobExecutor.stop(true);
     }
 
@@ -77,33 +90,26 @@
     expectedLogs.add("execute(b)");
     expectedLogs.add("execute(c)");
     expectedLogs.add("execute(end)");
-    
+
     assertEquals(nbrOfExecutions, recorder.executionEvents.size());
-    for (List<String> executionLogs: recorder.executionEvents.values()) {
+    for (List<String> executionLogs : recorder.executionEvents.values())
+    {
       assertEquals(expectedLogs, executionLogs);
     }
   }
 
-  public void deployProcess(EnvironmentFactory environmentFactory) {
-    commandService.execute(new Command<Object>() {
-      public Object execute(Environment environment) throws Exception {
+  public void deployProcess(EnvironmentFactory environmentFactory)
+  {
+    commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment) throws Exception
+      {
         log.debug("building process 'continuations'");
-        OpenProcessDefinition processDefinition = ProcessFactory.build("continuations")
-          .node("start").initial().behaviour(AutomaticActivity.class)
-            .asyncExecute()
-            .transition().to("a")
-          .node("a").behaviour(AutomaticActivity.class)
-            .asyncExecute()
-            .transition().to("b")
-          .node("b").behaviour(AutomaticActivity.class)
-            .asyncExecute()
-            .transition().to("c")
-          .node("c").behaviour(AutomaticActivity.class)
-            .asyncExecute()
-            .transition().to("end")
-          .node("end").behaviour(WaitState.class)
-          .done();
-        
+        OpenProcessDefinition processDefinition = ProcessFactory.build("continuations").node("start").initial().behaviour(
+            AutomaticActivity.class).asyncExecute().transition().to("a").node("a").behaviour(AutomaticActivity.class).asyncExecute()
+            .transition().to("b").node("b").behaviour(AutomaticActivity.class).asyncExecute().transition().to("c").node("c").behaviour(
+                AutomaticActivity.class).asyncExecute().transition().to("end").node("end").behaviour(WaitState.class).done();
+
         log.debug("saving process 'continuations'");
         environment.get(DbSession.class).save(processDefinition);
         return null;
@@ -111,10 +117,14 @@
     });
   }
 
-  public void startExecutions(int nbrOfExecutions, EnvironmentFactory environmentFactory, Set<Integer> expected) {
-    for (int i=0; i<nbrOfExecutions; i++) {
-      commandService.execute(new Command<Object>() {
-        public Object execute(Environment environment) throws Exception {
+  public void startExecutions(int nbrOfExecutions, EnvironmentFactory environmentFactory, Set<Integer> expected)
+  {
+    for (int i = 0; i < nbrOfExecutions; i++)
+    {
+      commandService.execute(new Command<Object>()
+      {
+        public Object execute(Environment environment) throws Exception
+        {
           PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
           ClientProcessDefinition processDefinition = pvmDbSession.findLatestProcessDefinitionByName("continuations");
           ClientExecution execution = processDefinition.startProcessInstance();
@@ -125,51 +135,68 @@
     }
   }
 
-  public void waitTillNoMoreMessages(JobExecutor jobExecutor, int maxWait, int checkInterval, EnvironmentFactory environmentFactory) {
+  public void waitTillNoMoreMessages(JobExecutor jobExecutor, int maxWait, int checkInterval, EnvironmentFactory environmentFactory)
+  {
 
     // 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() {
+    TimerTask interruptTask = new TimerTask()
+    {
       Thread testThread = Thread.currentThread();
-      public void run() {
-        log.debug("test "+getName()+" took too long. going to interrupt..."+testThread);
+
+      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 {
+
+    try
+    {
       boolean jobsAvailable = true;
-      while (jobsAvailable) {
-        log.debug("going to sleep for "+checkInterval+" millis, waiting for the jobImpl executor to process more jobs");
+      while (jobsAvailable)
+      {
+        log.debug("going to sleep for " + checkInterval + " millis, waiting for the jobImpl executor to process more jobs");
         Thread.sleep(checkInterval);
         jobsAvailable = areJobsAvailable(environmentFactory);
       }
-      
-    } catch (InterruptedException e) {
-      fail("test execution exceeded treshold of "+maxWait+" milliseconds");
-    } finally {
+
+    }
+    catch (InterruptedException e)
+    {
+      fail("test execution exceeded treshold of " + maxWait + " milliseconds");
+    }
+    finally
+    {
       timer.cancel();
     }
   }
 
-  private boolean areJobsAvailable(EnvironmentFactory environmentFactory) {
-    Integer nbrOfJobsAvailable = (Integer) commandService.execute(new Command<Object>() {
-      public Object execute(Environment environment) throws Exception {
+  private boolean areJobsAvailable(EnvironmentFactory environmentFactory)
+  {
+    Integer nbrOfJobsAvailable = (Integer)commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment) throws Exception
+      {
         Session session = environment.get(Session.class);
-        Number jobs = (Number) session.createQuery("select count(*) from " + JobImpl.class.getName()).uniqueResult();
-        if (jobs!=null) {
+        Number jobs = (Number)session.createQuery("select count(*) from " + JobImpl.class.getName()).uniqueResult();
+        if (jobs != null)
+        {
           return jobs.intValue();
         }
         return 0;
       }
     });
 
-    boolean areJobsAvailable = nbrOfJobsAvailable>0;
-    if (areJobsAvailable) {
-      log.debug("there are "+nbrOfJobsAvailable+" jobs currently in the jobImpl table");
-    } else {
+    boolean areJobsAvailable = nbrOfJobsAvailable > 0;
+    if (areJobsAvailable)
+    {
+      log.debug("there are " + nbrOfJobsAvailable + " jobs currently in the jobImpl table");
+    }
+    else
+    {
       log.debug("all jobs are processed");
     }
     return areJobsAvailable;

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,41 +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.db.continuation;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ContinuationTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("org.jbpm.pvm.api.db.continuation");
-    //$JUnit-BEGIN$
-    suite.addTestSuite(ContinuationTest.class);
-    //$JUnit-END$
-    return suite;
-  }
-
-}

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/DbSvcTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/DbSvcTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/DbSvcTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,43 +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.db.svc;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DbSvcTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("org.jbpm.pvm.api.db.svc");
-    //$JUnit-BEGIN$
-    suite.addTestSuite(ExecutionServiceTest.class);
-    suite.addTestSuite(ProcessServiceTest.class);
-    suite.addTestSuite(ManagementServiceTest.class);
-    //$JUnit-END$
-    return suite;
-  }
-
-}

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -26,6 +26,8 @@
 import java.util.List;
 import java.util.Map;
 
+import junit.framework.Test;
+
 import org.jbpm.pvm.Deployment;
 import org.jbpm.pvm.Execution;
 import org.jbpm.pvm.ExecutionService;
@@ -34,27 +36,31 @@
 import org.jbpm.pvm.client.ClientProcessDefinition;
 import org.jbpm.pvm.model.ProcessFactory;
 import org.jbpm.pvm.test.base.DbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
-
 /**
  * @author Tom Baeyens
  */
-public class ExecutionServiceTest extends DbTestCase {
-  
-  public void testStartExecutionById() {
+public class ExecutionServiceTest extends DbTestCase
+{
+
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(ExecutionServiceTest.class);
+  }
+
+  public void testStartExecutionById()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // deploy process with key 'NCLFU' and version 1
     // then we know that the key for this process will be 'NCLFU:1'
-    ClientProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .version(1)
-      .key("NCLFU")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+    ClientProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").version(1).key("NCLFU").node("initial").initial()
+        .behaviour(WaitState.class).done();
 
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
     // start an execution for the process with the given id
@@ -69,58 +75,54 @@
     assertNull(execution.getKey());
     // if there is no user defined name or key specified in the execution,
     // the default id generator will create a unique id like this: processDefinitionId/execution.dbid
-    assertEquals("NCLFU:1/", execution.getId().substring(0,8));
+    assertEquals("NCLFU:1/", execution.getId().substring(0, 8));
     // the last part of the execution key should be the dbid.
     Long.parseLong(execution.getId().substring(8));
   }
 
-  public void testStartExecutionByIdWithGivenExecutionKey() {
+  public void testStartExecutionByIdWithGivenExecutionKey()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // deploy the same process with a given key and version
-    ClientProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .version(1)
-      .key("NCLFU")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
-  
+    ClientProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").version(1).key("NCLFU").node("initial").initial()
+        .behaviour(WaitState.class).done();
+
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-  
+
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
-  
+
     Execution execution = executionService.startExecution("NCLFU:1", "TheFirstTime");
     assertNotNull(execution);
-  
+
     // checking the state
     assertEquals("initial", execution.getNodeName());
-  
+
     // checking the generated id
     assertNull(execution.getName());
     assertEquals("TheFirstTime", execution.getKey());
-    // if there is a user provided key in the execution, the default 
+    // if there is a user provided key in the execution, the default
     // id generator will take that to create the id
     assertEquals("NCLFU:1/TheFirstTime", execution.getId());
   }
 
-  public void testStartExecutionByIdWithVariables() {
+  public void testStartExecutionByIdWithVariables()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
-  
-    ClientProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .version(1)
-      .key("NCLFU")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
-  
+
+    ClientProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").version(1).key("NCLFU").node("initial").initial()
+        .behaviour(WaitState.class).done();
+
     processService.deploy(new Deployment(processDefinition));
 
     // create the map with variables
     Map<String, Object> variables = new HashMap<String, Object>();
     variables.put("a", new Integer(1));
     variables.put("b", "text");
-  
+
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
-  
+
     // provide the variables in the start execution method
     Execution execution = executionService.startExecution("NCLFU:1", variables);
     String executionId = execution.getId();
@@ -129,45 +131,47 @@
     assertEquals("text", executionService.getVariable(executionId, "b"));
   }
 
-  public void testStartExecutionInLatest() {
+  public void testStartExecutionInLatest()
+  {
     // deploy following processes
-    //  'nuclear fusion' with id NFU:1
-    //  'ultimate seduction' with id USD:1
-    //  'ultimate seduction' with id USD:2
-    //  'nuclear fusion' with id NFU:2
-    //  'publish book' with id PBO:1
-    //  'nuclear fusion' with id NFU:3
+    // 'nuclear fusion' with id NFU:1
+    // 'ultimate seduction' with id USD:1
+    // 'ultimate seduction' with id USD:2
+    // 'nuclear fusion' with id NFU:2
+    // 'publish book' with id PBO:1
+    // 'nuclear fusion' with id NFU:3
     deployMultipleVersionsOfProcesses();
-    
+
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
-    // start a nuclear fusion in the latest version of 
+    // start a nuclear fusion in the latest version of
     // the process definition with name 'nuclear fusion'
     Execution execution = executionService.startExecutionInLatest("nuclear fusion");
     assertNotNull(execution);
 
     // in the generated id, we can see if the right process definition version was taken
-    assertTrue("the execution id shows that the execution is not started in the latest version of the process: "+execution.getId(), 
-               execution.getId().startsWith("NFU:3/"));
+    assertTrue("the execution id shows that the execution is not started in the latest version of the process: " + execution.getId(),
+        execution.getId().startsWith("NFU:3/"));
   }
 
-  public void testStartExecutionInLatestByNameWithVariables() {
+  public void testStartExecutionInLatestByNameWithVariables()
+  {
     // deploy following processes
-    //  'nuclear fusion' with id NFU:1
-    //  'ultimate seduction' with id USD:1
-    //  'ultimate seduction' with id USD:2
-    //  'nuclear fusion' with id NFU:2
-    //  'publish book' with id PBO:1
-    //  'nuclear fusion' with id NFU:3
+    // 'nuclear fusion' with id NFU:1
+    // 'ultimate seduction' with id USD:1
+    // 'ultimate seduction' with id USD:2
+    // 'nuclear fusion' with id NFU:2
+    // 'publish book' with id PBO:1
+    // 'nuclear fusion' with id NFU:3
     deployMultipleVersionsOfProcesses();
-    
+
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
     // create variables that are fed into the process before it starts executing
     Map<String, Object> variables = new HashMap<String, Object>();
     variables.put("a", new Integer(1));
     variables.put("b", "text");
-    
+
     // feed the variables in
     Execution execution = executionService.startExecutionInLatest("nuclear fusion", variables);
     String executionId = execution.getId();
@@ -177,18 +181,19 @@
     assertEquals("text", executionService.getVariable(executionId, "b"));
 
     // in the generated id, we can see if the right process definition version was taken
-    assertTrue("the execution id shows that the execution is not started in the latest version of the process: "+execution.getId(), 
-               execution.getId().startsWith("NFU:3/"));
+    assertTrue("the execution id shows that the execution is not started in the latest version of the process: " + execution.getId(),
+        execution.getId().startsWith("NFU:3/"));
   }
-  
-  public void testStartExecutionByNameWithKey() {
+
+  public void testStartExecutionByNameWithKey()
+  {
     // deploy following processes
-    //  'nuclear fusion' with id NFU:1
-    //  'ultimate seduction' with id USD:1
-    //  'ultimate seduction' with id USD:2
-    //  'nuclear fusion' with id NFU:2
-    //  'publish book' with id PBO:1
-    //  'nuclear fusion' with id NFU:3
+    // 'nuclear fusion' with id NFU:1
+    // 'ultimate seduction' with id USD:1
+    // 'ultimate seduction' with id USD:2
+    // 'nuclear fusion' with id NFU:2
+    // 'publish book' with id PBO:1
+    // 'nuclear fusion' with id NFU:3
     deployMultipleVersionsOfProcesses();
 
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
@@ -198,31 +203,34 @@
     assertEquals("TheFirstTime", execution.getKey());
     assertEquals("NFU:3/TheFirstTime", execution.getId());
   }
-  
-  public void testFindExecution() {
+
+  public void testFindExecution()
+  {
     // create an arbitrary execution
     Execution execution = startExecution();
     // take the id and see if the execution service can still find it back
     execution = executionService.findExecution(execution.getId());
     assertNotNull(execution);
   }
-  
-  public void testSetVariable() {
+
+  public void testSetVariable()
+  {
     Execution execution = startExecution();
 
     String executionId = execution.getId();
     // set variable a to value text
     executionService.setVariable(executionId, "a", "text");
     // check if we can read that value back
-    assertEquals("text", executionService.getVariable(executionId, "a") );
+    assertEquals("text", executionService.getVariable(executionId, "a"));
 
     // overwrite the value of variable a with another text
     executionService.setVariable(executionId, "a", "another text");
     // see if we can read another text back from the variable
-    assertEquals("another text", executionService.getVariable(executionId, "a") );
+    assertEquals("another text", executionService.getVariable(executionId, "a"));
   }
 
-  public void testSetVariables() {
+  public void testSetVariables()
+  {
     Execution execution = startExecution();
 
     Map<String, Object> variables = new HashMap<String, Object>();
@@ -231,13 +239,13 @@
 
     // set variables in bulk by providing a map
     executionService.setVariables(execution.getId(), variables);
-    
+
     Map<String, Object> expected = new HashMap<String, Object>(variables);
-    
+
     List<String> variableNames = new ArrayList<String>();
     variableNames.add("a");
     variableNames.add("b");
-    
+
     // read the variables back and compare
     assertEquals(expected, executionService.getVariables(execution.getId(), variableNames));
 
@@ -255,70 +263,56 @@
 
     // add c to the variable names that should be collected
     variableNames.add("c");
-    
+
     // read the variables back and compare
     assertEquals(expected, executionService.getVariables(execution.getId(), variableNames));
   }
 
   // helper methods ///////////////////////////////////////////////////////////
-  
-  /** deploys 3 versions of process with name 'nuclear fusion', 2 versions 
-   * of the processes 'ultimate seduction' and 'publish book' */
-  void deployMultipleVersionsOfProcesses() {
+
+  /**
+   * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
+   * 'publish book'
+   */
+  void deployMultipleVersionsOfProcesses()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
-    
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .key("NFU")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").node("initial").initial().behaviour(
+        WaitState.class).done();
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
-    processDefinition = ProcessFactory.build("ultimate seduction")
-      .key("USD")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("ultimate seduction").key("USD").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-  
-    processDefinition = ProcessFactory.build("ultimate seduction")
-      .key("USD")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("ultimate seduction").key("USD").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-  
-    processDefinition = ProcessFactory.build("nuclear fusion")
-      .key("NFU")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
-    processDefinition = ProcessFactory.build("publish book")
-      .key("PBO")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("publish book").key("PBO").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-  
-    processDefinition = ProcessFactory.build("nuclear fusion")
-      .key("NFU")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
   }
 
-  Execution startExecution() {
+  Execution startExecution()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").node("initial").initial().behaviour(WaitState.class)
+        .done();
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
     return executionService.startExecutionInLatest("nuclear fusion");

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -21,17 +21,25 @@
  */
 package org.jbpm.pvm.api.db.svc;
 
+import junit.framework.Test;
+
 import org.jbpm.pvm.ManagementService;
 import org.jbpm.pvm.test.base.DbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
-
 /**
  * @author Tom Baeyens
  */
-public class ManagementServiceTest extends DbTestCase {
+public class ManagementServiceTest extends DbTestCase
+{
 
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(ManagementServiceTest.class);
+  }
 
-  public void testGetJobs() {
+  public void testGetJobs()
+  {
     ManagementService managementService = getEnvironmentFactory().get(ManagementService.class);
     assertEquals(0, managementService.getTimers(0, 10).size());
     assertEquals(0, managementService.getMessages(0, 10).size());

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -24,34 +24,43 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import junit.framework.Test;
+
 import org.jbpm.pvm.Deployment;
 import org.jbpm.pvm.ProcessDefinition;
 import org.jbpm.pvm.ProcessService;
 import org.jbpm.pvm.PvmException;
 import org.jbpm.pvm.model.ProcessFactory;
 import org.jbpm.pvm.test.base.DbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Tom Baeyens
  */
-public class ProcessServiceTest extends DbTestCase {
-  
-  public void testSimplestDeployment() {
+public class ProcessServiceTest extends DbTestCase
+{
+
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(ProcessServiceTest.class);
+  }
+
+  public void testSimplestDeployment()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // create the simplest possible process
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
-  
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").node("initial").initial().behaviour(WaitState.class)
+        .done();
+
     // deploy it
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     // fetch it back from the process service
     List<ProcessDefinition> processDefinitions = processService.findProcessDefinitions("nuclear fusion");
     assertNotNull(processDefinitions);
-    
+
     // verify there is only one
     assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
     processDefinition = processDefinitions.get(0);
@@ -60,22 +69,22 @@
     assertEquals("nuclear fusion", processDefinition.getName());
   }
 
-  public void testAutomaticVersioning() {
+  public void testAutomaticVersioning()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // create first process and only give it a name
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
-  
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").node("initial").initial().behaviour(WaitState.class)
+        .done();
+
     // deploy it
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     // look it up again
     List<ProcessDefinition> processDefinitions = processService.findProcessDefinitions("nuclear fusion");
     assertNotNull(processDefinitions);
-    
+
     // verify that there is only one
     assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
     processDefinition = processDefinitions.get(0);
@@ -83,14 +92,12 @@
     assertEquals(1, processDefinition.getVersion());
 
     // create a second process with the same name
-    processDefinition = ProcessFactory.build("nuclear fusion")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
-  
+    processDefinition = ProcessFactory.build("nuclear fusion").node("initial").initial().behaviour(WaitState.class).done();
+
     // deploy the second process
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     // verify that there now are 2 process definitions with that name
     processDefinitions = processService.findProcessDefinitions("nuclear fusion");
     assertNotNull(processDefinitions);
@@ -103,65 +110,63 @@
     assertEquals(2, processDefinition.getVersion());
   }
 
-  public void testUserProvidedVersion() {
+  public void testUserProvidedVersion()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // create a process with a user specified version
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .version(35)
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").version(35).node("initial").initial().behaviour(
+        WaitState.class).done();
 
     // deploy it
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     // load it
     List<ProcessDefinition> processDefinitions = processService.findProcessDefinitions("nuclear fusion");
     assertNotNull(processDefinitions);
     assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
     processDefinition = processDefinitions.get(0);
-    
-    // verify that the user specified version was used 
+
+    // verify that the user specified version was used
     // (and not overwritten by an automatically assigned versioning)
     assertEquals(35, processDefinition.getVersion());
   }
 
-  public void testIdGenerationFromName() {
+  public void testIdGenerationFromName()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // specify only a name, no key or version in the process
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
-  
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").node("initial").initial().behaviour(WaitState.class)
+        .done();
+
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     List<ProcessDefinition> processDefinitions = processService.findProcessDefinitions("nuclear fusion");
     assertNotNull(processDefinitions);
     assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
     processDefinition = processDefinitions.get(0);
     assertEquals("nuclear fusion", processDefinition.getName());
-    
-    // now check that the generated id.  the id generator always replaces all non-word 
-    // chars [a-zA-Z_0-9] with underscores 
+
+    // now check that the generated id. the id generator always replaces all non-word
+    // chars [a-zA-Z_0-9] with underscores
     assertEquals("nuclear_fusion:1", processDefinition.getId());
     assertNull(processDefinition.getKey());
   }
 
-  public void testIdGenerationFromKey() {
+  public void testIdGenerationFromKey()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // now we specify a name and a key
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .key("NCF")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
-  
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").key("NCF").node("initial").initial().behaviour(
+        WaitState.class).done();
+
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     List<ProcessDefinition> processDefinitions = processService.findProcessDefinitions("nuclear fusion");
     assertNotNull(processDefinitions);
     assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
@@ -173,78 +178,78 @@
     assertEquals("NCF", processDefinition.getKey());
   }
 
-  public void testDuplicateDeployment() {
+  public void testDuplicateDeployment()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // we create a simple process definition
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .version(1)
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").version(1).node("initial").initial().behaviour(
+        WaitState.class).done();
 
     // deploy it
     processService.deploy(new Deployment(processDefinition));
-    
+
     // then we create a process definition with the same name and version
-    processDefinition = ProcessFactory.build("nuclear fusion")
-      .version(1)
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
-    
-    try {
+    processDefinition = ProcessFactory.build("nuclear fusion").version(1).node("initial").initial().behaviour(WaitState.class).done();
+
+    try
+    {
       // and then we verify that the deployment fails
       processService.deploy(new Deployment(processDefinition));
       fail("expected exception");
-    } catch (PvmException e) {
+    }
+    catch (PvmException e)
+    {
       assertTextPresent(e.getMessage(), "process 'nuclear fusion' version 1 already exists");
     }
   }
 
-  public void testFindProcessDefinitionByNameAndVersion() {
+  public void testFindProcessDefinitionByNameAndVersion()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     // create a process with a user specified version
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .version(35)
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").version(35).node("initial").initial().behaviour(
+        WaitState.class).done();
 
     // deploy it
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
+
     // load it with by name and version
     processDefinition = processService.findProcessDefinition("nuclear fusion", 35);
-    
+
     // verify that the right process definition was returned
     assertEquals("nuclear fusion", processDefinition.getName());
     assertEquals(35, processDefinition.getVersion());
   }
 
-  public void testFindProcessDefinitionNames() {
+  public void testFindProcessDefinitionNames()
+  {
     deployMultipleVersionsOfProcesses();
-    
+
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
-    
+
     List<String> processNames = processService.findProcessDefinitionNames();
-    
+
     List<String> expected = new ArrayList<String>();
     expected.add("nuclear fusion");
     expected.add("publish book");
     expected.add("ultimate seduction");
-    
+
     assertEquals(expected, processNames);
   }
 
-  public void testFindProcessDefinitions() {
+  public void testFindProcessDefinitions()
+  {
     deployMultipleVersionsOfProcesses();
-    
+
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     List<ProcessDefinition> processDefinitions = processService.findProcessDefinitions("nuclear fusion");
     assertNotNull(processDefinitions);
-    
-    assertEquals("expected 3 but was "+processDefinitions.size()+": "+processDefinitions, 3, processDefinitions.size());
+
+    assertEquals("expected 3 but was " + processDefinitions.size() + ": " + processDefinitions, 3, processDefinitions.size());
     assertEquals("nuclear fusion", processDefinitions.get(0).getName());
     assertEquals(3, processDefinitions.get(0).getVersion());
 
@@ -255,69 +260,62 @@
     assertEquals(1, processDefinitions.get(2).getVersion());
   }
 
-  public void testFindLatestProcessDefinition() {
+  public void testFindLatestProcessDefinition()
+  {
     deployMultipleVersionsOfProcesses();
-    
+
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     ProcessDefinition retrieved = processService.findLatestProcessDefinition("nuclear fusion");
     assertNotNull(retrieved);
-    
+
     assertEquals("nuclear fusion", retrieved.getName());
     assertEquals(3, retrieved.getVersion());
   }
 
-  public void testLatestProcessDefinition() {
+  public void testLatestProcessDefinition()
+  {
     deployMultipleVersionsOfProcesses();
-    
+
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
 
     ProcessDefinition retrieved = processService.findLatestProcessDefinition("nuclear fusion");
     assertNotNull(retrieved);
-    
+
     assertEquals("nuclear fusion", retrieved.getName());
     assertEquals(3, retrieved.getVersion());
   }
-  
 
-  /** deploys 3 versions of process with name 'nuclear fusion', 2 versions 
-   * of the processes 'ultimate seduction' and 'publish book' */
-  void deployMultipleVersionsOfProcesses() {
+  /**
+   * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
+   * 'publish book'
+   */
+  void deployMultipleVersionsOfProcesses()
+  {
     ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
-    
-    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").node("initial").initial().behaviour(WaitState.class)
+        .done();
     Deployment deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
-    processDefinition = ProcessFactory.build("ultimate seduction")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("ultimate seduction").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-  
-    processDefinition = ProcessFactory.build("ultimate seduction")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("ultimate seduction").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-  
-    processDefinition = ProcessFactory.build("nuclear fusion")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("nuclear fusion").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-    
-    processDefinition = ProcessFactory.build("publish book")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("publish book").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
-  
-    processDefinition = ProcessFactory.build("nuclear fusion")
-      .node("initial").initial().behaviour(WaitState.class)
-    .done();
+
+    processDefinition = ProcessFactory.build("nuclear fusion").node("initial").initial().behaviour(WaitState.class).done();
     deployment = new Deployment(processDefinition);
     processService.deploy(deployment);
   }

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

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,41 +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.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;
-  }
-
-}

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -25,6 +25,8 @@
 
 import javax.transaction.Synchronization;
 
+import junit.framework.Test;
+
 import org.hibernate.Session;
 import org.jbpm.pvm.PvmException;
 import org.jbpm.pvm.env.Environment;
@@ -33,126 +35,165 @@
 import org.jbpm.pvm.internal.model.CommentImpl;
 import org.jbpm.pvm.internal.type.variable.StringVariable;
 import org.jbpm.pvm.test.base.DbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Tom Baeyens
  */
-public class BasicTransactionTest extends DbTestCase {
+public class BasicTransactionTest extends DbTestCase
+{
 
-  public void testCommit() {
-    commandService.execute(new Command<Object>(){
-      public Object execute(Environment environment) {
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(BasicTransactionTest.class);
+  }
+
+  public void testCommit()
+  {
+    commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment)
+      {
         Session session = environment.get(Session.class);
         session.save(new CommentImpl("if i only had the time to write code"));
         return null;
       }
     });
-    
-    commandService.execute(new Command<Object>(){
-      public Object execute(Environment environment) {
+
+    commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment)
+      {
         Session session = environment.get(Session.class);
-        List<CommentImpl> comments = session.createQuery("from "+CommentImpl.class.getName()).list();
+        List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
         assertEquals("if i only had the time to write code", comments.get(0).getMessage());
         return null;
       }
     });
   }
-  
-  
-  public static class MyOwnRuntimeException extends RuntimeException {
+
+  public static class MyOwnRuntimeException extends RuntimeException
+  {
   }
-  
-  public void testRollbackRuntimeException() {
-    try {
-      commandService.execute(new Command<Object>(){
-        public Object execute(Environment environment) {
+
+  public void testRollbackRuntimeException()
+  {
+    try
+    {
+      commandService.execute(new Command<Object>()
+      {
+        public Object execute(Environment environment)
+        {
           Session session = environment.get(Session.class);
           session.save(new CommentImpl("if i only had the time to write code"));
           throw new MyOwnRuntimeException();
         }
       });
       fail("expected exception");
-    } catch (MyOwnRuntimeException e) {
+    }
+    catch (MyOwnRuntimeException e)
+    {
       // OK
     }
-    
-    commandService.execute(new Command<Object>(){
-      public Object execute(Environment environment) {
+
+    commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment)
+      {
         Session session = environment.get(Session.class);
-        List<CommentImpl> comments = session.createQuery("from "+CommentImpl.class.getName()).list();
+        List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
         assertEquals(0, comments.size());
         return null;
       }
     });
   }
 
-  public static class MyOwnCheckedException extends Exception {
+  public static class MyOwnCheckedException extends Exception
+  {
   }
-  
-  public void testRollbackCheckedException() {
-    try {
-      commandService.execute(new Command<Object>(){
-        public Object execute(Environment environment) throws Exception {
+
+  public void testRollbackCheckedException()
+  {
+    try
+    {
+      commandService.execute(new Command<Object>()
+      {
+        public Object execute(Environment environment) throws Exception
+        {
           Session session = environment.get(Session.class);
           session.save(new CommentImpl("if i only had the time to write code"));
           throw new MyOwnCheckedException();
         }
       });
       fail("expected exception");
-    } catch (PvmException e) {
+    }
+    catch (PvmException e)
+    {
       // OK
       assertSame(MyOwnCheckedException.class, e.getCause().getClass());
     }
-    
-    commandService.execute(new Command<Object>(){
-      public Object execute(Environment environment) {
+
+    commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment)
+      {
         Session session = environment.get(Session.class);
-        List<CommentImpl> comments = session.createQuery("from "+CommentImpl.class.getName()).list();
+        List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
         assertEquals(0, comments.size());
         return null;
       }
     });
   }
 
-  
-  public static class SuccessfulSynchronization implements Synchronization {
-    public void beforeCompletion() {
+  public static class SuccessfulSynchronization implements Synchronization
+  {
+    public void beforeCompletion()
+    {
       Environment environment = Environment.getCurrent();
       Session session = environment.get(Session.class);
       StringVariable stringVariable = new StringVariable();
       stringVariable.setValue("hello");
       session.save(stringVariable);
     }
-    public void afterCompletion(int arg0) {
+
+    public void afterCompletion(int arg0)
+    {
     }
   }
-  
-  public void testSuccessfulSynchronization() {
-    commandService.execute(new Command<Object>(){
-      public Object execute(Environment environment) throws Exception {
+
+  public void testSuccessfulSynchronization()
+  {
+    commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment) throws Exception
+      {
         Session session = environment.get(Session.class);
         session.save(new CommentImpl("if i only had the time to write code"));
         Transaction transaction = environment.get(Transaction.class);
-        SuccessfulSynchronization successfulSynchronization = new SuccessfulSynchronization(); 
+        SuccessfulSynchronization successfulSynchronization = new SuccessfulSynchronization();
         transaction.registerSynchronization(successfulSynchronization);
         return null;
       }
     });
-    
-    commandService.execute(new Command<Object>(){
-      public Object execute(Environment environment) {
+
+    commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment)
+      {
         Session session = environment.get(Session.class);
-        List<CommentImpl> comments = session.createQuery("from "+CommentImpl.class.getName()).list();
+        List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
         assertEquals("if i only had the time to write code", comments.get(0).getMessage());
-        List<StringVariable> stringVariables = session.createQuery("from "+StringVariable.class.getName()).list();
+        List<StringVariable> stringVariables = session.createQuery("from " + StringVariable.class.getName()).list();
         assertEquals("hello", stringVariables.get(0).getValue());
         return null;
       }
     });
   }
 
-  public static class UnsuccessfulSynchronization implements Synchronization {
-    public void beforeCompletion() {
+  public static class UnsuccessfulSynchronization implements Synchronization
+  {
+    public void beforeCompletion()
+    {
       Environment environment = Environment.getCurrent();
       Session session = environment.get(Session.class);
       StringVariable stringVariable = new StringVariable();
@@ -160,36 +201,46 @@
       session.save(stringVariable);
       throw new MyOwnRuntimeException();
     }
-    public void afterCompletion(int arg0) {
+
+    public void afterCompletion(int arg0)
+    {
     }
   }
-  
-  public void testUnsuccessfulSynchronization() {
-    try {
-      commandService.execute(new Command<Object>(){
-        public Object execute(Environment environment) throws Exception {
+
+  public void testUnsuccessfulSynchronization()
+  {
+    try
+    {
+      commandService.execute(new Command<Object>()
+      {
+        public Object execute(Environment environment) throws Exception
+        {
           Session session = environment.get(Session.class);
           session.save(new CommentImpl("if i only had the time to write code"));
           Transaction transaction = environment.get(Transaction.class);
-          UnsuccessfulSynchronization unsuccessfulSynchronization = new UnsuccessfulSynchronization(); 
+          UnsuccessfulSynchronization unsuccessfulSynchronization = new UnsuccessfulSynchronization();
           transaction.registerSynchronization(unsuccessfulSynchronization);
           return null;
         }
       });
       fail("expected exception");
-    } catch (MyOwnRuntimeException e) {
+    }
+    catch (MyOwnRuntimeException e)
+    {
       // OK
     }
 
-    // the exception in the beforeCompletion in the synchronization should have caused 
+    // the exception in the beforeCompletion in the synchronization should have caused
     // the previous transaction to rollback
 
-    commandService.execute(new Command<Object>(){
-      public Object execute(Environment environment) {
+    commandService.execute(new Command<Object>()
+    {
+      public Object execute(Environment environment)
+      {
         Session session = environment.get(Session.class);
-        List<CommentImpl> comments = session.createQuery("from "+CommentImpl.class.getName()).list();
+        List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
         assertEquals(0, comments.size());
-        List<StringVariable> stringVariables = session.createQuery("from "+StringVariable.class.getName()).list();
+        List<StringVariable> stringVariables = session.createQuery("from " + StringVariable.class.getName()).list();
         assertEquals(0, stringVariables.size());
         return null;
       }

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/TxTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/TxTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/TxTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,41 +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.tx;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * @author Tom Baeyens
- */
-public class TxTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("org.jbpm.pvm.api.tx");
-    //$JUnit-BEGIN$
-    suite.addTestSuite(BasicTransactionTest.class);
-    //$JUnit-END$
-    return suite;
-  }
-
-}

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/example03/EmbeddedTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/example03/EmbeddedTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/example03/EmbeddedTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,38 +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.example03;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-public class EmbeddedTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("org.jbpm.pvm.api.db.embedded");
-    //$JUnit-BEGIN$
-    suite.addTestSuite(EmbeddedExecutionModeTest.class);
-    //$JUnit-END$
-    return suite;
-  }
-
-}

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/langext/DbLangExtTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/langext/DbLangExtTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/langext/DbLangExtTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,41 +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.db.langext;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DbLangExtTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("Test for org.jbpm.pvm.db.langext");
-    //$JUnit-BEGIN$
-    suite.addTestSuite(LanguageExtensionsDbTest.class);
-    //$JUnit-END$
-    return suite;
-  }
-
-}

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -24,47 +24,55 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
 import org.jbpm.pvm.Execution;
+import org.jbpm.pvm.internal.db.type.VariableCustomTypeTest;
 import org.jbpm.pvm.model.OpenProcessDefinition;
 import org.jbpm.pvm.model.ProcessFactory;
 import org.jbpm.pvm.session.DbSession;
 import org.jbpm.pvm.session.PvmDbSession;
+import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
-
 /**
  * @author Tom Baeyens
  */
-public class LanguageExtensionsDbTest extends EnvironmentDbTestCase {
-  
-  public LanguageExtensionsDbTest() {
-    super("org/jbpm/pvm/internal/db/langext/environment.cfg.xml");
+public class LanguageExtensionsDbTest extends EnvironmentDbTestCase
+{
+
+  private static final String ENVIRONMENT_CFG_XML = "org/jbpm/pvm/internal/db/langext/environment.cfg.xml";
+
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(LanguageExtensionsDbTest.class, ENVIRONMENT_CFG_XML);
   }
 
+  public LanguageExtensionsDbTest()
+  {
+    super(ENVIRONMENT_CFG_XML);
+  }
+
   /**
-   * Defines a simple process: only nodes and transitions.
-   * Adds a wait state behaviour.
-   * Persists it, reloads and executes the process.
+   * Defines a simple process: only nodes and transitions. Adds a wait state behaviour. Persists it, reloads and
+   * executes the process.
    */
-  
-  public void testBehaviour() {
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+
+  public void testBehaviour()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(persistenceSession);
 
-    OpenProcessDefinition processDefinition = ProcessFactory.build("addresses")
-      .node().initial().behaviour(new AddressActivity("Sesamestreet", 15))
-        .transition().to("a")
-      .node("a").behaviour(new AddressActivity("Broadway", 151))
-        .transition().to("b")
-      .node("b").behaviour(new AddressActivity("Champs Elysee", 23))
-        .transition().to("c")
-      .node("c").behaviour(new AddressActivity("Downing street", 10))
-    .done();
+    OpenProcessDefinition processDefinition = ProcessFactory.build("addresses").node().initial().behaviour(
+        new AddressActivity("Sesamestreet", 15)).transition().to("a").node("a").behaviour(new AddressActivity("Broadway", 151))
+        .transition().to("b").node("b").behaviour(new AddressActivity("Champs Elysee", 23)).transition().to("c").node("c").behaviour(
+            new AddressActivity("Downing street", 10)).done();
 
     persistenceSession.save(processDefinition);
 
     newTransaction();
-    
+
     PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
     Execution execution = pvmDbSession.findLatestProcessDefinitionByName("addresses").startProcessInstance();
 
@@ -75,7 +83,7 @@
     expected.add("Broadway 151");
     expected.add("Champs Elysee 23");
     expected.add("Downing street 10");
-    
+
     assertEquals(expected, environment.get(AddressSession.class).addresses);
   }
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/CommentDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/CommentDbTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/CommentDbTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -24,64 +24,76 @@
 import java.util.Date;
 import java.util.List;
 
-import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import junit.framework.Test;
+
 import org.jbpm.pvm.internal.model.CommentImpl;
 import org.jbpm.pvm.model.Comment;
 import org.jbpm.pvm.session.DbSession;
+import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Tom Baeyens
  */
-public class CommentDbTest extends EnvironmentDbTestCase {
+public class CommentDbTest extends EnvironmentDbTestCase
+{
 
-  public void testComment() {
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(CommentDbTest.class);
+  }
+
+  public void testComment()
+  {
     Date now = new Date();
-    
+
     CommentImpl comment = new CommentImpl();
     comment.setUserId("me");
     comment.setTime(now);
     comment.setMessage("hi");
-    
+
     comment = reload(comment, CommentImpl.class);
-    
+
     assertEquals("me", comment.getUserId());
     assertEquals(now, comment.getTime());
     assertEquals("hi", comment.getMessage());
   }
 
-  public void testCommentDelete() {
+  public void testCommentDelete()
+  {
     CommentImpl comment = new CommentImpl();
     comment.setUserId("me");
     comment.setMessage("hi");
-    
+
     comment = reload(comment, CommentImpl.class);
 
     DbSession dbSession = environment.get(DbSession.class);
     dbSession.delete(comment);
-    
+
     newTransaction();
-    
+
     dbSession = environment.get(DbSession.class);
     assertNull(dbSession.get(CommentImpl.class, comment.getDbid()));
   }
 
-  public void testCommentReplies() {
+  public void testCommentReplies()
+  {
     CommentImpl comment = new CommentImpl();
     comment.setMessage("how are you");
     Comment reply = comment.createComment("good, thank you");
     reply.createComment("you're welcome");
     reply = comment.createComment("and how are you");
     reply.createComment("i'm also fine");
-    
+
     comment = reload(comment, CommentImpl.class);
-    
+
     assertEquals("how are you", comment.getMessage());
-    
+
     List<Comment> replies = comment.getComments();
-    
+
     Comment reply0 = replies.get(0);
     assertEquals("good, thank you", reply0.getMessage());
-    
+
     List<Comment> replyReplies = reply0.getComments();
 
     Comment reply00 = replyReplies.get(0);
@@ -89,24 +101,25 @@
 
     Comment reply1 = replies.get(1);
     assertEquals("and how are you", reply1.getMessage());
-    
+
     replyReplies = reply1.getComments();
 
     Comment reply10 = replyReplies.get(0);
     assertEquals("i'm also fine", reply10.getMessage());
   }
 
-  public void testCommentDeleteReplies() {
+  public void testCommentDeleteReplies()
+  {
     CommentImpl comment = new CommentImpl();
     comment.setMessage("how are you");
     comment.createComment("good, thank you");
     comment.createComment("and how are you");
     comment.createComment("also fine a suppose");
-    
+
     comment = reload(comment, CommentImpl.class);
-    
+
     comment.removeComment(comment.getComments().get(1));
-    
+
     comment = reload(comment, CommentImpl.class);
 
     assertEquals("good, thank you", comment.getComments().get(0).getMessage());

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

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -15,8 +15,9 @@
 
 import java.util.List;
 
+import junit.framework.Test;
+
 import org.hibernate.Session;
-import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
 import org.jbpm.pvm.client.ClientProcessDefinition;
 import org.jbpm.pvm.internal.model.NodeImpl;
 import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
@@ -26,135 +27,135 @@
 import org.jbpm.pvm.model.Transition;
 import org.jbpm.pvm.session.DbSession;
 import org.jbpm.pvm.session.PvmDbSession;
+import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Guillaume Porcher
- *
+ * 
  */
-public class ProcessCacheDbTest extends EnvironmentDbTestCase {
-  
+public class ProcessCacheDbTest extends EnvironmentDbTestCase
+{
+
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(ProcessCacheDbTest.class);
+  }
+
   /**
-   * Defines a simple process: only nodes.
-   * persists it.
+   * Defines a simple process: only nodes. persists it.
    */
-  public void testCacheProcessDefinitionNodes(){
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .node("a").initial()
-        .node("b")
-        .node("c")
-    .done();
+  public void testCacheProcessDefinitionNodes()
+  {
+    OpenProcessDefinition processDefinition = ProcessFactory.build().node("a").initial().node("b").node("c").done();
 
     PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
     pvmDbSession.save(processDefinition);
-    
+
     environment.get(Session.class).flush();
 
-    newTransaction(); /////////////////////////////////////////////////////////
-    
-    // only the processDefinition.getDbid() is carried over from the previous transaction 
+    newTransaction(); // ///////////////////////////////////////////////////////
 
+    // only the processDefinition.getDbid() is carried over from the previous transaction
+
     pvmDbSession = environment.get(PvmDbSession.class);
     processDefinition = pvmDbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(processDefinition);
     List<Node> nodes = processDefinition.getNodes();
     assertNotNull(nodes);
-    
+
     Node a = nodes.get(0);
     assertEquals("a", a.getName());
     assertTrue(a.getNodes().isEmpty());
-    
+
     Node b = nodes.get(1);
     assertEquals("b", b.getName());
     assertTrue(b.getNodes().isEmpty());
-    
+
     Node c = nodes.get(2);
     assertEquals("c", c.getName());
     assertTrue(c.getNodes().isEmpty());
 
     assertEquals(3, nodes.size());
 
-    newTransaction(); /////////////////////////////////////////////////////////
-    
-    beginCacheTest(); ///////////////
-    // only the processDefinition.getDbid() is carried over from the previous transaction 
+    newTransaction(); // ///////////////////////////////////////////////////////
 
+    beginCacheTest(); // /////////////
+    // only the processDefinition.getDbid() is carried over from the previous transaction
+
     pvmDbSession = environment.get(PvmDbSession.class);
     processDefinition = pvmDbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(processDefinition);
     nodes = processDefinition.getNodes();
     assertNotNull(nodes);
-    
+
     a = nodes.get(0);
     assertEquals("a", a.getName());
     assertTrue(a.getNodes().isEmpty());
-    
+
     b = nodes.get(1);
     assertEquals("b", b.getName());
     assertTrue(b.getNodes().isEmpty());
-    
+
     c = nodes.get(2);
     assertEquals("c", c.getName());
     assertTrue(c.getNodes().isEmpty());
 
     assertEquals(3, nodes.size());
-    
-    endCacheTest(); /////////////
+
+    endCacheTest(); // ///////////
   }
 
   /**
-   * Defines a simple process: only nodes.
-   * persists it.
+   * Defines a simple process: only nodes. persists it.
    */
-  public void testCacheProcessDefinitionNodeOrder(){
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .node("a").initial()
-        .node("b")
-        .node("c")
-    .done();
+  public void testCacheProcessDefinitionNodeOrder()
+  {
+    OpenProcessDefinition processDefinition = ProcessFactory.build().node("a").initial().node("b").node("c").done();
 
     DbSession dbSession = environment.get(DbSession.class);
     dbSession.save(processDefinition);
 
-    newTransaction(); /////////////////////////////////////////////////////////
-    
-    // only the processDefinition.getDbid() is carried over from the previous transaction 
+    newTransaction(); // ///////////////////////////////////////////////////////
 
+    // only the processDefinition.getDbid() is carried over from the previous transaction
+
     dbSession = environment.get(DbSession.class);
     processDefinition = dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(processDefinition);
     List<Node> nodes = processDefinition.getNodes();
     assertNotNull(nodes);
     assertEquals(3, nodes.size());
-    
+
     Node a = nodes.get(0);
     assertEquals("a", a.getName());
     assertEquals(0, a.getNodes().size());
-    
+
     Node b = nodes.get(1);
     assertEquals("b", b.getName());
     assertEquals(0, b.getNodes().size());
-    
+
     Node c = nodes.get(2);
     assertEquals("c", c.getName());
     assertEquals(0, c.getNodes().size());
 
-    newTransaction(); /////////////////////////////////////////////////////////
-    
+    newTransaction(); // ///////////////////////////////////////////////////////
+
     dbSession = environment.get(DbSession.class);
     processDefinition = dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(processDefinition);
-    
+
     nodes = processDefinition.getNodes();
     assertNotNull(nodes);
-    
+
     // Pass a to the end -> node order is "b,c,a"
     nodes.add(nodes.remove(0));
-    
+
     nodes = processDefinition.getNodes();
     b = nodes.get(0);
     assertEquals("b", b.getName());
     assertEquals(0, b.getNodes().size());
-    
+
     c = nodes.get(1);
     assertEquals("c", c.getName());
     assertEquals(0, c.getNodes().size());
@@ -163,20 +164,19 @@
     assertEquals("a", a.getName());
     assertEquals(0, a.getNodes().size());
 
+    newTransaction(); // ///////////////////////////////////////////////////////
 
-    newTransaction(); /////////////////////////////////////////////////////////
-
     dbSession = environment.get(DbSession.class);
     processDefinition = dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(processDefinition);
     nodes = processDefinition.getNodes();
     assertNotNull(nodes);
     assertEquals(3, nodes.size());
-    
+
     b = nodes.get(0);
     assertEquals("b", b.getName());
     assertEquals(0, b.getNodes().size());
-    
+
     c = nodes.get(1);
     assertEquals("c", c.getName());
     assertEquals(0, c.getNodes().size());
@@ -184,21 +184,21 @@
     a = nodes.get(2);
     assertEquals("a", a.getName());
     assertEquals(0, a.getNodes().size());
-    
-    newTransaction(); /////////////////////////////////////////////////////////
-    beginCacheTest(); ///////////
- 
+
+    newTransaction(); // ///////////////////////////////////////////////////////
+    beginCacheTest(); // /////////
+
     dbSession = environment.get(DbSession.class);
     processDefinition = dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(processDefinition);
     nodes = processDefinition.getNodes();
     assertNotNull(nodes);
     assertEquals(3, nodes.size());
-    
+
     b = nodes.get(0);
     assertEquals("b", b.getName());
     assertEquals(0, b.getNodes().size());
-    
+
     c = nodes.get(1);
     assertEquals("c", c.getName());
     assertEquals(0, c.getNodes().size());
@@ -206,73 +206,68 @@
     a = nodes.get(2);
     assertEquals("a", a.getName());
     assertEquals(0, a.getNodes().size());
-    
-    endCacheTest(); ////////////////
+
+    endCacheTest(); // //////////////
   }
-  
+
   /**
    * Test processDefinition initial node
    */
-  public void testCacheProcessDefinitionInitialNode(){
+  public void testCacheProcessDefinitionInitialNode()
+  {
     ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
-    NodeImpl node = (NodeImpl) processDefinition.createNode();
+    NodeImpl node = (NodeImpl)processDefinition.createNode();
     node.setName("initial node");
     node.setDescription("very important node");
-    
+
     processDefinition.setInitial(node);
-    
+
     environment.get(DbSession.class).save(processDefinition);
 
-    newTransaction(); ///////////////////////////////////////////////////////
-    
+    newTransaction(); // /////////////////////////////////////////////////////
+
     ProcessDefinitionImpl p = environment.get(DbSession.class).get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(p);
-    
+
     NodeImpl n = p.getInitial();
-    
+
     assertNotNull(n);
     assertEquals(node.getName(), n.getName());
     assertEquals(node.getDescription(), n.getDescription());
-    
-    newTransaction(); ///////////////////////////////////////////////////////
-    beginCacheTest(); ////////////
- 
+
+    newTransaction(); // /////////////////////////////////////////////////////
+    beginCacheTest(); // //////////
+
     p = environment.get(DbSession.class).get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(p);
-    
+
     n = p.getInitial();
-    
+
     assertNotNull(n);
     assertEquals(node.getName(), n.getName());
     assertEquals(node.getDescription(), n.getDescription());
 
-    endCacheTest(); /////////////
+    endCacheTest(); // ///////////
   }
-  
+
   /**
-   * Defines a simple process: only nested nodes.
-   * persists it, reloads it and tries to access the nested nodes
+   * Defines a simple process: only nested nodes. persists it, reloads it and tries to access the nested nodes
    */
-  public void testCacheProcessDefinitionNestedNodes(){
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+  public void testCacheProcessDefinitionNestedNodes()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(persistenceSession);
-    
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .compositeNode().initial()
-          .node("a")
-          .node("b")
-          .node("c")
-        .compositeEnd()
-    .done();
 
+    OpenProcessDefinition processDefinition = ProcessFactory.build().compositeNode().initial().node("a").node("b").node("c").compositeEnd()
+        .done();
+
     persistenceSession.save(processDefinition);
 
-    newTransaction(); ///////////////////////////////////////////////////////
+    newTransaction(); // /////////////////////////////////////////////////////
 
+    persistenceSession = (DbSession)environment.get(DbSession.class);
 
-    persistenceSession = (DbSession) environment.get(DbSession.class);
-
-    OpenProcessDefinition p = (OpenProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+    OpenProcessDefinition p = (OpenProcessDefinition)persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(p);
 
     assertNotSame(processDefinition, p);
@@ -281,13 +276,13 @@
     assertNotNull(p.getInitial().getNode("a"));
     assertNotNull(p.getInitial().getNode("b"));
     assertNotNull(p.getInitial().getNode("c"));
- 
-    newTransaction(); ///////////////////////////////////////////////////////
-    beginCacheTest(); ///////////
- 
-    persistenceSession = (DbSession) environment.get(DbSession.class);
 
-    p = (OpenProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+    newTransaction(); // /////////////////////////////////////////////////////
+    beginCacheTest(); // /////////
+
+    persistenceSession = (DbSession)environment.get(DbSession.class);
+
+    p = (OpenProcessDefinition)persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(p);
 
     assertNotSame(processDefinition, p);
@@ -296,45 +291,28 @@
     assertNotNull(p.getInitial().getNode("a"));
     assertNotNull(p.getInitial().getNode("b"));
     assertNotNull(p.getInitial().getNode("c"));
-  
-    endCacheTest(); //////////
+
+    endCacheTest(); // ////////
   }
 
   /**
-   * Defines a process with nested nodes with nested nodes.
-   * persists it, reloads it and tries to access the nested nodes
+   * Defines a process with nested nodes with nested nodes. persists it, reloads it and tries to access the nested nodes
    */
-  public void testCacheProcessDefinitionNestedNestedNodes(){
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+  public void testCacheProcessDefinitionNestedNestedNodes()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(persistenceSession);
-    
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .compositeNode().initial()
-          .compositeNode("a")
-            .node("aa")
-            .node("ab")
-            .node("ac")
-          .compositeEnd()
-          .compositeNode("b")
-            .node("ba")
-            .node("bb")
-            .node("bc")
-          .compositeEnd()
-          .compositeNode("c")
-            .node("ca")
-            .node("cb")
-            .node("cc")
-          .compositeEnd()
-        .compositeEnd()
-    .done();
 
+    OpenProcessDefinition processDefinition = ProcessFactory.build().compositeNode().initial().compositeNode("a").node("aa").node("ab")
+        .node("ac").compositeEnd().compositeNode("b").node("ba").node("bb").node("bc").compositeEnd().compositeNode("c").node("ca").node(
+            "cb").node("cc").compositeEnd().compositeEnd().done();
+
     persistenceSession.save(processDefinition);
 
-    newTransaction(); ///////////////////////////////////////////////////////
+    newTransaction(); // /////////////////////////////////////////////////////
 
+    persistenceSession = (DbSession)environment.get(DbSession.class);
 
-    persistenceSession = (DbSession) environment.get(DbSession.class);
-
     ClientProcessDefinition p = persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(p);
 
@@ -348,7 +326,7 @@
     assertEquals("aa", l.get(0).getName());
     assertEquals("ab", l.get(1).getName());
     assertEquals("ac", l.get(2).getName());
-    
+
     n = p.getInitial().getNode("b");
     assertNotNull(n);
     l = n.getNodes();
@@ -356,7 +334,7 @@
     assertEquals("ba", l.get(0).getName());
     assertEquals("bb", l.get(1).getName());
     assertEquals("bc", l.get(2).getName());
-    
+
     n = p.getInitial().getNode("c");
     assertNotNull(n);
     l = n.getNodes();
@@ -364,12 +342,12 @@
     assertEquals("ca", l.get(0).getName());
     assertEquals("cb", l.get(1).getName());
     assertEquals("cc", l.get(2).getName());
-    
-    newTransaction(); ///////////////////////////////////////////////////////
-    beginCacheTest(); ////////////
-    
-    persistenceSession = (DbSession) environment.get(DbSession.class);
 
+    newTransaction(); // /////////////////////////////////////////////////////
+    beginCacheTest(); // //////////
+
+    persistenceSession = (DbSession)environment.get(DbSession.class);
+
     p = persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
     assertNotNull(p);
 
@@ -383,7 +361,7 @@
     assertEquals("aa", l.get(0).getName());
     assertEquals("ab", l.get(1).getName());
     assertEquals("ac", l.get(2).getName());
-    
+
     n = p.getInitial().getNode("b");
     assertNotNull(n);
     l = n.getNodes();
@@ -391,7 +369,7 @@
     assertEquals("ba", l.get(0).getName());
     assertEquals("bb", l.get(1).getName());
     assertEquals("bc", l.get(2).getName());
-    
+
     n = p.getInitial().getNode("c");
     assertNotNull(n);
     l = n.getNodes();
@@ -399,36 +377,29 @@
     assertEquals("ca", l.get(0).getName());
     assertEquals("cb", l.get(1).getName());
     assertEquals("cc", l.get(2).getName());
-  
-    endCacheTest(); /////////////
+
+    endCacheTest(); // ///////////
   }
-  
-  
+
   /**
-   * Defines a simple process: only nodes and default transitions.
-   * persists it, reloads and navigates through the transitions.
+   * Defines a simple process: only nodes and default transitions. persists it, reloads and navigates through the
+   * transitions.
    */
-  public void testCacheDefaultTransition() {
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+  public void testCacheDefaultTransition()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(persistenceSession);
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .node().initial()
-          .transition().to("a")
-        .node("a")
-          .transition().to("b")
-        .node("b")
-          .transition().to("c")
-        .node("c")
-    .done();
+    OpenProcessDefinition processDefinition = ProcessFactory.build().node().initial().transition().to("a").node("a").transition().to("b")
+        .node("b").transition().to("c").node("c").done();
 
     persistenceSession.save(processDefinition);
 
-    newTransaction(); ///////////////////////////////////////////////////////
-    
-    DbSession testSession = (DbSession) environment.get(DbSession.class);
+    newTransaction(); // /////////////////////////////////////////////////////
 
-    OpenProcessDefinition p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+    DbSession testSession = (DbSession)environment.get(DbSession.class);
 
+    OpenProcessDefinition p = (OpenProcessDefinition)testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
@@ -452,13 +423,13 @@
     assertEquals(p.getNode("c"), node);
     assertNull(node.getDefaultTransition());
 
-    newTransaction(); ///////////////////////////////////////////////////////
-    beginCacheTest(); ////////////
-    
-    testSession = (DbSession) environment.get(DbSession.class);
+    newTransaction(); // /////////////////////////////////////////////////////
+    beginCacheTest(); // //////////
 
-    p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+    testSession = (DbSession)environment.get(DbSession.class);
 
+    p = (OpenProcessDefinition)testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
@@ -481,100 +452,95 @@
     node = node.getDefaultTransition().getDestination();
     assertEquals(p.getNode("c"), node);
     assertNull(node.getDefaultTransition());
-    
-    endCacheTest(); ////////////
+
+    endCacheTest(); // //////////
   }
-  
+
   /**
-   * Defines a simple process: only nodes and transitions.
-   * persists it, reloads and navigates through the transitions.
+   * Defines a simple process: only nodes and transitions. persists it, reloads and navigates through the transitions.
    */
-  public void testCacheTwoTransitions() {
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+  public void testCacheTwoTransitions()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(persistenceSession);
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .node().initial()
-          .transition().to("a")
-          .transition().to("b")
-        .node("a")
-        .node("b")
-    .done();
+    OpenProcessDefinition processDefinition = ProcessFactory.build().node().initial().transition().to("a").transition().to("b").node("a")
+        .node("b").done();
 
     persistenceSession.save(processDefinition);
 
-    newTransaction(); ///////////////////////////////////////////////////////
-    
-    DbSession testSession = (DbSession) environment.get(DbSession.class);
+    newTransaction(); // /////////////////////////////////////////////////////
 
-    OpenProcessDefinition p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+    DbSession testSession = (DbSession)environment.get(DbSession.class);
 
+    OpenProcessDefinition p = (OpenProcessDefinition)testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
     Node node = p.getInitial();
     List<Transition> l = node.getOutgoingTransitions();
     assertNotNull(l);
-    assertEquals(2 , l.size());
-    
+    assertEquals(2, l.size());
+
     Node a = p.getNode("a");
     assertNotNull(a);
-    
+
     Node b = p.getNode("b");
     assertNotNull(b);
-    
+
     assertEquals(node, l.get(0).getSource());
     assertEquals(node, l.get(1).getSource());
-    
+
     assertEquals(a, l.get(0).getDestination());
     assertEquals(b, l.get(1).getDestination());
-    
+
     List<Transition> la = a.getIncomingTransitions();
     assertNotNull(la);
     assertEquals(1, la.size());
     assertSame(la.get(0), l.get(0));
-    
+
     List<Transition> lb = b.getIncomingTransitions();
     assertNotNull(lb);
     assertEquals(1, lb.size());
     assertSame(lb.get(0), l.get(1));
-    
-    newTransaction(); ///////////////////////////////////////////////////////
 
-    testSession = (DbSession) environment.get(DbSession.class);
-    beginCacheTest(); /////////
-    
-    p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+    newTransaction(); // /////////////////////////////////////////////////////
 
+    testSession = (DbSession)environment.get(DbSession.class);
+    beginCacheTest(); // ///////
+
+    p = (OpenProcessDefinition)testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
     node = p.getInitial();
     l = node.getOutgoingTransitions();
     assertNotNull(l);
-    assertEquals(2 , l.size());
-    
+    assertEquals(2, l.size());
+
     a = p.getNode("a");
     assertNotNull(a);
-    
+
     b = p.getNode("b");
     assertNotNull(b);
-    
+
     assertEquals(node, l.get(0).getSource());
     assertEquals(node, l.get(1).getSource());
-    
+
     assertEquals(a, l.get(0).getDestination());
     assertEquals(b, l.get(1).getDestination());
-    
+
     la = a.getIncomingTransitions();
     assertNotNull(la);
     assertEquals(1, la.size());
     assertSame(la.get(0), l.get(0));
-    
+
     lb = b.getIncomingTransitions();
     assertNotNull(lb);
     assertEquals(1, lb.size());
     assertSame(lb.get(0), l.get(1));
-    
-    endCacheTest(); //////////
+
+    endCacheTest(); // ////////
   }
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -16,7 +16,8 @@
 import java.util.Date;
 import java.util.List;
 
-import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import junit.framework.Test;
+
 import org.jbpm.pvm.internal.model.EventImpl;
 import org.jbpm.pvm.internal.model.EventListenerReference;
 import org.jbpm.pvm.internal.model.ExceptionHandlerImpl;
@@ -27,6 +28,8 @@
 import org.jbpm.pvm.model.ProcessFactory;
 import org.jbpm.pvm.model.Transition;
 import org.jbpm.pvm.session.DbSession;
+import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Charles Souillard
@@ -34,46 +37,48 @@
  */
 public class ProcessDefinitionDbTest extends EnvironmentDbTestCase
 {
-  
-  public void testProcessDefinitionBasicProperties() {
+
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(ProcessDefinitionDbTest.class);
+  }
+
+  public void testProcessDefinitionBasicProperties()
+  {
     Date deploymentTime = new Date();
-    
-    
+
     ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
     processDefinition.setName("name");
     processDefinition.setDescription("description");
     processDefinition.setVersion(3);
     processDefinition.setDeploymentTime(deploymentTime);
 
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
-    
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     assertEquals("name", processDefinition.getName());
     assertEquals("description", processDefinition.getDescription());
     assertEquals(3, processDefinition.getVersion());
     assertEquals(deploymentTime, processDefinition.getDeploymentTime());
   }
-  
-  public void testProcessDefinitionNodes(){
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .node("a").initial()
-        .node("b")
-        .node("c")
-    .done();
 
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+  public void testProcessDefinitionNodes()
+  {
+    OpenProcessDefinition processDefinition = ProcessFactory.build().node("a").initial().node("b").node("c").done();
 
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     assertNotNull(processDefinition);
     List<Node> nodes = processDefinition.getNodes();
     assertNotNull(nodes);
-    
+
     Node a = nodes.get(0);
     assertEquals("a", a.getName());
     assertTrue(a.getNodes().isEmpty());
-    
+
     Node b = nodes.get(1);
     assertEquals("b", b.getName());
     assertTrue(b.getNodes().isEmpty());
-    
+
     Node c = nodes.get(2);
     assertEquals("c", c.getName());
     assertTrue(c.getNodes().isEmpty());
@@ -81,15 +86,12 @@
     assertEquals(3, nodes.size());
   }
 
-  public void testInitialNode(){
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .node("a").initial()
-        .node("b")
-        .node("c")
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
-    
+  public void testInitialNode()
+  {
+    OpenProcessDefinition processDefinition = ProcessFactory.build().node("a").initial().node("b").node("c").done();
+
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     Node initial = processDefinition.getInitial();
     assertNotNull(initial);
 
@@ -99,139 +101,112 @@
     assertEquals(3, processDefinition.getNodes().size());
   }
 
-  public void testProcessDefinitionNestedNodes(){
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+  public void testProcessDefinitionNestedNodes()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(persistenceSession);
-    
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .compositeNode("top").initial()
-          .node("a")
-          .compositeNode("b")
-            .node("b1")
-            .node("b2")
-            .node("b3")
-          .compositeEnd()
-          .node("c")
-        .compositeEnd()
-    .done();
 
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+    OpenProcessDefinition processDefinition = ProcessFactory.build().compositeNode("top").initial().node("a").compositeNode("b").node("b1")
+        .node("b2").node("b3").compositeEnd().node("c").compositeEnd().done();
 
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     assertNotNull(processDefinition);
     Node initial = processDefinition.getInitial();
     assertNotNull(initial);
     assertEquals(initial, processDefinition.getNode("top"));
 
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
 
     List<Node> nodes = processDefinition.getNodes();
     assertNotNull(nodes);
-    assertEquals("expected size 1.  node list was: "+nodes.toString(), 1, nodes.size());
+    assertEquals("expected size 1.  node list was: " + nodes.toString(), 1, nodes.size());
     Node top = nodes.get(0);
     assertNotNull(top);
 
     nodes = top.getNodes();
     assertNotNull(nodes);
-    assertEquals("expected size 3.  node list was: "+nodes.toString(), 3, nodes.size());
+    assertEquals("expected size 3.  node list was: " + nodes.toString(), 3, nodes.size());
     assertEquals("a", nodes.get(0).getName());
     assertEquals("b", nodes.get(1).getName());
     assertEquals("c", nodes.get(2).getName());
-    
+
     nodes = processDefinition.getNode("top").getNode("b").getNodes();
     assertNotNull(nodes);
-    assertEquals("expected size 3.  node list was: "+nodes.toString(), 3, nodes.size());
+    assertEquals("expected size 3.  node list was: " + nodes.toString(), 3, nodes.size());
     assertEquals("b1", nodes.get(0).getName());
     assertEquals("b2", nodes.get(1).getName());
     assertEquals("b3", nodes.get(2).getName());
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
-    
+
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     Node node = processDefinition.findNode("b2");
     assertNotNull(node);
     assertEquals("b", node.getParent().getName());
     assertEquals("top", node.getParent().getParent().getName());
   }
 
-  public void testDefaultTransition() {
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+  public void testDefaultTransition()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(persistenceSession);
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .node("a").initial()
-          .transition().to("a")
-          .transition("tob").to("b")
-          .transition("toc").to("c")
-        .node("b")
-          .transition("toa").to("a")
-          .transition().to("b")
-          .transition("toc").to("c")
-        .node("c")
-          .transition().to("c")
-        .node("d")
-    .done();
+    OpenProcessDefinition processDefinition = ProcessFactory.build().node("a").initial().transition().to("a").transition("tob").to("b")
+        .transition("toc").to("c").node("b").transition("toa").to("a").transition().to("b").transition("toc").to("c").node("c")
+        .transition().to("c").node("d").done();
 
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
-    
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     assertEquals("a", processDefinition.getNode("a").getDefaultTransition().getDestination().getName());
     assertEquals("a", processDefinition.getNode("b").getDefaultTransition().getDestination().getName());
     assertEquals("c", processDefinition.getNode("c").getDefaultTransition().getDestination().getName());
     assertNull(processDefinition.getNode("d").getDefaultTransition());
   }
 
-  public void testTwoTransitionsWithoutAName() {
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+  public void testTwoTransitionsWithoutAName()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(persistenceSession);
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-        .node().initial()
-          .transition().to("a")
-          .transition().to("b")
-        .node("a")
-        .node("b")
-    .done();
+    OpenProcessDefinition processDefinition = ProcessFactory.build().node().initial().transition().to("a").transition().to("b").node("a")
+        .node("b").done();
 
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
 
     assertNotNull(processDefinition);
     Node node = processDefinition.getInitial();
     List<Transition> l = node.getOutgoingTransitions();
     assertNotNull(l);
-    assertEquals(2 , l.size());
-    
+    assertEquals(2, l.size());
+
     Node a = processDefinition.getNode("a");
     assertNotNull(a);
-    
+
     Node b = processDefinition.getNode("b");
     assertNotNull(b);
-    
+
     assertEquals(node, l.get(0).getSource());
     assertEquals(node, l.get(1).getSource());
-    
+
     assertEquals(a, l.get(0).getDestination());
     assertEquals(b, l.get(1).getDestination());
-    
+
     List<Transition> la = a.getIncomingTransitions();
     assertNotNull(la);
     assertEquals(1, la.size());
     assertSame(la.get(0), l.get(0));
-    
+
     List<Transition> lb = b.getIncomingTransitions();
     assertNotNull(lb);
     assertEquals(1, lb.size());
     assertSame(lb.get(0), l.get(1));
   }
-  
-  public void testEventsOnProcessDefinition() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .event(Event.PROCESS_BEGIN)
-          .listener("one")
-          .listener("two")
-        .event(Event.PROCESS_END)
-          .listener("three")
-          .listener("four")
-        .node().initial()
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
 
+  public void testEventsOnProcessDefinition()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().event(Event.PROCESS_BEGIN).listener("one")
+        .listener("two").event(Event.PROCESS_END).listener("three").listener("four").node().initial().done();
+
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     EventImpl event = processDefinition.getEvent(Event.PROCESS_BEGIN);
     List<EventListenerReference> listenerReferences = event.getListenerReferences();
     assertEquals("one", listenerReferences.get(0).getExpression());
@@ -243,19 +218,13 @@
     assertEquals("four", listenerReferences.get(1).getExpression());
   }
 
-  public void testEventsOnNode() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .node("a").initial()
-          .event(Event.NODE_BEGIN)
-            .listener("one")
-            .listener("two")
-          .event(Event.NODE_END)
-            .listener("three")
-            .listener("four")
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+  public void testEventsOnNode()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node("a").initial().event(Event.NODE_BEGIN)
+        .listener("one").listener("two").event(Event.NODE_END).listener("three").listener("four").done();
 
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     EventImpl event = processDefinition.getNode("a").getEvent(Event.NODE_BEGIN);
     List<EventListenerReference> listenerReferences = event.getListenerReferences();
     assertEquals("one", listenerReferences.get(0).getExpression());
@@ -267,132 +236,104 @@
     assertEquals("four", listenerReferences.get(1).getExpression());
   }
 
-  public void testListenersOnTransition() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .node("a").initial()
-          .transition().to("b")
-            .listener("one")
-            .listener("two")
-        .node("b")
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+  public void testListenersOnTransition()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node("a").initial().transition().to("b")
+        .listener("one").listener("two").node("b").done();
 
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     EventImpl event = processDefinition.getNode("a").getDefaultTransition().getEvent();
     List<EventListenerReference> listenerReferences = event.getListenerReferences();
     assertEquals("one", listenerReferences.get(0).getExpression());
     assertEquals("two", listenerReferences.get(1).getExpression());
   }
 
-  public void testExceptionHandlersOnProcessDefinition() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .exceptionHandler(IllegalArgumentException.class)
-          .listener("one")
-          .listener("two")
-        .exceptionHandlerEnd()
-        .exceptionHandler(RuntimeException.class)
-          .listener("three")
-          .listener("four")
-        .exceptionHandlerEnd()
-        .node().initial()
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
-    
+  public void testExceptionHandlersOnProcessDefinition()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build()
+        .exceptionHandler(IllegalArgumentException.class).listener("one").listener("two").exceptionHandlerEnd().exceptionHandler(
+            RuntimeException.class).listener("three").listener("four").exceptionHandlerEnd().node().initial().done();
+
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     List<ExceptionHandlerImpl> exceptionHandlers = processDefinition.getExceptionHandlers();
 
     ExceptionHandlerImpl exceptionHandler = exceptionHandlers.get(0);
     assertEquals(IllegalArgumentException.class.getName(), exceptionHandler.getExceptionClassName());
     assertEquals("one", exceptionHandler.getEventListenerReferences().get(0).getExpression());
     assertEquals("two", exceptionHandler.getEventListenerReferences().get(1).getExpression());
-    
+
     exceptionHandler = exceptionHandlers.get(1);
     assertEquals(RuntimeException.class.getName(), exceptionHandler.getExceptionClassName());
     assertEquals("three", exceptionHandler.getEventListenerReferences().get(0).getExpression());
     assertEquals("four", exceptionHandler.getEventListenerReferences().get(1).getExpression());
   }
 
-  public void testExceptionHandlersOnNode() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .node("a").initial()
-          .exceptionHandler(IllegalArgumentException.class)
-            .listener("one")
-            .listener("two")
-          .exceptionHandlerEnd()
-          .exceptionHandler(RuntimeException.class)
-            .listener("three")
-            .listener("four")
-          .exceptionHandlerEnd()
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
-    
+  public void testExceptionHandlersOnNode()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node("a").initial().exceptionHandler(
+        IllegalArgumentException.class).listener("one").listener("two").exceptionHandlerEnd().exceptionHandler(RuntimeException.class)
+        .listener("three").listener("four").exceptionHandlerEnd().done();
+
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     List<ExceptionHandlerImpl> exceptionHandlers = processDefinition.getNode("a").getExceptionHandlers();
 
     ExceptionHandlerImpl exceptionHandler = exceptionHandlers.get(0);
     assertEquals(IllegalArgumentException.class.getName(), exceptionHandler.getExceptionClassName());
     assertEquals("one", exceptionHandler.getEventListenerReferences().get(0).getExpression());
     assertEquals("two", exceptionHandler.getEventListenerReferences().get(1).getExpression());
-    
+
     exceptionHandler = exceptionHandlers.get(1);
     assertEquals(RuntimeException.class.getName(), exceptionHandler.getExceptionClassName());
     assertEquals("three", exceptionHandler.getEventListenerReferences().get(0).getExpression());
     assertEquals("four", exceptionHandler.getEventListenerReferences().get(1).getExpression());
   }
 
-  public void testProcessDynamicProperties() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .property("key1", "val1")
-        .property("key2", "val2")
-        .node().initial()
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
-    
+  public void testProcessDynamicProperties()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().property("key1", "val1").property("key2",
+        "val2").node().initial().done();
+
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
     assertEquals("val1", processDefinition.getProperty("key1"));
     assertEquals("val2", processDefinition.getProperty("key2"));
   }
 
-  public void testNodeDynamicProperties() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .node().initial()
-          .property("key1", "val1")
-          .property("key2", "val2")
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+  public void testNodeDynamicProperties()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node().initial().property("key1", "val1")
+        .property("key2", "val2").done();
 
-    Node node = processDefinition.getInitial(); 
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
+    Node node = processDefinition.getInitial();
     assertEquals("val1", node.getProperty("key1"));
     assertEquals("val2", node.getProperty("key2"));
   }
 
-  public void testTransitionDynamicProperties() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .node("a").initial()
-          .transition().to("a")
-            .property("key1", "val1")
-            .property("key2", "val2")
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+  public void testTransitionDynamicProperties()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node("a").initial().transition().to("a")
+        .property("key1", "val1").property("key2", "val2").done();
 
-    Transition transition = processDefinition.getInitial().getDefaultTransition(); 
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
+    Transition transition = processDefinition.getInitial().getDefaultTransition();
     assertEquals("val1", transition.getProperty("key1"));
     assertEquals("val2", transition.getProperty("key2"));
   }
 
-  public void testEventDynamicProperties() {
-    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessFactory.build()
-        .event(Event.PROCESS_BEGIN)
-          .property("key1", "val1")
-          .property("key2", "val2")
-        .node().initial()
-    .done();
-    
-    processDefinition = reload(processDefinition); /// new transaction ////////////////////////////
+  public void testEventDynamicProperties()
+  {
+    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().event(Event.PROCESS_BEGIN).property("key1",
+        "val1").property("key2", "val2").node().initial().done();
 
-    EventImpl event = processDefinition.getEvent(Event.PROCESS_BEGIN); 
+    processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+
+    EventImpl event = processDefinition.getEvent(Event.PROCESS_BEGIN);
     assertEquals("val1", event.getProperty("key1"));
     assertEquals("val2", event.getProperty("key2"));
   }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -13,20 +13,30 @@
  **/
 package org.jbpm.pvm.internal.db.model;
 
-import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import junit.framework.Test;
+
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
 import org.jbpm.pvm.model.OpenProcessDefinition;
+import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Guillaume Porcher
- *
+ * 
  */
-public class ProcessExecutionDbTest extends EnvironmentDbTestCase {
+public class ProcessExecutionDbTest extends EnvironmentDbTestCase
+{
 
-  public void testExecutionProperties() {
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(ProcessExecutionDbTest.class);
+  }
+
+  public void testExecutionProperties()
+  {
     OpenProcessDefinition processDefinition = new ProcessDefinitionImpl();
-    
+
     processDefinition = reload(processDefinition); // new transaction /////////
 
     ExecutionImpl execution = new ExecutionImpl();
@@ -34,141 +44,100 @@
     execution.setName("main");
     execution.setState("test");
     execution.setPriority(42);
-    
+
     execution = reload(execution); // new transaction /////////////////////////
-    
+
     assertNotNull(execution);
-    
+
     assertEquals("businessKey", execution.getKey());
     assertEquals("main", execution.getName());
     assertEquals("test", execution.getState());
     assertEquals(42, execution.getPriority());
   }
-/*
-  TODO finish after refactoring
-  
-  public void testChildExecutions() {
-    ProcessDefinition processDefinition = new ProcessDefinitionImpl();
-    
-    processDefinition = reload(processDefinition); // new transaction /////////
-
-    ExecutionImpl mainExecution = (ExecutionImpl) processDefinition.beginProcessInstance();
-
-    mainExecution = reload(mainExecution); // new transaction /////////////////////////
-    
-    mainExecution.createExecution("shipping");
-    mainExecution.createExecution("billing");
-    ExecutionImpl talking = mainExecution.createExecution("talking");
-    talking.createExecution("gossip");
-    talking.createExecution("bs");
-    talking.createExecution("rubbish");
-    
-    mainExecution = reload(mainExecution); // new transaction /////////////////////////
-
-    Collection<Execution> executions = mainExecution.getExecutions();
-    assertNotNull(executions);
-    assertNotNull(mainExecution.getExecution("shipping"));
-    assertNotNull(mainExecution.getExecution("billing"));
-    assertNotNull(mainExecution.getExecution("talking"));
-    assertEquals(3, executions.size());
-
-    ExecutionImpl talkingExecution = mainExecution.getExecution("talking");
-    Collection<Execution> talkingExecutions = mainExecution.getExecutions();
-    assertNotNull(talkingExecutions);
-    assertNotNull(talkingExecution.getExecution("gossip"));
-    assertNotNull(talkingExecution.getExecution("bs"));
-    assertNotNull(talkingExecution.getExecution("rubbish"));
-    assertEquals(3, talkingExecutions.size());
-  }
-
-  public void testSimpleProcessVariables() {
-    ProcessDefinition processDefinition = new ProcessDefinitionImpl();
-    
-    processDefinition = reload(processDefinition); // new transaction /////////
-
-    ExecutionImpl execution = (ExecutionImpl) processDefinition.beginProcessInstance();
-    execution.setVariable("amount", "$500");
-    execution.setVariable("size", 66);
-    execution.setVariable("color", "blue");
-    
-    execution = reload(execution); // new transaction /////////////////////////
-    
-    assertEquals("$500", execution.getVariable("amount"));
-    assertEquals(66, execution.getVariable("size"));
-    assertEquals("blue", execution.getVariable("color"));
-    assertEquals(3, execution.getVariableKeys().size());
-  }
-  
-  public static class Color {
-  }
-
-  public void testUnpersistableVariable() {
-    ProcessDefinition processDefinition = new ProcessDefinitionImpl();
-    
-    processDefinition = reload(processDefinition); // new transaction /////////
-
-    ExecutionImpl execution = (ExecutionImpl) processDefinition.beginProcessInstance();
-    execution.setVariable("color", new Color());
-    
-    try {
-      environment.get(DbSession.class).save(execution);
-      fail("expected exception");
-    } catch (RuntimeException e) {
-      // OK
-      environment.getTransaction().setRollbackOnly();
-    }
-  }
-
-  public void testVariablesQuery() {
-    ProcessDefinition processDefinition = new ProcessDefinitionImpl();
-    
-    processDefinition = reload(processDefinition); // new transaction /////////
-
-    ExecutionImpl execution = (ExecutionImpl) processDefinition.beginProcessInstance("one");
-    execution.setVariable("amount", 100);
-    environment.get(DbSession.class).save(execution);
-    
-    execution = (ExecutionImpl) processDefinition.beginProcessInstance("two");
-    execution.setVariable("amount", 200);
-    environment.get(DbSession.class).save(execution);
-
-    execution = (ExecutionImpl) processDefinition.beginProcessInstance("three");
-    execution.setVariable("amount", 300);
-    environment.get(DbSession.class).save(execution);
-
-    execution = (ExecutionImpl) processDefinition.beginProcessInstance("four");
-    execution.setVariable("amount", 400);
-    environment.get(DbSession.class).save(execution);
-    
-    execution = (ExecutionImpl) processDefinition.beginProcessInstance("hmmm");
-    execution.setVariable("sambucas", 500);
-    environment.get(DbSession.class).save(execution);
-    
-    newTransaction();
-    
-    Session session = environment.get(Session.class);
-    Query query = session.createQuery(
-        "select lv.processInstance " +
-        "from "+LongVariable.class.getName()+" as lv " +
-        "where lv.key = :variableKey" +
-        "  and lv.l > :variableValue"
-    );
-    query.setString("variableKey", "amount");
-    query.setInteger("variableValue", 250);
-    List executions = query.list();
-
-    assertNotNull(executions);
-    assertEquals(2, executions.size());
-
-    Set<String> retrievedExecutionNames = new HashSet<String>();
-    retrievedExecutionNames.add(((ExecutionImpl)executions.get(0)).getKey());
-    retrievedExecutionNames.add(((ExecutionImpl)executions.get(1)).getKey());
-
-    Set<String> expectedExecutionNames = new HashSet<String>();
-    expectedExecutionNames.add("three");
-    expectedExecutionNames.add("four");
-
-    assertEquals(expectedExecutionNames, retrievedExecutionNames);
-  }
-*/
+  /*
+   * TODO finish after refactoring
+   * 
+   * public void testChildExecutions() { ProcessDefinition processDefinition = new ProcessDefinitionImpl();
+   * 
+   * processDefinition = reload(processDefinition); // new transaction /////////
+   * 
+   * ExecutionImpl mainExecution = (ExecutionImpl) processDefinition.beginProcessInstance();
+   * 
+   * mainExecution = reload(mainExecution); // new transaction /////////////////////////
+   * 
+   * mainExecution.createExecution("shipping"); mainExecution.createExecution("billing"); ExecutionImpl talking =
+   * mainExecution.createExecution("talking"); talking.createExecution("gossip"); talking.createExecution("bs");
+   * talking.createExecution("rubbish");
+   * 
+   * mainExecution = reload(mainExecution); // new transaction /////////////////////////
+   * 
+   * Collection<Execution> executions = mainExecution.getExecutions(); assertNotNull(executions);
+   * assertNotNull(mainExecution.getExecution("shipping")); assertNotNull(mainExecution.getExecution("billing"));
+   * assertNotNull(mainExecution.getExecution("talking")); assertEquals(3, executions.size());
+   * 
+   * ExecutionImpl talkingExecution = mainExecution.getExecution("talking"); Collection<Execution> talkingExecutions =
+   * mainExecution.getExecutions(); assertNotNull(talkingExecutions);
+   * assertNotNull(talkingExecution.getExecution("gossip")); assertNotNull(talkingExecution.getExecution("bs"));
+   * assertNotNull(talkingExecution.getExecution("rubbish")); assertEquals(3, talkingExecutions.size()); }
+   * 
+   * public void testSimpleProcessVariables() { ProcessDefinition processDefinition = new ProcessDefinitionImpl();
+   * 
+   * processDefinition = reload(processDefinition); // new transaction /////////
+   * 
+   * ExecutionImpl execution = (ExecutionImpl) processDefinition.beginProcessInstance(); execution.setVariable("amount",
+   * "$500"); execution.setVariable("size", 66); execution.setVariable("color", "blue");
+   * 
+   * execution = reload(execution); // new transaction /////////////////////////
+   * 
+   * assertEquals("$500", execution.getVariable("amount")); assertEquals(66, execution.getVariable("size"));
+   * assertEquals("blue", execution.getVariable("color")); assertEquals(3, execution.getVariableKeys().size()); }
+   * 
+   * public static class Color { }
+   * 
+   * public void testUnpersistableVariable() { ProcessDefinition processDefinition = new ProcessDefinitionImpl();
+   * 
+   * processDefinition = reload(processDefinition); // new transaction /////////
+   * 
+   * ExecutionImpl execution = (ExecutionImpl) processDefinition.beginProcessInstance(); execution.setVariable("color",
+   * new Color());
+   * 
+   * try { environment.get(DbSession.class).save(execution); fail("expected exception"); } catch (RuntimeException e) {
+   * // OK environment.getTransaction().setRollbackOnly(); } }
+   * 
+   * public void testVariablesQuery() { ProcessDefinition processDefinition = new ProcessDefinitionImpl();
+   * 
+   * processDefinition = reload(processDefinition); // new transaction /////////
+   * 
+   * ExecutionImpl execution = (ExecutionImpl) processDefinition.beginProcessInstance("one");
+   * execution.setVariable("amount", 100); environment.get(DbSession.class).save(execution);
+   * 
+   * execution = (ExecutionImpl) processDefinition.beginProcessInstance("two"); execution.setVariable("amount", 200);
+   * environment.get(DbSession.class).save(execution);
+   * 
+   * execution = (ExecutionImpl) processDefinition.beginProcessInstance("three"); execution.setVariable("amount", 300);
+   * environment.get(DbSession.class).save(execution);
+   * 
+   * execution = (ExecutionImpl) processDefinition.beginProcessInstance("four"); execution.setVariable("amount", 400);
+   * environment.get(DbSession.class).save(execution);
+   * 
+   * execution = (ExecutionImpl) processDefinition.beginProcessInstance("hmmm"); execution.setVariable("sambucas", 500);
+   * environment.get(DbSession.class).save(execution);
+   * 
+   * newTransaction();
+   * 
+   * Session session = environment.get(Session.class); Query query = session.createQuery( "select lv.processInstance " +
+   * "from "+LongVariable.class.getName()+" as lv " + "where lv.key = :variableKey" + "  and lv.l > :variableValue" );
+   * query.setString("variableKey", "amount"); query.setInteger("variableValue", 250); List executions = query.list();
+   * 
+   * assertNotNull(executions); assertEquals(2, executions.size());
+   * 
+   * Set<String> retrievedExecutionNames = new HashSet<String>();
+   * retrievedExecutionNames.add(((ExecutionImpl)executions.get(0)).getKey());
+   * retrievedExecutionNames.add(((ExecutionImpl)executions.get(1)).getKey());
+   * 
+   * Set<String> expectedExecutionNames = new HashSet<String>(); expectedExecutionNames.add("three");
+   * expectedExecutionNames.add("four");
+   * 
+   * assertEquals(expectedExecutionNames, retrievedExecutionNames); }
+   */
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -21,18 +21,25 @@
  */
 package org.jbpm.pvm.internal.db.model;
 
+import junit.framework.Test;
+
 import org.hibernate.SessionFactory;
 import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
-
 /**
  * @author Tom Baeyens
  */
 public class SessionFactoryDbTest extends EnvironmentDbTestCase
 {
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(SessionFactoryDbTest.class);
+  }
 
-  public void testSessionFactory() {
+  public void testSessionFactory()
+  {
     environment.get(SessionFactory.class);
   }
-  
+
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -21,7 +21,8 @@
 import java.util.TreeMap;
 import java.util.TreeSet;
 
-import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import junit.framework.Test;
+
 import org.jbpm.pvm.internal.model.EventImpl;
 import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
 import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
@@ -52,212 +53,233 @@
 import org.jbpm.pvm.model.OpenProcessDefinition;
 import org.jbpm.pvm.model.ProcessFactory;
 import org.jbpm.pvm.session.DbSession;
+import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Guillaume Porcher
- *
- * This class uses process annotations to test wire descriptors persistence
+ * 
+ *         This class uses process annotations to test wire descriptors persistence
  */
-public class WireDbTest extends EnvironmentDbTestCase {
+public class WireDbTest extends EnvironmentDbTestCase
+{
 
-  public void testCharacterDescriptor() {
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(WireDbTest.class);
+  }
+
+  public void testCharacterDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     CharacterDescriptor descriptor = new CharacterDescriptor();
     descriptor.setName("n");
     descriptor.setValue('c');
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (CharacterDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (CharacterDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals('c', descriptor.construct(null));
   }
 
-  public void testByteDescriptor() {
+  public void testByteDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     ByteDescriptor descriptor = new ByteDescriptor();
     descriptor.setName("n");
     descriptor.setValue((byte)6);
 
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (ByteDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (ByteDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals((byte)6, descriptor.construct(null));
   }
 
-  public void testClassDescriptor() {
+  public void testClassDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     ClassDescriptor descriptor = new ClassDescriptor();
     descriptor.setName("n");
     descriptor.setClassName(EventImpl.class.getName());
 
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (ClassDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (ClassDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals(EventImpl.class, WireContext.create(descriptor));
   }
 
-  public void testDoubleDescriptor() {
+  public void testDoubleDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     DoubleDescriptor descriptor = new DoubleDescriptor();
     descriptor.setName("n");
     descriptor.setValue(6.666);
 
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (DoubleDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (DoubleDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals(6.666, descriptor.construct(null));
   }
 
-  public void testFalseDescriptor() {
+  public void testFalseDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     FalseDescriptor descriptor = new FalseDescriptor();
     descriptor.setName("n");
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (FalseDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (FalseDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals(Boolean.FALSE, descriptor.construct(null));
   }
 
-  public void testFloatDescriptor() {
+  public void testFloatDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     FloatDescriptor descriptor = new FloatDescriptor();
     descriptor.setName("n");
     descriptor.setValue((float)6.666);
 
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (FloatDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (FloatDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals((float)6.666, descriptor.construct(null));
   }
 
-  public void testIntegerDescriptor() {
+  public void testIntegerDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     IntegerDescriptor descriptor = new IntegerDescriptor();
     descriptor.setName("n");
     descriptor.setValue(6);
 
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (IntegerDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (IntegerDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals(6, descriptor.construct(null));
   }
 
-  public void testLongDescriptor() {
+  public void testLongDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     LongDescriptor descriptor = new LongDescriptor();
     descriptor.setName("n");
     descriptor.setValue(6L);
 
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (LongDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (LongDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals(6L, descriptor.construct(null));
   }
 
-  public void testNullDescriptor() {
+  public void testNullDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     NullDescriptor descriptor = new NullDescriptor();
     descriptor.setName("n");
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (NullDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (NullDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertNull(descriptor.construct(null));
   }
 
-  public void testShortDescriptor() {
+  public void testShortDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     ShortDescriptor descriptor = new ShortDescriptor();
     descriptor.setName("n");
     descriptor.setValue((short)6);
 
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (ShortDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (ShortDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals((short)6, descriptor.construct(null));
   }
 
-  public void testStringDescriptor() {
+  public void testStringDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     StringDescriptor descriptor = new StringDescriptor();
     descriptor.setName("n");
     descriptor.setValue("s");
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (StringDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (StringDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals("s", descriptor.construct(null));
   }
 
-  public void testTrueDescriptor() {
+  public void testTrueDescriptor()
+  {
     DbSession dbSession = environment.get(DbSession.class);
-    
+
     TrueDescriptor descriptor = new TrueDescriptor();
     descriptor.setName("n");
     dbSession.save(descriptor);
-    
+
     newTransaction();
     dbSession = environment.get(DbSession.class);
-    
-    descriptor = (TrueDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
+
+    descriptor = (TrueDescriptor)dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
     assertEquals(Boolean.TRUE, descriptor.construct(null));
   }
 
-  public void testRefDescriptor() {
-    DbSession dbSession = (DbSession) environment.get(DbSession.class);
+  public void testRefDescriptor()
+  {
+    DbSession dbSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(dbSession);
 
     WireProperties configurations = new WireProperties();
@@ -266,200 +288,194 @@
     referencedDescriptor.setName("referenced");
     referencedDescriptor.setValue("text");
     configurations.add(referencedDescriptor);
-    
+
     ReferenceDescriptor descriptor = new ReferenceDescriptor();
     descriptor.setName("reference");
     descriptor.setValue("referenced");
     configurations.add(descriptor);
-    
+
     dbSession.save(configurations);
-    
+
     newTransaction();
-    
-    dbSession = (DbSession) environment.get(DbSession.class);
-    
+
+    dbSession = (DbSession)environment.get(DbSession.class);
+
     configurations = dbSession.get(WireProperties.class, configurations.getDbid());
 
     assertNotNull(configurations);
-    assertEquals("text",  configurations.get("reference"));
+    assertEquals("text", configurations.get("reference"));
   }
-  
+
   /**
    * Check that list descriptors are persisted
    */
-  public void testListDescriptor() {
-    DbSession dbSession = (DbSession) environment.get(DbSession.class);
+  public void testListDescriptor()
+  {
+    DbSession dbSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(dbSession);
 
     StringDescriptor stringD = new StringDescriptor();
     stringD.setValue("value");
-    
+
     StringDescriptor string2D = new StringDescriptor();
     string2D.setValue("value2");
-    
+
     List<Descriptor> listValues = new ArrayList<Descriptor>();
     listValues.add(stringD);
     listValues.add(string2D);
-    
+
     ListDescriptor listD = new ListDescriptor();
     listD.setName("list");
     listD.setValueDescriptors(listValues);
     listD.setClassName(LinkedList.class.getName());
-    
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-      .property(listD)
-      .node().initial()
-    .done();
 
+    OpenProcessDefinition processDefinition = ProcessFactory.build().property(listD).node().initial().done();
+
     dbSession.save(processDefinition);
 
     newTransaction();
-    
-    dbSession = (DbSession) environment.get(DbSession.class);
-    
-    OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
 
+    dbSession = (DbSession)environment.get(DbSession.class);
+
+    OpenProcessDefinition p = (OpenProcessDefinition)dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
-    List<String> result = (List<String>) p.getProperty("list");
+    List<String> result = (List<String>)p.getProperty("list");
     assertNotNull(result);
     assertEquals(2, result.size());
     assertEquals("value", result.get(0));
     assertEquals("value2", result.get(1));
-    
+
     assertTrue(result instanceof LinkedList);
   }
-  
+
   /**
    * Check that set descriptors are persisted
    */
-  public void testSetDescriptor() {
-    DbSession dbSession = (DbSession) environment.get(DbSession.class);
+  public void testSetDescriptor()
+  {
+    DbSession dbSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(dbSession);
 
     StringDescriptor stringD = new StringDescriptor();
     stringD.setValue("value");
-    
+
     StringDescriptor string2D = new StringDescriptor();
     string2D.setValue("value2");
-    
+
     List<Descriptor> listValues = new ArrayList<Descriptor>();
     listValues.add(stringD);
     listValues.add(string2D);
-    
+
     SetDescriptor setD = new SetDescriptor();
     setD.setName("set");
     setD.setValueDescriptors(listValues);
     setD.setClassName(TreeSet.class.getName());
-    
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-      .property(setD)
-      .node().initial()
-    .done();
 
+    OpenProcessDefinition processDefinition = ProcessFactory.build().property(setD).node().initial().done();
+
     dbSession.save(processDefinition);
 
     newTransaction();
-    
-    dbSession = (DbSession) environment.get(DbSession.class);
-    
-    OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
 
+    dbSession = (DbSession)environment.get(DbSession.class);
+
+    OpenProcessDefinition p = (OpenProcessDefinition)dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
-    Set<String> result = (Set<String>) p.getProperty("set");
+    Set<String> result = (Set<String>)p.getProperty("set");
     assertNotNull(result);
     assertTrue(result.contains("value"));
     assertTrue(result.contains("value2"));
     assertEquals(2, result.size());
-    
+
     assertTrue(result instanceof TreeSet);
   }
-  
+
   /**
    * Check that map descriptors are persisted
    */
-  public void testMapDescriptor() {
-    DbSession dbSession = (DbSession) environment.get(DbSession.class);
+  public void testMapDescriptor()
+  {
+    DbSession dbSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(dbSession);
 
     StringDescriptor keyD = new StringDescriptor();
     keyD.setValue("key");
-    
+
     StringDescriptor key2D = new StringDescriptor();
     key2D.setValue("key2");
-    
+
     StringDescriptor stringD = new StringDescriptor();
     stringD.setValue("value");
-    
+
     StringDescriptor string2D = new StringDescriptor();
     string2D.setValue("value2");
-    
+
     List<Descriptor> mapKeys = new ArrayList<Descriptor>();
     mapKeys.add(keyD);
     mapKeys.add(key2D);
-    
+
     List<Descriptor> mapValues = new ArrayList<Descriptor>();
     mapValues.add(stringD);
     mapValues.add(string2D);
-    
+
     MapDescriptor mapD = new MapDescriptor();
     mapD.setName("map");
     mapD.setValueDescriptors(mapValues);
     mapD.setKeyDescriptors(mapKeys);
     mapD.setClassName(TreeMap.class.getName());
-    
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-      .property(mapD)
-      .node().initial()
-    .done();
 
+    OpenProcessDefinition processDefinition = ProcessFactory.build().property(mapD).node().initial().done();
+
     dbSession.save(processDefinition);
 
     newTransaction();
-    
-    dbSession = (DbSession) environment.get(DbSession.class);
-    
-    OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
 
+    dbSession = (DbSession)environment.get(DbSession.class);
+
+    OpenProcessDefinition p = (OpenProcessDefinition)dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
-    Map<String, String> result = (Map<String, String>) p.getProperty("map");
+    Map<String, String> result = (Map<String, String>)p.getProperty("map");
     assertNotNull(result);
     assertEquals(2, result.size());
-    assertEquals("value" , result.get("key"));
-    assertEquals("value2" , result.get("key2"));
-    
-    
+    assertEquals("value", result.get("key"));
+    assertEquals("value2", result.get("key2"));
+
     assertTrue(result instanceof TreeMap);
-  }  
-  
+  }
+
   /**
    * Check that map descriptors are persisted
    */
-  public void testObjectDescriptor() {
-    DbSession dbSession = (DbSession) environment.get(DbSession.class);
+  public void testObjectDescriptor()
+  {
+    DbSession dbSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(dbSession);
 
     ObjectDescriptor objDefault = new ObjectDescriptor();
     objDefault.setName("objectByEmptyConstr");
     objDefault.setClassName(Object.class.getName());
-    
+
     ObjectDescriptor objConstr = new ObjectDescriptor();
     objConstr.setName("objectByConstr");
     objConstr.setClassName(Integer.class.getName());
-    
+
     ArgDescriptor argObjConstr = new ArgDescriptor();
     argObjConstr.setTypeName(int.class.getName());
     IntegerDescriptor argObjConstrVal = new IntegerDescriptor();
     argObjConstrVal.setValue(42);
     argObjConstr.setDescriptor(argObjConstrVal);
-    
+
     objConstr.addArgDescriptor(argObjConstr);
-    
+
     ObjectDescriptor objStaticMethod = new ObjectDescriptor();
     objStaticMethod.setName("objectByStaticMethod");
     objStaticMethod.setClassName(Integer.class.getName());
@@ -469,116 +485,106 @@
     IntegerDescriptor argStaticMethodValue = new IntegerDescriptor();
     argStaticMethodValue.setValue(42);
     argStaticMethod.setDescriptor(argStaticMethodValue);
-    
+
     objStaticMethod.addArgDescriptor(argStaticMethod);
-        
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-      .property(objDefault)
-      .property(objConstr)
-      .property(objStaticMethod)
-      .node().initial()
-    .done();
 
+    OpenProcessDefinition processDefinition = ProcessFactory.build().property(objDefault).property(objConstr).property(objStaticMethod)
+        .node().initial().done();
+
     dbSession.save(processDefinition);
 
     newTransaction();
-    
-    dbSession = (DbSession) environment.get(DbSession.class);
-    
-    OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
 
+    dbSession = (DbSession)environment.get(DbSession.class);
+
+    OpenProcessDefinition p = (OpenProcessDefinition)dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
     assertNotNull(p.getProperty("objectByEmptyConstr"));
-    assertEquals(42 , p.getProperty("objectByConstr"));
+    assertEquals(42, p.getProperty("objectByConstr"));
     assertTrue(p.getProperty("objectByConstr") instanceof Integer);
-    
+
     assertEquals(1, p.getProperty("objectByStaticMethod"));
-  }  
-  
+  }
+
   /**
    * Check that map descriptors are persisted
    */
-  public void testFieldOperation() {
-    DbSession dbSession = (DbSession) environment.get(DbSession.class);
+  public void testFieldOperation()
+  {
+    DbSession dbSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(dbSession);
 
     ObjectDescriptor objDescr = new ObjectDescriptor(VariableDefinitionImpl.class.getName());
     objDescr.setName("object");
-    
+
     FieldOperation fieldOp = new FieldOperation();
     fieldOp.setFieldName("key");
-    
+
     StringDescriptor varNameDescriptor = new StringDescriptor();
     varNameDescriptor.setValue("varName");
-    
+
     fieldOp.setDescriptor(varNameDescriptor);
-    
+
     objDescr.addOperation(fieldOp);
-    
-    
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-      .property(objDescr)
-      .node().initial()
-    .done();
 
+    OpenProcessDefinition processDefinition = ProcessFactory.build().property(objDescr).node().initial().done();
+
     dbSession.save(processDefinition);
 
     newTransaction();
-    
-    dbSession = (DbSession) environment.get(DbSession.class);
-    
-    OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
 
+    dbSession = (DbSession)environment.get(DbSession.class);
+
+    OpenProcessDefinition p = (OpenProcessDefinition)dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
     assertNotNull(p.getProperty("object"));
     assertTrue(p.getProperty("object") instanceof VariableDefinitionImpl);
     assertEquals("varName", ((VariableDefinitionImpl)p.getProperty("object")).getKey());
-  }  
-  
+  }
+
   /**
    * Check that map descriptors are persisted
    */
-  public void testPropertyOperation() {
-    DbSession dbSession = (DbSession) environment.get(DbSession.class);
+  public void testPropertyOperation()
+  {
+    DbSession dbSession = (DbSession)environment.get(DbSession.class);
     assertNotNull(dbSession);
 
     ObjectDescriptor objDescr = new ObjectDescriptor();
     objDescr.setName("object");
     objDescr.setClassName(VariableDefinitionImpl.class.getName());
-    
+
     PropertyOperation propertyOp = new PropertyOperation();
     propertyOp.setPropertyName("key");
-    
+
     StringDescriptor varNameDescriptor = new StringDescriptor();
     varNameDescriptor.setValue("varName");
-    
+
     propertyOp.setDescriptor(varNameDescriptor);
-    
+
     objDescr.addOperation(propertyOp);
-    
-    
-    OpenProcessDefinition processDefinition = ProcessFactory.build()
-      .property(objDescr)
-      .node().initial()
-    .done();
 
+    OpenProcessDefinition processDefinition = ProcessFactory.build().property(objDescr).node().initial().done();
+
     dbSession.save(processDefinition);
 
     newTransaction();
-    
-    dbSession = (DbSession) environment.get(DbSession.class);
-    
-    OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
 
+    dbSession = (DbSession)environment.get(DbSession.class);
+
+    OpenProcessDefinition p = (OpenProcessDefinition)dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+
     assertNotNull(p);
     assertNotSame(processDefinition, p);
 
     assertNotNull(p.getProperty("object"));
     assertTrue(p.getProperty("object") instanceof VariableDefinitionImpl);
     assertEquals("varName", ((VariableDefinitionImpl)p.getProperty("object")).getKey());
-  }  
+  }
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -21,22 +21,31 @@
  */
 package org.jbpm.pvm.internal.db.model;
 
+import junit.framework.Test;
+
 import org.hibernate.Session;
-import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
 import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
 import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
 import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
 import org.jbpm.pvm.session.DbSession;
+import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
-
 /**
  * @author Tom Baeyens
  */
-public class WireTest extends EnvironmentDbTestCase {
-  
-  public void testObjectDescriptor() {
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
-    
+public class WireTest extends EnvironmentDbTestCase
+{
+
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(WireTest.class);
+  }
+
+  public void testObjectDescriptor()
+  {
+    DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
+
     ObjectDescriptor objStaticMethod = new ObjectDescriptor();
     objStaticMethod.setName("objectByStaticMethod");
     objStaticMethod.setClassName(Integer.class.getName());
@@ -46,7 +55,7 @@
     IntegerDescriptor argStaticMethodValue = new IntegerDescriptor();
     argStaticMethodValue.setValue(42);
     argStaticMethod.setDescriptor(argStaticMethodValue);
-    
+
     objStaticMethod.addArgDescriptor(argStaticMethod);
 
     persistenceSession.save(argStaticMethodValue);
@@ -55,69 +64,53 @@
     persistenceSession.save(objStaticMethod);
     environment.get(Session.class).flush();
 
-    
     persistenceSession.save(objStaticMethod);
     environment.get(Session.class).flush();
 
-  }  
+  }
 
-
   /*
-  public void testObjectDescriptor() {
-    DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
-    assertNotNull(persistenceSession);
-
-    ObjectDescriptor objDefault = new ObjectDescriptor();
-    objDefault.setName("objectByEmptyConstr");
-    objDefault.setClassName(Object.class.getName());
-    
-    ObjectDescriptor objConstr = new ObjectDescriptor();
-    objConstr.setName("objectByConstr");
-    objConstr.setClassName(Integer.class.getName());
-    
-    ArgDescriptor argObjConstr = new ArgDescriptor();
-    argObjConstr.setTypeName(int.class.getName());
-    IntegerDescriptor argObjConstrVal = new IntegerDescriptor();
-    argObjConstrVal.setValue(42);
-    argObjConstr.setDescriptor(argObjConstrVal);
-    
-    objConstr.addArgDescriptor(argObjConstr);
-    
-    ObjectDescriptor objStaticMethod = new ObjectDescriptor();
-    objStaticMethod.setName("objectByStaticMethod");
-    objStaticMethod.setClassName(Integer.class.getName());
-    objStaticMethod.setMethodName("signum");
-    ArgDescriptor argStaticMethod = new ArgDescriptor();
-    argStaticMethod.setTypeName(int.class.getName());
-    IntegerDescriptor argStaticMethodValue = new IntegerDescriptor();
-    argStaticMethodValue.setValue(42);
-    argStaticMethod.setDescriptor(argStaticMethodValue);
-    
-    objStaticMethod.addArgDescriptor(argStaticMethod);
-        
-    ProcessDefinition processDefinition = ProcessFactory.build()
-      .configuration(objDefault)
-      .configuration(objConstr)
-      .configuration(objStaticMethod)
-    .done();
-
-    persistenceSession.save(processDefinition);
-
-    newTransaction();
-    
-    DbSession testSession = (DbSession) environment.get(DbSession.class);
-    
-    ProcessDefinition p = (ProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
-    assertNotNull(p);
-    assertNotSame(processDefinition, p);
-
-    assertNotNull(p.getConfigurations());
-    assertNotNull(p.getConfigurations().get("objectByEmptyConstr"));
-    assertEquals(42 , p.getConfigurations().get("objectByConstr"));
-    assertTrue(p.getConfigurations().get("objectByConstr") instanceof Integer);
-    
-    assertEquals(1, p.getConfigurations().get("objectByStaticMethod"));
-  }  
-*/
+   * public void testObjectDescriptor() { DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
+   * assertNotNull(persistenceSession);
+   * 
+   * ObjectDescriptor objDefault = new ObjectDescriptor(); objDefault.setName("objectByEmptyConstr");
+   * objDefault.setClassName(Object.class.getName());
+   * 
+   * ObjectDescriptor objConstr = new ObjectDescriptor(); objConstr.setName("objectByConstr");
+   * objConstr.setClassName(Integer.class.getName());
+   * 
+   * ArgDescriptor argObjConstr = new ArgDescriptor(); argObjConstr.setTypeName(int.class.getName()); IntegerDescriptor
+   * argObjConstrVal = new IntegerDescriptor(); argObjConstrVal.setValue(42);
+   * argObjConstr.setDescriptor(argObjConstrVal);
+   * 
+   * objConstr.addArgDescriptor(argObjConstr);
+   * 
+   * ObjectDescriptor objStaticMethod = new ObjectDescriptor(); objStaticMethod.setName("objectByStaticMethod");
+   * objStaticMethod.setClassName(Integer.class.getName()); objStaticMethod.setMethodName("signum"); ArgDescriptor
+   * argStaticMethod = new ArgDescriptor(); argStaticMethod.setTypeName(int.class.getName()); IntegerDescriptor
+   * argStaticMethodValue = new IntegerDescriptor(); argStaticMethodValue.setValue(42);
+   * argStaticMethod.setDescriptor(argStaticMethodValue);
+   * 
+   * objStaticMethod.addArgDescriptor(argStaticMethod);
+   * 
+   * ProcessDefinition processDefinition = ProcessFactory.build() .configuration(objDefault) .configuration(objConstr)
+   * .configuration(objStaticMethod) .done();
+   * 
+   * persistenceSession.save(processDefinition);
+   * 
+   * newTransaction();
+   * 
+   * DbSession testSession = (DbSession) environment.get(DbSession.class);
+   * 
+   * ProcessDefinition p = (ProcessDefinition) testSession.get(ProcessDefinitionImpl.class,
+   * processDefinition.getDbid());
+   * 
+   * assertNotNull(p); assertNotSame(processDefinition, p);
+   * 
+   * assertNotNull(p.getConfigurations()); assertNotNull(p.getConfigurations().get("objectByEmptyConstr"));
+   * assertEquals(42 , p.getConfigurations().get("objectByConstr"));
+   * assertTrue(p.getConfigurations().get("objectByConstr") instanceof Integer);
+   * 
+   * assertEquals(1, p.getConfigurations().get("objectByStaticMethod")); }
+   */
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/type/VariableCustomTypeTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/type/VariableCustomTypeTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/type/VariableCustomTypeTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -25,6 +25,9 @@
 import java.util.GregorianCalendar;
 import java.util.Map;
 
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
 import org.jbpm.pvm.activity.ActivityExecution;
 import org.jbpm.pvm.activity.ExternalActivity;
 import org.jbpm.pvm.client.ClientProcessDefinition;
@@ -33,39 +36,51 @@
 import org.jbpm.pvm.internal.type.variable.DateVariable;
 import org.jbpm.pvm.model.ProcessFactory;
 import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Guillaume Porcher
  */
-public class VariableCustomTypeTest extends EnvironmentDbTestCase {
+public class VariableCustomTypeTest extends EnvironmentDbTestCase
+{
+  private static final String ENVIRONMENT_CFG_XML = "org/jbpm/pvm/internal/db/type/environmentCustomTypes.cfg.xml";
 
-  public VariableCustomTypeTest() {
-    super("org/jbpm/pvm/internal/db/type/environmentCustomTypes.cfg.xml");
+  public static Test suite()
+  {
+    TestSuite suite = new TestSuite(VariableCustomTypeTest.class);
+    return new EnvironmentFactoryTestSetup(suite, ENVIRONMENT_CFG_XML);
   }
 
-  public static class WaitState implements ExternalActivity {
+  public VariableCustomTypeTest()
+  {
+    super(ENVIRONMENT_CFG_XML);
+  }
+
+  public static class WaitState implements ExternalActivity
+  {
     private static final long serialVersionUID = 1L;
-    public void execute(ActivityExecution execution) {
+
+    public void execute(ActivityExecution execution)
+    {
       execution.waitForSignal();
     }
-    public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) {
+
+    public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters)
+    {
       execution.take(signalName);
     }
   }
-  
-  
- 
-  public void testDateVariable() {
-    ClientProcessDefinition clientProcessDefinition = ProcessFactory.build()
-    .node().initial().behaviour(WaitState.class)
-    .done();
-    
+
+  public void testDateVariable()
+  {
+    ClientProcessDefinition clientProcessDefinition = ProcessFactory.build().node().initial().behaviour(WaitState.class).done();
+
     getDbSession().save(clientProcessDefinition);
-    
-    ExecutionImpl execution = (ExecutionImpl) clientProcessDefinition.startProcessInstance();
-    
+
+    ExecutionImpl execution = (ExecutionImpl)clientProcessDefinition.startProcessInstance();
+
     execution = reload(execution);
-     
+
     Calendar calendar = new GregorianCalendar();
     calendar.set(Calendar.YEAR, 2007);
     calendar.set(Calendar.MONTH, 10); // (10 == november)
@@ -74,15 +89,15 @@
     calendar.set(Calendar.MINUTE, 28);
     calendar.set(Calendar.SECOND, 57);
     calendar.set(Calendar.MILLISECOND, 374);
-    
+
     execution.setVariable("v", calendar.getTime());
-    
+
     execution = reload(execution);
-    
+
     Variable variable = execution.getVariableObject("v");
     assertEquals(DateVariable.class, variable.getClass());
 
     assertEquals(calendar.getTime(), execution.getVariable("v"));
   }
-  
+
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -29,11 +29,14 @@
 import java.util.Timer;
 import java.util.TimerTask;
 
+import junit.framework.Test;
+
 import org.hibernate.Session;
 import org.jbpm.pvm.Deployment;
 import org.jbpm.pvm.ProcessService;
 import org.jbpm.pvm.activity.ActivityExecution;
 import org.jbpm.pvm.activity.ExternalActivity;
+import org.jbpm.pvm.api.db.svc.ExecutionServiceTest;
 import org.jbpm.pvm.client.ClientProcessDefinition;
 import org.jbpm.pvm.client.ClientExecution;
 import org.jbpm.pvm.env.Environment;
@@ -48,6 +51,7 @@
 import org.jbpm.pvm.session.MessageSession;
 import org.jbpm.pvm.session.PvmDbSession;
 import org.jbpm.pvm.test.base.DbTestCase;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
 
 /**
  * @author Tom Baeyens
@@ -67,6 +71,11 @@
   static int nbrOfTestMessagesPerExecution = 7;
   static int nbrOfTestExecutions = 5;
   
+  public static Test suite()
+  {
+    return new EnvironmentFactoryTestSetup(JobExecutorTest.class);
+  }
+  
   public void setUp() throws Exception {
     super.setUp();
     processedMessageIds = new ArrayList<Integer>();

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

Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireTests.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireTests.java	2008-09-25 05:40:46 UTC (rev 2371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireTests.java	2008-09-25 06:31:07 UTC (rev 2372)
@@ -1,62 +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.wire;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * @author Tom Baeyens
- */
-public class WireTests {
-
-  public static Test suite() {
-    TestSuite suite = new TestSuite("org.jbpm.pvm.internal.wire");
-    //$JUnit-BEGIN$
-    suite.addTestSuite(AutoWireTest.class);
-    suite.addTestSuite(BasicTypeWireTest.class);
-    suite.addTestSuite(ClassWireTest.class);
-    suite.addTestSuite(ConcurrentWiringTest.class);
-    suite.addTestSuite(ContextBlockSubscriptionTest.class);
-    suite.addTestSuite(ContextTest.class);
-    suite.addTestSuite(DelayedInitTest.class);
-    suite.addTestSuite(DependencyTest.class);
-    suite.addTestSuite(EagerInitTest.class);
-    suite.addTestSuite(EnvWireTest.class);
-    suite.addTestSuite(HibernateSessionFactoryWireTest.class);
-    suite.addTestSuite(ListWireTest.class);
-    suite.addTestSuite(MapWireTest.class);
-    suite.addTestSuite(MethodSubscriptionTest.class);
-    suite.addTestSuite(RefWireTest.class);
-    suite.addTestSuite(ObjectSubscriptionTest.class);
-    suite.addTestSuite(ObjectWireTest.class);
-    suite.addTestSuite(PropertiesWireTest.class);
-    suite.addTestSuite(SetWireTest.class);
-    suite.addTestSuite(TypeLookupTest.class);
-    suite.addTestSuite(WireEventsSubscriptionTest.class);
-    suite.addTestSuite(WireObservableTest.class);
-    //$JUnit-END$
-    return suite;
-  }
-
-}




More information about the jbpm-commits mailing list