use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testSuspendJobDefinitionByProcessDefinitionIdWithException.
@Test
public void testSuspendJobDefinitionByProcessDefinitionIdWithException() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("suspended", true);
params.put("processDefinitionId", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID);
String expectedException = "expectedException";
doThrow(new ProcessEngineException(expectedException)).when(mockSuspensionStateBuilder).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(JOB_DEFINITION_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testActivateJobDefinitionByProcessDefinitionIdWithException.
@Test
public void testActivateJobDefinitionByProcessDefinitionIdWithException() {
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(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);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testExecuteJobIdDoesntExist.
@Test
public void testExecuteJobIdDoesntExist() {
String jobId = MockProvider.NON_EXISTING_JOB_ID;
String expectedMessage = "No job found with id '" + jobId + "'";
doThrow(new ProcessEngineException(expectedMessage)).when(mockManagementService).executeJob(MockProvider.NON_EXISTING_JOB_ID);
given().pathParam("id", jobId).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo(expectedMessage)).when().post(JOB_RESOURCE_EXECUTE_JOB_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testSetJobRetriesNonExistentJob.
@Test
public void testSetJobRetriesNonExistentJob() {
String expectedMessage = "No job found with id '" + MockProvider.NON_EXISTING_JOB_ID + "'.";
doThrow(new ProcessEngineException(expectedMessage)).when(mockManagementService).setJobRetries(MockProvider.NON_EXISTING_JOB_ID, MockProvider.EXAMPLE_JOB_RETRIES);
Map<String, Object> retriesVariableJson = new HashMap<String, Object>();
retriesVariableJson.put("retries", MockProvider.EXAMPLE_JOB_RETRIES);
given().pathParam("id", MockProvider.NON_EXISTING_JOB_ID).contentType(ContentType.JSON).body(retriesVariableJson).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo(expectedMessage)).when().put(JOB_RESOURCE_SET_RETRIES_URL);
verify(mockManagementService).setJobRetries(MockProvider.NON_EXISTING_JOB_ID, MockProvider.EXAMPLE_JOB_RETRIES);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testActivateThrowsProcessEngineException.
@Test
public void testActivateThrowsProcessEngineException() {
JobSuspensionStateDto dto = new JobSuspensionStateDto();
dto.setSuspended(false);
String expectedMessage = "expectedMessage";
doThrow(new ProcessEngineException(expectedMessage)).when(mockSuspensionStateBuilder).activate();
given().pathParam("id", MockProvider.NON_EXISTING_JOB_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_JOB_SUSPENDED_URL);
}
Aggregations