Search in sources :

Example 81 with Task

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()));
}
Also used : Task(org.camunda.bpm.engine.task.Task) Test(org.junit.Test)

Example 82 with Task

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());
}
Also used : Task(org.camunda.bpm.engine.task.Task) Test(org.junit.Test)

Example 83 with Task

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();
}
Also used : Task(org.camunda.bpm.engine.task.Task)

Example 84 with Task

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()));
}
Also used : Task(org.camunda.bpm.engine.task.Task) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 85 with Task

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()));
}
Also used : Task(org.camunda.bpm.engine.task.Task) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Aggregations

Task (org.camunda.bpm.engine.task.Task)1654 Deployment (org.camunda.bpm.engine.test.Deployment)788 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)660 Test (org.junit.Test)648 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)230 ScenarioUnderTest (org.camunda.bpm.qa.upgrade.ScenarioUnderTest)190 HashMap (java.util.HashMap)140 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)139 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)108 Execution (org.camunda.bpm.engine.runtime.Execution)99 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)98 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)87 Job (org.camunda.bpm.engine.runtime.Job)71 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)67 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)52 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)46 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)46 Times (org.camunda.bpm.qa.upgrade.Times)46 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)45 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)45