use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testCallActivityReturnAfterProcessInstanceSuspendByProcessDefinitionKey.
@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 testCallActivityReturnAfterProcessInstanceSuspendByProcessDefinitionKey() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("callSimpleProcess").singleResult();
runtimeService.startProcessInstanceByKey("callSimpleProcess");
runtimeService.suspendProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
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.activateProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
taskService.complete(task.getId());
assertEquals(1, runtimeService.createProcessInstanceQuery().count());
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testSubmitTaskFormFailAfterProcessInstanceSuspend.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testSubmitTaskFormFailAfterProcessInstanceSuspend() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
runtimeService.suspendProcessInstanceById(processInstance.getId());
try {
formService.submitTaskFormData(taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult().getId(), new HashMap<String, String>());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
}
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testSubTaskCreationFailAfterProcessInstanceSuspendByProcessDefinitionKey.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testSubTaskCreationFailAfterProcessInstanceSuspendByProcessDefinitionKey() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
final Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
runtimeService.suspendProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
Task subTask = taskService.newTask("someTaskId");
subTask.setParentTaskId(task.getId());
try {
taskService.saveTask(subTask);
fail("Creating sub tasks for suspended task should not be possible");
} catch (SuspendedEntityInteractionException e) {
}
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testStartBeforeActivityForSuspendProcessInstance.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testStartBeforeActivityForSuspendProcessInstance() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
// start process instance
runtimeService.startProcessInstanceById(processDefinition.getId());
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult();
// Suspend process instance
runtimeService.suspendProcessInstanceById(processInstance.getId());
// try to start before activity for suspended processDefinition
try {
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("theTask").execute();
fail("Exception is expected but not thrown");
} catch (SuspendedEntityInteractionException e) {
assertTextPresentIgnoreCase("is suspended", e.getMessage());
}
}
Aggregations