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"));
}
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"));
}
Aggregations