use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class UserOperationLogAuthorizationTest method testQueryAfterDeletingDeployment.
// delete deployment (cascade = false)
public void testQueryAfterDeletingDeployment() {
// given
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
String taskId = selectSingleTask().getId();
setAssignee(taskId, "demo");
createGrantAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ_HISTORY);
disableAuthorization();
taskService.complete(taskId);
enableAuthorization();
deleteDeployment(deploymentId, false);
// when
UserOperationLogQuery query = historyService.createUserOperationLogQuery();
// then
verifyQueryResults(query, 2);
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 DeleteHistoricProcessInstancesBatchAuthorizationTest method setupAndExecuteHistoricProcessInstancesListTest.
protected void setupAndExecuteHistoricProcessInstancesListTest() {
// given
List<String> processInstanceIds = Arrays.asList(processInstance.getId(), processInstance2.getId());
runtimeService.deleteProcessInstances(processInstanceIds, null, true, false);
List<String> historicProcessInstances = new ArrayList<String>();
for (HistoricProcessInstance hpi : historyService.createHistoricProcessInstanceQuery().list()) {
historicProcessInstances.add(hpi.getId());
}
authRule.init(scenario).withUser("userId").bindResource("Process_1", sourceDefinition.getKey()).bindResource("Process_2", sourceDefinition2.getKey()).start();
// when
batch = historyService.deleteHistoricProcessInstancesAsync(historicProcessInstances, TEST_REASON);
executeSeedAndBatchJobs();
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class DeleteHistoricProcessInstancesBatchAuthorizationTest method cleanBatch.
public void cleanBatch() {
super.cleanBatch();
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().list();
if (list.size() > 0) {
List<String> instances = new ArrayList<String>();
for (HistoricProcessInstance hpi : list) {
instances.add(hpi.getId());
}
historyService.deleteHistoricProcessInstances(instances);
}
}
use of org.camunda.bpm.engine.history.HistoricProcessInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceAuthorizationTest 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
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
// then
verifyQueryResults(query, 9);
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 HistoryCleanupBatchWindowTest method clearDatabase.
@After
public void clearDatabase() {
// reset configuration changes
processEngineConfiguration.setHistoryCleanupBatchWindowStartTime(defaultStartTime);
processEngineConfiguration.setHistoryCleanupBatchWindowEndTime(defaultEndTime);
processEngineConfiguration.setHistoryCleanupBatchSize(defaultBatchSize);
processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
List<Job> jobs = managementService.createJobQuery().list();
if (jobs.size() > 0) {
assertEquals(1, jobs.size());
String jobId = jobs.get(0).getId();
commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0));
commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId);
}
List<HistoricIncident> historicIncidents = historyService.createHistoricIncidentQuery().list();
for (HistoricIncident historicIncident : historicIncidents) {
commandContext.getDbEntityManager().delete((HistoricIncidentEntity) historicIncident);
}
commandContext.getMeterLogManager().deleteAll();
return null;
}
});
List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().list();
for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
historyService.deleteHistoricProcessInstance(historicProcessInstance.getId());
}
List<HistoricDecisionInstance> historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery().list();
for (HistoricDecisionInstance historicDecisionInstance : historicDecisionInstances) {
historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId());
}
List<HistoricCaseInstance> historicCaseInstances = historyService.createHistoricCaseInstanceQuery().list();
for (HistoricCaseInstance historicCaseInstance : historicCaseInstances) {
historyService.deleteHistoricCaseInstance(historicCaseInstance.getId());
}
clearMetrics();
}
Aggregations