use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceTest method testHistoricProcessInstanceDeleteAsync.
/**
* See: https://app.camunda.com/jira/browse/CAM-1324
*/
@Deployment
public void testHistoricProcessInstanceDeleteAsync() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("failing");
runtimeService.deleteProcessInstance(pi.getId(), "cancel");
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().singleResult();
assertNotNull(historicProcessInstance.getDeleteReason());
assertEquals("cancel", historicProcessInstance.getDeleteReason());
assertNotNull(historicProcessInstance.getEndTime());
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceTest method testStartByKeyWithCaseInstanceId.
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
public void testStartByKeyWithCaseInstanceId() {
String caseInstanceId = "aCaseInstanceId";
String processInstanceId = runtimeService.startProcessInstanceByKey("oneTaskProcess", null, caseInstanceId).getId();
HistoricProcessInstance firstInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
assertNotNull(firstInstance);
assertEquals(caseInstanceId, firstInstance.getCaseInstanceId());
// the second possibility to start a process instance /////////////////////////////////////////////
processInstanceId = runtimeService.startProcessInstanceByKey("oneTaskProcess", null, caseInstanceId, null).getId();
HistoricProcessInstance secondInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
assertNotNull(secondInstance);
assertEquals(caseInstanceId, secondInstance.getCaseInstanceId());
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceTest method testRetrieveProcessDefinitionVersion.
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
public void testRetrieveProcessDefinitionVersion() {
// given
String processInstanceId = runtimeService.startProcessInstanceByKey("oneTaskProcess").getId();
// when
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
// then
assertEquals(1, historicProcessInstance.getProcessDefinitionVersion().intValue());
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceTest method testStartByIdWithCaseInstanceId.
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
public void testStartByIdWithCaseInstanceId() {
String processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").singleResult().getId();
String caseInstanceId = "aCaseInstanceId";
String processInstanceId = runtimeService.startProcessInstanceById(processDefinitionId, null, caseInstanceId).getId();
HistoricProcessInstance firstInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
assertNotNull(firstInstance);
assertEquals(caseInstanceId, firstInstance.getCaseInstanceId());
// the second possibility to start a process instance /////////////////////////////////////////////
processInstanceId = runtimeService.startProcessInstanceById(processDefinitionId, null, caseInstanceId, null).getId();
HistoricProcessInstance secondInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
assertNotNull(secondInstance);
assertEquals(caseInstanceId, secondInstance.getCaseInstanceId());
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceTest method testQueryBySubCaseInstanceId.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/superProcessWithCaseCallActivity.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryBySubCaseInstanceId() {
String superProcessInstanceId = runtimeService.startProcessInstanceByKey("subProcessQueryTest").getId();
String subCaseInstanceId = caseService.createCaseInstanceQuery().superProcessInstanceId(superProcessInstanceId).singleResult().getId();
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().subCaseInstanceId(subCaseInstanceId);
assertEquals(1, query.list().size());
assertEquals(1, query.count());
HistoricProcessInstance superProcessInstance = query.singleResult();
assertNotNull(superProcessInstance);
assertEquals(superProcessInstanceId, superProcessInstance.getId());
assertNull(superProcessInstance.getSuperCaseInstanceId());
assertNull(superProcessInstance.getSuperProcessInstanceId());
}
Aggregations