use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class TaskServiceTest method testGetIdentityLinksWithCandidateUser.
public void testGetIdentityLinksWithCandidateUser() {
Task task = taskService.newTask();
taskService.saveTask(task);
String taskId = task.getId();
identityService.saveUser(identityService.newUser("kermit"));
taskService.addCandidateUser(taskId, "kermit");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
assertEquals(1, identityLinks.size());
assertEquals("kermit", identityLinks.get(0).getUserId());
assertNull(identityLinks.get(0).getGroupId());
assertEquals(IdentityLinkType.CANDIDATE, identityLinks.get(0).getType());
//cleanup
taskService.deleteTask(taskId, true);
identityService.deleteUser("kermit");
}
use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class TaskServiceTest method testGetIdentityLinksWithCandidateGroup.
public void testGetIdentityLinksWithCandidateGroup() {
Task task = taskService.newTask();
taskService.saveTask(task);
String taskId = task.getId();
identityService.saveGroup(identityService.newGroup("muppets"));
taskService.addCandidateGroup(taskId, "muppets");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
assertEquals(1, identityLinks.size());
assertEquals("muppets", identityLinks.get(0).getGroupId());
assertNull(identityLinks.get(0).getUserId());
assertEquals(IdentityLinkType.CANDIDATE, identityLinks.get(0).getType());
//cleanup
taskService.deleteTask(taskId, true);
identityService.deleteGroup("muppets");
}
use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class TaskServiceTest method testGetIdentityLinksWithNonExistingAssignee.
public void testGetIdentityLinksWithNonExistingAssignee() {
Task task = taskService.newTask();
taskService.saveTask(task);
String taskId = task.getId();
taskService.claim(taskId, "nonExistingAssignee");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
assertEquals(1, identityLinks.size());
assertEquals("nonExistingAssignee", identityLinks.get(0).getUserId());
assertNull(identityLinks.get(0).getGroupId());
assertEquals(IdentityLinkType.ASSIGNEE, identityLinks.get(0).getType());
//cleanup
taskService.deleteTask(taskId, true);
}
use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class TaskServiceTest method testGetIdentityLinksWithNonExistingOwner.
public void testGetIdentityLinksWithNonExistingOwner() {
Task task = taskService.newTask();
taskService.saveTask(task);
String taskId = task.getId();
taskService.claim(taskId, "nonExistingOwner");
taskService.delegateTask(taskId, "nonExistingAssignee");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
assertEquals(2, identityLinks.size());
IdentityLink assignee = identityLinks.get(0);
assertEquals("nonExistingAssignee", assignee.getUserId());
assertNull(assignee.getGroupId());
assertEquals(IdentityLinkType.ASSIGNEE, assignee.getType());
IdentityLink owner = identityLinks.get(1);
assertEquals("nonExistingOwner", owner.getUserId());
assertNull(owner.getGroupId());
assertEquals(IdentityLinkType.OWNER, owner.getType());
//cleanup
taskService.deleteTask(taskId, true);
}
use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class TaskIdentityLinksTest method testDeleteCandidateUser.
@Deployment(resources = "org/activiti/engine/test/api/task/TaskIdentityLinksTest.testDeleteCandidateUser.bpmn20.xml")
public void testDeleteCandidateUser() {
runtimeService.startProcessInstanceByKey("TaskIdentityLinks");
String taskId = taskService.createTaskQuery().singleResult().getId();
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
assertEquals(1, identityLinks.size());
IdentityLink identityLink = identityLinks.get(0);
assertEquals("user", identityLink.getUserId());
}
Aggregations