use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testStandaloneTaskUpdateVariablesLocalWithReadPermissionOnTask.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_AUDIT)
public void testStandaloneTaskUpdateVariablesLocalWithReadPermissionOnTask() {
// given
String taskId = "myTask";
createTask(taskId);
createGrantAuthorization(TASK, taskId, userId, UPDATE);
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
// when (1)
((TaskServiceImpl) taskService).updateVariablesLocal(taskId, getVariables(), null);
// then (1)
disableAuthorization();
verifyQueryResults(query, 1);
enableAuthorization();
// when (2)
((TaskServiceImpl) taskService).updateVariablesLocal(taskId, null, Arrays.asList(VARIABLE_NAME));
// then (2)
disableAuthorization();
verifyQueryResults(query, 0);
enableAuthorization();
// when (3)
((TaskServiceImpl) taskService).updateVariablesLocal(taskId, getVariables(), Arrays.asList(VARIABLE_NAME));
// then (3)
disableAuthorization();
verifyQueryResults(query, 0);
enableAuthorization();
deleteTask(taskId, true);
List<HistoricVariableInstance> deletedVariables = historyService.createHistoricVariableInstanceQuery().includeDeleted().list();
Assert.assertEquals("DELETED", deletedVariables.get(0).getState());
Assert.assertEquals("DELETED", deletedVariables.get(1).getState());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testDeleteProcessInstanceWithoutSubprocessInstances.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
@Test
public void testDeleteProcessInstanceWithoutSubprocessInstances() {
// given a process instance with subprocesses
BpmnModelInstance calling = prepareComplexProcess("A", "B", "C");
BpmnModelInstance calledA = prepareSimpleProcess("A");
BpmnModelInstance calledB = prepareSimpleProcess("B");
BpmnModelInstance calledC = prepareSimpleProcess("C");
testRule.deploy(calling, calledA, calledB, calledC);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("calling");
List<ProcessInstance> subInstances = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.getId()).list();
// when the process instance is deleted and we do skip sub processes
String id = processInstance.getId();
runtimeService.deleteProcessInstance(id, "test_purposes", false, true, false, true);
// then
testRule.assertProcessEnded(id);
for (ProcessInstance subInstance : subInstances) {
testRule.assertProcessNotEnded(subInstance.getId());
}
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testDeleteProcessInstanceSkipIoMappings.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcessWithIoMappings.bpmn20.xml" })
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
@Test
public void testDeleteProcessInstanceSkipIoMappings() {
// given a process instance
ProcessInstance instance = runtimeService.startProcessInstanceByKey("ioMappingProcess");
// when the process instance is deleted and we do skip the io mappings
runtimeService.deleteProcessInstance(instance.getId(), null, false, true, true);
// then
testRule.assertProcessEnded(instance.getId());
assertEquals(1, historyService.createHistoricVariableInstanceQuery().processInstanceId(instance.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 testCascadingDeleteSubprocessInstanceWithoutSkipIoMappings.
@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 testCascadingDeleteSubprocessInstanceWithoutSkipIoMappings() {
// 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 not skip the io mappings
runtimeService.deleteProcessInstance(instance.getId(), "test_purposes", false, true, false);
// then
testRule.assertProcessEnded(instance.getId());
assertEquals(2, historyService.createHistoricVariableInstanceQuery().processInstanceId(instance2.getId()).list().size());
assertEquals(1, historyService.createHistoricVariableInstanceQuery().variableName("inputMappingExecuted").count());
assertEquals(1, historyService.createHistoricVariableInstanceQuery().variableName("outputMappingExecuted").count());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class UpdateProcessInstancesSuspendStateAsyncTest method testBatchActivationByHistoricProcessInstanceQuery.
@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 testBatchActivationByHistoricProcessInstanceQuery() {
// 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);
Batch activateprocess = runtimeService.updateProcessInstanceSuspensionState().byHistoricProcessInstanceQuery(historyService.createHistoricProcessInstanceQuery().processInstanceIds(Sets.newHashSet(processInstance1.getId(), processInstance2.getId()))).activateAsync();
helper.executeSeedJob(activateprocess);
helper.executeJobs(activateprocess);
// then
ProcessInstance p1c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance1.getId()).singleResult();
assertFalse(p1c.isSuspended());
ProcessInstance p2c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance2.getId()).singleResult();
assertFalse(p2c.isSuspended());
}
Aggregations