[jbpm-commits] JBoss JBPM SVN: r1729 - in jbpm4/pvm/trunk/modules/core: src/test/java/org/jbpm and 14 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Jul 25 09:32:48 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-07-25 09:32:48 -0400 (Fri, 25 Jul 2008)
New Revision: 1729
Added:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandExecutorTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandReceiverTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/ExclusiveTestMessage.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailOnceTestMessage.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailingTestMessage.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTests.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTimerSessionTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestMessage.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestTimer.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemJobExecutor.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemMessageService.java
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/enterprise/
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/msg/
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/msg/environment.cfg.xml
Removed:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/db/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/msg/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemJobExecutor.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemMessageService.java
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/enterprise/
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/jobexecutor/
Modified:
jbpm4/pvm/trunk/modules/core/pom.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/enterprise/custom/HappyActivity.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/InsertPhraseCmd.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/NoisyActivity.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/Phrase.hbm.xml
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/Phrase.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/RemovePhraseCmd.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/CronExpression.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/CronTrigger.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemMessageServiceTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/wire/ConcurrentWiringTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/wire/WireTests.java
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/enterprise/custom/Phrase.hbm.xml
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/environment.cfg.xml
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/mappings.hbm.xml
Log:
reorganised test packages
Modified: jbpm4/pvm/trunk/modules/core/pom.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/pom.xml 2008-07-25 13:01:49 UTC (rev 1728)
+++ jbpm4/pvm/trunk/modules/core/pom.xml 2008-07-25 13:32:48 UTC (rev 1729)
@@ -158,16 +158,16 @@
<configuration>
<argLine>${surefire.jvm.args}</argLine>
<excludes>
- <exclude>org/jbpm/enterprise/CommandExecutorTest.java</exclude>
- <exclude>org/jbpm/enterprise/TimerTest.java</exclude>
- <exclude>org/jbpm/enterprise/EnterpriseTimerSessionTest.java</exclude>
- <exclude>org/jbpm/enterprise/CommandReceiverTest.java</exclude>
- <exclude>org/jbpm/jobexecutor/JobExecutorTimerSessionTest.java</exclude>
+ <exclude>org/jbpm/pvm/enterprise/CommandExecutorTest.java</exclude>
+ <exclude>org/jbpm/pvm/enterprise/TimerTest.java</exclude>
+ <exclude>org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java</exclude>
+ <exclude>org/jbpm/pvm/enterprise/CommandReceiverTest.java</exclude>
+ <exclude>org/jbpm/pvm/jobexecutor/JobExecutorTimerSessionTest.java</exclude>
<exclude>org/jbpm/pvm/timer/TimerIntegrationTest.java</exclude>
- <exclude>org/jbpm/svc/jobexecutor/ContinuationTest.java</exclude>
<exclude>org/jbpm/pvm/samples/ex12/TimerTest.java</exclude>
<exclude>org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java</exclude>
<exclude>org/jbpm/pvm/samples/ex11/AsynchronousContinuationsTest.java</exclude>
+ <exclude>org/jbpm/svc/jobexecutor/ContinuationTest.java</exclude>
<exclude>org/jbpm/svc/hibernate/ExecutionTypeTest.java</exclude>
</excludes>
</configuration>
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-07-25 13:01:49 UTC (rev 1728)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -27,6 +27,7 @@
import org.jbpm.pvm.db.langext.DbLangExtTests;
import org.jbpm.pvm.db.model.DbModelTests;
import org.jbpm.pvm.db.svc.DbSvcTests;
+import org.jbpm.pvm.jobexecutor.JobExecutorTests;
/**
@@ -41,6 +42,7 @@
suite.addTest(DbLangExtTests.suite());
suite.addTest(DbModelTests.suite());
suite.addTest(DbSvcTests.suite());
+ suite.addTest(JobExecutorTests.suite());
//$JUnit-END$
return suite;
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandExecutorTest.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/CommandExecutorTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandExecutorTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandExecutorTest.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,115 @@
+/*
+ * 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.enterprise;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.naming.InitialContext;
+
+import org.apache.cactus.ServletTestCase;
+
+import org.jbpm.pvm.enterprise.custom.InsertPhraseCmd;
+import org.jbpm.pvm.enterprise.custom.RemovePhraseCmd;
+import org.jbpm.pvm.internal.ejb.CommandExecutorSLSB;
+import org.jbpm.pvm.internal.ejb.LocalCommandExecutor;
+import org.jbpm.pvm.internal.ejb.LocalCommandExecutorHome;
+import org.jbpm.pvm.internal.log.Log;
+
+/**
+ * Server-side test for the {@linkplain CommandExecutorSLSB command executor}.
+ * The local interface is used.
+ *
+ * @author Tom Baeyens
+ * @author Alejandro Guizar
+ */
+public class CommandExecutorTest extends ServletTestCase {
+
+ private LocalCommandExecutor commandExecutor;
+
+ private static final Log log = Log.getLog(CommandExecutorTest.class.getName());
+
+ private static LocalCommandExecutorHome commandExecutorHome;
+
+ @Override
+ protected void setUp() throws Exception {
+ if (commandExecutorHome == null) {
+ // retrieve managed objects
+ InitialContext initialContext = new InitialContext();
+ try {
+ commandExecutorHome = (LocalCommandExecutorHome) initialContext.lookup("java:comp/env/ejb/LocalCommandExecutor");
+ } finally {
+ initialContext.close();
+ }
+ }
+ commandExecutor = commandExecutorHome.create();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ commandExecutor = null;
+ }
+
+ /**
+ * This scenario tests a command that completes with no incident.
+ * <h3>Preconditions</h3>
+ * The TEST_PHRASE table does not contain any row with the specified text.
+ * <h3>Behavior</h3>
+ * The {@link InsertPhraseCmd} command creates a row with the specified text.
+ * <h3>Postconditions</h3>
+ * A new row with the specified text exists in the table. The
+ * {@link RemovePhraseCmd} command removes the row, and the return value confirms
+ * it was there.
+ */
+ public void testHappyCommand() throws CreateException {
+ String text = "been there, done that";
+ commandExecutor.execute(new InsertPhraseCmd(text));
+ // verify phrase was inserted
+ assertTrue(commandExecutor.execute(new RemovePhraseCmd(text)));
+ }
+
+ /**
+ * This scenario tests a command that throws a checked exception inside the
+ * {@link InsertPhraseCmd#execute(org.jbpm.env.Environment) execute} method.
+ * <h3>Preconditions</h3>
+ * The TEST_PHRASE table does not contain any row with the specified text.
+ * <h3>Behavior</h3>
+ * The {@link InsertPhraseCmd} command creates a row with the specified text. The
+ * command is configured to throw a checked exception before completing.
+ * <h3>Postconditions</h3>
+ * The command executor throws an {@link EJBException} and rolls back the
+ * managed transaction. No row with the specified text exists in the database.
+ * The {@link RemovePhraseCmd} command return value confirms the row was not
+ * there.
+ */
+ public void testNoisyCommand() throws CreateException {
+ String text = "houston, we have a problem";
+ // insert phrase via command
+ try {
+ commandExecutor.execute(new InsertPhraseCmd(text, /* fail? */true));
+ fail("expected: " + EJBException.class.getSimpleName());
+ } catch (EJBException e) {
+ log.info("noisy command threw exception", e);
+ // verify phrase was NOT inserted
+ assertFalse(commandExecutor.execute(new RemovePhraseCmd(text)));
+ }
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandExecutorTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandReceiverTest.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/CommandReceiverTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandReceiverTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandReceiverTest.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,178 @@
+/*
+ * 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.enterprise;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.cactus.ServletTestCase;
+
+import org.jbpm.pvm.enterprise.custom.InsertPhraseCmd;
+import org.jbpm.pvm.enterprise.custom.RemovePhraseCmd;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.ejb.CommandReceiverMDB;
+
+/**
+ * Server-side test for the {@linkplain CommandReceiverMDB command receiver}.
+ *
+ * @author Alejandro Guizar
+ */
+public class CommandReceiverTest extends ServletTestCase {
+
+ private Connection jmsConnection;
+
+ private static final long TIMEOUT = 2000;
+
+ private static ConnectionFactory jmsConnectionFactory;
+ private static Destination commandQueue;
+
+ @Override
+ protected void setUp() throws Exception {
+ if (jmsConnectionFactory == null) {
+ // retrieve managed objects
+ Context initial = new InitialContext();
+ try {
+ jmsConnectionFactory = (ConnectionFactory) initial.lookup("java:comp/env/jms/CommandConnectionFactory");
+ commandQueue = (Destination) initial.lookup("java:comp/env/jms/CommandQueue");
+ } finally {
+ initial.close();
+ }
+ }
+ jmsConnection = jmsConnectionFactory.createConnection();
+ jmsConnection.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (jmsConnection != null) {
+ jmsConnection.stop();
+ jmsConnection.close();
+ jmsConnection = null;
+ }
+ }
+
+ /**
+ * This scenario tests a command message that completes with no incident.
+ * <h3>Preconditions</h3>
+ * The TEST_PHRASE table does not contain any row with the specified text.
+ * <h3>Behavior</h3>
+ * The {@link InsertPhraseCmd} command message creates a row with the specified
+ * text. Once the command completes, the command receiver sends the result to
+ * the reply queue.
+ * <h3>Postconditions</h3>
+ * A new row with the specified text exists in the table. The
+ * {@link RemovePhraseCmd} command message removes the row. The result sent to
+ * the reply queue confirms the row was there.
+ */
+ public void testHappyMessage() throws JMSException {
+ final String text = "been there, done that";
+ Session jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ try {
+ // send insert command
+ Command<Void> insertCommand = new InsertPhraseCmd(text, /* fail? */false);
+ Message insertMessage = jmsSession.createObjectMessage(insertCommand);
+ Destination replyTo = jmsSession.createTemporaryQueue();
+ insertMessage.setJMSReplyTo(replyTo);
+ MessageProducer producer = jmsSession.createProducer(commandQueue);
+ producer.send(insertMessage);
+
+ // receive insertion response
+ MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + insertMessage.getJMSMessageID() + "'");
+ ObjectMessage responseMessage = (ObjectMessage) insertConsumer.receive(TIMEOUT);
+ assertNull(responseMessage.getObject());
+
+ // send remove command
+ Command<Boolean> removeCommand = new RemovePhraseCmd(text);
+ Message removeMessage = jmsSession.createObjectMessage(removeCommand);
+ removeMessage.setJMSReplyTo(replyTo);
+ producer.send(removeMessage);
+
+ // receive removal response
+ MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + removeMessage.getJMSMessageID() + "'");
+ responseMessage = (ObjectMessage) removeConsumer.receive(TIMEOUT);
+ // verify phrase was inserted
+ assertTrue((Boolean) responseMessage.getObject());
+ } finally {
+ jmsSession.close();
+ }
+ }
+
+ /**
+ * This scenario tests a command message that throws a checked exception
+ * inside the {@link InsertPhraseCmd#execute(org.jbpm.env.Environment) execute}
+ * method.
+ * <h3>Preconditions</h3>
+ * The TEST_PHRASE table does not contain any row with the specified text.
+ * <h3>Behavior</h3>
+ * The {@link InsertPhraseCmd} command message creates a row with the specified
+ * text. The command is configured to throw a checked exception before
+ * completing. The exception prevents the command receiver from sending the
+ * result to the reply queue.
+ * <h3>Postconditions</h3>
+ * The command receiver rolls back the managed transaction and puts the
+ * insertion message back in the command queue. No row with the specified
+ * exists in the database. The {@link RemovePhraseCmd} command result sent to the
+ * reply queue confirms the row was not there.
+ */
+ public void testNoisyMessage() throws JMSException {
+ final String text = "houston, we have a problem";
+ // insert phrase via command
+ Session jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ try {
+ // send insert command
+ Command<Void> insertCommand = new InsertPhraseCmd(text, /* fail? */true);
+ Message insertMessage = jmsSession.createObjectMessage(insertCommand);
+ Destination replyTo = jmsSession.createTemporaryQueue();
+ insertMessage.setJMSReplyTo(replyTo);
+ MessageProducer producer = jmsSession.createProducer(commandQueue);
+ producer.send(insertMessage);
+
+ // receive insertion response
+ MessageConsumer insertConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + insertMessage.getJMSMessageID() + "'");
+ ObjectMessage insertResponse = (ObjectMessage) insertConsumer.receive(TIMEOUT);
+ assertNull(insertResponse);
+
+ // send remove command
+ Command<Boolean> removeCommand = new RemovePhraseCmd(text);
+ Message removeMessage = jmsSession.createObjectMessage(removeCommand);
+ removeMessage.setJMSReplyTo(replyTo);
+ producer.send(removeMessage);
+
+ // receive removal response
+ MessageConsumer removeConsumer = jmsSession.createConsumer(replyTo, "JMSCorrelationID = '" + removeMessage.getJMSMessageID() + "'");
+ ObjectMessage removeResponse = (ObjectMessage) removeConsumer.receive(TIMEOUT);
+ // verify phrase was NOT inserted
+ assertFalse((Boolean) removeResponse.getObject());
+ } finally {
+ jmsSession.close();
+ }
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/CommandReceiverTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/EnterpriseTimerSessionTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,166 @@
+/*
+ * 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.enterprise;
+
+import java.util.Date;
+
+import javax.ejb.CreateException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.cactus.ServletTestCase;
+import org.jbpm.pvm.Execution;
+import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.enterprise.custom.HappyActivity;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.cmd.DeployCmd;
+import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
+import org.jbpm.pvm.internal.ejb.EnterpriseTimerSession;
+import org.jbpm.pvm.internal.ejb.LocalCommandExecutor;
+import org.jbpm.pvm.internal.ejb.LocalCommandExecutorHome;
+import org.jbpm.pvm.internal.job.TimerImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.session.DbSession;
+import org.jbpm.pvm.session.TimerSession;
+
+/**
+ * Server-side test for the enterprise
+ * {@linkplain EnterpriseTimerSession timerImpl session}.
+ *
+ * @author Alejandro Guizar
+ */
+public class EnterpriseTimerSessionTest extends ServletTestCase {
+
+ private LocalCommandExecutor commandExecutor;
+
+ private static final int TIMEOUT = 2000;
+
+ private static LocalCommandExecutorHome commandExecutorHome;
+
+ protected void setUp() throws Exception {
+ // lookup home in jndi
+ if (commandExecutorHome == null) {
+ Context initialContext = new InitialContext();
+ try {
+ commandExecutorHome = (LocalCommandExecutorHome) initialContext.lookup("java:comp/env/ejb/LocalCommandExecutor");
+ } finally {
+ initialContext.close();
+ }
+ }
+ // create local bean
+ commandExecutor = commandExecutorHome.create();
+ // deploy process
+ ProcessDefinition processDefinition = ProcessFactory.build(getName())
+ .timer(TIMEOUT + " milliseconds", null)
+ .event("timeout")
+ .listener(new ObjectDescriptor(HappyActivity.class))
+ .done();
+ commandExecutor.execute(new DeployCmd(new Deployment(processDefinition)));
+ }
+
+ protected void tearDown() throws Exception {
+ commandExecutor = null;
+ }
+
+ /**
+ * This scenario schedules a non-repeating timerImpl whose referenced activity
+ * completes with no incident.
+ * <h3>Preconditions</h3>
+ * The activity has not executed.
+ * <h3>Behavior</h3>
+ * The {@link ScheduleTimerCmd} command activates a timerImpl. After that, the test
+ * waits for the activity to execute. Upon timeout, the
+ * {@linkplain HappyActivity activity} notifies the test of its execution.
+ * <h3>Postconditions</h3>
+ * The activity executes on or after the timerImpl's due date.
+ */
+ public void testSchedule() throws CreateException {
+ // start an execution
+ Execution execution = commandExecutor.execute(new StartExecutionCmd("timers included", null, null));
+
+ /* TODO timers will have to be fetched with a call to the management service
+
+ Timer timer = execution.getTimers().iterator().next();
+
+ Date dueDate = timer.getDueDate();
+ Date executionDate = HappyActivity.waitFor();
+ assertTrue(dueDate.compareTo(executionDate) <= 0);
+ */
+ }
+
+ /**
+ * This scenario schedules a non-repeating timerImpl and immediately cancels it.
+ * <h3>Preconditions</h3>
+ * The activity has not executed.
+ * <h3>Behavior</h3>
+ * The {@link ScheduleTimerCmd} command activates a timerImpl, which is immediately
+ * disabled by the {@link CancelTimerCmd} command. After that, the test waits
+ * past the timerImpl's due date.
+ * <h3>Postconditions</h3>
+ * The activity does not execute, ever.
+ */
+ public void testCancel() throws CreateException {
+ // start an execution
+ commandExecutor.execute(new StartExecutionCmd("timers included", null, null));
+
+ Date executionDate = HappyActivity.waitFor(2 * TIMEOUT);
+ assertNull(executionDate);
+ }
+
+ static class ScheduleTimerCmd implements Command<Void> {
+
+ private final TimerImpl timer;
+
+ private static final long serialVersionUID = 1L;
+
+ ScheduleTimerCmd(TimerImpl timer) {
+ this.timer = timer;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ environment.get(DbSession.class).save(timer.getExecution());
+ environment.get(TimerSession.class).schedule(timer);
+ return null;
+ }
+ }
+
+ static class CancelTimerCmd implements Command<Void> {
+
+ private final long timerDbid;
+
+ private static final long serialVersionUID = 1L;
+
+ CancelTimerCmd(long timerDbid) {
+ this.timerDbid = timerDbid;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ TimerImpl timerImpl = environment.get(DbSession.class).get(TimerImpl.class, timerDbid);
+ environment.get(TimerSession.class).cancel(timerImpl);
+ return null;
+ }
+ }
+
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/TimerTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,253 @@
+/*
+ * 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.enterprise;
+
+import java.util.Date;
+
+import javax.ejb.CreateException;
+import javax.naming.InitialContext;
+
+import org.apache.cactus.ServletTestCase;
+
+import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.enterprise.custom.HappyActivity;
+import org.jbpm.pvm.enterprise.custom.NoisyActivity;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.cmd.DeployCmd;
+import org.jbpm.pvm.internal.cmd.GetVariableCmd;
+import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
+import org.jbpm.pvm.internal.ejb.LocalCommandExecutor;
+import org.jbpm.pvm.internal.ejb.LocalCommandExecutorHome;
+import org.jbpm.pvm.internal.ejb.LocalTimer;
+import org.jbpm.pvm.internal.ejb.LocalTimerHome;
+import org.jbpm.pvm.internal.ejb.TimerEB;
+import org.jbpm.pvm.internal.job.TimerImpl;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.session.DbSession;
+
+/**
+ * Server-side test for the {@linkplain TimerEB timerImpl bean}. The local
+ * interface is used.
+ *
+ * @author Alejandro Guizar
+ */
+public class TimerTest extends ServletTestCase {
+
+ private ProcessDefinition processDefinition;
+ private ObjectDescriptor activityDescriptor = new ObjectDescriptor();
+
+ private LocalCommandExecutor commandExecutor;
+
+ private static final int TIMEOUT = 2000;
+ private static final int REPEAT = 1000;
+
+ private static final Log log = Log.getLog(TimerTest.class.getName());
+
+ private static LocalTimerHome timerHome;
+ private static LocalCommandExecutorHome commandExecutorHome;
+
+ protected void setUp() throws Exception {
+ // lookup homes in jndi
+ if (commandExecutorHome == null) {
+ InitialContext initialContext = new InitialContext();
+ try {
+ commandExecutorHome = (LocalCommandExecutorHome) initialContext.lookup("java:comp/env/ejb/LocalCommandExecutor");
+ timerHome = (LocalTimerHome) initialContext.lookup("java:comp/env/ejb/LocalTimer");
+ } finally {
+ initialContext.close();
+ }
+ }
+ // create local bean
+ commandExecutor = commandExecutorHome.create();
+ // define process
+ processDefinition = ProcessFactory.build(getName())
+ .event("timeout")
+ .listener(activityDescriptor)
+ .done();
+ }
+
+ protected void tearDown() throws Exception {
+ commandExecutor = null;
+ }
+
+ /**
+ * This scenario tests a non-repeating timerImpl whose referenced activity
+ * completes with no incident.
+ * <h3>Preconditions</h3>
+ * The activity has not executed.
+ * <h3>Behavior</h3>
+ * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
+ * service. After that, the test waits for the activity to execute. Upon
+ * timeout, the {@linkplain HappyActivity activity} notifies the test of its
+ * execution.
+ * <h3>Postconditions</h3>
+ * The activity executes on or after the timerImpl's due date.
+ */
+ public void testHappyTimer() throws CreateException {
+ activityDescriptor.setClassName(HappyActivity.class.getName());
+ commandExecutor.execute(new DeployCmd(new Deployment(processDefinition)));
+
+ ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
+
+ Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
+ TimerImpl timerImpl = new TimerImpl();
+ timerImpl.setEventName("timeout");
+ timerImpl.setDueDate(dueDate);
+ timerImpl.setExecution(execution);
+ commandExecutor.execute(new CreateTimerCmd(timerImpl));
+
+ Date executionDate = HappyActivity.waitFor();
+ assertTrue(dueDate.compareTo(executionDate) <= 0);
+ }
+
+ /**
+ * This scenario tests a non-repeating timerImpl whose referenced activity throws
+ * a checked exception.
+ * <h3>Preconditions</h3>
+ * The activity has not executed.
+ * <h3>Behavior</h3>
+ * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
+ * service. After that, the test waits for the activity to execute. Upon
+ * timeout, the {@linkplain NoisyActivity activity} notifies the test of its
+ * execution, sets a variable and throws a checked exception.
+ * <h3>Postconditions</h3>
+ * The activity executes on or after the timerImpl's due date. The EJB timerImpl
+ * service rolls back the managed transaction. The variable is unset.
+ */
+ public void testNoisyTimer() throws CreateException {
+ activityDescriptor.setClassName(NoisyActivity.class.getName());
+ commandExecutor.execute(new DeployCmd(new Deployment(processDefinition)));
+
+ ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
+
+ Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
+ TimerImpl timerImpl = new TimerImpl();
+ timerImpl.setEventName("timeout");
+ timerImpl.setDueDate(dueDate);
+ timerImpl.setExecution(execution);
+ commandExecutor.execute(new CreateTimerCmd(timerImpl));
+
+ Date executionDate = NoisyActivity.waitFor();
+ assertTrue(dueDate.compareTo(executionDate) <= 0);
+
+ Object variableValue = commandExecutor.execute(new GetVariableCmd(execution.getDbid(), "executionDate"));
+ assertNull(variableValue);
+ }
+
+ /**
+ * This scenario tests a repeating timerImpl whose referenced activity completes
+ * with no incident.
+ * <h3>Preconditions</h3>
+ * The activity has not executed.
+ * <h3>Behavior</h3>
+ * The {@link CreateTimerCmd} command subscribes a timerImpl bean to the EJB timerImpl
+ * service. After that, the test waits for the first execution of the
+ * activity, and then for the subsequent <em>n</em> executions of the
+ * activity. Upon each timeout, the {@linkplain HappyActivity activity}
+ * notifies the test of its execution.
+ * <h3>Postconditions</h3>
+ * The first execution of the activity occurs on or after the timerImpl's due
+ * date. The subsequent <em>n</em> executions of the activity occur on or
+ * after the timerImpl's repeat interval.
+ */
+ public void testCyclicTimer() throws CreateException {
+ activityDescriptor.setClassName(HappyActivity.class.getName());
+ commandExecutor.execute(new DeployCmd(new Deployment(processDefinition)));
+
+ ExecutionImpl execution = (ExecutionImpl) commandExecutor.execute(new StartExecutionCmd(processDefinition.getName(), null, null));
+
+ Date dueDate = new Date(System.currentTimeMillis() + TIMEOUT);
+ TimerImpl timerImpl = new TimerImpl();
+ timerImpl.setEventName("timeout");
+ timerImpl.setDueDate(dueDate);
+ timerImpl.setRepeat(REPEAT + " milliseconds");
+ timerImpl.setExecution(execution);
+ commandExecutor.execute(new CreateTimerCmd(timerImpl));
+
+ try {
+ Date executionTime = HappyActivity.waitFor();
+ assertTrue(dueDate.compareTo(executionTime) <= 0);
+
+ for (int i = 0; i < 5; i++) {
+ dueDate.setTime(dueDate.getTime() + REPEAT);
+ log.info("next execution due " + TimerImpl.formatDueDate(dueDate));
+ executionTime = HappyActivity.waitFor();
+ assertTrue(dueDate.compareTo(executionTime) <= 0);
+ }
+ } finally {
+ commandExecutor.execute(new CancelTimerCmd(timerImpl.getDbid()));
+ }
+ }
+
+ static class CreateTimerCmd implements Command<Void> {
+
+ private final TimerImpl timerImpl;
+
+ private static final long serialVersionUID = 1L;
+
+ CreateTimerCmd(TimerImpl timerImpl) {
+ this.timerImpl = timerImpl;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ DbSession dbSession = environment.get(DbSession.class);
+ dbSession.save(timerImpl);
+ dbSession.flush();
+
+ long timerDbid = timerImpl.getDbid();
+ log.info("scheduling " + timerImpl + " #" + timerDbid);
+ LocalTimer timerBean = timerHome.findByPrimaryKey(timerDbid);
+ timerBean.schedule();
+ return null;
+ }
+
+ public String toString() {
+ return CreateTimerCmd.class.getSimpleName() + '(' + timerImpl + ')';
+ }
+ }
+
+ static class CancelTimerCmd implements Command<Void> {
+
+ private final long timerDbid;
+
+ private static final long serialVersionUID = 1L;
+
+ CancelTimerCmd(long timerDbid) {
+ this.timerDbid = timerDbid;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ LocalTimer timerBean = timerHome.findByPrimaryKey(timerDbid);
+ timerBean.remove();
+ return null;
+ }
+
+ public String toString() {
+ return CancelTimerCmd.class.getSimpleName() + '(' + timerDbid + ')';
+ }
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/custom)
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/HappyActivity.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/custom/HappyActivity.java 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/HappyActivity.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jbpm.enterprise.custom;
+package org.jbpm.pvm.enterprise.custom;
import java.util.Date;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/InsertPhraseCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/custom/InsertPhraseCmd.java 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/InsertPhraseCmd.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jbpm.enterprise.custom;
+package org.jbpm.pvm.enterprise.custom;
import java.sql.SQLException;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/NoisyActivity.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/custom/NoisyActivity.java 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/NoisyActivity.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jbpm.enterprise.custom;
+package org.jbpm.pvm.enterprise.custom;
import java.sql.SQLException;
import java.util.Date;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/Phrase.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/custom/Phrase.hbm.xml 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/Phrase.hbm.xml 2008-07-25 13:32:48 UTC (rev 1729)
@@ -2,7 +2,7 @@
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-access="field" auto-import="false">
- <class name="org.jbpm.enterprise.custom.Phrase" table="TEST_PHRASE">
+ <class name="org.jbpm.pvm.enterprise.custom.Phrase" table="TEST_PHRASE">
<id name="id" column="ID_">
<generator class="native" />
</id>
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/Phrase.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/custom/Phrase.java 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/Phrase.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jbpm.enterprise.custom;
+package org.jbpm.pvm.enterprise.custom;
/**
* @author Alejandro Guizar
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/RemovePhraseCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/enterprise/custom/RemovePhraseCmd.java 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/custom/RemovePhraseCmd.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jbpm.enterprise.custom;
+package org.jbpm.pvm.enterprise.custom;
import java.util.List;
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/ExclusiveTestMessage.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/ExclusiveTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/ExclusiveTestMessage.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/ExclusiveTestMessage.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.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;
+ }
+
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/ExclusiveTestMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailOnceTestMessage.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/FailOnceTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailOnceTestMessage.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailOnceTestMessage.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -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.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;
+ }
+
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailOnceTestMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailingTestMessage.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/FailingTestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailingTestMessage.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailingTestMessage.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.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");
+ }
+
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/FailingTestMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTest.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/JobExecutorTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTest.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,361 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.jobexecutor;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.hibernate.Session;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestCase;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.client.ClientProcessInstance;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.Transaction;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.job.Job;
+import org.jbpm.pvm.model.Comment;
+import org.jbpm.pvm.session.MessageSession;
+import org.jbpm.pvm.session.PvmDbSession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JobExecutorTest extends EnvironmentFactoryTestCase {
+
+ private static final Log log = Log.getLog(JobExecutorTest.class.getName());
+
+ /**
+ * test the case where the jobExecutor is start and shortly after stopped.
+ * It can appears for example in other tests with auto-start activated
+ * if the test is too short.
+ *
+ * The jobExecutor is registered as active when the run method is invoked.
+ * It happens only after a system context switching. If the jobExecutor is
+ * stopped before that, it won't really be stopped because it has not been
+ * started yet.
+ */
+ public void testImmediateJobExecutorShutdown() throws InterruptedException {
+
+ // if the test fail, there can be a live lock
+ // install a timer that will interrupt if it takes too long
+ // if that happens, it will lead to an interrupted exception and the test will fail
+ final Thread testThread = Thread.currentThread();
+ TimerTask interruptTask = new TimerTask() {
+ public void run() {
+ log.debug("test "+getName()+" took too long. going to interrupt..."+testThread);
+ testThread.interrupt();
+ }
+ };
+ Timer timer = new Timer();
+ timer.schedule(interruptTask, 10000);
+
+ final JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+ jobExecutor.setIdleInterval(1000);
+ assertFalse(jobExecutor.isActive());
+ jobExecutor.start();
+ jobExecutor.stop();
+ Thread.sleep(800);
+ assertFalse(jobExecutor.isActive());
+ }
+
+ public void testSuccessfulMessageProcessing() {
+ int nbrOfTestMessages = 5;
+ int testTimeoutMillis = 10000;
+ int checkInterval = 500;
+
+ List<Integer> processedMessageIds = (List<Integer>) getEnvironmentFactory().get("processedMessageIds");
+ processedMessageIds.clear();
+
+ JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+ jobExecutor.start();
+ try {
+ insertTestMessages(nbrOfTestMessages);
+ waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+ for (int i=0; i<nbrOfTestMessages; i++) {
+ assertTrue("message "+i+" is not processed", processedMessageIds.contains(i));
+ }
+ }
+
+ public void testMessagesPresentUponJobExecutorStartUp() {
+ int nbrOfTestMessages = 2;
+ int testTimeoutMillis = 5000;
+ int checkInterval = 400;
+
+ insertTestMessages(nbrOfTestMessages);
+
+ List<Integer> processedMessageIds = (List<Integer>) getEnvironmentFactory().get("processedMessageIds");
+ processedMessageIds.clear();
+
+ JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+ jobExecutor.start();
+ try {
+ waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+ for (int i=0; i<nbrOfTestMessages; i++) {
+ assertTrue("message "+i+" is not processed", processedMessageIds.contains(i));
+ }
+ }
+
+ public void testExclusiveMessageProcessing() {
+ int testTimeoutMillis = 10000;
+ int checkInterval = 500;
+ int nbrOfTestMessagesPerExecution = 5;
+ int nbrOfTestExecutions = 1;
+
+ insertExclusiveTestMessages(nbrOfTestExecutions, nbrOfTestMessagesPerExecution);
+
+ JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+ jobExecutor.start();
+ try {
+
+ waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+
+ Environment environment = getEnvironmentFactory().openEnvironment();
+ try {
+ // exclusiveMessageIds maps execution keys to a set of thread ids.
+ // the idea is that for each execution, all the exclusive jobs will
+ // be executed by 1 thread sequentially.
+
+ // in the end, each set should contain exactly 1 element
+ Map<String, Set<Long>> exclusiveThreadIds = (Map) environment.get("exclusiveThreadIds");
+
+ for (int i=0; i<nbrOfTestExecutions; i++) {
+ String executionKey = "execution-"+i;
+ Set<Long> threadIds = exclusiveThreadIds.get(executionKey);
+ assertNotNull("no thread id set for "+executionKey+" in: "+exclusiveThreadIds, threadIds);
+ assertEquals("exclusive messages for "+executionKey+" have been executed by multiple threads: "+threadIds,
+ 1,
+ threadIds.size());
+ }
+ } finally {
+ environment.close();
+ }
+
+ }
+
+ public void testFailOnceMessages() {
+ int nbrOfTestMessages = 7;
+ int testTimeoutMillis = 10000;
+ int checkInterval = 500;
+
+ List<Integer> failOnceMessageIds = (List<Integer>) getEnvironmentFactory().get("failOnceMessageIds");
+ failOnceMessageIds.clear();
+
+ JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+ jobExecutor.start();
+ try {
+ insertFailOnceTestMessages(nbrOfTestMessages);
+ waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+ for (int i=0; i<nbrOfTestMessages; i++) {
+ assertTrue("message "+i+" is not failed once: "+failOnceMessageIds, failOnceMessageIds.contains(i));
+ }
+ assertEquals(nbrOfTestMessages, failOnceMessageIds.size());
+
+ Environment environment = getEnvironmentFactory().openEnvironment();
+ try {
+ Session session = environment.get(Session.class);
+ List<Comment> comments = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
+
+ for (Comment comment: comments) {
+ Integer messageId = new Integer(comment.getMessage());
+ assertTrue("message "+messageId+" committed twice", failOnceMessageIds.remove(messageId));
+ // clean up for next tests
+ session.delete(comment);
+ }
+
+ assertTrue("not all messages made a successful commit: "+failOnceMessageIds, failOnceMessageIds.isEmpty());
+ } finally {
+ environment.close();
+ }
+ }
+
+ public void testFailedMessageProcessing() {
+ int testTimeoutMillis = 3000;
+ int checkInterval = 400;
+
+ JobExecutor jobExecutor = getEnvironmentFactory().get(JobExecutor.class);
+ jobExecutor.start();
+ try {
+ Environment environment = getEnvironmentFactory().openEnvironment();
+ try {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ messageSession.send(new FailingTestMessage());
+ } finally {
+ environment.close();
+ }
+
+ waitTillNoMoreMessages(jobExecutor, testTimeoutMillis, checkInterval);
+
+ } finally {
+ jobExecutor.stop(true);
+ }
+
+ Environment environment = getEnvironmentFactory().openEnvironment();
+ try {
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ List<Job> deadJobs = pvmDbSession.findDeadJobs();
+ assertEquals("there should be one dead jobImpl", 1, deadJobs.size());
+
+ Session session = environment.get(Session.class);
+ List commands = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
+ assertTrue("command insertion should have been rolled back", commands.isEmpty());
+ } finally {
+ environment.close();
+ }
+ }
+
+ // helper methods ///////////////////////////////////////////////////////////
+
+ void insertTestMessages(int nbrOfTestMessages) {
+ Environment environment = getEnvironmentFactory().openEnvironment();
+ try {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ for (int i=0; i<nbrOfTestMessages; i++) {
+ TestMessage testMessage = new TestMessage(i);
+ messageSession.send(testMessage);
+ }
+ } catch (RuntimeException e) {
+ environment.get(Transaction.class).setRollbackOnly();
+ throw e;
+ } finally {
+ environment.close();
+ }
+ }
+
+ void insertExclusiveTestMessages(int nbrOfTestExecutions, int nbrOfTestMessagesPerExecution) {
+ Environment environment = getEnvironmentFactory().openEnvironment();
+ try {
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ ClientProcessDefinition processDefinition = new ProcessDefinitionImpl();
+ pvmDbSession.save(processDefinition);
+
+ MessageSession messageSession = environment.get(MessageSession.class);
+ for (int i=0; i<nbrOfTestExecutions; i++) {
+ ClientProcessInstance execution = processDefinition.beginProcessInstance("execution-"+i);
+ pvmDbSession.save(execution);
+
+ for (int j=0; j<nbrOfTestMessagesPerExecution; j++) {
+
+ ExclusiveTestMessage testMessage = new ExclusiveTestMessage(execution);
+ messageSession.send(testMessage);
+ }
+ }
+ } catch (RuntimeException e) {
+ environment.get(Transaction.class).setRollbackOnly();
+ throw e;
+ } finally {
+ environment.close();
+ }
+ }
+
+ void insertFailOnceTestMessages(int nbrOfTestMessages) {
+ Environment environment = getEnvironmentFactory().openEnvironment();
+ try {
+ MessageSession messageSession = environment.get(MessageSession.class);
+ for (int i=0; i<nbrOfTestMessages; i++) {
+ FailOnceTestMessage testMessage = new FailOnceTestMessage(i);
+ messageSession.send(testMessage);
+ }
+ } catch (RuntimeException e) {
+ environment.get(Transaction.class).setRollbackOnly();
+ throw e;
+ } finally {
+ environment.close();
+ }
+ }
+
+
+ private void waitTillNoMoreMessages(JobExecutor jobExecutor, int maxWait, int checkInterval) {
+
+ // install a timer that will interrupt if it takes too long
+ // if that happens, it will lead to an interrupted exception and the test will fail
+ TimerTask interruptTask = new TimerTask() {
+ Thread testThread = Thread.currentThread();
+ public void run() {
+ log.debug("test "+getName()+" took too long. going to interrupt..."+testThread);
+ testThread.interrupt();
+ }
+ };
+ Timer timer = new Timer();
+ timer.schedule(interruptTask, maxWait);
+
+ try {
+ boolean jobsAvailable = true;
+ while (jobsAvailable) {
+ log.debug("going to sleep for "+checkInterval+" millis, waiting for the jobImpl executor to process more jobs");
+ Thread.sleep(checkInterval);
+ jobsAvailable = areJobsAvailable();
+ }
+
+ } catch (InterruptedException e) {
+ fail("test execution exceeded treshold of "+maxWait+" milliseconds");
+ } finally {
+ timer.cancel();
+ }
+ }
+
+ boolean areJobsAvailable() {
+ Environment environment = getEnvironmentFactory().openEnvironment();
+ try {
+ JobDbSession jobDbSession = environment.get(JobDbSession.class);
+
+ JobImpl<?> firstAcquirableJob = jobDbSession.findFirstAcquirableJob();
+ if (firstAcquirableJob!=null) {
+ log.debug("found more jobs to process");
+ return true;
+ }
+ } catch (RuntimeException e) {
+ environment.get(Transaction.class).setRollbackOnly();
+ throw e;
+ } finally {
+ environment.close();
+ }
+ log.debug("no more jobs to process");
+ return false;
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTests.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTests.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.jobexecutor;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JobExecutorTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.jbpm.pvm.jobexecutor");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(JobExecutorTimerSessionTest.class);
+ suite.addTestSuite(JobExecutorTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTimerSessionTest.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/JobExecutorTimerSessionTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTimerSessionTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTimerSessionTest.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,398 @@
+/**
+ * Copyright (C) 2007 Bull S. A. S.
+ * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation
+ * version 2.1 of the License.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301, USA.
+ **/
+package org.jbpm.pvm.jobexecutor;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jbpm.pvm.test.base.DbTestCase;
+import org.jbpm.pvm.PvmException;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.job.TimerImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.job.Job;
+import org.jbpm.pvm.job.Timer;
+import org.jbpm.pvm.session.PvmDbSession;
+import org.jbpm.pvm.session.TimerSession;
+
+/**
+ * @author Pascal Verdage
+ */
+public class JobExecutorTimerSessionTest extends DbTestCase
+{
+
+ public void setUp() throws Exception {
+ super.setUp();
+ getVariables().clear();
+ // launch jobExecutor
+ Environment.getCurrent().get(JobExecutor.class).setIdleInterval(500000);
+ Environment.getCurrent().get(JobExecutor.class).start();
+ }
+
+ public void tearDown() throws Exception {
+ Environment.getCurrent().get(JobExecutor.class).stop();
+ super.tearDown();
+ }
+
+ /* GETTERS */
+ @SuppressWarnings("unchecked")
+ public static Map<String, Integer> getVariables() {
+ return (Map<String, Integer>) Environment.getCurrent()
+ .getEnvironmentFactory().get("timerVariables");
+ }
+
+ /** get TimerSession if an environment is open */
+ protected static TimerSession getTimerSession() {
+ assertNotNull(Environment.getCurrent());
+ return Environment.getCurrent().get(TimerSession.class);
+ }
+
+ /** get JobDbSession if an environment is open */
+ protected static JobDbSession getJobDbSession() {
+ assertNotNull(Environment.getCurrent());
+ return Environment.getCurrent().get(JobDbSession.class);
+ }
+
+ /** get PvmDbSession if an environment is open */
+ protected static PvmDbSession getPvmDbSession() {
+ assertNotNull(Environment.getCurrent());
+ return Environment.getCurrent().get(PvmDbSession.class);
+ }
+
+ /* Test assertion tools */
+ /** return the number of timers among active jobs */
+ private static int getNbTimer() {
+ int result = 0;
+ List<Timer> timers = getPvmDbSession().findTimers();
+ if (timers != null) {
+ for (Job job : timers) {
+ if (job instanceof TimerImpl) {
+ result++;
+ }
+ }
+ }
+ // List<JobImpl<?>> deadJobs = getPvmDbSession().findAllJobs();
+ // if (deadJobs != null) {
+ // for (JobImpl<?> jobImpl : deadJobs) {
+ // if (jobImpl instanceof TimerImpl) {
+ // result++;
+ // }
+ // }
+ // }
+ return result;
+ }
+
+ private static int TIMEOUT = 60 * 1000; // 1 minutes
+
+ /** This method change the transaction */
+ protected void waitUntilNbTimerEquals(int expected) {
+ int rate = 500; // check every rate millis
+ int result = Integer.MAX_VALUE;
+
+ for (int i = 0; i < TIMEOUT / rate; i++) {
+ try {
+ Thread.sleep(rate);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ fail();
+ }
+ newTransaction();
+ result = getNbTimer();
+ if (result == expected) {
+ break;
+ }
+ }
+ // if false, then the timeout occurred
+ assertEquals(expected, result);
+ }
+
+ protected static void assertNbTimersEquals(int expected) {
+ assertEquals(expected, getNbTimer());
+ }
+
+ /* TimerImpl manipulation tools */
+
+ /** @return the first due timer or null if none */
+ protected TimerImpl findFirstDueTimer() {
+ TimerImpl result = null;
+ JobImpl<?> firstJob = getJobDbSession().findFirstDueJob();
+ if (firstJob instanceof TimerImpl) {
+ result = (TimerImpl) firstJob;
+ } else {
+ List<Timer> timers = getPvmDbSession().findTimers();
+ if (timers != null) {
+ Date dueDate = new Date(Long.MAX_VALUE);
+ for (Timer timer : timers) {
+ if (timer instanceof TimerImpl && timer.getDueDate().before(dueDate)) {
+ dueDate = timer.getDueDate();
+ result = (TimerImpl) timer;
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /** create a timer that should not be executed */
+ private TimerImpl createForbiddenTimer(String name, long delay) {
+ return new TestTimer(name, delay, 0);
+ }
+ /** create a timer that should be executed once */
+ private TimerImpl createTimer(String name, Date dueDate) {
+ return new TestTimer(name, dueDate, 1);
+ }
+ /** create a timer that should be executed once */
+ private TimerImpl createTimer(String name, long delay) {
+ return new TestTimer(name, delay, 1);
+ }
+ /** create a timer that should be executed nbExecution times */
+ private TimerImpl createTimer(String name, long delay, long repeatDelay, int nbExecution) {
+ TimerImpl timerImpl = new TestTimer(name, delay, nbExecution);
+ timerImpl.setRepeat(Long.toString(repeatDelay) + " millis");
+ return timerImpl;
+ }
+
+ /* Functionnal tests */
+
+ /** Test all use cases that should throw PvmException for method schedule */
+ public void testScheduleIllegalArgument() {
+ TimerSession timerSession = getTimerSession();
+ TimerImpl timerImpl;
+
+ // null TimerImpl
+ try {
+ timerSession.schedule(null);
+ fail("Should not happen");
+ } catch (PvmException e) {
+ assertTextPresent("null timer", e.getMessage());
+ }
+
+ // no execution
+ try {
+ timerImpl = new TimerImpl();
+ timerSession.schedule(timerImpl);
+ // clean before failure
+ timerSession.cancel(timerImpl);
+ fail("Should not happen");
+ } catch (PvmException e) {
+ assertTextPresent("no execution", e.getMessage());
+ }
+
+ ExecutionImpl execution = new ExecutionImpl();
+
+ // no signal or event
+ try {
+ timerImpl = new TimerImpl();
+ timerImpl.setExecution(execution);
+ timerSession.schedule(timerImpl);
+ // clean before failure
+ timerSession.cancel(timerImpl);
+ fail("Should not happen");
+ } catch (PvmException e) {
+ assertTextPresent("no signalName or eventName", e.getMessage());
+ }
+
+ // a signalName with no activityInstance to signal is valid
+
+ // null dueDate
+ try {
+ timerImpl = createTimer("schedule error 1", null);
+ timerImpl.setExecution(execution);
+
+ timerImpl.setSignalName("timeout");
+ timerSession.schedule(timerImpl);
+ // clean before failure
+ timerSession.cancel(timerImpl);
+ fail("Should not happen");
+ } catch (PvmException e) {
+ assertTextPresent("null date", e.getMessage());
+ }
+
+ // date.getTime() negative
+ try {
+ timerImpl = createTimer("schedule error 2", new Date(-10));
+ timerImpl.setExecution(execution);
+
+ timerImpl.setSignalName("timeout");
+ timerSession.schedule(timerImpl);
+ // clean before failure
+ timerSession.cancel(timerImpl);
+ fail("Should not happen");
+ } catch (PvmException e) {
+ assertTextPresent("negative date", e.getMessage());
+ }
+ }
+
+ /** Test the method cancel */
+ public void testCancel() {
+ TimerSession timerSession;
+ TimerImpl timerImpl;
+
+ // null jobImpl
+ try {
+ getTimerSession().cancel(null);
+ fail();
+ } catch (PvmException e) {
+ // OK
+ }
+
+ // non scheduled jobImpl
+ timerSession = getTimerSession();
+ timerImpl = createForbiddenTimer("cancel 1", 500);
+ timerSession.cancel(timerImpl);
+ assertNbTimersEquals(0);
+
+ // scheduled non-executed jobImpl
+ ExecutionImpl execution = new ExecutionImpl();
+ getPvmDbSession().save(execution);
+
+ timerSession = getTimerSession();
+ timerImpl = createForbiddenTimer("cancel 2", 500);
+ timerImpl.setSignalName("timeout");
+ timerImpl.setExecution(execution);
+
+ timerSession.schedule(timerImpl);
+ newTransaction();
+ assertNbTimersEquals(1);
+ timerSession = getTimerSession();
+ timerSession.cancel(findFirstDueTimer());
+
+ newTransaction();
+ assertNbTimersEquals(0);
+
+ execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+ getPvmDbSession().delete(execution);
+
+ /*
+ * scheduled jobImpl with repeat
+ * This is not necessary because in the test, a timer scheduled with
+ * a repeat will be deleted by the instance. So this case is covered
+ * by the test testScheduleRepeatDelay
+ */
+ }
+
+ /** Schedule a jobImpl in the past */
+ public void testSchedulePastJob() {
+ ExecutionImpl execution = new ExecutionImpl();
+ execution = reload(execution);
+ try {
+ TimerImpl timerImpl = createTimer("schedule past jobImpl", -500);
+ timerImpl.setExecution(execution);
+ timerImpl.setEventName("timeout");
+ getTimerSession().schedule(timerImpl);
+ assertNbTimersEquals(1);
+ newTransaction();
+ waitUntilNbTimerEquals(0);
+ } finally {
+ execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+ getPvmDbSession().delete(execution);
+ newTransaction();
+ }
+ }
+
+ /** Schedule a jobImpl in the future */
+ public void testScheduleFutureJob() {
+ ExecutionImpl execution = new ExecutionImpl();
+ execution = reload(execution);
+ try {
+ TimerImpl timerImpl = createTimer("schedule future jobImpl", 500);
+ timerImpl.setExecution(execution);
+ timerImpl.setEventName("timeout");
+ getTimerSession().schedule(timerImpl);
+ assertNbTimersEquals(1);
+ newTransaction();
+ waitUntilNbTimerEquals(0);
+ } finally {
+ execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+ getPvmDbSession().delete(execution);
+ newTransaction();
+ }
+ }
+
+ /** Test the method schedule with a repeated jobImpl */
+ public void testScheduleRepeatDelay() {
+ ExecutionImpl execution = new ExecutionImpl();
+ execution = reload(execution);
+ try {
+ TimerImpl timerImpl = createTimer("schedule repeat delay", 200, 400, 3);
+ timerImpl.setExecution(execution);
+ timerImpl.setEventName("timeout");
+ getTimerSession().schedule(timerImpl);
+ assertNbTimersEquals(1);
+ newTransaction();
+ waitUntilNbTimerEquals(0);
+ } finally {
+ execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+ getPvmDbSession().delete(execution);
+ newTransaction();
+ }
+ }
+
+
+ /* Concurrent tests */
+
+ /** create a timer that should be executed once and increment a variable */
+ private TimerImpl createIncrementingTimer(String name, Date dueDate, String variable) {
+ TestTimer timer = new TestTimer(name, dueDate, 1);
+ timer.setVariableName(variable);
+ timer.setEventName("incrementation");
+ return timer;
+ }
+
+ private void testManyTimers(int nbTimer, long delayBetweenTimers) {
+ ExecutionImpl execution = new ExecutionImpl();
+ execution = reload(execution);
+ try {
+ long startTime = System.currentTimeMillis();
+ for (int i=0; i<nbTimer; i++) {
+ Date dueDate = new Date(startTime + 1000 + i*delayBetweenTimers);
+ String name = "timer " + i;
+ TimerImpl timerImpl = createIncrementingTimer(name, dueDate, name);
+ timerImpl.setExecution(execution);
+ getTimerSession().schedule(timerImpl);
+ }
+
+ newTransaction();
+ assertNbTimersEquals(nbTimer);
+ waitUntilNbTimerEquals(0);
+ int sum = 0;
+ Map<String, Integer> variables = getVariables();
+ if (variables != null) {
+ for (Entry<String, Integer> variable : variables.entrySet()) {
+ assertEquals(variable.getKey(), 1, (int)variable.getValue());
+ sum += variable.getValue();
+ }
+ }
+ assertEquals(nbTimer, sum);
+ } finally {
+ execution = getPvmDbSession().get(ExecutionImpl.class, execution.getDbid());
+ getPvmDbSession().delete(execution);
+ newTransaction();
+ }
+ }
+
+ public void testSeveralTimer() {
+ testManyTimers(20, 100);
+ }
+
+ public void testSimultaneousTimer() {
+ testManyTimers(20, 0);
+ }
+
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/JobExecutorTimerSessionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestMessage.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/TestMessage.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestMessage.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestMessage.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.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;
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestTimer.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/TestTimer.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestTimer.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestTimer.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.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;
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/TestTimer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/cron)
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/CronExpression.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/cron/CronExpression.java 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/CronExpression.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -1,4 +1,4 @@
-package org.jbpm.jobexecutor.cron;
+package org.jbpm.pvm.jobexecutor.cron;
import java.io.Serializable;
import java.text.ParseException;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/CronTrigger.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/cron/CronTrigger.java 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/jobexecutor/cron/CronTrigger.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -18,7 +18,7 @@
/*
* Previously Copyright (c) 2001-2004 James House
*/
-package org.jbpm.jobexecutor.cron;
+package org.jbpm.pvm.jobexecutor.cron;
import java.text.ParseException;
import java.util.Calendar;
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/msg)
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemJobExecutor.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemJobExecutor.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemJobExecutor.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemJobExecutor.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.msg;
+
+import java.util.Queue;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.log.Log;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class MemJobExecutor {
+
+ private static final Log log = Log.getLog(MemJobExecutor.class.getName());
+
+ Queue<JobImpl<?>> queue;
+ EnvironmentFactory environmentFactory;
+
+ public void executeAvailableJobs() {
+ while (! queue.isEmpty()) {
+ JobImpl<?> job = queue.poll();
+ if (job!=null) {
+ executeJob(job);
+ }
+ }
+ }
+
+ protected void executeJob(JobImpl<?> job) {
+ Environment environment = environmentFactory.openEnvironment();
+ try {
+ log.trace("processing jobImpl "+job);
+ job.execute(environment);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ environment.close();
+ }
+ }
+
+ public void startExecutingJobs() {
+ }
+
+ public void stopExecutingJobs() {
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemJobExecutor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemMessageService.java (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemMessageService.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemMessageService.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemMessageService.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,73 @@
+/*
+ * 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.msg;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Queue;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.log.Log;
+import org.jbpm.pvm.internal.tx.Resource;
+import org.jbpm.pvm.session.MessageSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class MemMessageService implements MessageSession, Resource {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(MemMessageService.class.getName());
+
+ Environment environment; // injected
+ Queue<JobImpl<?>> queue = null;
+ List<JobImpl<?>> producedMessages = null;
+
+ public void send(MessageImpl<?> message) {
+ log.trace("adding message "+message);
+ if (producedMessages==null) {
+ producedMessages = new ArrayList<JobImpl<?>>();
+ }
+ producedMessages.add(message);
+ }
+
+ public void prepare() {
+ }
+
+ public void commit() {
+ if (producedMessages!=null) {
+ queue.addAll(producedMessages);
+ }
+ }
+
+ public void rollback() {
+ producedMessages = null;
+ }
+
+ public void close() {
+ }
+
+ public void flush() {
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemMessageService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemMessageServiceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/msg/MemMessageServiceTest.java 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/msg/MemMessageServiceTest.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -1,34 +1,19 @@
-package org.jbpm.msg;
+package org.jbpm.pvm.msg;
import java.util.Queue;
-import org.jbpm.pvm.test.base.JbpmTestCase;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.env.Transaction;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.svc.memory.MemMessageService;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestCase;
-public class MemMessageServiceTest extends JbpmTestCase
-{
+public class MemMessageServiceTest extends EnvironmentFactoryTestCase {
public void testSendJob() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
- "<contexts>" +
- " <environment-factory>" +
- " <object name='queue' class='java.util.concurrent.LinkedBlockingQueue' />" +
- " </environment-factory>" +
- " <environment>" +
- " <transaction name='tx' />" +
- " <object name='messageService' class='"+MemMessageService.class.getName()+"' auto-wire='enabled'>" +
- " <enlist transaction='tx'/>" +
- " </object>" +
- // queue gets auto-wired into the message service
- " </environment>" +
- "</contexts>"
- );
+ EnvironmentFactory environmentFactory = getEnvironmentFactory();
MessageImpl<?> message = new MessageImpl<Object>() {
private static final long serialVersionUID = 1L;
@@ -38,6 +23,7 @@
};
Queue<JobImpl<?>> queue = (Queue<JobImpl<?>>) ((PvmEnvironmentFactory)environmentFactory).get("queue");
+ queue.clear();
Environment environment = environmentFactory.openEnvironment();
MemMessageService msgService = (MemMessageService) environment.get("messageService");
@@ -51,18 +37,7 @@
}
public void testSendJobAndRollback() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
- "<contexts>" +
- " <environment-factory>" +
- " <object name='queue' class='java.util.concurrent.LinkedBlockingQueue' />" +
- " </environment-factory>" +
- " <environment>" +
- " <transaction name='tx' />" +
- " <object name='messageService' class='"+MemMessageService.class.getName()+"' auto-wire='enabled'/>" +
- // queue gets auto-wired into the message service
- " </environment>" +
- "</contexts>"
- );
+ EnvironmentFactory environmentFactory = getEnvironmentFactory();
MessageImpl<?> message = new MessageImpl<Object>() {
private static final long serialVersionUID = 1L;
@@ -72,6 +47,7 @@
};
Queue<JobImpl<?>> queue = (Queue<JobImpl<?>>) ((PvmEnvironmentFactory)environmentFactory).get("queue");
+ queue.clear();
Environment environment = environmentFactory.openEnvironment();
MemMessageService msgService = (MemMessageService) environment.get("messageService");
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemJobExecutor.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemJobExecutor.java 2008-07-25 13:01:49 UTC (rev 1728)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemJobExecutor.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -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.svc.memory;
-
-import java.util.Queue;
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.log.Log;
-
-
-/**
- * @author Tom Baeyens
- */
-public class MemJobExecutor {
-
- private static final Log log = Log.getLog(MemJobExecutor.class.getName());
-
- Queue<JobImpl<?>> queue;
- EnvironmentFactory environmentFactory;
-
- public void executeAvailableJobs() {
- while (! queue.isEmpty()) {
- JobImpl<?> job = queue.poll();
- if (job!=null) {
- executeJob(job);
- }
- }
- }
-
- protected void executeJob(JobImpl<?> job) {
- Environment environment = environmentFactory.openEnvironment();
- try {
- log.trace("processing jobImpl "+job);
- job.execute(environment);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- environment.close();
- }
- }
-
- public void startExecutingJobs() {
- }
-
- public void stopExecutingJobs() {
- }
-}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemMessageService.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemMessageService.java 2008-07-25 13:01:49 UTC (rev 1728)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/svc/memory/MemMessageService.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -1,73 +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.svc.memory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Queue;
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.log.Log;
-import org.jbpm.pvm.internal.tx.Resource;
-import org.jbpm.pvm.session.MessageSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class MemMessageService implements MessageSession, Resource {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(MemMessageService.class.getName());
-
- Environment environment; // injected
- Queue<JobImpl<?>> queue = null;
- List<JobImpl<?>> producedMessages = null;
-
- public void send(MessageImpl<?> message) {
- log.trace("adding message "+message);
- if (producedMessages==null) {
- producedMessages = new ArrayList<JobImpl<?>>();
- }
- producedMessages.add(message);
- }
-
- public void prepare() {
- }
-
- public void commit() {
- if (producedMessages!=null) {
- queue.addAll(producedMessages);
- }
- }
-
- public void rollback() {
- producedMessages = null;
- }
-
- public void close() {
- }
-
- public void flush() {
- }
-}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/wire/ConcurrentWiringTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/wire/ConcurrentWiringTest.java 2008-07-25 13:01:49 UTC (rev 1728)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/wire/ConcurrentWiringTest.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -116,7 +116,15 @@
}
for (Thread collector: collectors) {
- collector.join();
+ boolean isJoined = false;
+ while (collector.isAlive() && !isJoined) {
+ try {
+ collector.join();
+ isJoined = true;
+ } catch (InterruptedException e) {
+ log.info("ignoring interrupted exception while joining "+collector);
+ }
+ }
}
Object a = wireContext.get("a");
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/wire/WireTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/wire/WireTests.java 2008-07-25 13:01:49 UTC (rev 1728)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/wire/WireTests.java 2008-07-25 13:32:48 UTC (rev 1729)
@@ -33,27 +33,27 @@
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.jbpm.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(EagerInitTest.class);
suite.addTestSuite(ContextTest.class);
+ suite.addTestSuite(DelayedInitTest.class);
suite.addTestSuite(DependencyTest.class);
- suite.addTestSuite(BasicTypeWireTest.class);
+ suite.addTestSuite(EagerInitTest.class);
+ suite.addTestSuite(EnvWireTest.class);
suite.addTestSuite(HibernateSessionFactoryWireTest.class);
- suite.addTestSuite(SetWireTest.class);
- suite.addTestSuite(ObjectWireTest.class);
- suite.addTestSuite(TypeLookupTest.class);
+ suite.addTestSuite(ListWireTest.class);
+ suite.addTestSuite(MapWireTest.class);
suite.addTestSuite(MethodSubscriptionTest.class);
suite.addTestSuite(RefWireTest.class);
- suite.addTestSuite(AutoWireTest.class);
- suite.addTestSuite(ClassWireTest.class);
- suite.addTestSuite(EnvWireTest.class);
- suite.addTestSuite(ConcurrentWiringTest.class);
+ suite.addTestSuite(ObjectSubscriptionTest.class);
+ suite.addTestSuite(ObjectWireTest.class);
suite.addTestSuite(PropertiesWireTest.class);
- suite.addTestSuite(MapWireTest.class);
- suite.addTestSuite(ObjectSubscriptionTest.class);
+ suite.addTestSuite(SetWireTest.class);
+ suite.addTestSuite(TypeLookupTest.class);
suite.addTestSuite(WireEventsSubscriptionTest.class);
- suite.addTestSuite(ListWireTest.class);
- suite.addTestSuite(DelayedInitTest.class);
//$JUnit-END$
return suite;
}
Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/enterprise (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/enterprise)
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/enterprise
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/enterprise/custom/Phrase.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/enterprise/custom/Phrase.hbm.xml 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/enterprise/custom/Phrase.hbm.xml 2008-07-25 13:32:48 UTC (rev 1729)
@@ -2,7 +2,7 @@
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-access="field" auto-import="false">
- <class name="org.jbpm.enterprise.custom.Phrase" table="TEST_PHRASE">
+ <class name="org.jbpm.pvm.enterprise.custom.Phrase" table="TEST_PHRASE">
<id name="id" column="ID_">
<generator class="native" />
</id>
Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor (from rev 1726, jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/jobexecutor)
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/environment.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/jobexecutor/environment.cfg.xml 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/environment.cfg.xml 2008-07-25 13:32:48 UTC (rev 1729)
@@ -12,7 +12,7 @@
<hibernate-configuration>
<properties resource="hibernate.properties" />
<mappings resource="org/jbpm/pvm/pvm.hibernate.mappings.xml" />
- <mapping resource="org/jbpm/jobexecutor/mappings.hbm.xml" />
+ <mapping resource="org/jbpm/pvm/jobexecutor/mappings.hbm.xml" />
<cache-configuration resource="org/jbpm/pvm/pvm.cache.xml" usage="nonstrict-read-write" />
</hibernate-configuration>
Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/mappings.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/jobexecutor/mappings.hbm.xml 2008-07-25 12:29:12 UTC (rev 1726)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/jobexecutor/mappings.hbm.xml 2008-07-25 13:32:48 UTC (rev 1729)
@@ -4,7 +4,7 @@
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<hibernate-mapping package="org.jbpm.jobexecutor" default-access="field">
+<hibernate-mapping package="org.jbpm.pvm.jobexecutor" default-access="field">
<subclass name="TestMessage" extends="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="T">
<property name="messageId" />
Added: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/msg/environment.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/msg/environment.cfg.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/msg/environment.cfg.xml 2008-07-25 13:32:48 UTC (rev 1729)
@@ -0,0 +1,11 @@
+<contexts>
+ <environment-factory>
+ <object name="queue" class="java.util.concurrent.LinkedBlockingQueue" />
+ </environment-factory>
+ <environment>
+ <transaction name="tx" />
+ <object name="messageService" class="org.jbpm.pvm.msg.MemMessageService" auto-wire="enabled">
+ <enlist transaction="tx"/>
+ </object>
+ </environment>
+</contexts>
More information about the jbpm-commits
mailing list