Index: modules/test-db/src/test/java/org/jbpm/test/activity/foreach/ForEachTest.java =================================================================== --- modules/test-db/src/test/java/org/jbpm/test/activity/foreach/ForEachTest.java (revision 6426) +++ modules/test-db/src/test/java/org/jbpm/test/activity/foreach/ForEachTest.java (working copy) @@ -1,438 +1,495 @@ -/* - * 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.foreach; - -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.jbpm.api.Execution; -import org.jbpm.api.JbpmException; -import org.jbpm.api.ProcessInstance; -import org.jbpm.api.history.HistoryProcessInstance; -import org.jbpm.api.history.HistoryTask; -import org.jbpm.api.task.Task; -import org.jbpm.test.JbpmTestCase; - -/** - * @author Maciej Swiderski - */ -public class ForEachTest extends JbpmTestCase { - - public void testForEachLiteral() { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachLiteral"); - - Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); - assertEquals("task1", taskAlex.getActivityName()); - taskService.completeTask(taskAlex.getId()); - - Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); - assertEquals("task1", taskMike.getActivityName()); - taskService.completeTask(taskMike.getId()); - - processInstance = executionService.findProcessInstanceById(processInstance.getId()); - assertEquals(2, processInstance.getExecutions().size()); - - for (Execution exec : processInstance.getExecutions()) { - assertEquals(Execution.STATE_ACTIVE_CONCURRENT, exec.getState()); - executionService.signalExecutionById(exec.getId()); - } - - HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() - .processInstanceId(processInstance.getId()) - .uniqueResult(); - assertEquals(ProcessInstance.STATE_ENDED, history.getState()); - assertEquals("end1", history.getEndActivityName()); - } - - public void testForEachList() { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - Map variables = Collections.singletonMap("actors", Arrays.asList("alex", "mike")); - ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachList", variables); - - Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); - assertEquals("task1", taskAlex.getActivityName()); - taskService.completeTask(taskAlex.getId()); - - Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); - assertEquals("task1", taskMike.getActivityName()); - taskService.completeTask(taskMike.getId()); - - processInstance = executionService.findProcessInstanceById(processInstance.getId()); - assertEquals(2, processInstance.getExecutions().size()); - - for (Execution exec : processInstance.getExecutions()) { - assertEquals(Execution.STATE_ACTIVE_CONCURRENT, exec.getState()); - executionService.signalExecutionById(exec.getId()); - } - - HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() - .processInstanceId(processInstance.getId()) - .uniqueResult(); - assertEquals(ProcessInstance.STATE_ENDED, history.getState()); - assertEquals("end1", history.getEndActivityName()); - } - - public void testForEachArray() { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - Map variables = Collections.singletonMap("actors", new String[] { "alex", "mike" }); - ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachArray", variables); - - Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); - assertEquals("task1", taskAlex.getActivityName()); - taskService.completeTask(taskAlex.getId()); - - Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); - assertEquals("task1", taskMike.getActivityName()); - taskService.completeTask(taskMike.getId()); - - processInstance = executionService.findProcessInstanceById(processInstance.getId()); - assertEquals(2, processInstance.getExecutions().size()); - - for (Execution exec : processInstance.getExecutions()) { - assertEquals(Execution.STATE_ACTIVE_CONCURRENT, exec.getState()); - executionService.signalExecutionById(exec.getId()); - } - - HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() - .processInstanceId(processInstance.getId()) - .uniqueResult(); - assertEquals(ProcessInstance.STATE_ENDED, history.getState()); - assertEquals("end1", history.getEndActivityName()); - } - - public void testForEachInvalid() { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - Map variables = Collections.singletonMap("actors", new Date()); - try { - executionService.startProcessInstanceByKey("ForEachInvalid", variables); - fail("It should fail, since for-each list of items is a Date object"); - } - catch (JbpmException e) { - // expected result - } - } - - public void testForEachMissingVar() { - try { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - fail("expected foreach with missing variable to fail"); - } - catch (JbpmException e) { - // expected result - e.printStackTrace(); - } - } - - public void testForEachJoinMultiplicity() { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - Map variables = Collections.singletonMap("actors", Arrays.asList("alex", "mike")); - ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachJoinMultiplicity", variables); - - Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); - assertEquals("task1", taskAlex.getActivityName()); - taskService.completeTask(taskAlex.getId()); - - Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); - assertNull(taskMike); - - HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() - .processInstanceId(processInstance.getId()) - .uniqueResult(); - assertEquals(ProcessInstance.STATE_ENDED, history.getState()); - assertEquals("end1", history.getEndActivityName()); - } - - public void testForEachConditionMet() { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachConditionMet"); - - Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); - assertEquals("task1", taskAlex.getActivityName()); - taskService.completeTask(taskAlex.getId()); - - Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); - assertEquals("task1", taskMike.getActivityName()); - taskService.completeTask(taskMike.getId()); - - processInstance = executionService.findProcessInstanceById(processInstance.getId()); - assertEquals(2, processInstance.getExecutions().size()); - - for (Execution exec : processInstance.getExecutions()) { - assertEquals(Execution.STATE_ACTIVE_CONCURRENT, exec.getState()); - executionService.signalExecutionById(exec.getId()); - } - - HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() - .processInstanceId(processInstance.getId()) - .uniqueResult(); - assertEquals(ProcessInstance.STATE_ENDED, history.getState()); - assertEquals("end1", history.getEndActivityName()); - } - - public void testForEachConditionNotMet() { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachConditionNotMet"); - - List tasks = taskService.createTaskQuery().list(); - assertEquals(0, tasks.size()); - - HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() - .processInstanceId(processInstance.getId()) - .uniqueResult(); - assertEquals(ProcessInstance.STATE_ENDED, history.getState()); - } - - public void testForEachNoTransitions() { - try { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - fail("expected deployment failure"); - } - catch (JbpmException e) { - // expected result - } - } - - public void testForEachJoinMultiplicityLeftTask() { - deployJpdlXmlString("" - + "" - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + " " - + ""); - - Map variables = Collections.singletonMap("actors", Arrays.asList("alex", "mike")); - ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachJoinMultiplicity", variables); - - Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); - assertEquals("task1", taskAlex.getActivityName()); - taskService.completeTask(taskAlex.getId()); - - Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); - assertNull(taskMike); - - processInstance = executionService.findProcessInstanceById(processInstance.getId()); - - executionService.signalExecutionById(processInstance.getId()); - - HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() - .processInstanceId(processInstance.getId()) - .uniqueResult(); - assertEquals(ProcessInstance.STATE_ENDED, history.getState()); - assertEquals("end1", history.getEndActivityName()); - - List historyTasks = historyService.createHistoryTaskQuery().assignee("alex").list(); - assertEquals(1, historyTasks.size()); - assertEquals(HistoryTask.STATE_COMPLETED, historyTasks.get(0).getState()); - - historyTasks = historyService.createHistoryTaskQuery().assignee("mike").list(); - assertEquals(1, historyTasks.size()); - assertEquals(HistoryTask.STATE_OBSOLETE, historyTasks.get(0).getState()); - } -} +/* + * 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.foreach; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.jbpm.api.Execution; +import org.jbpm.api.JbpmException; +import org.jbpm.api.ProcessInstance; +import org.jbpm.api.history.HistoryProcessInstance; +import org.jbpm.api.history.HistoryTask; +import org.jbpm.api.task.Task; +import org.jbpm.test.JbpmTestCase; + +/** + * @author Maciej Swiderski + */ +public class ForEachTest extends JbpmTestCase { + + public void testForEachLiteral() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachLiteral"); + + Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); + assertEquals("task1", taskAlex.getActivityName()); + taskService.completeTask(taskAlex.getId()); + + Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); + assertEquals("task1", taskMike.getActivityName()); + taskService.completeTask(taskMike.getId()); + + processInstance = executionService.findProcessInstanceById(processInstance.getId()); + assertEquals(2, processInstance.getExecutions().size()); + + for (Execution exec : processInstance.getExecutions()) { + assertEquals(Execution.STATE_ACTIVE_CONCURRENT, exec.getState()); + executionService.signalExecutionById(exec.getId()); + } + + HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() + .processInstanceId(processInstance.getId()) + .uniqueResult(); + assertEquals(ProcessInstance.STATE_ENDED, history.getState()); + assertEquals("end1", history.getEndActivityName()); + } + + public void testForEachList() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + Map variables = Collections.singletonMap("actors", Arrays.asList("alex", "mike")); + ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachList", variables); + + Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); + assertEquals("task1", taskAlex.getActivityName()); + taskService.completeTask(taskAlex.getId()); + + Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); + assertEquals("task1", taskMike.getActivityName()); + taskService.completeTask(taskMike.getId()); + + processInstance = executionService.findProcessInstanceById(processInstance.getId()); + assertEquals(2, processInstance.getExecutions().size()); + + for (Execution exec : processInstance.getExecutions()) { + assertEquals(Execution.STATE_ACTIVE_CONCURRENT, exec.getState()); + executionService.signalExecutionById(exec.getId()); + } + + HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() + .processInstanceId(processInstance.getId()) + .uniqueResult(); + assertEquals(ProcessInstance.STATE_ENDED, history.getState()); + assertEquals("end1", history.getEndActivityName()); + } + + public void testForEachArray() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + Map variables = Collections.singletonMap("actors", new String[] { "alex", "mike" }); + ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachArray", variables); + + Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); + assertEquals("task1", taskAlex.getActivityName()); + taskService.completeTask(taskAlex.getId()); + + Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); + assertEquals("task1", taskMike.getActivityName()); + taskService.completeTask(taskMike.getId()); + + processInstance = executionService.findProcessInstanceById(processInstance.getId()); + assertEquals(2, processInstance.getExecutions().size()); + + for (Execution exec : processInstance.getExecutions()) { + assertEquals(Execution.STATE_ACTIVE_CONCURRENT, exec.getState()); + executionService.signalExecutionById(exec.getId()); + } + + HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() + .processInstanceId(processInstance.getId()) + .uniqueResult(); + assertEquals(ProcessInstance.STATE_ENDED, history.getState()); + assertEquals("end1", history.getEndActivityName()); + } + + public void testForEachInvalid() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + Map variables = Collections.singletonMap("actors", new Date()); + try { + executionService.startProcessInstanceByKey("ForEachInvalid", variables); + fail("It should fail, since for-each list of items is a Date object"); + } + catch (JbpmException e) { + // expected result + } + } + + public void testForEachMissingVar() { + try { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + fail("expected foreach with missing variable to fail"); + } + catch (JbpmException e) { + // expected result + e.printStackTrace(); + } + } + + public void testForEachJoinMultiplicity() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + Map variables = Collections.singletonMap("actors", Arrays.asList("alex", "mike")); + ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachJoinMultiplicity", variables); + + Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); + assertEquals("task1", taskAlex.getActivityName()); + taskService.completeTask(taskAlex.getId()); + + Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); + assertNull(taskMike); + + HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() + .processInstanceId(processInstance.getId()) + .uniqueResult(); + assertEquals(ProcessInstance.STATE_ENDED, history.getState()); + assertEquals("end1", history.getEndActivityName()); + } + + public void testForEachConditionMet() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachConditionMet"); + + Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); + assertEquals("task1", taskAlex.getActivityName()); + taskService.completeTask(taskAlex.getId()); + + Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); + assertEquals("task1", taskMike.getActivityName()); + taskService.completeTask(taskMike.getId()); + + processInstance = executionService.findProcessInstanceById(processInstance.getId()); + assertEquals(2, processInstance.getExecutions().size()); + + for (Execution exec : processInstance.getExecutions()) { + assertEquals(Execution.STATE_ACTIVE_CONCURRENT, exec.getState()); + executionService.signalExecutionById(exec.getId()); + } + + HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() + .processInstanceId(processInstance.getId()) + .uniqueResult(); + assertEquals(ProcessInstance.STATE_ENDED, history.getState()); + assertEquals("end1", history.getEndActivityName()); + } + + public void testForEachConditionNotMet() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachConditionNotMet"); + + List tasks = taskService.createTaskQuery().list(); + assertEquals(0, tasks.size()); + + HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() + .processInstanceId(processInstance.getId()) + .uniqueResult(); + assertEquals(ProcessInstance.STATE_ENDED, history.getState()); + } + + public void testForEachNoTransitions() { + try { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + fail("expected deployment failure"); + } + catch (JbpmException e) { + // expected result + } + } + + public void testForEachJoinMultiplicityLeftTask() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + Map variables = Collections.singletonMap("actors", Arrays.asList("alex", "mike")); + ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachJoinMultiplicity", variables); + + Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); + assertEquals("task1", taskAlex.getActivityName()); + taskService.completeTask(taskAlex.getId()); + + Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); + assertNull(taskMike); + + processInstance = executionService.findProcessInstanceById(processInstance.getId()); + + executionService.signalExecutionById(processInstance.getId()); + + HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() + .processInstanceId(processInstance.getId()) + .uniqueResult(); + assertEquals(ProcessInstance.STATE_ENDED, history.getState()); + assertEquals("end1", history.getEndActivityName()); + + List historyTasks = historyService.createHistoryTaskQuery().assignee("alex").list(); + assertEquals(1, historyTasks.size()); + assertEquals(HistoryTask.STATE_COMPLETED, historyTasks.get(0).getState()); + + historyTasks = historyService.createHistoryTaskQuery().assignee("mike").list(); + assertEquals(1, historyTasks.size()); + assertEquals(HistoryTask.STATE_OBSOLETE, historyTasks.get(0).getState()); + } + + public void testForEachJoinMultiplicityLeftTasks() { + deployJpdlXmlString("" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""); + + Map variables = Collections.singletonMap("actors", Arrays.asList("alex", "mike", "bob")); + ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEachJoinMultiplicity", variables); + + Task taskAlex = taskService.createTaskQuery().assignee("alex").uniqueResult(); + assertEquals("task1", taskAlex.getActivityName()); + taskService.completeTask(taskAlex.getId()); + + Task taskMike = taskService.createTaskQuery().assignee("mike").uniqueResult(); + assertNull(taskMike); + + Task taskBob = taskService.createTaskQuery().assignee("bob").uniqueResult(); + assertNull(taskMike); + + processInstance = executionService.findProcessInstanceById(processInstance.getId()); + + executionService.signalExecutionById(processInstance.getId()); + + HistoryProcessInstance history = historyService.createHistoryProcessInstanceQuery() + .processInstanceId(processInstance.getId()) + .uniqueResult(); + assertEquals(ProcessInstance.STATE_ENDED, history.getState()); + assertEquals("end1", history.getEndActivityName()); + + List historyTasks = historyService.createHistoryTaskQuery().assignee("alex").list(); + assertEquals(1, historyTasks.size()); + assertEquals(HistoryTask.STATE_COMPLETED, historyTasks.get(0).getState()); + + historyTasks = historyService.createHistoryTaskQuery().assignee("mike").list(); + assertEquals(1, historyTasks.size()); + assertEquals(HistoryTask.STATE_OBSOLETE, historyTasks.get(0).getState()); + + historyTasks = historyService.createHistoryTaskQuery().assignee("bob").list(); + assertEquals(1, historyTasks.size()); + assertEquals(HistoryTask.STATE_OBSOLETE, historyTasks.get(0).getState()); + } +}