Search in sources :

Example 46 with QueryFilter

use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.

the class RuntimeDataServiceImplTest method testGetTaskOwned.

@Test
public void testGetTaskOwned() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jboss.qa.bpms.HumanTask");
    assertNotNull(processInstanceId);
    ProcessInstance instance = processService.getProcessInstance(processInstanceId);
    assertNotNull(instance);
    List<TaskSummary> tasks = runtimeDataService.getTasksOwned("john", new QueryFilter(0, 5));
    assertNotNull(tasks);
    assertEquals(1, tasks.size());
    TaskSummary userTask = tasks.get(0);
    assertNotNull(userTask);
    assertEquals(processInstanceId, userTask.getProcessInstanceId());
    assertEquals("Hello", userTask.getName());
    assertEquals("john", userTask.getActualOwnerId());
    assertEquals("Reserved", userTask.getStatusId());
    assertNotNull(userTask.getActualOwner());
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) TaskSummary(org.kie.api.task.model.TaskSummary) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 47 with QueryFilter

use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.

the class RuntimeDataServiceImplSecurityTest method testGetProcessInstancesByProcessId.

@Test
public void testGetProcessInstancesByProcessId() {
    // let's grant managers role so process can be started
    List<String> roles = new ArrayList<String>();
    roles.add("managers");
    roles.add("employees");
    identityProvider.setRoles(roles);
    Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstances(new QueryContext());
    assertNotNull(instances);
    assertEquals(0, instances.size());
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    instances = runtimeDataService.getProcessInstancesByProcessDefinition("org.jbpm.writedocument", new QueryContext());
    assertNotNull(instances);
    assertEquals(1, instances.size());
    ProcessInstanceDesc instance = instances.iterator().next();
    assertEquals(1, (int) instance.getState());
    assertEquals("org.jbpm.writedocument", instance.getProcessId());
    List<TaskSummary> taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter(0, 10));
    assertNotNull(taskSummaries);
    assertEquals(1, taskSummaries.size());
    processService.abortProcessInstance(processInstanceId);
    processInstanceId = null;
    instances = runtimeDataService.getProcessInstancesByProcessDefinition("org.jbpm.writedocument", new QueryContext());
    assertNotNull(instances);
    assertEquals(1, instances.size());
    instance = instances.iterator().next();
    assertEquals(3, (int) instance.getState());
    assertEquals("org.jbpm.writedocument", instance.getProcessId());
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) ArrayList(java.util.ArrayList) TaskSummary(org.kie.api.task.model.TaskSummary) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc) QueryContext(org.kie.api.runtime.query.QueryContext) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 48 with QueryFilter

use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.

the class RuntimeDataServiceImplTaskLookupTest method testGetTasksAssignedAsPotentialOwnerWithGroups.

@Test
public void testGetTasksAssignedAsPotentialOwnerWithGroups() {
    asssertProcessInstance();
    List<TaskSummary> taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("maciej", fakeGroupIds, new QueryFilter());
    assertNotNull(taskSummaries);
    assertEquals(1, taskSummaries.size());
    taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("kris", fakeGroupIds, new QueryFilter());
    assertNotNull(taskSummaries);
    assertEquals(2, taskSummaries.size());
    taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("tihomir", fakeGroupIds, new QueryFilter());
    assertNotNull(taskSummaries);
    assertEquals(0, taskSummaries.size());
    processService.abortProcessInstance(processInstanceId);
    processInstanceId = null;
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) TaskSummary(org.kie.api.task.model.TaskSummary) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 49 with QueryFilter

use of org.kie.internal.query.QueryFilter 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 50 with QueryFilter

use of org.kie.internal.query.QueryFilter 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

QueryFilter (org.kie.internal.query.QueryFilter)149 Test (org.junit.Test)127 TaskSummary (org.kie.api.task.model.TaskSummary)122 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)52 HashMap (java.util.HashMap)47 AbstractCaseServicesBaseTest (org.jbpm.casemgmt.impl.util.AbstractCaseServicesBaseTest)31 KModuleDeploymentServiceTest (org.jbpm.kie.services.test.KModuleDeploymentServiceTest)26 AuditTask (org.kie.internal.task.api.AuditTask)25 ArrayList (java.util.ArrayList)24 QueryContext (org.kie.api.runtime.query.QueryContext)24 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)23 CaseInstance (org.jbpm.casemgmt.api.model.instance.CaseInstance)21 Task (org.kie.api.task.model.Task)19 CaseFileInstance (org.jbpm.casemgmt.api.model.instance.CaseFileInstance)18 TaskFluent (org.jbpm.services.task.utils.TaskFluent)17 TaskEvent (org.kie.internal.task.api.model.TaskEvent)17 HumanTaskServicesBaseTest (org.jbpm.services.task.HumanTaskServicesBaseTest)14 Status (org.kie.api.task.model.Status)13 OrganizationalEntity (org.kie.api.task.model.OrganizationalEntity)11 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)10