use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskVariableRestResourceInteractionTest method testGetSingleVariableThrowsAuthorizationException.
@Test
public void testGetSingleVariableThrowsAuthorizationException() {
String variableKey = "aVariableKey";
String message = "excpected exception";
when(taskServiceMock.getVariableTyped(anyString(), anyString(), anyBoolean())).thenThrow(new AuthorizationException(message));
given().pathParam("id", EXAMPLE_TASK_ID).pathParam("varId", variableKey).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(message)).when().get(SINGLE_TASK_SINGLE_VARIABLE_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskVariableRestResourceInteractionTest method testPutSingleVariableThrowsAuthorizationException.
@Test
public void testPutSingleVariableThrowsAuthorizationException() {
String variableKey = "aVariableKey";
String variableValue = "1abc";
String type = "String";
Map<String, Object> variableJson = VariablesBuilder.getVariableValueMap(variableValue, type);
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(taskServiceMock).setVariable(anyString(), anyString(), any());
given().pathParam("id", EXAMPLE_TASK_ID).pathParam("varId", variableKey).contentType(ContentType.JSON).body(variableJson).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().put(SINGLE_TASK_PUT_SINGLE_VARIABLE_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskVariableRestResourceInteractionTest method testPutSingleBinaryVariableThrowsAuthorizationException.
@Test
public void testPutSingleBinaryVariableThrowsAuthorizationException() {
byte[] bytes = "someContent".getBytes();
String variableKey = "aVariableKey";
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(taskServiceMock).setVariable(anyString(), anyString(), any());
given().pathParam("id", EXAMPLE_TASK_ID).pathParam("varId", variableKey).multiPart("data", "unspecified", bytes).expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(SINGLE_TASK_SINGLE_BINARY_VARIABLE_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class CleanableHistoricBatchReportServiceTest method testMissingAuthorization.
@Test
public void testMissingAuthorization() {
String message = "not authorized";
when(historicBatchReport.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 CleanableHistoricDecisionInstanceReportServiceTest method testMissingAuthorization.
@Test
public void testMissingAuthorization() {
String message = "not authorized";
when(historicDecisionInstanceReport.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);
}
Aggregations