use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskIdentityLinksTest method testOwnerLink.
public void testOwnerLink() {
Task task = taskService.newTask("task");
task.setOwner("owner");
taskService.saveTask(task);
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(task.getId());
assertNotNull(identityLinks);
assertEquals(1, identityLinks.size());
IdentityLink identityLink = identityLinks.get(0);
assertEquals(IdentityLinkType.OWNER, identityLink.getType());
assertEquals("owner", identityLink.getUserId());
assertEquals("task", identityLink.getTaskId());
taskService.deleteTask(task.getId(), true);
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskIdentityLinksTest method testCustomTypeUserLink.
@Deployment(resources = "org/camunda/bpm/engine/test/api/task/IdentityLinksProcess.bpmn20.xml")
public void testCustomTypeUserLink() {
runtimeService.startProcessInstanceByKey("IdentityLinksProcess");
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.addUserIdentityLink(taskId, "kermit", "interestee");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
IdentityLink identityLink = identityLinks.get(0);
assertNull(identityLink.getGroupId());
assertEquals("kermit", identityLink.getUserId());
assertEquals("interestee", identityLink.getType());
assertEquals(taskId, identityLink.getTaskId());
assertEquals(1, identityLinks.size());
taskService.deleteUserIdentityLink(taskId, "kermit", "interestee");
assertEquals(0, taskService.getIdentityLinksForTask(taskId).size());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskIdentityLinksTest method testCustomLinkGroupLink.
@Deployment(resources = "org/camunda/bpm/engine/test/api/task/IdentityLinksProcess.bpmn20.xml")
public void testCustomLinkGroupLink() {
runtimeService.startProcessInstanceByKey("IdentityLinksProcess");
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.addGroupIdentityLink(taskId, "muppets", "playing");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
IdentityLink identityLink = identityLinks.get(0);
assertEquals("muppets", identityLink.getGroupId());
assertNull("kermit", identityLink.getUserId());
assertEquals("playing", identityLink.getType());
assertEquals(taskId, identityLink.getTaskId());
assertEquals(1, identityLinks.size());
taskService.deleteGroupIdentityLink(taskId, "muppets", "playing");
assertEquals(0, taskService.getIdentityLinksForTask(taskId).size());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testProcessTaskAddCandidateGroupWithUpdatePersmissionOnTask.
public void testProcessTaskAddCandidateGroupWithUpdatePersmissionOnTask() {
// given
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectSingleTask().getId();
createGrantAuthorization(TASK, taskId, userId, UPDATE);
// when
taskService.addCandidateGroup(taskId, "accounting");
// then
disableAuthorization();
List<IdentityLink> linksForTask = taskService.getIdentityLinksForTask(taskId);
enableAuthorization();
assertNotNull(linksForTask);
assertEquals(1, linksForTask.size());
IdentityLink identityLink = linksForTask.get(0);
assertNotNull(identityLink);
assertEquals("accounting", identityLink.getGroupId());
assertEquals(IdentityLinkType.CANDIDATE, identityLink.getType());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTestByXml method testShouldAddProcessCandidateStarterGroupforAddIdentityLinkUsingXml.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/OneTaskProcessWithCandidateStarterGroups.bpmn20.xml" })
public void testShouldAddProcessCandidateStarterGroupforAddIdentityLinkUsingXml() {
// Pre test - Historical identity link is added as part of deployment
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 1);
// given
ProcessDefinition latestProcessDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY_CANDIDATE_STARTER_GROUP).singleResult();
assertNotNull(latestProcessDef);
List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(latestProcessDef.getId());
assertEquals(1, links.size());
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 1);
// query Test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.groupId(XML_GROUP).count(), 1);
}
Aggregations