use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class MultiTenancyFormServiceCmdsTenantCheckTest method testGetTaskFormKeyWithDisabledTenantCheck.
@Test
public void testGetTaskFormKeyWithDisabledTenantCheck() {
testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/authorization/formKeyProcess.bpmn20.xml");
runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY);
Task task = taskService.createTaskQuery().singleResult();
identityService.setAuthentication("aUserId", null);
processEngineConfiguration.setTenantCheckEnabled(false);
formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
// then
assertEquals("aTaskFormKey", formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey()));
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class MultiTenancyFormServiceCmdsTenantCheckTest method testGetTaskFormKeyWithNoAuthenticatedTenant.
@Test
public void testGetTaskFormKeyWithNoAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/authorization/formKeyProcess.bpmn20.xml");
runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY);
Task task = taskService.createTaskQuery().singleResult();
identityService.setAuthentication("aUserId", null);
// then
thrown.expect(ProcessEngineException.class);
thrown.expectMessage("Cannot get the process definition '" + task.getProcessDefinitionId() + "' because it belongs to no authenticated tenant.");
// when
formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricDataCmdsTenantCheckTest method createTaskForTenant.
protected String createTaskForTenant(String tenantId) {
Task task = taskService.newTask();
task.setTenantId(TENANT_ONE);
taskService.saveTask(task);
taskService.complete(task.getId());
return task.getId();
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationSubProcessTest method shouldContinueParentProcessWithMultiInstanceInsideEmbeddedSubProcess.
@Test
public void shouldContinueParentProcessWithMultiInstanceInsideEmbeddedSubProcess() {
final BpmnModelInstance parentProcessInstance = Bpmn.createExecutableProcess("parentProcess").startEvent().subProcess().embeddedSubProcess().startEvent().callActivity("callActivity").calledElement("subprocess").multiInstance().cardinality("3").multiInstanceDone().endEvent().subProcessDone().userTask().endEvent().done();
final BpmnModelInstance subprocessInstance = Bpmn.createExecutableProcess("subprocess").startEvent().userTask("userTask").endEvent("subEnd").done();
testHelper.deploy(parentProcessInstance, subprocessInstance);
final String subprocessPrDefId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("subprocess").singleResult().getId();
// given I start the process, which waits at user task inside multiinstance subprocess
ProcessInstance parentPI = runtimeService.startProcessInstanceByKey("parentProcess");
final List<ProcessInstance> subprocesses = runtimeService.createProcessInstanceQuery().processDefinitionKey("subprocess").list();
assertEquals(3, subprocesses.size());
// when I do process instance modification
runtimeService.createModification(subprocessPrDefId).cancelAllForActivity("userTask").startAfterActivity("userTask").processInstanceIds(collectIds(subprocesses)).execute();
// then the parent process instance is still active
assertThat(runtimeService.createProcessInstanceQuery().count(), is(1L));
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getProcessInstanceId(), is(parentPI.getId()));
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationSubProcessTest method shouldContinueParentProcessWithMultiInstanceEmbeddedSubProcess.
@Test
public void shouldContinueParentProcessWithMultiInstanceEmbeddedSubProcess() {
final BpmnModelInstance parentProcessInstance = Bpmn.createExecutableProcess("parentProcess").startEvent().subProcess().embeddedSubProcess().startEvent().callActivity("callActivity").calledElement("subprocess").endEvent().subProcessDone().multiInstance().cardinality("3").multiInstanceDone().userTask().endEvent().done();
final BpmnModelInstance subprocessInstance = Bpmn.createExecutableProcess("subprocess").startEvent().userTask("userTask").endEvent("subEnd").done();
testHelper.deploy(parentProcessInstance, subprocessInstance);
final String subprocessPrDefId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("subprocess").singleResult().getId();
// given I start the process, which waits at user task inside multiinstance subprocess
ProcessInstance parentPI = runtimeService.startProcessInstanceByKey("parentProcess");
final List<ProcessInstance> subprocesses = runtimeService.createProcessInstanceQuery().processDefinitionKey("subprocess").list();
assertEquals(3, subprocesses.size());
// when I do process instance modification
runtimeService.createModification(subprocessPrDefId).cancelAllForActivity("userTask").startAfterActivity("userTask").processInstanceIds(collectIds(subprocesses)).execute();
// then the parent process instance is still active
assertThat(runtimeService.createProcessInstanceQuery().count(), is(1L));
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getProcessInstanceId(), is(parentPI.getId()));
}
Aggregations