use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testSetRetriesAsync.
@Test
public void testSetRetriesAsync() {
List<String> ids = Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
Batch batchEntity = MockProvider.createMockBatch();
when(mockManagementService.setJobRetriesAsync(anyListOf(String.class), any(JobQuery.class), anyInt())).thenReturn(batchEntity);
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("jobIds", ids);
messageBodyJson.put(RETRIES, 5);
Response response = given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(JOBS_SET_RETRIES_URL);
verifyBatchJson(response.asString());
verify(mockManagementService, times(1)).setJobRetriesAsync(eq(ids), eq((JobQuery) null), eq(5));
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceImpl method deleteAsync.
@Override
public BatchDto deleteAsync(DeleteProcessInstancesDto dto) {
RuntimeService runtimeService = getProcessEngine().getRuntimeService();
ProcessInstanceQuery processInstanceQuery = null;
if (dto.getProcessInstanceQuery() != null) {
processInstanceQuery = dto.getProcessInstanceQuery().toQuery(getProcessEngine());
}
Batch batch = null;
try {
batch = runtimeService.deleteProcessInstancesAsync(dto.getProcessInstanceIds(), processInstanceQuery, dto.getDeleteReason(), dto.isSkipCustomListeners(), dto.isSkipSubprocesses());
return BatchDto.fromBatch(batch);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceRestServiceImpl method deleteAsync.
public BatchDto deleteAsync(DeleteHistoricDecisionInstancesDto dto) {
HistoricDecisionInstanceQuery decisionInstanceQuery = null;
if (dto.getHistoricDecisionInstanceQuery() != null) {
decisionInstanceQuery = dto.getHistoricDecisionInstanceQuery().toQuery(processEngine);
}
try {
List<String> historicDecisionInstanceIds = dto.getHistoricDecisionInstanceIds();
String deleteReason = dto.getDeleteReason();
Batch batch = processEngine.getHistoryService().deleteHistoricDecisionInstancesAsync(historicDecisionInstanceIds, decisionInstanceQuery, deleteReason);
return BatchDto.fromBatch(batch);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
use of org.camunda.bpm.engine.batch.Batch 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.batch.Batch in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceRestServiceInteractionTest method testDeleteAsync.
@Test
public void testDeleteAsync() {
List<String> ids = Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
Batch batchEntity = MockProvider.createMockBatch();
when(historyServiceMock.deleteHistoricProcessInstancesAsync(anyListOf(String.class), any(HistoricProcessInstanceQuery.class), anyString())).thenReturn(batchEntity);
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("historicProcessInstanceIds", ids);
messageBodyJson.put(DELETE_REASON, TEST_DELETE_REASON);
Response response = given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(DELETE_HISTORIC_PROCESS_INSTANCES_ASYNC_URL);
verifyBatchJson(response.asString());
verify(historyServiceMock, times(1)).deleteHistoricProcessInstancesAsync(eq(ids), eq((HistoricProcessInstanceQuery) null), eq(TEST_DELETE_REASON));
}
Aggregations