As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<br> public void testCompleteWithTaskLocalParameters() {<br> ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testTaskLocalVars");<br><br> // Fetch first task<br> Task task = taskService.createTaskQuery().singleResult();<br><br> // Complete first task<br> Map<String, Object> taskParams = new HashMap<String, Object>();<br> taskParams.put("a", 1);<br> taskParams.put("b", 1);<br> taskService.complete(task.getId(), taskParams, true);<br> <br> // Verify vars are not stored process instance wide<br> assertNull(runtimeService.getVariable(processInstance.getId(), "a"));<br> assertNull(runtimeService.getVariable(processInstance.getId(), "b"));<br> <br> // verify script listener has done its job<br> assertEquals(new Integer(2), runtimeService.getVariable(processInstance.getId(), "sum"));<br><br> // Fetch second task<br> taskService.createTaskQuery().singleResult();<br><br> }<br>
<br> @Deployment(resources = { <br> "org/activiti/engine/test/api/twoTasksProcess.bpmn20.xml" })<br> public void testCompleteWithParametersTask() {<br> ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoTasksProcess");<br><br> // Fetch first task<br> Task task = taskService.createTaskQuery().singleResult();<br> assertEquals("First task", task.getName());<br><br> // Complete first task<br> Map<String, Object> taskParams = new HashMap<String, Object>();<br> taskParams.put("myParam", "myValue");<br> taskService.complete(task.getId(), taskParams);<br><br> // Fetch second task<br> task = taskService.createTaskQuery().singleResult();<br> assertEquals("Second task", task.getName());<br><br> // Verify task parameters set on execution<br> Map<String, Object> variables = runtimeService.getVariables(processInstance.getId());<br> assertEquals(1, variables.size());<br> assertEquals("myValue", variables.get("myParam"));<br> }<br>