use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method testDeleteLocalVariableThrowsAuthorizationException.
@Test
public void testDeleteLocalVariableThrowsAuthorizationException() {
String variableKey = "aVariableKey";
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(runtimeServiceMock).removeVariableLocal(anyString(), anyString());
given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).pathParam("varId", variableKey).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(message)).when().delete(SINGLE_EXECUTION_LOCAL_VARIABLE_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testSetRetriesThrowsAuthorizationException.
@Test
public void testSetRetriesThrowsAuthorizationException() {
doThrow(new AuthorizationException("aMessage")).when(externalTaskService).setRetries(any(String.class), anyInt());
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("retries", "5");
given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).pathParam("id", "anExternalTaskId").then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo("aMessage")).when().put(RETRIES_EXTERNAL_TASK_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testUnlockThrowsAuthorizationException.
@Test
public void testUnlockThrowsAuthorizationException() {
doThrow(new AuthorizationException("aMessage")).when(externalTaskService).unlock(any(String.class));
given().pathParam("id", "anExternalTaskId").then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo("aMessage")).when().post(UNLOCK_EXTERNAL_TASK_URL);
verify(externalTaskService).unlock("anExternalTaskId");
verifyNoMoreInteractions(externalTaskService);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testHandleBpmnErrorThrowsAuthorizationException.
@Test
public void testHandleBpmnErrorThrowsAuthorizationException() {
doThrow(new AuthorizationException("aMessage")).when(externalTaskService).handleBpmnError(any(String.class), any(String.class), any(String.class));
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("workerId", "aWorkerId");
parameters.put("errorCode", "errorCode");
given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).pathParam("id", "anExternalTaskId").then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo("aMessage")).when().post(HANDLE_EXTERNAL_TASK_BPMN_ERROR_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testSetPriorityThrowsAuthorizationException.
@Test
public void testSetPriorityThrowsAuthorizationException() {
doThrow(new AuthorizationException("aMessage")).when(externalTaskService).setPriority(any(String.class), anyInt());
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("priority", "5");
given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).pathParam("id", "anExternalTaskId").then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo("aMessage")).when().put(PRIORITY_EXTERNAL_TASK_URL);
}
Aggregations