use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method testSignalNonExistingExecution.
@Test
public void testSignalNonExistingExecution() {
doThrow(new ProcessEngineException("expected exception")).when(runtimeServiceMock).signal(anyString(), any(Map.class));
given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).contentType(ContentType.JSON).body(EMPTY_JSON_OBJECT).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(RestException.class.getSimpleName())).body("message", equalTo("Cannot signal execution " + MockProvider.EXAMPLE_EXECUTION_ID + ": expected exception")).when().post(SIGNAL_EXECUTION_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method testLocalVariableModificationForNonExistingExecution.
@Test
public void testLocalVariableModificationForNonExistingExecution() {
doThrow(new ProcessEngineException("expected exception")).when(runtimeServiceMock).updateVariablesLocal(anyString(), any(Map.class), any(List.class));
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
String variableKey = "aKey";
int variableValue = 123;
Map<String, Object> modifications = VariablesBuilder.create().variable(variableKey, variableValue).getVariables();
messageBodyJson.put("modifications", modifications);
given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(RestException.class.getSimpleName())).body("message", equalTo("Cannot modify variables for execution " + MockProvider.EXAMPLE_EXECUTION_ID + ": expected exception")).when().post(EXECUTION_LOCAL_VARIABLES_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method testGetLocalVariablesForNonExistingExecution.
@Test
public void testGetLocalVariablesForNonExistingExecution() {
when(runtimeServiceMock.getVariablesLocalTyped(anyString(), eq(true))).thenThrow(new ProcessEngineException("expected exception"));
given().pathParam("id", "aNonExistingExecutionId").then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(ProcessEngineException.class.getSimpleName())).body("message", equalTo("expected exception")).when().get(EXECUTION_LOCAL_VARIABLES_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method testGetLocalVariableForNonExistingExecution.
@Test
public void testGetLocalVariableForNonExistingExecution() {
String variableKey = "aVariableKey";
when(runtimeServiceMock.getVariableLocalTyped(eq(MockProvider.EXAMPLE_EXECUTION_ID), eq(variableKey), eq(true))).thenThrow(new ProcessEngineException("expected exception"));
given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).pathParam("varId", variableKey).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(RestException.class.getSimpleName())).body("message", is("Cannot get execution variable " + variableKey + ": expected exception")).when().get(SINGLE_EXECUTION_LOCAL_VARIABLE_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class CaseDefinitionResourceImpl method getCaseDefinition.
@Override
public CaseDefinitionDto getCaseDefinition() {
RepositoryService repositoryService = engine.getRepositoryService();
CaseDefinition definition = null;
try {
definition = repositoryService.getCaseDefinition(caseDefinitionId);
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e, e.getMessage());
} catch (NotValidException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e);
}
return CaseDefinitionDto.fromCaseDefinition(definition);
}
Aggregations