use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class BatchCreationAuthorizationTest method setupHistory.
protected List<String> setupHistory() {
runtimeService.deleteProcessInstance(processInstance.getId(), null);
List<String> historicProcessInstances = new ArrayList<String>();
for (HistoricProcessInstance hpi : historyService.createHistoricProcessInstanceQuery().list()) {
historicProcessInstances.add(hpi.getId());
}
return historicProcessInstances;
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceAuthorizationTest method testQueryAfterDeletingDeployment.
// delete deployment (cascade = false)
public void testQueryAfterDeletingDeployment() {
// given
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
disableAuthorization();
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.complete(task.getId());
}
enableAuthorization();
disableAuthorization();
repositoryService.deleteDeployment(deploymentId);
enableAuthorization();
// when
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
// then
verifyQueryResults(query, 3);
disableAuthorization();
List<HistoricProcessInstance> instances = historyService.createHistoricProcessInstanceQuery().list();
for (HistoricProcessInstance instance : instances) {
historyService.deleteHistoricProcessInstance(instance.getId());
}
enableAuthorization();
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceAuthorizationTest method testQueryAfterDeletingDeployment.
// delete deployment (cascade = false)
public void testQueryAfterDeletingDeployment() {
// given
startProcessInstanceByKey(PROCESS_KEY, getVariables());
startProcessInstanceByKey(PROCESS_KEY, getVariables());
startProcessInstanceByKey(PROCESS_KEY, getVariables());
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
disableAuthorization();
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.complete(task.getId());
}
enableAuthorization();
disableAuthorization();
repositoryService.deleteDeployment(deploymentId);
enableAuthorization();
// when
HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
// then
verifyQueryResults(query, 3);
disableAuthorization();
List<HistoricProcessInstance> instances = historyService.createHistoricProcessInstanceQuery().list();
for (HistoricProcessInstance instance : instances) {
historyService.deleteHistoricProcessInstance(instance.getId());
}
enableAuthorization();
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class TerminateEndEventTest method testTerminateInSubProcessShouldNotEndProcessInstanceInHistory.
/**
* CAM-4067
*/
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/event/end/TerminateEndEventTest.testTerminateInSubProcess.bpmn")
public void testTerminateInSubProcessShouldNotEndProcessInstanceInHistory() throws Exception {
// when process instance is started and terminate end event in subprocess executed
ProcessInstance pi = runtimeService.startProcessInstanceByKey("terminateEndEventExample");
// then the historic process instance should not appear ended
assertProcessNotEnded(pi.getId());
if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
HistoricProcessInstance hpi = historyService.createHistoricProcessInstanceQuery().singleResult();
assertNotNull(hpi);
assertNull(hpi.getEndTime());
assertNull(hpi.getDurationInMillis());
assertNull(hpi.getDeleteReason());
}
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class BoundaryErrorEventTest method testDeeplyNestedErrorThrownOnlyAutomaticSteps.
@Deployment
public void testDeeplyNestedErrorThrownOnlyAutomaticSteps() {
// input == 1 -> error2 is thrown -> caught on subprocess2 -> end event in subprocess -> proc inst end 1
String procId = runtimeService.startProcessInstanceByKey("deeplyNestedErrorThrown", CollectionUtil.singletonMap("input", 1)).getId();
assertProcessEnded(procId);
HistoricProcessInstance hip;
int historyLevel = processEngineConfiguration.getHistoryLevel().getId();
if (historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult();
assertEquals("processEnd1", hip.getEndActivityId());
}
// input == 2 -> error2 is thrown -> caught on subprocess1 -> proc inst end 2
procId = runtimeService.startProcessInstanceByKey("deeplyNestedErrorThrown", CollectionUtil.singletonMap("input", 1)).getId();
assertProcessEnded(procId);
if (historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult();
assertEquals("processEnd1", hip.getEndActivityId());
}
}
Aggregations