use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testSuspendJobDefinitionByProcessDefinitionKeyWithAuthorizationException.
@Test
public void testSuspendJobDefinitionByProcessDefinitionKeyWithAuthorizationException() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("suspended", true);
params.put("processDefinitionKey", MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY);
String expectedException = "expectedException";
doThrow(new AuthorizationException(expectedException)).when(mockSuspensionStateBuilder).suspend();
given().contentType(ContentType.JSON).body(params).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(expectedException)).when().put(JOB_DEFINITION_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testSetJobRetriesAuthorizationException.
@Test
public void testSetJobRetriesAuthorizationException() {
String expectedMessage = "expected exception message";
doThrow(new AuthorizationException(expectedMessage)).when(mockManagementService).setJobRetriesByJobDefinitionId(MockProvider.NON_EXISTING_JOB_DEFINITION_ID, MockProvider.EXAMPLE_JOB_RETRIES);
Map<String, Object> retriesVariableJson = new HashMap<String, Object>();
retriesVariableJson.put("retries", MockProvider.EXAMPLE_JOB_RETRIES);
given().pathParam("id", MockProvider.NON_EXISTING_JOB_DEFINITION_ID).contentType(ContentType.JSON).body(retriesVariableJson).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(expectedMessage)).when().put(JOB_DEFINITION_RETRIES_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testSuspendJobDefinitionByIdThrowsAuthorizationException.
@Test
public void testSuspendJobDefinitionByIdThrowsAuthorizationException() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("suspended", true);
params.put("includeJobs", false);
String expectedMessage = "expectedMessage";
doThrow(new AuthorizationException(expectedMessage)).when(mockSuspensionStateBuilder).suspend();
given().pathParam("id", MockProvider.NON_EXISTING_JOB_DEFINITION_ID).contentType(ContentType.JSON).body(params).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(expectedMessage)).when().put(SINGLE_JOB_DEFINITION_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testSuspendJobByJobDefinitionIdThrowsAuthorizationException.
@Test
public void testSuspendJobByJobDefinitionIdThrowsAuthorizationException() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("suspended", true);
params.put("jobDefinitionId", MockProvider.EXAMPLE_JOB_DEFINITION_ID);
String expectedException = "expectedException";
doThrow(new AuthorizationException(expectedException)).when(mockSuspensionStateBuilder).suspend();
given().contentType(ContentType.JSON).body(params).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(expectedException)).when().put(JOB_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testSetJobPriorityThrowsAuthorizationException.
@Test
public void testSetJobPriorityThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(mockManagementService).setJobPriority(anyString(), anyInt());
Map<String, Object> priorityJson = new HashMap<String, Object>();
priorityJson.put("priority", MockProvider.EXAMPLE_JOB_PRIORITY);
given().pathParam("id", MockProvider.EXAMPLE_JOB_ID).contentType(ContentType.JSON).body(priorityJson).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().put(JOB_RESOURCE_SET_PRIORITY_URL);
}
Aggregations