use of org.camunda.bpm.engine.rest.dto.runtime.JobSuspensionStateDto in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testActivateJob.
@Test
public void testActivateJob() {
JobSuspensionStateDto dto = new JobSuspensionStateDto();
dto.setSuspended(false);
given().pathParam("id", MockProvider.EXAMPLE_JOB_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(SINGLE_JOB_SUSPENDED_URL);
verify(mockSuspensionStateSelectBuilder).byJobId(MockProvider.EXAMPLE_JOB_ID);
verify(mockSuspensionStateBuilder).activate();
}
use of org.camunda.bpm.engine.rest.dto.runtime.JobSuspensionStateDto in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testSuspendJob.
@Test
public void testSuspendJob() {
JobSuspensionStateDto dto = new JobSuspensionStateDto();
dto.setSuspended(true);
given().pathParam("id", MockProvider.EXAMPLE_JOB_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(SINGLE_JOB_SUSPENDED_URL);
verify(mockSuspensionStateSelectBuilder).byJobId(MockProvider.EXAMPLE_JOB_ID);
verify(mockSuspensionStateBuilder).suspend();
}
use of org.camunda.bpm.engine.rest.dto.runtime.JobSuspensionStateDto in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testActivateThrowsProcessEngineException.
@Test
public void testActivateThrowsProcessEngineException() {
JobSuspensionStateDto dto = new JobSuspensionStateDto();
dto.setSuspended(false);
String expectedMessage = "expectedMessage";
doThrow(new ProcessEngineException(expectedMessage)).when(mockSuspensionStateBuilder).activate();
given().pathParam("id", MockProvider.NON_EXISTING_JOB_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(ProcessEngineException.class.getSimpleName())).body("message", is(expectedMessage)).when().put(SINGLE_JOB_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.rest.dto.runtime.JobSuspensionStateDto in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testActivateThrowsAuthorizationException.
@Test
public void testActivateThrowsAuthorizationException() {
JobSuspensionStateDto dto = new JobSuspensionStateDto();
dto.setSuspended(false);
String expectedMessage = "expectedMessage";
doThrow(new AuthorizationException(expectedMessage)).when(mockSuspensionStateBuilder).activate();
given().pathParam("id", MockProvider.EXAMPLE_JOB_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", is(expectedMessage)).when().put(SINGLE_JOB_SUSPENDED_URL);
}
use of org.camunda.bpm.engine.rest.dto.runtime.JobSuspensionStateDto in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testSuspendedThrowsProcessEngineException.
@Test
public void testSuspendedThrowsProcessEngineException() {
JobSuspensionStateDto dto = new JobSuspensionStateDto();
dto.setSuspended(true);
String expectedMessage = "expectedMessage";
doThrow(new ProcessEngineException(expectedMessage)).when(mockSuspensionStateBuilder).suspend();
given().pathParam("id", MockProvider.NON_EXISTING_JOB_ID).contentType(ContentType.JSON).body(dto).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(ProcessEngineException.class.getSimpleName())).body("message", is(expectedMessage)).when().put(SINGLE_JOB_SUSPENDED_URL);
}
Aggregations