use of org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskQueryDto in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceImpl method updateRetries.
protected UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto) {
ExternalTaskService externalTaskService = getProcessEngine().getExternalTaskService();
List<String> externalTaskIds = retriesDto.getExternalTaskIds();
List<String> processInstanceIds = retriesDto.getProcessInstanceIds();
ExternalTaskQuery externalTaskQuery = null;
ProcessInstanceQuery processInstanceQuery = null;
HistoricProcessInstanceQuery historicProcessInstanceQuery = null;
ExternalTaskQueryDto externalTaskQueryDto = retriesDto.getExternalTaskQuery();
if (externalTaskQueryDto != null) {
externalTaskQuery = externalTaskQueryDto.toQuery(getProcessEngine());
}
ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.getProcessInstanceQuery();
if (processInstanceQueryDto != null) {
processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine());
}
HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.getHistoricProcessInstanceQuery();
if (historicProcessInstanceQueryDto != null) {
historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(getProcessEngine());
}
return externalTaskService.updateRetries().externalTaskIds(externalTaskIds).processInstanceIds(processInstanceIds).externalTaskQuery(externalTaskQuery).processInstanceQuery(processInstanceQuery).historicProcessInstanceQuery(historicProcessInstanceQuery);
}
use of org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskQueryDto in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testSetRetriesSyncWithExternalTaskQuery.
@Test
public void testSetRetriesSyncWithExternalTaskQuery() {
when(externalTaskService.createExternalTaskQuery()).thenReturn(new ExternalTaskQueryImpl());
ExternalTaskQueryDto query = new ExternalTaskQueryDto();
query.setProcessDefinitionId(EXAMPLE_PROCESS_DEFINITION_ID);
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("retries", "5");
parameters.put("externalTaskQuery", query);
given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(RETRIES_EXTERNAL_TASK_SYNC_URL);
ArgumentCaptor<ExternalTaskQuery> queryCapture = ArgumentCaptor.forClass(ExternalTaskQuery.class);
verify(externalTaskService).updateRetries();
verify(externalTaskService).createExternalTaskQuery();
verifyNoMoreInteractions(externalTaskService);
verify(updateRetriesBuilder).externalTaskIds((List<String>) null);
verify(updateRetriesBuilder).processInstanceIds((List<String>) null);
verify(updateRetriesBuilder).externalTaskQuery(queryCapture.capture());
verify(updateRetriesBuilder).processInstanceQuery(null);
verify(updateRetriesBuilder).historicProcessInstanceQuery(null);
verify(updateRetriesBuilder).set(5);
verifyNoMoreInteractions(updateRetriesBuilder);
ExternalTaskQueryImpl actualQuery = (ExternalTaskQueryImpl) queryCapture.getValue();
assertThat(actualQuery).isNotNull();
assertThat(actualQuery.getProcessDefinitionId()).isEqualTo(EXAMPLE_PROCESS_DEFINITION_ID);
}
use of org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskQueryDto in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testSetRetriesAsyncWithExternalTaskQuery.
@Test
public void testSetRetriesAsyncWithExternalTaskQuery() {
when(externalTaskService.createExternalTaskQuery()).thenReturn(new ExternalTaskQueryImpl());
ExternalTaskQueryDto query = new ExternalTaskQueryDto();
query.setProcessDefinitionId(EXAMPLE_PROCESS_DEFINITION_ID);
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("retries", "5");
parameters.put("externalTaskQuery", query);
given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).then().expect().statusCode(Status.OK.getStatusCode()).when().post(RETRIES_EXTERNAL_TASKS_ASYNC_URL);
ArgumentCaptor<ExternalTaskQuery> queryCapture = ArgumentCaptor.forClass(ExternalTaskQuery.class);
verify(externalTaskService).updateRetries();
verify(externalTaskService).createExternalTaskQuery();
verifyNoMoreInteractions(externalTaskService);
verify(updateRetriesBuilder).externalTaskIds((List<String>) null);
verify(updateRetriesBuilder).processInstanceIds((List<String>) null);
verify(updateRetriesBuilder).externalTaskQuery(queryCapture.capture());
verify(updateRetriesBuilder).processInstanceQuery(null);
verify(updateRetriesBuilder).historicProcessInstanceQuery(null);
verify(updateRetriesBuilder).setAsync(5);
verifyNoMoreInteractions(updateRetriesBuilder);
ExternalTaskQueryImpl actualQuery = (ExternalTaskQueryImpl) queryCapture.getValue();
assertThat(actualQuery).isNotNull();
assertThat(actualQuery.getProcessDefinitionId()).isEqualTo(EXAMPLE_PROCESS_DEFINITION_ID);
}
Aggregations