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());
}
}
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);
}
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);
}
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);
}
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()));
}
Aggregations