Index: modules/test-db/src/test/java/org/jbpm/test/activity/task/ForkSwimlaneTest.java =================================================================== --- modules/test-db/src/test/java/org/jbpm/test/activity/task/ForkSwimlaneTest.java (revision 0) +++ modules/test-db/src/test/java/org/jbpm/test/activity/task/ForkSwimlaneTest.java (revision 0) @@ -0,0 +1,110 @@ +/* + * 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.activity.task; + +import java.util.List; +import org.jbpm.api.ProcessInstance; +import org.jbpm.api.cmd.Command; +import org.jbpm.api.cmd.Environment; +import org.jbpm.api.task.Task; + +import org.jbpm.pvm.internal.history.HistoryEvent; +import org.jbpm.pvm.internal.history.events.VariableCreate; +import org.jbpm.pvm.internal.model.ExecutionImpl; +import org.jbpm.pvm.internal.repository.RepositoryCache; +import org.jbpm.pvm.internal.task.TaskImpl; +import org.jbpm.pvm.internal.type.Variable; +import org.jbpm.api.task.Task; +import org.jbpm.test.JbpmTestCase; + + +public class ForkSwimlaneTest extends JbpmTestCase { + private static final String PROCESS_XML = "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""; + + protected void setUp() throws Exception { + super.setUp(); + + String groupA = identityService.createGroup("A"); + String groupB = identityService.createGroup("B"); + + identityService.createUser("lingo", "lingo", "lingo"); + identityService.createMembership("lingo", groupA, "lingo-groupA"); + identityService.createMembership("lingo", groupB, "lingo-groupB"); + this.deployJpdlXmlString(PROCESS_XML); + } + + protected void tearDown() throws Exception { + identityService.deleteGroup("A"); + identityService.deleteGroup("B"); + identityService.deleteUser("lingo"); + super.tearDown(); + } + + public void testSwimlane() { + ProcessInstance processInstance = executionService + .startProcessInstanceByKey("ForkSwimlane"); + takeAndCompleteTask("lingo"); + takeAndCompleteTask("lingo"); + completeTask("lingo"); + completeTask("lingo"); + } + + protected void takeAndCompleteTask(String username) { + List tasks = taskService.findGroupTasks(username); + Task task = tasks.get(0); + taskService.takeTask(task.getId(), username); + taskService.completeTask(task.getId()); + } + + protected void completeTask(String username) { + List tasks = taskService.findPersonalTasks(username); + Task task = tasks.get(0); + taskService.completeTask(task.getId()); + } +}