use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceRestServiceReportTest method testMissingAuthorization.
@Test
public void testMissingAuthorization() {
String message = "not authorized";
when(mockedReportQuery.duration(MONTH)).thenThrow(new AuthorizationException(message));
given().queryParam("reportType", "duration").queryParam("periodUnit", "month").then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().get(HISTORIC_PROCESS_INSTANCE_REPORT_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class CleanableHistoricCaseInstanceReportServiceTest method testMissingAuthorization.
@Test
public void testMissingAuthorization() {
String message = "not authorized";
when(historicCaseInstanceReport.list()).thenThrow(new AuthorizationException(message));
given().then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().get(HISTORIC_REPORT_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method testLocalVariableModificationThrowsAuthorizationException.
@Test
public void testLocalVariableModificationThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(runtimeServiceMock).updateVariablesLocal(anyString(), any(Map.class), any(List.class));
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
String variableKey = "aKey";
int variableValue = 123;
Map<String, Object> modifications = VariablesBuilder.create().variable(variableKey, variableValue).getVariables();
messageBodyJson.put("modifications", modifications);
given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(EXECUTION_LOCAL_VARIABLES_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method testGetLocalVariablesThrowsAuthorizationException.
@Test
public void testGetLocalVariablesThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(runtimeServiceMock).getVariablesLocalTyped(anyString(), anyBoolean());
given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().get(EXECUTION_LOCAL_VARIABLES_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method testMessageEventTriggeringThrowsAuthorizationException.
@Test
public void testMessageEventTriggeringThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(runtimeServiceMock).messageEventReceived(anyString(), anyString(), any(Map.class));
given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).pathParam("messageName", "someMessage").contentType(ContentType.JSON).body(EMPTY_JSON_OBJECT).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(message)).when().post(TRIGGER_MESSAGE_SUBSCRIPTION_URL);
}
Aggregations