use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testActivateJobByProcessDefinitionKeyWithException.
@Test
public void testActivateJobByProcessDefinitionKeyWithException() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("suspended", false);
params.put("processDefinitionKey", MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY);
String expectedException = "expectedException";
doThrow(new ProcessEngineException(expectedException)).when(mockSuspensionStateBuilder).activate();
given().contentType(ContentType.JSON).body(params).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(ProcessEngineException.class.getSimpleName())).body("message", is(expectedException)).when().put(JOB_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class MessageRestServiceTest method testFailingInstantiation.
@Test
public void testFailingInstantiation() {
String messageName = "aMessage";
// thrown, if instantiation of the process or signalling the instance fails
doThrow(new ProcessEngineException("Expected exception")).when(messageCorrelationBuilderMock).correlateWithResult();
Map<String, Object> messageParameters = new HashMap<String, Object>();
messageParameters.put("messageName", messageName);
given().contentType(POST_JSON_CONTENT_TYPE).body(messageParameters).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(ProcessEngineException.class.getSimpleName())).body("message", equalTo("Expected exception")).when().post(MESSAGE_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testActivateThrowsProcessEngineException.
@Test
public void testActivateThrowsProcessEngineException() {
ProcessInstanceSuspensionStateDto dto = new ProcessInstanceSuspensionStateDto();
dto.setSuspended(false);
String expectedMessage = "expectedMessage";
doThrow(new ProcessEngineException(expectedMessage)).when(mockUpdateSuspensionStateBuilder).activate();
given().pathParam("id", MockProvider.EXAMPLE_NON_EXISTENT_PROCESS_INSTANCE_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(ProcessEngineException.class.getSimpleName())).body("message", is(expectedMessage)).when().put(SINGLE_PROCESS_INSTANCE_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testActivateProcessInstanceByProcessDefinitionIdWithException.
@Test
public void testActivateProcessInstanceByProcessDefinitionIdWithException() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("suspended", false);
params.put("processDefinitionId", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID);
String expectedException = "expectedException";
doThrow(new ProcessEngineException(expectedException)).when(mockUpdateSuspensionStateBuilder).activate();
given().contentType(ContentType.JSON).body(params).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(ProcessEngineException.class.getSimpleName())).body("message", is(expectedException)).when().put(PROCESS_INSTANCE_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testGetActivityInstanceTreeWithInternalError.
@Test
public void testGetActivityInstanceTreeWithInternalError() {
when(runtimeServiceMock.getActivityInstance(anyString())).thenThrow(new ProcessEngineException("expected exception"));
given().pathParam("id", "aNonExistingProcessInstanceId").then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo("expected exception")).when().get(PROCESS_INSTANCE_ACTIVIY_INSTANCES_URL);
}
Aggregations