Search in sources :

Example 6 with HistoryTimeToLiveDto

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

the class ProcessDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveNegativeValue.

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

Example 7 with HistoryTimeToLiveDto

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

the class ProcessDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLive.

@Test
public void testUpdateHistoryTimeToLive() {
    given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID).content(new HistoryTimeToLiveDto(5)).contentType(ContentType.JSON).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).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) Test(org.junit.Test)

Example 8 with HistoryTimeToLiveDto

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

the class ProcessDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveNullValue.

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

Example 9 with HistoryTimeToLiveDto

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

the class DecisionDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLive.

@Test
public void testUpdateHistoryTimeToLive() {
    given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).content(new HistoryTimeToLiveDto(5)).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, 5);
}
Also used : HistoryTimeToLiveDto(org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto) Test(org.junit.Test)

Example 10 with HistoryTimeToLiveDto

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

the class DecisionDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveNegativeValue.

@Test
public void testUpdateHistoryTimeToLiveNegativeValue() {
    String expectedMessage = "expectedMessage";
    doThrow(new BadUserRequestException(expectedMessage)).when(repositoryServiceMock).updateDecisionDefinitionHistoryTimeToLive(eq(MockProvider.EXAMPLE_DECISION_DEFINITION_ID), eq(-1));
    given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).content(new HistoryTimeToLiveDto(-1)).contentType(ContentType.JSON).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", is(BadUserRequestException.class.getSimpleName())).body("message", containsString(expectedMessage)).when().put(UPDATE_HISTORY_TIME_TO_LIVE_URL);
    verify(repositoryServiceMock).updateDecisionDefinitionHistoryTimeToLive(MockProvider.EXAMPLE_DECISION_DEFINITION_ID, -1);
}
Also used : HistoryTimeToLiveDto(org.camunda.bpm.engine.rest.dto.HistoryTimeToLiveDto) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) 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