use of org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method verifyMigrationPlanExecutionProcessInstanceQuery.
protected void verifyMigrationPlanExecutionProcessInstanceQuery(InOrder inOrder) {
ArgumentCaptor<ProcessInstanceQuery> queryCapture = ArgumentCaptor.forClass(ProcessInstanceQuery.class);
inOrder.verify(migrationPlanExecutionBuilderMock).processInstanceQuery(queryCapture.capture());
ProcessInstanceQueryImpl actualQuery = (ProcessInstanceQueryImpl) queryCapture.getValue();
assertThat(actualQuery).isNotNull();
assertThat(actualQuery.getProcessDefinitionId()).isEqualTo(EXAMPLE_PROCESS_DEFINITION_ID);
}
use of org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl 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);
}
use of org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl 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);
}
use of org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl 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();
}
use of org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl in project camunda-bpm-platform by camunda.
the class AbstractUpdateProcessInstancesSuspendStateCmd method collectProcessInstanceIds.
protected Collection<String> collectProcessInstanceIds() {
HashSet<String> allProcessInstanceIds = new HashSet<String>();
List<String> processInstanceIds = builder.getProcessInstanceIds();
if (processInstanceIds != null) {
allProcessInstanceIds.addAll(processInstanceIds);
}
ProcessInstanceQueryImpl processInstanceQuery = (ProcessInstanceQueryImpl) builder.getProcessInstanceQuery();
if (processInstanceQuery != null) {
allProcessInstanceIds.addAll(processInstanceQuery.listIds());
}
HistoricProcessInstanceQueryImpl historicProcessInstanceQuery = (HistoricProcessInstanceQueryImpl) builder.getHistoricProcessInstanceQuery();
if (historicProcessInstanceQuery != null) {
allProcessInstanceIds.addAll(historicProcessInstanceQuery.listIds());
}
return allProcessInstanceIds;
}
Aggregations