[jbpm-commits] JBoss JBPM SVN: r1826 - in jbpm4/pvm/trunk/modules/core/src: test/java/org/jbpm/pvm and 5 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Aug 5 13:18:46 EDT 2008


Author: tom.baeyens at jboss.com
Date: 2008-08-05 13:18:46 -0400 (Tue, 05 Aug 2008)
New Revision: 1826

Added:
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.java
Removed:
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTimerSessionTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessage.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java
Modified:
   jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml
   jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
   jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java
   jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml
   jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties
   jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml
Log:
updated job executor test to new test suite base classes

Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml	2008-08-05 17:18:46 UTC (rev 1826)
@@ -340,6 +340,7 @@
       <column name="OBJ_ID_" />
     </any>
     <property name="expression" column="OBJ_EXPRESSION_"/>
+    <property name="expressionLanguage" column="OBJ_EXPRLANG_"/>
     
     <subclass name="EventListenerReference" discriminator-value="evtlis">
       <property name="isPropagationEnabled" column="PROPAGATE_" />

Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml	2008-08-05 17:18:46 UTC (rev 1826)
@@ -31,6 +31,12 @@
                  cascade="none"
                  foreign-key="FK_JOB_EXE"
                  index="IDX_JOB_EXE"/>
+    <many-to-one name="commandDescriptor"
+                 column="CMDDESCR_"
+                 class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" 
+                 cascade="all"
+                 foreign-key="FK_JOB_CMDDESCR"
+                 index="IDX_JOB_CMDDESCR"/>
 
     <subclass name="MessageImpl" discriminator-value="Msg">
       <subclass name="org.jbpm.pvm.internal.model.op.ExecuteNodeMessage" discriminator-value="ExeNodeMsg" />
@@ -43,6 +49,7 @@
       </subclass>
       <subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
       <subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
+      <subclass name="org.jbpm.pvm.internal.job.CommandMessage" discriminator-value="CmdMsg" />
     </subclass>
     
     <subclass name="TimerImpl" discriminator-value="Timer">

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -47,7 +47,7 @@
     defaultConfigTests.addTest(DbSvcTests.suite());
     defaultConfigTests.addTest(SpringTests.suite());
     defaultConfigTests.addTest(JobExecutorTests.suite());
-    defaultConfigTests.addTest(ContinuationTests.suite());
+    // defaultConfigTests.addTest(ContinuationTests.suite());
     
     // TODO wrap the suite with a test setup that creates and closes the environment factory
     // something like this:

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -35,8 +35,11 @@
 /**
  * @author Tom Baeyens
  */
