[jbpm-commits] JBoss JBPM SVN: r5647 - jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Sep 16 07:24:17 EDT 2009
Author: jbarrez
Date: 2009-09-16 07:24:16 -0400 (Wed, 16 Sep 2009)
New Revision: 5647
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TaskTimerTaskTest.java
Log:
Added testcase for JBPM-2537
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TaskTimerTaskTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TaskTimerTaskTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TaskTimerTaskTest.java 2009-09-16 11:24:16 UTC (rev 5647)
@@ -0,0 +1,90 @@
+/*
+ * 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.test.timer;
+
+import java.util.List;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Joram Barrez
+ */
+public class TaskTimerTaskTest extends JbpmTestCase {
+
+ // Test case for JBPM-2537
+ public void testTaskClosedWhenTimerFires() {
+ deployJpdlXmlString(
+ "<process name='test1' xmlns='http://jbpm.org/4.0/jpdl'>" +
+ " <start g='-9,192,48,48' name='start1'>" +
+ " <transition g='-44,-18' name='to task3' to='task3' />" +
+ " </start>" +
+ " <task g='272,189,92,52' name='task1'>" +
+ " <transition g='-42,-18' name='to end1' to='end1' />" +
+ " <transition g='-45,-18' name='to wait' to='waitHere'>" +
+ " <timer duedate='10 seconds' />" +
+ " </transition>" +
+ " </task>" +
+ " <task g='454,316,92,52' name='task2'>" +
+ " <transition g='-42,-18' name='to end2' to='end2' />" +
+ " </task>" +
+ " <task g='113,189,92,52' name='task3'>" +
+ " <transition g='-44,-18' to='task1' name='to end1' />" +
+ " </task>" +
+ " <state name='waitHere'>" +
+ " <transition to='end1' />" +
+ " </state>" +
+ " <end g='490,192,48,48' name='end1' />" +
+ " <end g='626,319,48,48' name='end2' />" +
+ "</process>");
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("test1");
+
+ Task currentTask = taskService.createTaskQuery().uniqueResult();
+ assertEquals("task3", currentTask.getName());
+ taskService.completeTask(currentTask.getId());
+
+ currentTask = taskService.createTaskQuery().uniqueResult();
+ assertEquals("task1", currentTask.getName());
+
+ Job timeout = managementService.createJobQuery().timers().uniqueResult();
+ managementService.executeJob(timeout.getId());
+
+ assertActivityActive(processInstance.getId(), "waitHere");
+
+ // Task1 should be completed now
+ List<Task> currentTasks = taskService.createTaskQuery().list();
+
+ // TODO: Uncomment when fixing issue!
+ // assertTrue("Error: there are still tasks active: "
+ // + listAllOpenTasks(processInstance.getId()), currentTasks.isEmpty());
+
+ }
+
+
+}
More information about the jbpm-commits
mailing list