use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testCascadingDeleteSubprocessInstanceSkipIoMappings.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testCascadingDeleteSubprocessInstanceSkipIoMappings.Calling.bpmn20.xml", "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testCascadingDeleteSubprocessInstanceSkipIoMappings.Called.bpmn20.xml" })
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
@Test
public void testCascadingDeleteSubprocessInstanceSkipIoMappings() {
// given a process instance
ProcessInstance instance = runtimeService.startProcessInstanceByKey("callingProcess");
ProcessInstance instance2 = runtimeService.createProcessInstanceQuery().superProcessInstanceId(instance.getId()).singleResult();
// when the process instance is deleted and we do skip the io mappings
runtimeService.deleteProcessInstance(instance.getId(), "test_purposes", false, true, true);
// then
testRule.assertProcessEnded(instance.getId());
assertEquals(1, historyService.createHistoricVariableInstanceQuery().processInstanceId(instance2.getId()).list().size());
assertEquals(1, historyService.createHistoricVariableInstanceQuery().variableName("inputMappingExecuted").count());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testDeleteCalledSubprocess.
@Test
@RequiredHistoryLevel(ProcessEngineConfigurationImpl.HISTORY_AUDIT)
public void testDeleteCalledSubprocess() {
// given
BpmnModelInstance callingInstance = ProcessModels.newModel("oneTaskProcess").startEvent().callActivity().calledElement("called").endEvent().done();
BpmnModelInstance calledInstance = ProcessModels.newModel("called").startEvent().userTask().endEvent().done();
testRule.deploy(callingInstance, calledInstance);
final String processInstanceId = runtimeService.startProcessInstanceByKey("oneTaskProcess").getProcessInstanceId();
String subprocessId = historyService.createHistoricProcessInstanceQuery().processDefinitionKey("called").singleResult().getId();
runtimeService.deleteProcessInstance(subprocessId, TESTING_INSTANCE_DELETION);
assertEquals(TESTING_INSTANCE_DELETION, historyService.createHistoricProcessInstanceQuery().processInstanceId(subprocessId).singleResult().getDeleteReason());
assertEquals(TESTING_INSTANCE_DELETION, historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult().getDeleteReason());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class UpdateProcessInstancesSuspendStateAsyncTest method testBatchSuspensionByHistoricProcessInstanceQuery.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/externaltask/twoExternalTaskProcess.bpmn20.xml" })
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_ACTIVITY)
public void testBatchSuspensionByHistoricProcessInstanceQuery() {
// given
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");
ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("twoExternalTaskProcess");
// when
Batch suspendprocess = runtimeService.updateProcessInstanceSuspensionState().byHistoricProcessInstanceQuery(historyService.createHistoricProcessInstanceQuery().processInstanceIds(Sets.newHashSet(processInstance1.getId(), processInstance2.getId()))).suspendAsync();
helper.executeSeedJob(suspendprocess);
helper.executeJobs(suspendprocess);
// then
ProcessInstance p1c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance1.getId()).singleResult();
assertTrue(p1c.isSuspended());
ProcessInstance p2c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance2.getId()).singleResult();
assertTrue(p2c.isSuspended());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class ModifyVariableInSameTransactionTest method testInsertDeleteInsertTheSameVariable.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_AUDIT)
public void testInsertDeleteInsertTheSameVariable() {
BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess("serviceTaskProcess").startEvent().userTask("userTask").serviceTask("service").camundaClass(InsertDeleteInsertVariableDelegate.class).userTask("userTask1").endEvent().done();
ProcessDefinition processDefinition = testHelper.deployAndGetDefinition(bpmnModel);
VariableMap variables = Variables.createVariables().putValue("listVar", Arrays.asList(new int[] { 1, 2, 3 }));
ProcessInstance instance = engineRule.getRuntimeService().startProcessInstanceById(processDefinition.getId(), variables);
Task task = engineRule.getTaskService().createTaskQuery().singleResult();
engineRule.getTaskService().complete(task.getId());
VariableInstance variable = engineRule.getRuntimeService().createVariableInstanceQuery().processInstanceIdIn(instance.getId()).variableName("foo").singleResult();
assertNotNull(variable);
assertEquals("bar", variable.getValue());
List<HistoricVariableInstance> historyVariables = engineRule.getHistoryService().createHistoricVariableInstanceQuery().list();
for (HistoricVariableInstance historicVariable : historyVariables) {
if (variable.getName().equals(historicVariable.getName())) {
assertEquals(HistoricVariableInstance.STATE_CREATED, historicVariable.getState());
break;
}
}
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class CompensateEventTest method FAILING_testDeleteInstanceWithEventScopeExecution.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_ACTIVITY)
public void FAILING_testDeleteInstanceWithEventScopeExecution() {
// given
BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("foo").startEvent("start").subProcess("subProcess").embeddedSubProcess().startEvent("subProcessStart").endEvent("subProcessEnd").subProcessDone().userTask("userTask").done();
modelInstance = ModifiableBpmnModelInstance.modify(modelInstance).addSubProcessTo("subProcess").id("eventSubProcess").triggerByEvent().embeddedSubProcess().startEvent().compensateEventDefinition().compensateEventDefinitionDone().endEvent().done();
deployment(modelInstance);
long dayInMillis = 1000 * 60 * 60 * 24;
Date date1 = new Date(10 * dayInMillis);
ClockUtil.setCurrentTime(date1);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("foo");
// when
Date date2 = new Date(date1.getTime() + dayInMillis);
ClockUtil.setCurrentTime(date2);
runtimeService.deleteProcessInstance(processInstance.getId(), null);
// then
List<HistoricActivityInstance> historicActivityInstance = historyService.createHistoricActivityInstanceQuery().orderByActivityId().asc().list();
assertEquals(5, historicActivityInstance.size());
assertEquals("start", historicActivityInstance.get(0).getActivityId());
assertEquals(date1, historicActivityInstance.get(0).getEndTime());
assertEquals("subProcess", historicActivityInstance.get(1).getActivityId());
assertEquals(date1, historicActivityInstance.get(1).getEndTime());
assertEquals("subProcessEnd", historicActivityInstance.get(2).getActivityId());
assertEquals(date1, historicActivityInstance.get(2).getEndTime());
assertEquals("subProcessStart", historicActivityInstance.get(3).getActivityId());
assertEquals(date1, historicActivityInstance.get(3).getEndTime());
assertEquals("userTask", historicActivityInstance.get(4).getActivityId());
assertEquals(date2, historicActivityInstance.get(4).getEndTime());
}
Aggregations