use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class InterruptingEventSubProcessCompensationSenarioTest method testInitThrowCompensateCompletionHistory.
/**
* Does not work because in PvmAtomicOperationActivityInstanceEnd we don't correctly
* detect that the compensation throw event has no dedicated scope execution, so we restore
* activity instance IDs wrongly before firing the history listener.
*/
@Ignore
@Test
@ScenarioUnderTest("init.throwCompensate.2")
public void testInitThrowCompensateCompletionHistory() {
// given
ProcessInstance processInstance = rule.processInstance();
Task undoTask = rule.taskQuery().singleResult();
// when
rule.getTaskService().complete(undoTask.getId());
Task afterCompensateTask = rule.taskQuery().singleResult();
rule.getTaskService().complete(afterCompensateTask.getId());
// then the historic throw compensate instance has an end time
HistoricActivityInstance throwCompensateInstance = rule.getHistoryService().createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).activityId("throwCompensate").singleResult();
Assert.assertNotNull(throwCompensateInstance.getEndTime());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceTest method testHistoricProcInstQueryWithExecutedActivityIds.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testHistoricProcInstQueryWithExecutedActivityIds() {
// given
deployment(ProcessModels.TWO_TASKS_PROCESS);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");
Task task = taskService.createTaskQuery().active().singleResult();
taskService.complete(task.getId());
// assume
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).activityId("userTask1").singleResult();
assertNotNull(historicActivityInstance);
// when
List<HistoricProcessInstance> result = historyService.createHistoricProcessInstanceQuery().executedActivityIdIn(historicActivityInstance.getActivityId()).list();
// then
assertNotNull(result);
assertEquals(1, result.size());
assertEquals(result.get(0).getId(), processInstance.getId());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceTest method testHistoricProcInstQueryWithActiveActivityIds.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testHistoricProcInstQueryWithActiveActivityIds() {
// given
deployment(ProcessModels.TWO_TASKS_PROCESS);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");
// assume
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("userTask1").singleResult();
assertNotNull(historicActivityInstance);
// when
List<HistoricProcessInstance> result = historyService.createHistoricProcessInstanceQuery().activeActivityIdIn(historicActivityInstance.getActivityId()).list();
// then
assertNotNull(result);
assertEquals(1, result.size());
assertEquals(result.get(0).getId(), processInstance.getId());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceTest method testHistoricTaskInstanceAssignmentListener.
@Deployment
public void testHistoricTaskInstanceAssignmentListener() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("assignee", "jonny");
runtimeService.startProcessInstanceByKey("testProcess", variables);
HistoricActivityInstance hai = historyService.createHistoricActivityInstanceQuery().activityId("task").singleResult();
assertEquals("jonny", hai.getAssignee());
HistoricTaskInstance hti = historyService.createHistoricTaskInstanceQuery().singleResult();
assertEquals("jonny", hti.getAssignee());
assertNull(hti.getOwner());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class FullHistoryTest method testHistoricFormPropertiesOnReEnteringActivity.
/**
* Test created to validate ACT-621 fix.
*/
@Test
@Deployment
public void testHistoricFormPropertiesOnReEnteringActivity() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("comeBack", Boolean.TRUE);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("HistoricFormPropertiesProcess", variables);
assertNotNull(processInstance);
// Submit form on task
Map<String, String> data = new HashMap<String, String>();
data.put("formProp1", "Property value");
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
formService.submitTaskFormData(task.getId(), data);
// Historic property should be available
List<HistoricDetail> details = historyService.createHistoricDetailQuery().formProperties().processInstanceId(processInstance.getId()).list();
assertNotNull(details);
assertEquals(1, details.size());
// Task should be active in the same activity as the previous one
task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
formService.submitTaskFormData(task.getId(), data);
details = historyService.createHistoricDetailQuery().formProperties().processInstanceId(processInstance.getId()).list();
assertNotNull(details);
assertEquals(2, details.size());
// Should have 2 different historic activity instance ID's, with the same activityId
Assert.assertNotSame(details.get(0).getActivityInstanceId(), details.get(1).getActivityInstanceId());
HistoricActivityInstance historicActInst1 = historyService.createHistoricActivityInstanceQuery().activityInstanceId(details.get(0).getActivityInstanceId()).singleResult();
HistoricActivityInstance historicActInst2 = historyService.createHistoricActivityInstanceQuery().activityInstanceId(details.get(1).getActivityInstanceId()).singleResult();
assertEquals(historicActInst1.getActivityId(), historicActInst2.getActivityId());
}
Aggregations