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());
}
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());
}
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;
}
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());
}
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());
}
Aggregations