Search in sources :

Example 1 with ProcessInstanceQueryDto

use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto 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);
}
Also used : HistoricProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto) HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ExternalTaskQueryDto(org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskQueryDto) ExternalTaskService(org.camunda.bpm.engine.ExternalTaskService) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto) HistoricProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)

Example 2 with ProcessInstanceQueryDto

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

the class MigrationRestServiceInteractionTest method verifyMigrationExecutionBuilderInteraction.

protected void verifyMigrationExecutionBuilderInteraction(InOrder inOrder, Map<String, Object> migrationExecution) {
    List<String> processInstanceIds = ((List<String>) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_PROCESS_INSTANCE_IDS));
    inOrder.verify(migrationPlanExecutionBuilderMock).processInstanceIds(eq(processInstanceIds));
    ProcessInstanceQueryDto processInstanceQuery = (ProcessInstanceQueryDto) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_PROCESS_INSTANCE_QUERY);
    if (processInstanceQuery != null) {
        verifyMigrationPlanExecutionProcessInstanceQuery(inOrder);
    }
    Boolean skipCustomListeners = (Boolean) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_SKIP_CUSTOM_LISTENERS);
    if (Boolean.TRUE.equals(skipCustomListeners)) {
        inOrder.verify(migrationPlanExecutionBuilderMock).skipCustomListeners();
    }
    Boolean skipIoMappings = (Boolean) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_SKIP_IO_MAPPINGS);
    if (Boolean.TRUE.equals(skipIoMappings)) {
        inOrder.verify(migrationPlanExecutionBuilderMock).skipIoMappings();
    }
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto)

Example 3 with ProcessInstanceQueryDto

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

the class ModificationRestServiceInteractionTest method executeModificationWithInvalidProcessInstanceQueryAsync.

@Test
public void executeModificationWithInvalidProcessInstanceQueryAsync() {
    when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(new ProcessInstanceQueryImpl());
    Map<String, Object> json = new HashMap<String, Object>();
    List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
    instructions.add(ModificationInstructionBuilder.startAfter().activityId("acivityId").getJson());
    ProcessInstanceQueryDto processInstanceQueryDto = new ProcessInstanceQueryDto();
    processInstanceQueryDto.setBusinessKey("foo");
    json.put("processInstanceQuery", processInstanceQueryDto);
    json.put("instructions", instructions);
    json.put("processDefinitionId", "processDefinitionId");
    given().contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.OK.getStatusCode()).when().post(EXECUTE_MODIFICATION_ASYNC_URL);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ProcessInstanceQueryImpl(org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl) Matchers.anyString(org.mockito.Matchers.anyString) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Example 4 with ProcessInstanceQueryDto

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

the class ModificationRestServiceInteractionTest method executeModificationWithInvalidProcessInstanceQuerySync.

@Test
public void executeModificationWithInvalidProcessInstanceQuerySync() {
    when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(new ProcessInstanceQueryImpl());
    Map<String, Object> json = new HashMap<String, Object>();
    String message = "Process instance ids is null";
    doThrow(new BadUserRequestException(message)).when(modificationBuilderMock).execute();
    List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
    instructions.add(ModificationInstructionBuilder.startAfter().activityId("acivityId").getJson());
    ProcessInstanceQueryDto processInstanceQueryDto = new ProcessInstanceQueryDto();
    processInstanceQueryDto.setBusinessKey("foo");
    json.put("processInstanceQuery", processInstanceQueryDto);
    json.put("instructions", instructions);
    json.put("processDefinitionId", "processDefinitionId");
    given().contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(EXECUTE_MODIFICATION_SYNC_URL);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ProcessInstanceQueryImpl(org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl) Matchers.anyString(org.mockito.Matchers.anyString) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Example 5 with ProcessInstanceQueryDto

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

the class ModificationRestServiceInteractionTest method executeModificationWithValidProcessInstanceQueryAsync.

@Test
public void executeModificationWithValidProcessInstanceQueryAsync() {
    when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(new ProcessInstanceQueryImpl());
    Map<String, Object> json = new HashMap<String, Object>();
    List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
    instructions.add(ModificationInstructionBuilder.startAfter().activityId("activityId").getJson());
    ProcessInstanceQueryDto processInstanceQueryDto = new ProcessInstanceQueryDto();
    processInstanceQueryDto.setBusinessKey("foo");
    json.put("processInstanceQuery", processInstanceQueryDto);
    json.put("instructions", instructions);
    json.put("processDefinitionId", "processDefinitionId");
    given().contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.OK.getStatusCode()).when().post(EXECUTE_MODIFICATION_ASYNC_URL);
    verify(runtimeServiceMock, times(1)).createProcessInstanceQuery();
    verify(modificationBuilderMock).startAfterActivity("activityId");
    verify(modificationBuilderMock).processInstanceQuery(processInstanceQueryDto.toQuery(processEngine));
    verify(modificationBuilderMock).executeAsync();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ProcessInstanceQueryImpl(org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl) Matchers.anyString(org.mockito.Matchers.anyString) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Aggregations

ProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto)19 Test (org.junit.Test)15 HashMap (java.util.HashMap)13 HistoricProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)10 Matchers.anyString (org.mockito.Matchers.anyString)9 ProcessInstanceQueryImpl (org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl)8 ExampleVariableObject (org.camunda.bpm.engine.rest.helper.ExampleVariableObject)7 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)6 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)4 BatchEntity (org.camunda.bpm.engine.impl.batch.BatchEntity)4 HistoricProcessInstanceQueryImpl (org.camunda.bpm.engine.impl.HistoricProcessInstanceQueryImpl)2 MigrationExecutionDtoBuilder (org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder)2 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)1 ExternalTaskService (org.camunda.bpm.engine.ExternalTaskService)1 Batch (org.camunda.bpm.engine.batch.Batch)1 ExternalTaskQuery (org.camunda.bpm.engine.externaltask.ExternalTaskQuery)1 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)1 MigrationPlanExecutionBuilder (org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder)1