[jbpm-commits] JBoss JBPM SVN: r6211 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src: test/java/org/jbpm and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Mar 5 03:17:31 EST 2010
Author: mputz
Date: 2010-03-05 03:17:30 -0500 (Fri, 05 Mar 2010)
New Revision: 6211
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2812/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2812/JBPM2812Test.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/Timer.java
Log:
Fix for JBPM-2812: Timer does not take leaving transition defined at super-state
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/Timer.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/Timer.java 2010-03-05 04:26:40 UTC (rev 6210)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/Timer.java 2010-03-05 08:17:30 UTC (rev 6211)
@@ -85,7 +85,7 @@
// and if no unhandled exception occurred during the action
if (transitionName != null && exception == null) {
Node node = token.getNode();
- if (node.hasLeavingTransition(transitionName)) {
+ if (node.getLeavingTransition(transitionName)!=null) {
token.signal(transitionName);
}
else {
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2812/JBPM2812Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2812/JBPM2812Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2812/JBPM2812Test.java 2010-03-05 08:17:30 UTC (rev 6211)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jbpm2812;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * Test to verify timer execution inside a super-state
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2812">JBPM-2812</a>
+ * @author Martin Putz
+ */
+public class JBPM2812Test extends AbstractDbTestCase {
+
+ public void testTimerWithSuperState() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
+ "<process-definition name='jbpm2812'>" +
+ " <start-state name='start'>" +
+ " <transition to='super-state/state1'/>" +
+ " </start-state>" +
+ " <super-state name='super-state'>" +
+ " <state name='state1'>" +
+ " <timer duedate='3 seconds' name='timeout-timer' transition='timeout'/>" +
+ " <transition to='state2' name='go'/>" +
+ " </state>" +
+ " <state name='state2'>" +
+ " <transition to='end' name='go'/>" +
+ " </state>" +
+ " <transition to='timed-out-end' name='timeout'/>" +
+ " </super-state>" +
+ " <end-state name='timed-out-end'/>" +
+ " <end-state name='end'/>" +
+ "</process-definition>"
+ );
+
+ processDefinition = saveAndReload(processDefinition);
+ try
+ {
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ // long before = System.currentTimeMillis();
+ processInstance.signal();
+ assertEquals("state1", processInstance.getRootToken().getNode().getName());
+
+ processJobs(60 * 1000);
+
+ processInstance = jbpmContext.loadProcessInstance(processInstance.getId());
+ assertTrue("expected " + processInstance + " to have ended", processInstance.hasEnded());
+ assertEquals("timed-out-end", processInstance.getRootToken().getNode().getName());
+ }
+ finally
+ {
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ }
+
+ }
+
+}
More information about the jbpm-commits
mailing list