use of org.camunda.bpm.engine.history.HistoricCaseInstance in project camunda-bpm-platform by camunda.
the class HistoryCleanupAuthorizationTest method clearDatabase.
protected void clearDatabase() {
// reset configuration changes
String defaultStartTime = processEngineConfiguration.getHistoryCleanupBatchWindowStartTime();
String defaultEndTime = processEngineConfiguration.getHistoryCleanupBatchWindowEndTime();
int defaultBatchSize = processEngineConfiguration.getHistoryCleanupBatchSize();
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());
}
}
use of org.camunda.bpm.engine.history.HistoricCaseInstance 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();
}
use of org.camunda.bpm.engine.history.HistoricCaseInstance in project camunda-bpm-platform by camunda.
the class HistoryCleanupTest 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();
}
use of org.camunda.bpm.engine.history.HistoricCaseInstance in project camunda-bpm-platform by camunda.
the class CleanableHistoricCaseInstanceReportTest method cleanUp.
@After
public void cleanUp() {
List<HistoricCaseInstance> instanceList = historyService.createHistoricCaseInstanceQuery().active().list();
if (!instanceList.isEmpty()) {
for (HistoricCaseInstance instance : instanceList) {
caseService.terminateCaseExecution(instance.getId());
caseService.closeCaseInstance(instance.getId());
}
}
List<HistoricCaseInstance> historicCaseInstances = historyService.createHistoricCaseInstanceQuery().list();
for (HistoricCaseInstance historicCaseInstance : historicCaseInstances) {
historyService.deleteHistoricCaseInstance(historicCaseInstance.getId());
}
}
use of org.camunda.bpm.engine.history.HistoricCaseInstance in project camunda-bpm-platform by camunda.
the class HistoricCaseActivityInstanceTest method testAutoCompleteEnabled.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/stage/AutoCompleteTest.testCasePlanModel.cmmn" })
public void testAutoCompleteEnabled() {
String caseInstanceId = createCaseInstanceByKey("case").getId();
HistoricCaseInstance caseInstance = historyService.createHistoricCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isCompleted());
HistoricCaseActivityInstanceQuery query = historyService.createHistoricCaseActivityInstanceQuery();
HistoricCaseActivityInstance humanTask1 = query.caseActivityId("PI_HumanTask_1").singleResult();
assertNotNull(humanTask1);
assertTrue(humanTask1.isTerminated());
assertNotNull(humanTask1.getEndTime());
assertNotNull(humanTask1.getDurationInMillis());
HistoricCaseActivityInstance humanTask2 = query.caseActivityId("PI_HumanTask_2").singleResult();
assertNotNull(humanTask2);
assertTrue(humanTask2.isTerminated());
assertNotNull(humanTask2.getEndTime());
assertNotNull(humanTask2.getDurationInMillis());
}
Aggregations