use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testDeleteNonExistingProcessInstance.
@Test
public void testDeleteNonExistingProcessInstance() {
doThrow(new ProcessEngineException("expected exception")).when(runtimeServiceMock).deleteProcessInstance(anyString(), anyString(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean());
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo("Process instance with id " + MockProvider.EXAMPLE_PROCESS_INSTANCE_ID + " does not exist")).when().delete(SINGLE_PROCESS_INSTANCE_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSuspendProcessInstanceByProcessDefinitionKeyWithException.
@Test
public void testSuspendProcessInstanceByProcessDefinitionKeyWithException() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("suspended", true);
params.put("processDefinitionKey", MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY);
String expectedException = "expectedException";
doThrow(new ProcessEngineException(expectedException)).when(mockUpdateSuspensionStateBuilder).suspend();
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 JobDefinitionRestServiceInteractionTest method testSuspendThrowsProcessEngineException.
@Test
public void testSuspendThrowsProcessEngineException() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("suspended", true);
params.put("includeJobs", false);
String expectedMessage = "expectedMessage";
doThrow(new ProcessEngineException(expectedMessage)).when(mockSuspensionStateBuilder).suspend();
given().pathParam("id", MockProvider.NON_EXISTING_JOB_DEFINITION_ID).contentType(ContentType.JSON).body(params).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(ProcessEngineException.class.getSimpleName())).body("message", is(expectedMessage)).when().put(SINGLE_JOB_DEFINITION_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testSetJobPriorityExceptionExpected.
@Test
public void testSetJobPriorityExceptionExpected() {
String expectedMessage = "expected exception message";
doThrow(new ProcessEngineException(expectedMessage)).when(mockManagementService).setOverridingJobPriorityForJobDefinition(eq(MockProvider.EXAMPLE_JOB_DEFINITION_ID), eq(MockProvider.EXAMPLE_JOB_DEFINITION_PRIORITY), anyBoolean());
Map<String, Object> priorityJson = new HashMap<String, Object>();
priorityJson.put("priority", MockProvider.EXAMPLE_JOB_DEFINITION_PRIORITY);
given().pathParam("id", MockProvider.EXAMPLE_JOB_DEFINITION_ID).contentType(ContentType.JSON).body(priorityJson).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", equalTo(RestException.class.getSimpleName())).body("message", equalTo(expectedMessage)).when().put(JOB_DEFINITION_PRIORITY_URL);
verify(mockManagementService).setOverridingJobPriorityForJobDefinition(MockProvider.EXAMPLE_JOB_DEFINITION_ID, MockProvider.EXAMPLE_JOB_DEFINITION_PRIORITY, false);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testActivateJobDefinitionByProcessDefinitionKeyWithException.
@Test
public void testActivateJobDefinitionByProcessDefinitionKeyWithException() {
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_DEFINITION_SUSPENDED_URL);
}
Aggregations