-public class LanguageExtensionsDbTest extends EnvironmentDbTestCase
-{
+public class LanguageExtensionsDbTest extends EnvironmentDbTestCase {
+  
+  public LanguageExtensionsDbTest() {
+    super("org/jbpm/pvm/internal/db/langext/environment.cfg.xml");
+  }
 
   /**
    * Defines a simple process: only nodes and transitions.

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -107,7 +107,7 @@
     
     descriptor = (ClassDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
     assertEquals("n", descriptor.getName());
-    assertEquals(EventImpl.class, descriptor.construct(new WireContext()));
+    assertEquals(EventImpl.class, WireContext.create(descriptor));
   }
 
   public void testDoubleDescriptor() {

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

Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestMessage.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,87 +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 java.util.HashSet;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.log.Log;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.model.OpenExecution;
-import org.jbpm.pvm.session.DbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ExclusiveTestMessage extends MessageImpl<Object> {
-
-  private static final long serialVersionUID = 1L;
-  private static final Log log = Log.getLog(ExclusiveTestMessage.class.getName());
-  static Random random = new Random();
-
-  public ExclusiveTestMessage() {
-  }
-
-  public ExclusiveTestMessage(OpenExecution execution) {
-    this.execution = (ExecutionImpl) execution;
-    this.processInstance = (ExecutionImpl) execution.getProcessInstance();
-    this.isExclusive = true;
-  }
-
-  public Object execute(Environment environment) throws Exception {
-    Long threadId = Thread.currentThread().getId();
-    String executionKey = execution.getKey();
-
-    // exclusiveMessageIds maps execution keys to a set of thread ids.
-    // the idea is that for each execution, all the exclusive jobs will 
-    // be executed by 1 thread sequentially.  
-    
-    // in the end, each set should contain exactly 1 element  
-    Map<String, Set<Long>> exclusiveThreadIds = (Map<String, Set<Long>>) environment.get("exclusiveThreadIds");
-    Set<Long> groupMessages = exclusiveThreadIds.get(executionKey);
-    if (groupMessages==null) {
-      groupMessages = new HashSet<Long>();
-      exclusiveThreadIds.put(executionKey, groupMessages);
-    }
-    groupMessages.add(threadId);
-    
-    // let's assume that an average jobImpl takes between 0 and 150 millis to complete.
-    int workTime = random.nextInt(150);
-    log.debug("executing exclusive message for "+execution+".  this is going to take "+workTime+"ms");
-    try {
-      Thread.sleep(workTime);
-    } catch (RuntimeException e) {
-      log.debug("sleeping was interrupted");
-    }
-    
-    DbSession dbSession = environment.get(DbSession.class);
-    dbSession.delete(this);
-    
-    return null;
-  }
-
-}

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

Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestMessage.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,75 +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 java.util.List;
-
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.log.Log;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.pvm.model.Comment;
-import org.jbpm.pvm.session.DbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FailOnceTestMessage extends MessageImpl<Object> {
-
-  private static final long serialVersionUID = 1L;
-  private static final Log log = Log.getLog(FailOnceTestMessage.class.getName());
-  
-  int messageId;
-  
-  public FailOnceTestMessage() {
-  }
-
-  public FailOnceTestMessage(int messageId) {
-    this.messageId = messageId;
-  }
-
-  public Object execute(Environment environment) throws Exception {
-    DbSession dbSession = environment.get(DbSession.class);
-
-    // this message execution should be rolled back
-    Comment comment = new CommentImpl(Integer.toString(messageId));
-    dbSession.save(comment);
-
-    dbSession.delete(this);
-
-    List<Integer> failOnceMessageIds = (List) environment.get("failOnceMessageIds");
-    if (!failOnceMessageIds.contains(messageId)) {
-      // registering the failed message in a non-transactional resource
-      // so the messageId will still be added even after the transaction has rolled back
-      log.debug("adding failonce message "+messageId);
-      failOnceMessageIds.add(messageId);
-      
-      throw new RuntimeException("failing once"); 
-    }
-
-    log.debug("message "+messageId+" now succeeds");
-
-    return null;
-  }
-
-}

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

Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestMessage.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,50 +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 org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.pvm.model.Comment;
-import org.jbpm.pvm.session.DbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FailingTestMessage extends MessageImpl<Object> {
-
-  private static final long serialVersionUID = 1L;
-
-  public Object execute(Environment environment) throws Exception {
-    DbSession dbSession = environment.get(DbSession.class);
-    
-    // this message execution should be rolled back
-    Comment comment = new CommentImpl("failing update");
-    dbSession.save(comment);
-    
-    dbSession.delete(this);
-    
-    throw new RuntimeException("ooops"); 
-  }
-
-}

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -21,6 +21,8 @@
  */
 package org.jbpm.pvm.internal.jobexecutor;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -28,79 +30,51 @@
 import java.util.TimerTask;
 
 import org.hibernate.Session;
-import org.jbpm.pvm.test.base.EnvironmentFactoryTestCase;
 import org.jbpm.pvm.client.ClientProcessDefinition;
 import org.jbpm.pvm.client.ClientProcessInstance;
 import org.jbpm.pvm.env.Environment;
 import org.jbpm.pvm.env.Transaction;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.job.CommandMessage;
 import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
 import org.jbpm.pvm.internal.log.Log;
 import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
 import org.jbpm.pvm.job.Job;
 import org.jbpm.pvm.model.Comment;
 import org.jbpm.pvm.session.MessageSession;
 import org.jbpm.pvm.session.PvmDbSession;
+import org.jbpm.pvm.test.base.DbTestCase;
 
 /**
  * @author Tom Baeyens
  */
-public class JobExecutorTest extends EnvironmentFactoryTestCase {
+public class JobExecutorTest extends DbTestCase {
   
   private static final Log log = Log.getLog(JobExecutorTest.class.getName());
   
-  public JobExecutorTest() {
-    super("org/jbpm/pvm/internal/jobexecutor/environment.cfg.xml");
+  static List<Integer> processedMessageIds;
+  static Map<String, Set<Long>> exclusiveThreadIds; 
+  static List<Integer> failOnceMessageIds;
+  
+  static int nbrOfTestMessages = 10;
+  static int timeoutMillis = 10000;
+  static int checkInterval = 400;
+  static int nbrOfTestMessagesPerExecution = 7;
+  static int nbrOfTestExecutions = 5;
+  
+  public void setUp() throws Exception {
+    super.setUp();
+    processedMessageIds = new ArrayList<Integer>();
+    exclusiveThreadIds = new HashMap<String, Set<Long>>(); 
+    failOnceMessageIds = new ArrayList<Integer>();
   }
-
-  /**
-   * test the case where the jobExecutor is start and shortly after stopped.
-   * It can appears for example in other tests with auto-start activated
-   * if the test is too short.
-   * 
-   * The jobExecutor is registered as active when the run method is invoked.
-   * It happens only after a system context switching. If the jobExecutor is
-   * stopped before that, it won't really be stopped because it has not been
-   * started yet.
-   */
-  public void testImmediateJobExecutorShutdown() throws InterruptedException {
-
-    // if the test fail, there can be a live lock
-    // install a timer that will interrupt if it takes too long
-    // if that happens, it will lead to an interrupted exception and the test will fail
-    final Thread testThread = Thread.currentThread();
-    TimerTask interruptTask = new TimerTask() {
-      public void run() {
-        log.debug("test "+getName()+" took too long. going to interrupt..."+testThread);
-        testThread.interrupt();
-      }
-    };
-    Timer timer = new Timer();
-    timer.schedule(interruptTask, 10000);
     
-    final JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
-    jobExecutor.setIdleInterval(1000);
-    assertFalse(jobExecutor.isActive());
-    jobExecutor.start();
-    jobExecutor.stop();
-    Thread.sleep(800);
-    assertFalse(jobExecutor.isActive());
-  }
-
   public void testSuccessfulMessageProcessing() {
-    int nbrOfTestMessages = 5;
-    int testTimeoutMillis = 10000;
-    int checkInterval = 500;
-    
-    List<Integer> processedMessageIds = (List<Integer>) getEnvironmentFactory().get("processedMessageIds");
-    processedMessageIds.clear();
-
     JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
     jobExecutor.start();
     try {
-      insertTestMessages(nbrOfTestMessages);
-      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+      insertTestMessages();
+      waitTillNoMoreMessages(jobExecutor);
 
     } finally {
       jobExecutor.stop(true);
@@ -112,19 +86,13 @@
   }
 
   public void testMessagesPresentUponJobExecutorStartUp() {
-    int nbrOfTestMessages = 2;
-    int testTimeoutMillis = 5000;
-    int checkInterval = 400;
     
-    insertTestMessages(nbrOfTestMessages);
+    insertTestMessages();
 
-    List<Integer> processedMessageIds = (List<Integer>) getEnvironmentFactory().get("processedMessageIds");
-    processedMessageIds.clear();
-    
     JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
     jobExecutor.start();
     try {
-      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+      waitTillNoMoreMessages(jobExecutor);
 
     } finally {
       jobExecutor.stop(true);
@@ -136,60 +104,46 @@
   }
 
   public void testExclusiveMessageProcessing() {
-    int testTimeoutMillis = 10000;
-    int checkInterval = 500;
-    int nbrOfTestMessagesPerExecution = 5;
-    int nbrOfTestExecutions = 1;
+    insertExclusiveTestMessages();
 
-    insertExclusiveTestMessages(nbrOfTestExecutions, nbrOfTestMessagesPerExecution);
-
     JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
     jobExecutor.start();
     try {
       
-      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+      waitTillNoMoreMessages(jobExecutor);
 
     } finally {
       jobExecutor.stop(true);
     }
 
     
-    Environment environment = getEnvironmentFactory().openEnvironment();
-    try {
-      // exclusiveMessageIds maps execution keys to a set of thread ids.
-      // the idea is that for each execution, all the exclusive jobs will 
-      // be executed by 1 thread sequentially.  
-      
-      // in the end, each set should contain exactly 1 element  
-      Map<String, Set<Long>> exclusiveThreadIds = (Map) environment.get("exclusiveThreadIds");
-
-      for (int i=0; i<nbrOfTestExecutions; i++) {
-        String executionKey = "execution-"+i;
-        Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
-        assertNotNull("no thread id set for "+executionKey+" in: "+exclusiveThreadIds, threadIds);
-        assertEquals("exclusive messages for "+executionKey+" have been executed by multiple threads: "+threadIds, 
-                     1, 
-                     threadIds.size());
+    commandService.execute(new Command<Object>() {
+      public Object execute(Environment environment) throws Exception {
+        // exclusiveMessageIds maps execution keys to a set of thread ids.
+        // the idea is that for each execution, all the exclusive jobs will 
+        // be executed by 1 thread sequentially.  
+        
+        for (int i=0; i<nbrOfTestExecutions; i++) {
+          String executionKey = "execution-"+i;
+          Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
+          assertNotNull("no thread id set for "+executionKey+" in: "+exclusiveThreadIds, threadIds);
+          assertEquals("exclusive messages for "+executionKey+" have been executed by multiple threads: "+threadIds, 
+                       1, 
+                       threadIds.size());
+        }
+        return null;
       }
-    } finally {
-      environment.close();
-    }
-    
+    });
   }
 
   public void testFailOnceMessages() {
-    int nbrOfTestMessages = 7;
-    int testTimeoutMillis = 10000;
-    int checkInterval = 500;
-    
-    List<Integer> failOnceMessageIds = (List<Integer>) getEnvironmentFactory().get("failOnceMessageIds");
     failOnceMessageIds.clear();
 
     JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
     jobExecutor.start();
     try {
-      insertFailOnceTestMessages(nbrOfTestMessages);
-      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+      insertFailOnceTestMessages();
+      waitTillNoMoreMessages(jobExecutor);
 
     } finally {
       jobExecutor.stop(true);
@@ -200,122 +154,110 @@
     }
     assertEquals(nbrOfTestMessages, failOnceMessageIds.size());
     
-    Environment environment = getEnvironmentFactory().openEnvironment();
-    try {
-      Session session = environment.get(Session.class);
-      List<Comment> comments = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
-      
-      for (Comment comment: comments) {
-        Integer messageId = new Integer(comment.getMessage());
-        assertTrue("message "+messageId+" committed twice", failOnceMessageIds.remove(messageId));
-        // clean up for next tests
-        session.delete(comment);
-      }
+    commandService.execute(new Command<Object>() {
+      public Object execute(Environment environment) throws Exception {
+        Session session = environment.get(Session.class);
+        List<Comment> comments = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
+        
+        for (Comment comment: comments) {
+          Integer messageId = new Integer(comment.getMessage());
+          assertTrue("message "+messageId+" committed twice", failOnceMessageIds.remove(messageId));
+          // clean up for next tests
+          session.delete(comment);
+        }
 
-      assertTrue("not all messages made a successful commit: "+failOnceMessageIds, failOnceMessageIds.isEmpty());
-    } finally {
-      environment.close();
-    }
+        assertTrue("not all messages made a successful commit: "+failOnceMessageIds, failOnceMessageIds.isEmpty());
+        return null;
+      }
+    });
   }
 
   public void testFailedMessageProcessing() {
-    int testTimeoutMillis = 3000;
-    int checkInterval = 400;
-
     JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
     jobExecutor.start();
     try {
-      Environment environment = getEnvironmentFactory().openEnvironment();
-      try {
-        MessageSession messageSession = environment.get(MessageSession.class);
-        messageSession.send(new FailingTestMessage());
-      } finally {
-        environment.close();
-      }
+      commandService.execute(new Command<Object>() {
+        public Object execute(Environment environment) throws Exception {
+          MessageSession messageSession = environment.get(MessageSession.class);
+          CommandMessage commandMessage = FailingTestCommand.createMessage();
+          messageSession.send(commandMessage);
+          return null;
+        }
+      });
       
-      waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+      waitTillNoMoreMessages(jobExecutor);
 
     } finally {
       jobExecutor.stop(true);
     }
     
-    Environment environment = getEnvironmentFactory().openEnvironment();
-    try {
-      PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-      List<Job> deadJobs = pvmDbSession.findDeadJobs();
-      assertEquals("there should be one dead jobImpl", 1, deadJobs.size());
+    commandService.execute(new Command<Object>() {
+      public Object execute(Environment environment) throws Exception {
+        PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+        List<Job> deadJobs = pvmDbSession.findDeadJobs();
+        assertEquals("there should be one dead jobImpl", 1, deadJobs.size());
 
-      Session session = environment.get(Session.class);
-      List commands = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
-      assertTrue("command insertion should have been rolled back", commands.isEmpty());
-    } finally {
-      environment.close();
-    }
+        Session session = environment.get(Session.class);
+        List commands = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
+        assertTrue("command insertion should have been rolled back", commands.isEmpty());
+        return null;
+      }
+    });
   }
 
   // helper methods ///////////////////////////////////////////////////////////
 
-  void insertTestMessages(int nbrOfTestMessages) {
-    Environment environment = getEnvironmentFactory().openEnvironment();
-    try {
-      MessageSession messageSession = environment.get(MessageSession.class);
-      for (int i=0; i<nbrOfTestMessages; i++) {
-        TestMessage testMessage = new TestMessage(i);
-        messageSession.send(testMessage);
+  void insertTestMessages() {
+    commandService.execute(new Command<Object>() {
+      public Object execute(Environment environment) throws Exception {
+        MessageSession messageSession = environment.get(MessageSession.class);
+        for (int i=0; i<nbrOfTestMessages; i++) {
+          CommandMessage commandMessage = TestMessageCommand.createMessage(i);
+          messageSession.send(commandMessage);
+        }
+        return null;
       }
-    } catch (RuntimeException e) {
-      environment.get(Transaction.class).setRollbackOnly();
-      throw e;
-    } finally {
-      environment.close();
-    }
+    });
   }
 
-  void insertExclusiveTestMessages(int nbrOfTestExecutions, int nbrOfTestMessagesPerExecution) {
-    Environment environment = getEnvironmentFactory().openEnvironment();
-    try {
-      PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-      ClientProcessDefinition processDefinition = new ProcessDefinitionImpl();
-      pvmDbSession.save(processDefinition);
-      
-      MessageSession messageSession = environment.get(MessageSession.class);
-      for (int i=0; i<nbrOfTestExecutions; i++) {
-        ClientProcessInstance execution = processDefinition.beginProcessInstance("execution-"+i);
-        pvmDbSession.save(execution);
+  void insertExclusiveTestMessages() {
+    commandService.execute(new Command<Object>() {
+      public Object execute(Environment environment) throws Exception {
+        PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+        ClientProcessDefinition processDefinition = new ProcessDefinitionImpl();
+        pvmDbSession.save(processDefinition);
         
-        for (int j=0; j<nbrOfTestMessagesPerExecution; j++) {
+        MessageSession messageSession = environment.get(MessageSession.class);
+        for (int i=0; i<nbrOfTestExecutions; i++) {
+          ClientProcessInstance execution = processDefinition.beginProcessInstance("execution-"+i);
+          pvmDbSession.save(execution);
           
-          ExclusiveTestMessage testMessage = new ExclusiveTestMessage(execution);
-          messageSession.send(testMessage);
+          for (int j=0; j<nbrOfTestMessagesPerExecution; j++) {
+            CommandMessage exclusiveTestMessage = ExclusiveTestCommand.createMessage(execution);
+            messageSession.send(exclusiveTestMessage);
+          }
         }
+        return null;
       }
-    } catch (RuntimeException e) {
-      environment.get(Transaction.class).setRollbackOnly();
-      throw e;
-    } finally {
-      environment.close();
-    }
+    });
+    Environment environment = getEnvironmentFactory().openEnvironment();
   }
 
-  void insertFailOnceTestMessages(int nbrOfTestMessages) {
-    Environment environment = getEnvironmentFactory().openEnvironment();
-    try {
-      MessageSession messageSession = environment.get(MessageSession.class);
-      for (int i=0; i<nbrOfTestMessages; i++) {
-        FailOnceTestMessage testMessage = new FailOnceTestMessage(i);
-        messageSession.send(testMessage);
+  void insertFailOnceTestMessages() {
+    commandService.execute(new Command<Object>() {
+      public Object execute(Environment environment) throws Exception {
+        MessageSession messageSession = environment.get(MessageSession.class);
+        for (int i=0; i<nbrOfTestMessages; i++) {
+          CommandMessage commandMessage = FailOnceTestCommand.createMessage(i);
+          messageSession.send(commandMessage);
+        }
+        return null;
       }
-    } catch (RuntimeException e) {
-      environment.get(Transaction.class).setRollbackOnly();
-      throw e;
-    } finally {
-      environment.close();
-    }
+    });
   }
 
+  private void waitTillNoMoreMessages(JobExecutor jobExecutor) {
 
-  private void waitTillNoMoreMessages(JobExecutor jobExecutor, int maxWait, int checkInterval) {
-
     // install a timer that will interrupt if it takes too long
     // if that happens, it will lead to an interrupted exception and the test will fail
     TimerTask interruptTask = new TimerTask() {
@@ -326,7 +268,7 @@
       }
     };
     Timer timer = new Timer();
-    timer.schedule(interruptTask, maxWait);
+    timer.schedule(interruptTask, timeoutMillis);
     
     try {
       boolean jobsAvailable = true;
@@ -337,7 +279,7 @@
       }
       
     } catch (InterruptedException e) {
-      fail("test execution exceeded treshold of "+maxWait+" milliseconds");
+      fail("test execution exceeded treshold of "+timeoutMillis+" milliseconds");
     } finally {
       timer.cancel();
     }

Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTests.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -33,7 +33,6 @@
   public static Test suite() {
     TestSuite suite = new TestSuite("Test for org.jbpm.pvm.jobexecutor");
     //$JUnit-BEGIN$
-    suite.addTestSuite(JobExecutorTimerSessionTest.class);
     suite.addTestSuite(JobExecutorTest.class);
     //$JUnit-END$
     return suite;

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

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

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

Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestTimer.java	2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,95 +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 java.util.Date;
-import java.util.Map;
-
-import org.jbpm.pvm.test.base.JbpmTestCase;
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.TimerImpl;
-import org.jbpm.pvm.session.TimerSession;
-
-/**
- * @author Tom Baeyens
- * @author Pascal Verdage
- */
-public class TestTimer extends TimerImpl {
-  private static final long serialVersionUID = 1L;
-
-  private String name;
-  private int nbMaxExecution;
-  // used to increment a variable
-  private String variableName;
-
-  private int nbExecution = 0;
-
-  protected TestTimer() {}
-
-  public TestTimer(String name, long delay, int nbMaxExecution) {
-    this(name, new Date(System.currentTimeMillis() + delay), nbMaxExecution);
-  }
-
-  public TestTimer(String name, Date dueDate, int nbMaxExecution) {
-    this.name = name;
-    this.dueDate = dueDate;
-    this.nbMaxExecution = nbMaxExecution;
-  }
-  
-  public Boolean execute(Environment environment) throws Exception {
-    Date now = new Date();
-    JbpmTestCase.assertTrue(name+" is executing too soon", now.after(dueDate));
-    nbExecution++;
-    JbpmTestCase.assertTrue(name+" should not be executed",
-        nbExecution <= nbMaxExecution);
-    
-    if (variableName != null) {
-      Map<String, Integer> variables =
-        JobExecutorTimerSessionTest.getVariables();
-      if (variables != null) {
-        Integer n = variables.get(variableName);
-        if (n == null) {
-          n = 0;
-        }
-        n++;
-        variables.put(variableName, n);
-      }
-    }
-    
-    // reschedule if necessary
-    boolean deleteThisJob = super.execute(environment);
-    
-    // cancel the timer if necessary
-    if (nbExecution == nbMaxExecution) {
-      JbpmTestCase.assertNotNull(Environment.getCurrent());
-      TimerSession timerSession = Environment.getCurrent().get(TimerSession.class);
-      JbpmTestCase.assertNotNull(timerSession);
-      timerSession.cancel(this);
-    }
-      
-    return deleteThisJob;
-  }
-  
-  public void setVariableName(String variableName) {
-    this.variableName = variableName;
-  }
-}

Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml	2008-08-05 17:18:46 UTC (rev 1826)
@@ -21,6 +21,8 @@
       <hibernate-session-interceptor />
       <hibernate-transaction-interceptor />
     </command-service>
+    
+    <job-executor threads="1" auto-start="false" />
   
     <hibernate-configuration>
       <properties resource="hibernate.properties" />
@@ -38,6 +40,8 @@
     <hibernate-session />
     <hibernate-transaction />
     <pvm-db-session />
+    <job-db-session />
+    <message-session />
   </environment>
 
 </contexts>

Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/logging.properties	2008-08-05 17:18:46 UTC (rev 1826)
@@ -22,7 +22,7 @@
 org.hibernate.cfg.HbmBinder.level=SEVERE
 org.hibernate.cfg.SettingsFactory.level=SEVERE
 # org.hibernate.level=FINE
-org.hibernate.SQL.level=FINEST
+# org.hibernate.SQL.level=FINEST
 # org.hibernate.type.level=FINEST
 # org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
 # org.hibernate.transaction.level=FINEST

Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml	2008-08-05 16:42:37 UTC (rev 1825)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml	2008-08-05 17:18:46 UTC (rev 1826)
@@ -1,7 +1,27 @@
-<contexts>
+<?xml version="1.0" encoding="UTF-8"?>
 
-	<environment-factory>
-	
+<contexts xmlns="http://jbpm.org/pvm/1.0/wire">
+
+  <environment-factory>
+  
+    <deployer-manager resource="pvm.language.deployers.xml">
+      <language name="api">
+        <verify-version />
+        <save-process />
+      </language>
+    </deployer-manager>
+    
+    <process-service />
+    <execution-service />
+    <management-service />
+  
+    <command-service>
+      <retry-interceptor />
+      <environment-interceptor />
+      <hibernate-session-interceptor />
+      <hibernate-transaction-interceptor />
+    </command-service>
+  
     <hibernate-configuration>
       <properties resource="hibernate.properties" />
       <mappings resource="org/jbpm/pvm/pvm.hibernate.mappings.xml" />
@@ -10,17 +30,16 @@
     </hibernate-configuration>
     
     <hibernate-session-factory />
+    
     <variable-types resource="org/jbpm/pvm/pvm.types.xml" />
 
   </environment-factory>
 
   <environment>
-
-    <transaction />
     <hibernate-session />
+    <hibernate-transaction />
     <pvm-db-session />
     <object class="org.jbpm.pvm.internal.db.langext.AddressSession" />
-
   </environment>
 
 </contexts>




More information about the jbpm-commits mailing list