use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testTaskNonLifecycleOperationsSucceedAfterProcessInstanceSuspendByProcessDefinitionKey.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testTaskNonLifecycleOperationsSucceedAfterProcessInstanceSuspendByProcessDefinitionKey() {
// Start a new process instance with one task
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
final Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
runtimeService.suspendProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
assertNotNull(task);
try {
taskService.setVariable(task.getId(), "someVar", "someValue");
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
try {
taskService.setVariableLocal(task.getId(), "someVar", "someValue");
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
try {
HashMap<String, String> variables = new HashMap<String, String>();
variables.put("varOne", "one");
variables.put("varTwo", "two");
taskService.setVariables(task.getId(), variables);
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
try {
HashMap<String, String> variables = new HashMap<String, String>();
variables.put("varOne", "one");
variables.put("varTwo", "two");
taskService.setVariablesLocal(task.getId(), variables);
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
try {
taskService.removeVariable(task.getId(), "someVar");
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
try {
taskService.removeVariableLocal(task.getId(), "someVar");
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
try {
taskService.removeVariables(task.getId(), Arrays.asList("one", "two"));
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
try {
taskService.removeVariablesLocal(task.getId(), Arrays.asList("one", "two"));
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
if (processEngineConfiguration.getHistoryLevel().getId() > HistoryLevel.HISTORY_LEVEL_ACTIVITY.getId()) {
try {
taskService.createComment(task.getId(), processInstance.getId(), "test comment");
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
try {
taskService.createAttachment("text", task.getId(), processInstance.getId(), "tesTastName", "testDescription", "http://test.com");
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
}
try {
taskService.setPriority(task.getId(), 99);
} catch (SuspendedEntityInteractionException e) {
fail("should be allowed");
}
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testStartAfterActivityForSuspendProcessInstance.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testStartAfterActivityForSuspendProcessInstance() {
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 after activity for suspended processDefinition
try {
runtimeService.createProcessInstanceModification(processInstance.getId()).startAfterActivity("theTask").execute();
fail("Exception is expected but not thrown");
} catch (SuspendedEntityInteractionException e) {
assertTextPresentIgnoreCase("is suspended", e.getMessage());
}
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testMessageEventReceiveFailAfterSuspendByProcessDefinitionId.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/ProcessInstanceSuspensionTest.testMessageEventReceiveFailAfterSuspend.bpmn20.xml" })
public void testMessageEventReceiveFailAfterSuspendByProcessDefinitionId() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
runtimeService.startProcessInstanceById(processDefinition.getId());
runtimeService.suspendProcessInstanceByProcessDefinitionId(processDefinition.getId());
EventSubscription subscription = runtimeService.createEventSubscriptionQuery().singleResult();
try {
runtimeService.messageEventReceived("someMessage", subscription.getExecutionId());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
assertTextPresent("is suspended", e.getMessage());
}
try {
runtimeService.messageEventReceived("someMessage", subscription.getExecutionId(), new HashMap<String, Object>());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
assertTextPresent("is suspended", e.getMessage());
}
}
use of org.camunda.bpm.engine.SuspendedEntityInteractionException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testSubmitTaskFormFailAfterProcessInstanceSuspendByProcessDefinitionKey.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testSubmitTaskFormFailAfterProcessInstanceSuspendByProcessDefinitionKey() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
runtimeService.suspendProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
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 testProcessInstanceSignalFailAfterSuspend.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testProcessInstanceSignalFailAfterSuspend() {
// Suspend process instance
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
runtimeService.suspendProcessInstanceById(processInstance.getId());
try {
runtimeService.signal(processInstance.getId());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
assertTextPresent("is suspended", e.getMessage());
assertTrue(e instanceof BadUserRequestException);
}
try {
runtimeService.signal(processInstance.getId(), new HashMap<String, Object>());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
assertTextPresent("is suspended", e.getMessage());
assertTrue(e instanceof BadUserRequestException);
}
}
Aggregations