Search in sources :

Example 66 with QueryFilter

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

the class UserTaskAdminServiceImplTest method testAddRemoveInputData.

@Test
public void testAddRemoveInputData() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    Assertions.assertThat(processInstanceId).isNotNull();
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    Assertions.assertThat(tasks).hasSize(1);
    TaskSummary task = tasks.get(0);
    Map<String, Object> inputData = userTaskService.getTaskInputContentByTaskId(task.getId());
    Assertions.assertThat(inputData).doesNotContainKey("added-input");
    userTaskAdminService.addTaskInput(task.getId(), "added-input", "just a test");
    inputData = userTaskService.getTaskInputContentByTaskId(task.getId());
    Assertions.assertThat(inputData).containsKey("added-input");
    Assertions.assertThat(inputData.get("added-input")).isEqualTo("just a test");
    Assertions.assertThat(inputData).doesNotContainKey("added-input2");
    Assertions.assertThat(inputData).doesNotContainKey("added-input3");
    Map<String, Object> extra = new HashMap<>();
    extra.put("added-input2", "1");
    extra.put("added-input3", "2");
    userTaskAdminService.addTaskInputs(task.getId(), extra);
    inputData = userTaskService.getTaskInputContentByTaskId(task.getId());
    Assertions.assertThat(inputData).containsKey("added-input2");
    Assertions.assertThat(inputData.get("added-input2")).isEqualTo("1");
    Assertions.assertThat(inputData).containsKey("added-input3");
    Assertions.assertThat(inputData.get("added-input3")).isEqualTo("2");
    userTaskAdminService.removeTaskInputs(task.getId(), "added-input2", "added-input3");
    inputData = userTaskService.getTaskInputContentByTaskId(task.getId());
    Assertions.assertThat(inputData).doesNotContainKey("added-input2");
    Assertions.assertThat(inputData).doesNotContainKey("added-input3");
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) HashMap(java.util.HashMap) TaskSummary(org.kie.api.task.model.TaskSummary) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 67 with QueryFilter

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

the class UserTaskAdminServiceImplTest method testAddPotentialOwnersToNonExistentTask.

@Test
public void testAddPotentialOwnersToNonExistentTask() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    Assertions.assertThat(processInstanceId).isNotNull();
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    Assertions.assertThat(tasks).hasSize(1);
    TaskSummary task = tasks.get(0);
    userTaskService.release(task.getId(), "salaboy");
    Assertions.assertThatThrownBy(() -> userTaskAdminService.addPotentialOwners(15456, false, factory.newUser("john"))).hasMessageContaining("Task with id 15456 was not found");
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) TaskSummary(org.kie.api.task.model.TaskSummary) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 68 with QueryFilter

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

the class UserTaskAdminServiceImplTest method testNotifyNotStarted.

@Test(timeout = 10000)
public void testNotifyNotStarted() throws Exception {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    Assertions.assertThat(processInstanceId).isNotNull();
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    Assertions.assertThat(tasks).hasSize(1);
    TaskSummary task = tasks.get(0);
    List<OrganizationalEntity> recipients = new ArrayList<>();
    recipients.add(factory.newUser("john"));
    EmailNotification emailNotification = userTaskAdminService.buildEmailNotification("test", recipients, "Simple body", "Administrator", "");
    userTaskAdminService.notifyWhenNotStarted(task.getId(), "2s", emailNotification);
    CountDownListenerFactory.getExistingTask("userTaskAdminService").waitTillCompleted();
    tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    Assertions.assertThat(tasks).hasSize(1);
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) OrganizationalEntity(org.kie.api.task.model.OrganizationalEntity) TaskSummary(org.kie.api.task.model.TaskSummary) ArrayList(java.util.ArrayList) EmailNotification(org.kie.internal.task.api.model.EmailNotification) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 69 with QueryFilter

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

the class UserTaskAdminServiceImplTest method testAddPotentialOwnersNotBusinessAdmin.

@Test
public void testAddPotentialOwnersNotBusinessAdmin() {
    identityProvider.setName("notAdmin");
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    Assertions.assertThat(processInstanceId).isNotNull();
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    Assertions.assertThat(tasks).hasSize(1);
    TaskSummary task = tasks.get(0);
    userTaskService.release(task.getId(), "salaboy");
    Assertions.assertThatThrownBy(() -> userTaskAdminService.addPotentialOwners(task.getId(), false, factory.newUser("john"))).hasMessageContaining("User notAdmin is not business admin of task 1");
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) TaskSummary(org.kie.api.task.model.TaskSummary) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 70 with QueryFilter

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

the class HumanTaskQueryFilterTest method testFilterParams.

/**
 * TODO - Need to pass in parameters which do make sense.
 */
@Test
@BZ("1132157")
public void testFilterParams() {
    startHumanTaskProcess(10, "john's task", "john");
    QueryFilter queryFilter = new QueryFilter("x=1,y=2", null, "t.name", true);
    List<TaskSummary> taskList = taskService.getTasksAssignedAsPotentialOwner("john", null, null, queryFilter);
    logger.debug("### Potential owner task list: " + taskList);
    Assertions.assertThat(taskList).hasSize(1);
    abortHumanTaskProcess(10);
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) TaskSummary(org.kie.api.task.model.TaskSummary) Test(org.junit.Test) BZ(qa.tools.ikeeper.annotation.BZ)

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