use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class BulkHistoryDeleteTest method collectHistoricDecisionOutputIds.
private void collectHistoricDecisionOutputIds(List<HistoricDecisionInstance> historicDecisionInstances, List<String> historicDecisionOutputIds, List<String> outputByteArrayId) {
for (HistoricDecisionInstance historicDecisionInstance : historicDecisionInstances) {
for (HistoricDecisionOutputInstance outputInstanceEntity : historicDecisionInstance.getOutputs()) {
historicDecisionOutputIds.add(outputInstanceEntity.getId());
final String byteArrayValueId = ((HistoricDecisionOutputInstanceEntity) outputInstanceEntity).getByteArrayValueId();
if (byteArrayValueId != null) {
outputByteArrayId.add(byteArrayValueId);
}
}
}
assertEquals(PROCESS_INSTANCE_COUNT, historicDecisionOutputIds.size());
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance 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.HistoricDecisionInstance 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.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceTest method testManualActivationRuleEvaluatesDecision.
@Deployment(resources = { DECISION_CASE_WITH_DECISION_SERVICE_INSIDE_RULE, DECISION_RETURNS_TRUE })
public void testManualActivationRuleEvaluatesDecision() {
CaseInstance caseInstance = caseService.withCaseDefinitionByKey("case").setVariable("input1", null).setVariable("myBean", new DecisionServiceDelegate()).create();
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionId(caseInstance.getCaseDefinitionId()).singleResult();
String decisionDefinitionId = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).singleResult().getId();
String activityInstanceId = historyService.createHistoricCaseActivityInstanceQuery().caseActivityId("PI_HumanTask_1").singleResult().getId();
HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().singleResult();
assertThat(historicDecisionInstance, is(notNullValue()));
assertThat(historicDecisionInstance.getDecisionDefinitionId(), is(decisionDefinitionId));
assertThat(historicDecisionInstance.getDecisionDefinitionKey(), is(DECISION_DEFINITION_KEY));
assertThat(historicDecisionInstance.getDecisionDefinitionName(), is("sample decision"));
// references to case instance should be set since the decision is evaluated while executing a case instance
assertThat(historicDecisionInstance.getProcessDefinitionKey(), is(nullValue()));
assertThat(historicDecisionInstance.getProcessDefinitionId(), is(nullValue()));
assertThat(historicDecisionInstance.getProcessInstanceId(), is(nullValue()));
assertThat(historicDecisionInstance.getCaseDefinitionKey(), is(caseDefinition.getKey()));
assertThat(historicDecisionInstance.getCaseDefinitionId(), is(caseDefinition.getId()));
assertThat(historicDecisionInstance.getCaseInstanceId(), is(caseInstance.getId()));
assertThat(historicDecisionInstance.getActivityId(), is("PI_HumanTask_1"));
assertThat(historicDecisionInstance.getActivityInstanceId(), is(activityInstanceId));
assertThat(historicDecisionInstance.getEvaluationTime(), is(notNullValue()));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceTest method testMultipleDecisionInputInstances.
@Deployment(resources = { DECISION_PROCESS, DECISION_MULTIPLE_INPUT_DMN })
public void testMultipleDecisionInputInstances() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("input1", "a");
variables.put("input2", 1);
runtimeService.startProcessInstanceByKey("testProcess", variables);
HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeInputs().singleResult();
List<HistoricDecisionInputInstance> inputs = historicDecisionInstance.getInputs();
assertThat(inputs.size(), is(2));
assertThat(inputs.get(0).getValue(), is((Object) "a"));
assertThat(inputs.get(1).getValue(), is((Object) 1));
}
Aggregations