use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class EventSubProcessStartConditionalEventTest method testSuspendedProcess.
@Test
public void testSuspendedProcess() {
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask(TASK_WITH_CONDITION_ID).endEvent().done();
deployConditionalEventSubProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, true);
// given suspended process
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
runtimeService.suspendProcessInstanceById(procInst.getId());
// when wrong variable is set
runtimeService.setVariable(procInst.getId(), VARIABLE_NAME + 1, 1);
// then nothing happens
assertTrue(runtimeService.createProcessInstanceQuery().singleResult().isSuspended());
// then exception is expected
try {
runtimeService.setVariable(procInst.getId(), VARIABLE_NAME, 1);
fail("Should fail!");
} catch (SuspendedEntityInteractionException seie) {
// expected
}
runtimeService.activateProcessInstanceById(procInst.getId());
tasksAfterVariableIsSet = taskService.createTaskQuery().list();
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class EventSubProcessStartConditionalEventTest method testNonInterruptingConditionalSuspendedProcess.
@Test
public void testNonInterruptingConditionalSuspendedProcess() {
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask(TASK_WITH_CONDITION_ID).endEvent().done();
deployConditionalEventSubProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, false);
// given suspended process
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
runtimeService.suspendProcessInstanceById(procInst.getId());
// when wrong variable is set
runtimeService.setVariable(procInst.getId(), VARIABLE_NAME + 1, 1);
// then nothing happens
assertTrue(runtimeService.createProcessInstanceQuery().singleResult().isSuspended());
// then exception is expected
try {
runtimeService.setVariable(procInst.getId(), VARIABLE_NAME, 1);
fail("Should fail!");
} catch (SuspendedEntityInteractionException seie) {
// expected
}
runtimeService.activateProcessInstanceById(procInst.getId());
tasksAfterVariableIsSet = taskService.createTaskQuery().list();
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class IntermediateConditionalEventTest method testSuspendedProcess.
@Test
public void testSuspendedProcess() {
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().intermediateCatchEvent(CONDITIONAL_EVENT).conditionalEventDefinition().condition(CONDITION_EXPR).conditionalEventDefinitionDone().endEvent().done();
engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy());
// given suspended process
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
runtimeService.suspendProcessInstanceById(procInst.getId());
// when wrong variable is set
runtimeService.setVariable(procInst.getId(), VARIABLE_NAME + 1, 1);
// then nothing happens
assertTrue(runtimeService.createProcessInstanceQuery().singleResult().isSuspended());
// then exception is expected
try {
runtimeService.setVariable(procInst.getId(), VARIABLE_NAME, 1);
fail("Should fail!");
} catch (SuspendedEntityInteractionException seie) {
// expected
}
runtimeService.activateProcessInstanceById(procInst.getId());
tasksAfterVariableIsSet = taskService.createTaskQuery().list();
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class BoundaryConditionalEventTest method testNonInterruptingConditionalSuspendedProcess.
@Test
public void testNonInterruptingConditionalSuspendedProcess() {
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask(TASK_WITH_CONDITION_ID).endEvent().done();
deployConditionalBoundaryEventProcess(modelInstance, TASK_WITH_CONDITION_ID, false);
// given suspended process
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
runtimeService.suspendProcessInstanceById(procInst.getId());
// when wrong variable is set
runtimeService.setVariable(procInst.getId(), VARIABLE_NAME + 1, 1);
// then nothing happens
assertTrue(runtimeService.createProcessInstanceQuery().singleResult().isSuspended());
// then exception is expected
try {
runtimeService.setVariable(procInst.getId(), VARIABLE_NAME, 1);
fail("Should fail!");
} catch (SuspendedEntityInteractionException seie) {
// expected
}
runtimeService.activateProcessInstanceById(procInst.getId());
tasksAfterVariableIsSet = taskService.createTaskQuery().list();
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testCallActivityReturnAfterProcessInstanceSuspendByProcessDefinitionId.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/ProcessInstanceSuspensionTest.callSimpleProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/runtime/subProcess.bpmn20.xml" })
public void testCallActivityReturnAfterProcessInstanceSuspendByProcessDefinitionId() {
ProcessInstance instance = runtimeService.startProcessInstanceByKey("callSimpleProcess");
runtimeService.suspendProcessInstanceByProcessDefinitionId(instance.getProcessDefinitionId());
Task task = taskService.createTaskQuery().singleResult();
try {
taskService.complete(task.getId());
fail("this should not be successful, as the execution of a suspended instance is resumed");
} catch (SuspendedEntityInteractionException e) {
// this is expected to fail
}
// should be successful after reactivation
runtimeService.activateProcessInstanceByProcessDefinitionId(instance.getProcessDefinitionId());
taskService.complete(task.getId());
assertEquals(1, runtimeService.createProcessInstanceQuery().count());
}
Aggregations