Search in sources :

Example 76 with Task

use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.

the class MultiTenancyTaskCountByCandidateGroupTest method createTask.

protected void createTask(String groupId, String tenantId) {
    Task task = taskService.newTask();
    task.setTenantId(tenantId);
    taskService.saveTask(task);
    if (groupId != null) {
        taskService.addCandidateGroup(task.getId(), groupId);
        taskIds.add(task.getId());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task)

Example 77 with Task

use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.

the class MultiTenancyTaskServiceTest method testStandaloneTaskCannotChangeTenantIdIfNull.

public void testStandaloneTaskCannotChangeTenantIdIfNull() {
    // given a persistent task without tenant id
    Task task = taskService.newTask();
    taskService.saveTask(task);
    task = taskService.createTaskQuery().singleResult();
    // if
    // change the tenant id
    task.setTenantId(tenant1);
    // an exception is thrown on 'save'
    try {
        taskService.saveTask(task);
        fail("Expected an exception");
    } catch (ProcessEngineException e) {
        assertTextPresent("ENGINE-03072 Cannot change tenantId of Task", e.getMessage());
    }
    // Finally, delete task
    deleteTasks(task);
}
Also used : Task(org.camunda.bpm.engine.task.Task) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 78 with Task

use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.

the class MultiTenancyTaskServiceTest method testStandaloneTaskCreateWithTenantId.

public void testStandaloneTaskCreateWithTenantId() {
    // given a transient task with tenant id
    Task task = taskService.newTask();
    task.setTenantId(tenant1);
    // if
    // it is saved
    taskService.saveTask(task);
    // then
    // when I load it, the tenant id is preserved
    task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
    assertEquals(tenant1, task.getTenantId());
    // Finally, delete task
    deleteTasks(task);
}
Also used : Task(org.camunda.bpm.engine.task.Task)

Example 79 with Task

use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.

the class MultiTenancyTaskServiceTest method testStandaloneTaskCannotChangeTenantId.

public void testStandaloneTaskCannotChangeTenantId() {
    // given a persistent task with tenant id
    Task task = taskService.newTask();
    task.setTenantId(tenant1);
    taskService.saveTask(task);
    task = taskService.createTaskQuery().singleResult();
    // if
    // change the tenant id
    task.setTenantId(tenant2);
    // an exception is thrown on 'save'
    try {
        taskService.saveTask(task);
        fail("Expected an exception");
    } catch (ProcessEngineException e) {
        assertTextPresent("ENGINE-03072 Cannot change tenantId of Task", e.getMessage());
    }
    // Finally, delete task
    deleteTasks(task);
}
Also used : Task(org.camunda.bpm.engine.task.Task) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 80 with Task

use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.

the class MultiTenancyFormServiceCmdsTenantCheckTest method testGetTaskFormKeyWithAuthenticatedTenant.

// getTaskFormKey
@Test
public void testGetTaskFormKeyWithAuthenticatedTenant() {
    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, Arrays.asList(TENANT_ONE));
    assertEquals("aTaskFormKey", formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey()));
}
Also used : Task(org.camunda.bpm.engine.task.Task) 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