01-15-2014 11:36 PM
runtimeService.suspendProcessInstanceById(processInstanceId);
runtimeService.activateProcessInstanceById(processInstanceId);
ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).signalEventSubscriptionName(signalName);
if (executionQuery != null) {
Execution execution = executionQuery.singleResult();
runtimeService.signalEventReceived(eventSignal, execution.getId());
}
01-16-2014 02:26 AM
@Deployment(resources = "org/activiti/engine/test/api/runtime/ProcessInstanceSuspensionTest.testSignalEventReceivedAfterProcessInstanceSuspended.bpmn20.xml")
public void testSignalEventReceivedAfterMultipleProcessInstancesSuspended() {
final String signal = "Some Signal";
// Test if process instance can be completed using the signal
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalSuspendedProcessInstance");
runtimeService.startProcessInstanceByKey("signalSuspendedProcessInstance");
runtimeService.signalEventReceived(signal);
assertEquals(0, runtimeService.createProcessInstanceQuery().count());
// Now test when suspending the process instance: the process instance shouldn't be continued
processInstance = runtimeService.startProcessInstanceByKey("signalSuspendedProcessInstance");
runtimeService.suspendProcessInstanceById(processInstance.getId());
processInstance = runtimeService.startProcessInstanceByKey("signalSuspendedProcessInstance");
runtimeService.suspendProcessInstanceById(processInstance.getId());
runtimeService.signalEventReceived(signal);
assertEquals(2, runtimeService.createProcessInstanceQuery().count());
runtimeService.signalEventReceived(signal, new HashMap<String, Object>());
assertEquals(2, runtimeService.createProcessInstanceQuery().count());
// Activate and try again
runtimeService.activateProcessInstanceById(processInstance.getId());
runtimeService.signalEventReceived(signal);
assertEquals(1, runtimeService.createProcessInstanceQuery().count());
}
01-16-2014 03:26 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.