public virtual void testBatchActivationByHistoricProcessInstanceQuery() { // given ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess"); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("twoExternalTaskProcess"); // when Batch suspendprocess = runtimeService.updateProcessInstanceSuspensionState().byHistoricProcessInstanceQuery(historyService.createHistoricProcessInstanceQuery().processInstanceIds(Sets.newHashSet(processInstance1.Id, processInstance2.Id))).suspendAsync(); helper.executeSeedJob(suspendprocess); helper.executeJobs(suspendprocess); Batch activateprocess = runtimeService.updateProcessInstanceSuspensionState().byHistoricProcessInstanceQuery(historyService.createHistoricProcessInstanceQuery().processInstanceIds(Sets.newHashSet(processInstance1.Id, processInstance2.Id))).activateAsync(); helper.executeSeedJob(activateprocess); helper.executeJobs(activateprocess); // then ProcessInstance p1c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance1.Id).singleResult(); assertFalse(p1c.Suspended); ProcessInstance p2c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance2.Id).singleResult(); assertFalse(p2c.Suspended); }
public virtual void testBatchActivatationByHistoricProcessInstanceQuery() { // given ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess"); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("twoExternalTaskProcess"); // when the process instances are suspended runtimeService.updateProcessInstanceSuspensionState().byHistoricProcessInstanceQuery(historyService.createHistoricProcessInstanceQuery().processInstanceIds(Sets.newHashSet(processInstance1.Id, processInstance2.Id))).suspend(); // when they are activated again runtimeService.updateProcessInstanceSuspensionState().byHistoricProcessInstanceQuery(historyService.createHistoricProcessInstanceQuery().processInstanceIds(Sets.newHashSet(processInstance1.Id, processInstance2.Id))).activate(); // Update the process instances and they are active again ProcessInstance p1c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance1.Id).singleResult(); assertFalse(p1c.Suspended); ProcessInstance p2c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance2.Id).singleResult(); assertFalse(p2c.Suspended); }