use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testProcessInstanceSignalFailAfterSuspendByProcessDefinitionId.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testProcessInstanceSignalFailAfterSuspendByProcessDefinitionId() {
// Suspend process instance
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
runtimeService.suspendProcessInstanceByProcessDefinitionId(processDefinition.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);
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceAsyncTest method restartProcessInstanceWithoutInstructions.
@Test
public void restartProcessInstanceWithoutInstructions() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ProcessModels.TWO_TASKS_PROCESS);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");
try {
Batch batch = runtimeService.restartProcessInstances(processDefinition.getId()).processInstanceIds(processInstance.getId()).executeAsync();
helper.completeBatch(batch);
fail("exception expected");
} catch (BadUserRequestException e) {
Assert.assertThat(e.getMessage(), containsString("instructions is empty"));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceSyncTest method restartNotExistingProcessInstance.
@Test
public void restartNotExistingProcessInstance() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
try {
runtimeService.restartProcessInstances(processDefinition.getId()).startBeforeActivity("bar").processInstanceIds("aaa").execute();
fail("exception expected");
} catch (BadUserRequestException e) {
Assert.assertThat(e.getMessage(), containsString("Historic process instance cannot be found"));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceSyncTest method restartProcessInstanceWithNullProcessInstanceId.
@Test
public void restartProcessInstanceWithNullProcessInstanceId() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
try {
runtimeService.restartProcessInstances(processDefinition.getId()).startAfterActivity("bar").processInstanceIds((String) null).execute();
fail("exception expected");
} catch (BadUserRequestException e) {
Assert.assertThat(e.getMessage(), containsString("Process instance ids cannot be null"));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMigrateNonExistingTargetDefinition.
@Test
public void testMigrateNonExistingTargetDefinition() {
ProcessDefinition processDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
try {
runtimeService.createMigrationPlan(processDefinition.getId(), "aNonExistingProcDefId").mapActivities("userTask", "userTask").build();
fail("Should not succeed");
} catch (BadUserRequestException e) {
assertExceptionMessage(e, "Target process definition with id 'aNonExistingProcDefId' does not exist");
}
}
Aggregations