use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class DeploymentRestServiceInteractionTest method testCreateDeploymentThrowsAuthorizationException.
@Test
public void testCreateDeploymentThrowsAuthorizationException() {
String message = "expected exception";
when(mockDeploymentBuilder.deployWithResult()).thenThrow(new AuthorizationException(message));
resourceNames.addAll(Arrays.asList("data", "more-data"));
given().multiPart("data", "unspecified", createMockDeploymentResourceByteData()).multiPart("more-data", "unspecified", createMockDeploymentResourceBpmnData()).multiPart("deployment-name", MockProvider.EXAMPLE_DEPLOYMENT_ID).multiPart("enable-duplicate-filtering", "true").then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(message)).when().post(CREATE_DEPLOYMENT_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class StatisticsRestTest method testActivtyStatisticsByIdThrowsAuthorizationExceptionByKey.
@Test
public void testActivtyStatisticsByIdThrowsAuthorizationExceptionByKey() {
String message = "expected exception";
when(activityQueryMock.list()).thenThrow(new AuthorizationException(message));
given().pathParam("key", MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().get(ACTIVITY_STATISTICS_BY_KEY_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testSaveNewTaskThrowsAuthorizationException.
@Test
public void testSaveNewTaskThrowsAuthorizationException() {
Map<String, Object> json = new HashMap<String, Object>();
json.put("id", "anyTaskId");
Task newTask = mock(Task.class);
when(taskServiceMock.newTask(anyString())).thenReturn(newTask);
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(taskServiceMock).saveTask(newTask);
given().body(json).contentType(ContentType.JSON).header("accept", MediaType.APPLICATION_JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(TASK_CREATE_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testDeleteUserIdentityLinkThrowsAuthorizationException.
@Test
public void testDeleteUserIdentityLinkThrowsAuthorizationException() {
String deleteIdentityLinkUrl = TASK_IDENTITY_LINKS_URL + "/delete";
String taskId = EXAMPLE_TASK_ID;
String userId = MockProvider.EXAMPLE_USER_ID;
String type = "someIdentityLinkType";
Map<String, Object> json = new HashMap<String, Object>();
json.put("userId", userId);
json.put("type", type);
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(taskServiceMock).deleteUserIdentityLink(anyString(), anyString(), anyString());
given().pathParam("id", taskId).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(deleteIdentityLinkUrl);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testGetTaskFormVariablesThrowsAuthorizationException.
@Test
public void testGetTaskFormVariablesThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(formServiceMock).getTaskFormVariables(anyString(), Matchers.<Collection<String>>any(), anyBoolean());
given().pathParam("id", MockProvider.EXAMPLE_TASK_ID).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().get(FORM_VARIABLES_URL);
}
Aggregations