use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceSuspensionStateDto 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.rest.dto.runtime.ProcessInstanceSuspensionStateDto in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testActivateThrowsAuthorizationException.
@Test
public void testActivateThrowsAuthorizationException() {
ProcessInstanceSuspensionStateDto dto = new ProcessInstanceSuspensionStateDto();
dto.setSuspended(false);
String message = "expectedMessage";
doThrow(new AuthorizationException(message)).when(mockUpdateSuspensionStateBuilder).activate();
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().put(SINGLE_PROCESS_INSTANCE_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceSuspensionStateDto in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testActivateInstance.
@Test
public void testActivateInstance() {
ProcessInstanceSuspensionStateDto dto = new ProcessInstanceSuspensionStateDto();
dto.setSuspended(false);
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(SINGLE_PROCESS_INSTANCE_SUSPENDED_URL);
verify(mockUpdateSuspensionStateSelectBuilder).byProcessInstanceId(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
verify(mockUpdateSuspensionStateBuilder).activate();
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceSuspensionStateDto in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSuspendThrowsAuthorizationException.
@Test
public void testSuspendThrowsAuthorizationException() {
ProcessInstanceSuspensionStateDto dto = new ProcessInstanceSuspensionStateDto();
dto.setSuspended(true);
String message = "expectedMessage";
doThrow(new AuthorizationException(message)).when(mockUpdateSuspensionStateBuilder).suspend();
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().put(SINGLE_PROCESS_INSTANCE_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceSuspensionStateDto in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSuspendInstance.
@Test
public void testSuspendInstance() {
ProcessInstanceSuspensionStateDto dto = new ProcessInstanceSuspensionStateDto();
dto.setSuspended(true);
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(SINGLE_PROCESS_INSTANCE_SUSPENDED_URL);
verify(mockUpdateSuspensionStateSelectBuilder).byProcessInstanceId(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
verify(mockUpdateSuspensionStateBuilder).suspend();
}
Aggregations