Search in sources :

Example 11 with AuditTask

use of org.kie.internal.task.api.AuditTask in project jbpm by kiegroup.

the class AuditTaskDeleteTest method testTaskAuditServiceClear.

@Test
public void testTaskAuditServiceClear() {
    AuditTaskQueryBuilder queryBuilder = this.auditTaskQuery();
    List<AuditTask> tasks = queryBuilder.taskId(taskTestData[4].getId()).build().getResultList();
    assertEquals(1, tasks.size());
    queryBuilder.clear();
    List<AuditTask> data = this.auditTaskQuery().build().getResultList();
    assertEquals(10, data.size());
    this.clear();
    data = this.auditTaskQuery().build().getResultList();
    assertEquals(0, data.size());
}
Also used : AuditTaskQueryBuilder(org.kie.internal.task.query.AuditTaskQueryBuilder) AuditTask(org.kie.internal.task.api.AuditTask) Test(org.junit.Test)

Example 12 with AuditTask

use of org.kie.internal.task.api.AuditTask in project jbpm by kiegroup.

the class RuntimeDataServiceImplTest method testGetAuditTaskByStatus.

@Test
public void testGetAuditTaskByStatus() throws Exception {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    ProcessInstance instance = processService.getProcessInstance(processInstanceId);
    assertNotNull(instance);
    Collection<NodeInstance> activeNodes = ((WorkflowProcessInstanceImpl) instance).getNodeInstances();
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    NodeInstance node = activeNodes.iterator().next();
    assertNotNull(node);
    assertTrue(node instanceof WorkItemNodeInstance);
    Long workItemId = ((WorkItemNodeInstance) node).getWorkItemId();
    assertNotNull(workItemId);
    List<String> statuses = new ArrayList();
    statuses.add(Status.Reserved.toString());
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("statuses", statuses);
    QueryFilter queryFilter = new QueryFilter();
    queryFilter.setParams(params);
    List<AuditTask> auditTasks = runtimeDataService.getAllAuditTaskByStatus("salaboy", queryFilter);
    assertNotNull(auditTasks);
    assertEquals(1, auditTasks.size());
    assertEquals("Write a Document", auditTasks.get(0).getName());
    processService.abortProcessInstance(processInstanceId);
    processInstanceId = null;
}
Also used : HashMap(java.util.HashMap) WorkflowProcessInstanceImpl(org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl) ArrayList(java.util.ArrayList) WorkItemNodeInstance(org.jbpm.workflow.instance.node.WorkItemNodeInstance) AuditTask(org.kie.internal.task.api.AuditTask) QueryFilter(org.kie.internal.query.QueryFilter) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) NodeInstance(org.kie.api.runtime.process.NodeInstance) WorkItemNodeInstance(org.jbpm.workflow.instance.node.WorkItemNodeInstance) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 13 with AuditTask

use of org.kie.internal.task.api.AuditTask in project jbpm by kiegroup.

the class RuntimeDataServiceImplTest method testGetTaskAudit.

@Test
public void testGetTaskAudit() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    ProcessInstance instance = processService.getProcessInstance(processInstanceId);
    assertNotNull(instance);
    Collection<NodeInstance> activeNodes = ((WorkflowProcessInstanceImpl) instance).getNodeInstances();
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    NodeInstance node = activeNodes.iterator().next();
    assertNotNull(node);
    assertTrue(node instanceof WorkItemNodeInstance);
    Long workItemId = ((WorkItemNodeInstance) node).getWorkItemId();
    assertNotNull(workItemId);
    List<AuditTask> auditTasks = runtimeDataService.getAllAuditTask("salaboy", new QueryFilter(0, 10));
    assertNotNull(auditTasks);
    assertEquals(1, auditTasks.size());
    assertEquals("Write a Document", auditTasks.get(0).getName());
    processService.abortProcessInstance(processInstanceId);
    processInstanceId = null;
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) WorkflowProcessInstanceImpl(org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkItemNodeInstance(org.jbpm.workflow.instance.node.WorkItemNodeInstance) NodeInstance(org.kie.api.runtime.process.NodeInstance) WorkItemNodeInstance(org.jbpm.workflow.instance.node.WorkItemNodeInstance) AuditTask(org.kie.internal.task.api.AuditTask) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 14 with AuditTask

use of org.kie.internal.task.api.AuditTask in project jbpm by kiegroup.

the class RuntimeDataServiceImplTaskLookupTest method testGetAllAdminAuditTask.

@Test
public void testGetAllAdminAuditTask() {
    asssertProcessInstance();
    List<AuditTask> auditTasks = runtimeDataService.getAllAdminAuditTask("maciej", new QueryFilter());
    assertNotNull(auditTasks);
    assertEquals(0, auditTasks.size());
    auditTasks = runtimeDataService.getAllAdminAuditTask("kris", new QueryFilter());
    assertNotNull(auditTasks);
    assertEquals(0, auditTasks.size());
    auditTasks = runtimeDataService.getAllAdminAuditTask("tihomir", new QueryFilter());
    assertNotNull(auditTasks);
    assertEquals(0, auditTasks.size());
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) AuditTask(org.kie.internal.task.api.AuditTask) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 15 with AuditTask

use of org.kie.internal.task.api.AuditTask in project jbpm by kiegroup.

the class RuntimeDataServiceImplTaskLookupTest method testGetAllGroupAuditTasks.

@Test
public void testGetAllGroupAuditTasks() {
    asssertProcessInstance();
    List<AuditTask> auditTasks = runtimeDataService.getAllGroupAuditTask("maciej", new QueryFilter());
    assertNotNull(auditTasks);
    assertEquals(1, auditTasks.size());
    assertEquals("AdminsTask", auditTasks.get(0).getName());
    auditTasks = runtimeDataService.getAllGroupAuditTask("kris", new QueryFilter());
    assertNotNull(auditTasks);
    assertEquals(2, auditTasks.size());
    assertAuditTasksContain("AdminsTask", auditTasks);
    assertAuditTasksContain("ManagersTask", auditTasks);
    auditTasks = runtimeDataService.getAllGroupAuditTask("tihomir", new QueryFilter());
    assertNotNull(auditTasks);
    assertEquals(0, auditTasks.size());
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) AuditTask(org.kie.internal.task.api.AuditTask) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Aggregations

AuditTask (org.kie.internal.task.api.AuditTask)28 QueryFilter (org.kie.internal.query.QueryFilter)23 Test (org.junit.Test)19 Task (org.kie.api.task.model.Task)16 TaskFluent (org.jbpm.services.task.utils.TaskFluent)15 HumanTaskServicesBaseTest (org.jbpm.services.task.HumanTaskServicesBaseTest)12 TaskSummary (org.kie.api.task.model.TaskSummary)7 TaskEvent (org.kie.internal.task.api.model.TaskEvent)6 ArrayList (java.util.ArrayList)5 List (java.util.List)4 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)4 HashMap (java.util.HashMap)3 WorkflowProcessInstanceImpl (org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl)3 WorkItemNodeInstance (org.jbpm.workflow.instance.node.WorkItemNodeInstance)3 NodeInstance (org.kie.api.runtime.process.NodeInstance)3 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)3 TaskContext (org.kie.internal.task.api.TaskContext)3 TaskPersistenceContext (org.kie.internal.task.api.TaskPersistenceContext)3 Date (java.util.Date)2 I18NTextImpl (org.jbpm.services.task.impl.model.I18NTextImpl)2