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