@Test public void testCompletingSuspendedJobDuringRunningInstance() { testRule.deploy(Bpmn.createExecutableProcess("process") .startEvent() .receiveTask() .intermediateCatchEvent() .timerWithDuration("PT0M") .endEvent() .done()); // given // a process definition ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); // a running instance ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId()); // suspend the process definition (and the job definitions) repositoryService.suspendProcessDefinitionById(processDefinition.getId()); // assert that there still exists a running and active process instance assertEquals(1, runtimeService.createProcessInstanceQuery().active().count()); // when runtimeService.signal(processInstance.getId()); // then // there should be one suspended job assertEquals(1, managementService.createJobQuery().suspended().count()); assertEquals(0, managementService.createJobQuery().active().count()); assertEquals(1, runtimeService.createProcessInstanceQuery().active().count()); }
@Test public void testCompletingSuspendedJobDuringRunningInstance() { testRule.deploy(Bpmn.createExecutableProcess("process") .startEvent() .receiveTask() .intermediateCatchEvent() .timerWithDuration("PT0M") .endEvent() .done()); // given // a process definition ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); // a running instance ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId()); // suspend the process definition (and the job definitions) repositoryService.suspendProcessDefinitionById(processDefinition.getId()); // assert that there still exists a running and active process instance assertEquals(1, runtimeService.createProcessInstanceQuery().active().count()); // when runtimeService.signal(processInstance.getId()); // then // there should be one suspended job assertEquals(1, managementService.createJobQuery().suspended().count()); assertEquals(0, managementService.createJobQuery().active().count()); assertEquals(1, runtimeService.createProcessInstanceQuery().active().count()); }