Search in sources :

Example 1 with HistoricDecisionInstanceQueryDto

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

the class HistoricDecisionInstanceRestServiceInteractionTest method testDeleteAsyncWithIdsAndQuery.

@Test
public void testDeleteAsyncWithIdsAndQuery() {
    Batch batchEntity = MockProvider.createMockBatch();
    when(historyServiceMock.deleteHistoricDecisionInstancesAsync(anyListOf(String.class), any(HistoricDecisionInstanceQuery.class), anyString())).thenReturn(batchEntity);
    Map<String, Object> messageBodyJson = new HashMap<String, Object>();
    HistoricDecisionInstanceQueryDto query = new HistoricDecisionInstanceQueryDto();
    query.setDecisionDefinitionKey("decision");
    messageBodyJson.put("historicDecisionInstanceQuery", query);
    List<String> ids = Arrays.asList(MockProvider.EXAMPLE_DECISION_INSTANCE_ID);
    messageBodyJson.put("historicDecisionInstanceIds", ids);
    messageBodyJson.put("deleteReason", "a-delete-reason");
    Response response = given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(HISTORIC_DECISION_INSTANCES_DELETE_ASYNC_URL);
    verifyBatchJson(response.asString());
    verify(historyServiceMock, times(1)).deleteHistoricDecisionInstancesAsync(eq(ids), any(HistoricDecisionInstanceQuery.class), eq("a-delete-reason"));
}
Also used : Response(com.jayway.restassured.response.Response) Batch(org.camunda.bpm.engine.batch.Batch) HashMap(java.util.HashMap) Matchers.anyString(org.mockito.Matchers.anyString) HistoricDecisionInstanceQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricDecisionInstanceQueryDto) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Test(org.junit.Test) AbstractRestServiceTest(org.camunda.bpm.engine.rest.AbstractRestServiceTest)

Example 2 with HistoricDecisionInstanceQueryDto

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

the class HistoricDecisionInstanceRestServiceInteractionTest method testDeleteAsyncWithQuery.

@Test
public void testDeleteAsyncWithQuery() {
    Batch batchEntity = MockProvider.createMockBatch();
    when(historyServiceMock.deleteHistoricDecisionInstancesAsync(anyListOf(String.class), any(HistoricDecisionInstanceQuery.class), anyString())).thenReturn(batchEntity);
    Map<String, Object> messageBodyJson = new HashMap<String, Object>();
    HistoricDecisionInstanceQueryDto query = new HistoricDecisionInstanceQueryDto();
    query.setDecisionDefinitionKey("decision");
    messageBodyJson.put("historicDecisionInstanceQuery", query);
    messageBodyJson.put("deleteReason", "a-delete-reason");
    Response response = given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(HISTORIC_DECISION_INSTANCES_DELETE_ASYNC_URL);
    verifyBatchJson(response.asString());
    verify(historyServiceMock, times(1)).deleteHistoricDecisionInstancesAsync(eq((List<String>) null), any(HistoricDecisionInstanceQuery.class), eq("a-delete-reason"));
}
Also used : Response(com.jayway.restassured.response.Response) Batch(org.camunda.bpm.engine.batch.Batch) HashMap(java.util.HashMap) List(java.util.List) Matchers.anyString(org.mockito.Matchers.anyString) HistoricDecisionInstanceQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricDecisionInstanceQueryDto) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Test(org.junit.Test) AbstractRestServiceTest(org.camunda.bpm.engine.rest.AbstractRestServiceTest)

Aggregations

Response (com.jayway.restassured.response.Response)2 HashMap (java.util.HashMap)2 Batch (org.camunda.bpm.engine.batch.Batch)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)2 HistoricDecisionInstanceQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricDecisionInstanceQueryDto)2 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 List (java.util.List)1