use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testFailToRestartProcessInstanceAsyncWithOtherTenantId.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testFailToRestartProcessInstanceAsyncWithOtherTenantId() {
// given
ProcessInstance processInstance = startAndDeleteProcessInstance(TENANT_ONE, PROCESS);
identityService.setAuthentication("user", null, Collections.singletonList(TENANT_TWO));
try {
// when
runtimeService.restartProcessInstances(processInstance.getProcessDefinitionId()).startBeforeActivity("userTask").processInstanceIds(processInstance.getId()).executeAsync();
} catch (ProcessEngineException e) {
assertThat(e.getMessage(), containsString("Cannot restart process instances of process definition '" + processInstance.getProcessDefinitionId() + "' because it belongs to no authenticated tenant."));
}
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testFailToRestartProcessInstanceAsyncWithOtherTenantIdByHistoricProcessInstanceQuery.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testFailToRestartProcessInstanceAsyncWithOtherTenantIdByHistoricProcessInstanceQuery() {
// given
ProcessInstance processInstance = startAndDeleteProcessInstance(TENANT_ONE, PROCESS);
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId());
identityService.setAuthentication("user", null, Collections.singletonList(TENANT_TWO));
try {
// when
runtimeService.restartProcessInstances(processInstance.getProcessDefinitionId()).startBeforeActivity("userTask").historicProcessInstanceQuery(query).executeAsync();
} catch (ProcessEngineException e) {
assertThat(e.getMessage(), containsString("processInstanceIds is empty"));
}
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstantiationTest method testFailToRestartProcessInstanceSyncWithOtherTenantIdByHistoricProcessInstanceQuery.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testFailToRestartProcessInstanceSyncWithOtherTenantIdByHistoricProcessInstanceQuery() {
// given
ProcessInstance processInstance = startAndDeleteProcessInstance(TENANT_ONE, PROCESS);
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId());
identityService.setAuthentication("user", null, Collections.singletonList(TENANT_TWO));
try {
// when
runtimeService.restartProcessInstances(processInstance.getProcessDefinitionId()).startBeforeActivity("userTask").historicProcessInstanceQuery(query).execute();
fail("expected exception");
} catch (BadUserRequestException e) {
// then
assertThat(e.getMessage(), containsString("processInstanceIds is empty"));
}
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testDeleteProcessInstanceWithoutSkipIoMappings.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcessWithIoMappings.bpmn20.xml" })
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
@Test
public void testDeleteProcessInstanceWithoutSkipIoMappings() {
// given a process instance
ProcessInstance instance = runtimeService.startProcessInstanceByKey("ioMappingProcess");
// when the process instance is deleted and we do not skip the io mappings
runtimeService.deleteProcessInstance(instance.getId(), null, false, true, false);
// then
testRule.assertProcessEnded(instance.getId());
assertEquals(2, historyService.createHistoricVariableInstanceQuery().processInstanceId(instance.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 RuntimeServiceTest method testDeleteProcessInstanceWithSubprocessInstances.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
@Test
public void testDeleteProcessInstanceWithSubprocessInstances() {
// given a process instance with subprocesses
BpmnModelInstance calling = prepareComplexProcess("A", "B", "A");
BpmnModelInstance calledA = prepareSimpleProcess("A");
BpmnModelInstance calledB = prepareSimpleProcess("B");
testRule.deploy(calling, calledA, calledB);
ProcessInstance instance = runtimeService.startProcessInstanceByKey("calling");
List<ProcessInstance> subInstances = runtimeService.createProcessInstanceQuery().superProcessInstanceId(instance.getId()).list();
// when the process instance is deleted and we do not skip sub processes
String id = instance.getId();
runtimeService.deleteProcessInstance(id, "test_purposes", false, true, false, false);
// then
testRule.assertProcessEnded(id);
for (ProcessInstance subInstance : subInstances) {
testRule.assertProcessEnded(subInstance.getId());
}
}
Aggregations