@Test public void testQueryByProcessInstanceIdAsPost() { String processInstanceId = MockProvider.EXAMPLE_HISTORIC_TASK_INST_PROC_INST_ID; Map<String, Object> params = new HashMap<String, Object>(); params.put("processInstanceId", processInstanceId); given() .contentType(POST_JSON_CONTENT_TYPE) .body(params) .then().expect().statusCode(Status.OK.getStatusCode()) .when().post(HISTORIC_TASK_INSTANCE_RESOURCE_URL); verify(mockedQuery).processInstanceId(processInstanceId); }
protected void assertHistoricTaskDeletionPresent(List<String> processIds, String deleteReason, ProcessEngineTestRule testRule) { if (!testRule.isHistoryLevelNone()) { for (String processId : processIds) { HistoricTaskInstance historicTaskInstance = historyService .createHistoricTaskInstanceQuery() .processInstanceId(processId) .singleResult(); assertThat(historicTaskInstance.getDeleteReason(), is(deleteReason)); } } }
@Test public void testQueryByProcessInstanceId() { String processInstanceId = MockProvider.EXAMPLE_HISTORIC_TASK_INST_PROC_INST_ID; given() .queryParam("processInstanceId", processInstanceId) .then().expect().statusCode(Status.OK.getStatusCode()) .when().get(HISTORIC_TASK_INSTANCE_RESOURCE_URL); verify(mockedQuery).processInstanceId(processInstanceId); }
query.processInstanceId(processInstanceId);
query.processInstanceId(processInstanceId);
@Deployment(resources={"org/camunda/bpm/engine/test/history/HistoricVariableInstanceTest.testParallel.bpmn20.xml"}) public void testHistoricVariableInstanceQueryByTaskIds() { // given ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); TaskQuery taskQuery = taskService.createTaskQuery(); Task userTask = taskQuery.singleResult(); assertEquals("userTask1", userTask.getName()); // set local variable on user task taskService.setVariableLocal(userTask.getId(), "taskVariable", "aCustomValue"); // complete user task to finish process instance taskService.complete(userTask.getId()); assertProcessEnded(processInstance.getId()); List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); // check existing variables assertEquals(3, historyService.createHistoricVariableInstanceQuery().count()); // check existing variables for task ID assertEquals(1, historyService.createHistoricVariableInstanceQuery().taskIdIn(tasks.get(0).getId()).list().size()); assertEquals(1, historyService.createHistoricVariableInstanceQuery().taskIdIn(tasks.get(0).getId()).count()); }
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") public void testProcessDefinitionKeyProperty() { // given String key = "oneTaskProcess"; String processInstanceId = runtimeService.startProcessInstanceByKey(key).getId(); // when HistoricTaskInstance task = historyService .createHistoricTaskInstanceQuery() .processInstanceId(processInstanceId) .taskDefinitionKey("theTask") .singleResult(); // then assertNotNull(task.getProcessDefinitionKey()); assertEquals(key, task.getProcessDefinitionKey()); assertNull(task.getCaseDefinitionKey()); }
@Deployment(resources={ "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) @Test public void testDeleteProcessInstance() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); assertEquals(1, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count()); runtimeService.deleteProcessInstance(processInstance.getId(), TESTING_INSTANCE_DELETION); assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count()); // test that the delete reason of the process instance shows up as delete reason of the task in history // ACT-848 if(!ProcessEngineConfiguration.HISTORY_NONE.equals(processEngineConfiguration.getHistory())) { HistoricTaskInstance historicTaskInstance = historyService .createHistoricTaskInstanceQuery() .processInstanceId(processInstance.getId()) .singleResult(); assertEquals(TESTING_INSTANCE_DELETION, historicTaskInstance.getDeleteReason()); } }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getProcessInstanceId()); }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getId()); }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getProcessInstanceId()); }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getProcessInstanceId()); }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getProcessInstanceId()); }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getProcessInstanceId()); }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getId()); }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getId()); }
@Override protected HistoricTaskInstanceQuery historicTaskInstanceQuery() { return super.historicTaskInstanceQuery().processInstanceId(actual.getProcessInstanceId()); }
assertEquals(4, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).count()); assertEquals(4, historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).count()); assertEquals(1, historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).count()); assertEquals(0, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).count()); assertEquals(0, historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).count()); assertEquals(0, historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).count());
assertEquals(1, historyService.createHistoricTaskInstanceQuery().processInstanceId(finishedInstance.getId()).count()); assertEquals(0, historyService.createHistoricTaskInstanceQuery().processInstanceId("unexistingid").count());
protected void assertHistoricTaskDeletionPresent(List<String> processIds, String deleteReason, ProcessEngineTestRule testRule) { if (!testRule.isHistoryLevelNone()) { for (String processId : processIds) { HistoricTaskInstance historicTaskInstance = historyService .createHistoricTaskInstanceQuery() .processInstanceId(processId) .singleResult(); assertThat(historicTaskInstance.getDeleteReason(), is(deleteReason)); } } }