Search in sources :

Example 1 with WorkItemDelegationEventType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemDelegationEventType in project midpoint by Evolveum.

the class TestDelegation method test120DelegateToUser2.

@Test
public void test120DelegateToUser2() throws Exception {
    final String TEST_NAME = "test120DelegateToUser2";
    TestUtil.displayTestTile(this, TEST_NAME);
    login(userLead1);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    workflowService.delegateWorkItem(workItemId, Collections.singletonList(ort(userLead2Oid)), ADD_ASSIGNEES, result);
    result.computeStatus();
    assertSuccess(result);
    WorkItemType workItem = getWorkItem(task, result);
    display("work item", workItem);
    PrismObject<TaskType> wfTask = getObjectViaRepo(TaskType.class, taskOid);
    display("task", wfTask);
    PrismAsserts.assertReferenceValues(ref(workItem.getAssigneeRef()), userLead1Oid, userLead2Oid);
    assertRefEquals("Wrong originalAssigneeRef", ort(userLead1Oid), workItem.getOriginalAssigneeRef());
    org.activiti.engine.task.Task activitiTask = activitiEngine.getTaskService().createTaskQuery().taskId(workItem.getExternalId()).singleResult();
    System.out.println("Activiti task: " + activitiTask);
    assertEquals("Wrong activiti assignee", "UserType:" + userLead1Oid, activitiTask.getAssignee());
    List<String> assignees = getAssignees(activitiTask);
    assertEquals("Wrong midpoint-assignee values", new HashSet<>(Arrays.asList("UserType:" + userLead1Oid, "UserType:" + userLead2Oid)), new HashSet<>(assignees));
    List<WorkItemDelegationEventType> events = WfContextUtil.getWorkItemEvents(wfTask.asObjectable().getWorkflowContext(), workItemId, WorkItemDelegationEventType.class);
    assertEquals("Wrong # of delegation events", 1, events.size());
// TODO check content
}
Also used : Task(com.evolveum.midpoint.task.api.Task) WorkItemDelegationEventType(com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemDelegationEventType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) WorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType) Test(org.testng.annotations.Test)

Example 2 with WorkItemDelegationEventType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemDelegationEventType in project midpoint by Evolveum.

the class TestDelegation method test130DelegateToUser3ByReplace.

@Test
public void test130DelegateToUser3ByReplace() throws Exception {
    final String TEST_NAME = "test130DelegateToUser3ByReplace";
    TestUtil.displayTestTile(this, TEST_NAME);
    login(userLead1);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    workflowService.delegateWorkItem(workItemId, Collections.singletonList(ort(userLead3Oid)), REPLACE_ASSIGNEES, result);
    result.computeStatus();
    assertSuccess(result);
    WorkItemType workItem = getWorkItem(task, result);
    display("work item", workItem);
    PrismObject<TaskType> wfTask = getObjectViaRepo(TaskType.class, taskOid);
    display("task", wfTask);
    PrismAsserts.assertReferenceValues(ref(workItem.getAssigneeRef()), userLead3Oid);
    assertRefEquals("Wrong originalAssigneeRef", ort(userLead1Oid), workItem.getOriginalAssigneeRef());
    org.activiti.engine.task.Task activitiTask = activitiEngine.getTaskService().createTaskQuery().taskId(workItem.getExternalId()).singleResult();
    System.out.println("Activiti task: " + activitiTask);
    assertEquals("Wrong activiti assignee", "UserType:" + userLead3Oid, activitiTask.getAssignee());
    List<String> assignees = getAssignees(activitiTask);
    assertEquals("Wrong midpoint-assignee values", Collections.singleton("UserType:" + userLead3Oid), new HashSet<>(assignees));
    List<WorkItemDelegationEventType> events = WfContextUtil.getWorkItemEvents(wfTask.asObjectable().getWorkflowContext(), workItemId, WorkItemDelegationEventType.class);
    assertEquals("Wrong # of delegation events", 2, events.size());
// TODO check content
}
Also used : Task(com.evolveum.midpoint.task.api.Task) WorkItemDelegationEventType(com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemDelegationEventType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) WorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType) Test(org.testng.annotations.Test)

Example 3 with WorkItemDelegationEventType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemDelegationEventType in project midpoint by Evolveum.

the class TestDelegation method test140DelegateToNoneByReplace.

@Test
public void test140DelegateToNoneByReplace() throws Exception {
    final String TEST_NAME = "test140DelegateToNoneByReplace";
    TestUtil.displayTestTile(this, TEST_NAME);
    login(userLead3);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    workflowService.delegateWorkItem(workItemId, Collections.emptyList(), REPLACE_ASSIGNEES, result);
    result.computeStatus();
    assertSuccess(result);
    WorkItemType workItem = getWorkItem(task, result);
    display("work item", workItem);
    PrismObject<TaskType> wfTask = getObjectViaRepo(TaskType.class, taskOid);
    display("task", wfTask);
    assertEquals("Wrong assigneeRef count", 0, workItem.getAssigneeRef().size());
    assertRefEquals("Wrong originalAssigneeRef", ort(userLead1Oid), workItem.getOriginalAssigneeRef());
    org.activiti.engine.task.Task activitiTask = activitiEngine.getTaskService().createTaskQuery().taskId(workItem.getExternalId()).singleResult();
    System.out.println("Activiti task: " + activitiTask);
    assertEquals("Wrong activiti assignee", null, activitiTask.getAssignee());
    assertEquals("Wrong # of assignees", 0, getAssignees(activitiTask).size());
    List<WorkItemDelegationEventType> events = WfContextUtil.getWorkItemEvents(wfTask.asObjectable().getWorkflowContext(), workItemId, WorkItemDelegationEventType.class);
    assertEquals("Wrong # of delegation events", 3, events.size());
// TODO check content
}
Also used : Task(com.evolveum.midpoint.task.api.Task) WorkItemDelegationEventType(com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemDelegationEventType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) WorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType) Test(org.testng.annotations.Test)

Aggregations

OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 Task (com.evolveum.midpoint.task.api.Task)3 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)3 WorkItemDelegationEventType (com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemDelegationEventType)3 WorkItemType (com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType)3 Test (org.testng.annotations.Test)3