Search in sources :

Example 1 with HistoryTimeToLiveDto

use of org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto in project camunda-bpm-platform by camunda.

the class DecisionDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveAuthorizationException.

@Test
public void testUpdateHistoryTimeToLiveAuthorizationException() {
    String expectedMessage = "expectedMessage";
    doThrow(new AuthorizationException(expectedMessage)).when(repositoryServiceMock).updateDecisionDefinitionHistoryTimeToLive(eq(MockProvider.EXAMPLE_DECISION_DEFINITION_ID), eq(5));
    given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).content(new HistoryTimeToLiveDto(5)).contentType(ContentType.JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", containsString(expectedMessage)).when().put(UPDATE_HISTORY_TIME_TO_LIVE_URL);
    verify(repositoryServiceMock).updateDecisionDefinitionHistoryTimeToLive(MockProvider.EXAMPLE_DECISION_DEFINITION_ID, 5);
}
Also used : AuthorizationException(org.camunda.bpm.engine.AuthorizationException) HistoryTimeToLiveDto(org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 2 with HistoryTimeToLiveDto

use of org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto in project camunda-bpm-platform by camunda.

the class DecisionDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveNullValue.

@Test
public void testUpdateHistoryTimeToLiveNullValue() {
    given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).content(new HistoryTimeToLiveDto()).contentType(ContentType.JSON).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(UPDATE_HISTORY_TIME_TO_LIVE_URL);
    verify(repositoryServiceMock).updateDecisionDefinitionHistoryTimeToLive(MockProvider.EXAMPLE_DECISION_DEFINITION_ID, null);
}
Also used : HistoryTimeToLiveDto(org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto) Test(org.junit.Test)

Example 3 with HistoryTimeToLiveDto

use of org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto in project camunda-bpm-platform by camunda.

the class CaseDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveAuthorizationException.

@Test
public void testUpdateHistoryTimeToLiveAuthorizationException() {
    String expectedMessage = "expectedMessage";
    doThrow(new AuthorizationException(expectedMessage)).when(repositoryServiceMock).updateCaseDefinitionHistoryTimeToLive(eq(MockProvider.EXAMPLE_CASE_DEFINITION_ID), eq(5));
    given().pathParam("id", MockProvider.EXAMPLE_CASE_DEFINITION_ID).content(new HistoryTimeToLiveDto(5)).contentType(ContentType.JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", containsString(expectedMessage)).when().put(UPDATE_HISTORY_TIME_TO_LIVE_URL);
    verify(repositoryServiceMock).updateCaseDefinitionHistoryTimeToLive(MockProvider.EXAMPLE_CASE_DEFINITION_ID, 5);
}
Also used : AuthorizationException(org.camunda.bpm.engine.AuthorizationException) HistoryTimeToLiveDto(org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto) Matchers.anyString(org.mockito.Matchers.anyString) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 4 with HistoryTimeToLiveDto

use of org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto in project camunda-bpm-platform by camunda.

the class CaseDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveNullValue.

@Test
public void testUpdateHistoryTimeToLiveNullValue() {
    given().pathParam("id", MockProvider.EXAMPLE_CASE_DEFINITION_ID).content(new HistoryTimeToLiveDto()).contentType(ContentType.JSON).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(UPDATE_HISTORY_TIME_TO_LIVE_URL);
    verify(repositoryServiceMock).updateCaseDefinitionHistoryTimeToLive(MockProvider.EXAMPLE_CASE_DEFINITION_ID, null);
}
Also used : HistoryTimeToLiveDto(org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto) Test(org.junit.Test)

Example 5 with HistoryTimeToLiveDto

use of org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto in project camunda-bpm-platform by camunda.

the class ProcessDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveAuthorizationException.

@Test
public void testUpdateHistoryTimeToLiveAuthorizationException() {
    String expectedMessage = "expectedMessage";
    doThrow(new AuthorizationException(expectedMessage)).when(repositoryServiceMock).updateProcessDefinitionHistoryTimeToLive(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID), eq(5));
    given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID).content(new HistoryTimeToLiveDto(5)).contentType(ContentType.JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).body("type", is(AuthorizationException.class.getSimpleName())).body("message", containsString(expectedMessage)).when().put(SINGLE_PROCESS_DEFINITION_HISTORY_TIMETOLIVE_URL);
    verify(repositoryServiceMock).updateProcessDefinitionHistoryTimeToLive(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID, 5);
}
Also used : HistoryTimeToLiveDto(org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

HistoryTimeToLiveDto (org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto)12 Test (org.junit.Test)12 Matchers.anyString (org.mockito.Matchers.anyString)6 Matchers.containsString (org.hamcrest.Matchers.containsString)4 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)2 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)2