use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testReassignNotStartedInvalidOrgEntities.
@Test(timeout = 10000)
public void testReassignNotStartedInvalidOrgEntities() 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);
Assertions.assertThatThrownBy(() -> {
userTaskAdminService.reassignWhenNotStarted(task.getId(), "2s", null);
}).hasMessage("Invalid org entity");
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testAddPotentialOwnersWrongDeploymentId.
@Test
public void testAddPotentialOwnersWrongDeploymentId() {
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");
assertThatExceptionOfType(TaskNotFoundException.class).isThrownBy(() -> {
userTaskAdminService.addPotentialOwners("wrong-one", task.getId(), false, factory.newUser("john"));
}).withMessageContaining("Task with id " + task.getId() + " is not associated with wrong-one");
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter());
Assertions.assertThat(tasks).hasSize(0);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testNotifyNotCompleted.
@Test(timeout = 10000)
public void testNotifyNotCompleted() 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);
Collection<TaskNotification> notifications = userTaskAdminService.getTaskNotifications(task.getId(), false);
Assertions.assertThat(notifications).isNotNull();
Assertions.assertThat(notifications).hasSize(0);
userTaskService.start(task.getId(), "salaboy");
List<OrganizationalEntity> recipients = new ArrayList<>();
recipients.add(factory.newUser("john"));
EmailNotification emailNotification = userTaskAdminService.buildEmailNotification("test", recipients, "Simple body", "Administrator", "");
userTaskAdminService.notifyWhenNotCompleted(task.getId(), "2s", emailNotification);
notifications = userTaskAdminService.getTaskNotifications(task.getId(), false);
Assertions.assertThat(notifications).isNotNull();
Assertions.assertThat(notifications).hasSize(1);
CountDownListenerFactory.getExistingTask("userTaskAdminService").waitTillCompleted();
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
Assertions.assertThat(tasks).hasSize(1);
notifications = userTaskAdminService.getTaskNotifications(task.getId(), true);
Assertions.assertThat(notifications).isNotNull();
Assertions.assertThat(notifications).hasSize(0);
notifications = userTaskAdminService.getTaskNotifications(task.getId(), false);
Assertions.assertThat(notifications).isNotNull();
Assertions.assertThat(notifications).hasSize(1);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testRemovePotentialOwners.
@Test
public void testRemovePotentialOwners() {
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");
userTaskAdminService.removePotentialOwners(task.getId(), factory.newUser("salaboy"));
List<TaskEvent> events = runtimeDataService.getTaskEvents(task.getId(), new QueryFilter());
Assertions.assertThat(events).hasSize(3);
TaskEvent updatedEvent = events.get(2);
Assertions.assertThat(updatedEvent.getMessage()).isEqualTo("Potential owners [salaboy] have been removed");
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
Assertions.assertThat(tasks).hasSize(0);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testNotifyNotStartedAndCancel.
@Test(timeout = 10000)
public void testNotifyNotStartedAndCancel() 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);
Collection<TaskNotification> notifications = userTaskAdminService.getTaskNotifications(task.getId(), false);
Assertions.assertThat(notifications).isNotNull();
Assertions.assertThat(notifications).hasSize(0);
List<OrganizationalEntity> recipients = new ArrayList<>();
recipients.add(factory.newUser("john"));
EmailNotification emailNotification = userTaskAdminService.buildEmailNotification("test", recipients, "Simple body", "Administrator", "");
long notificationId = userTaskAdminService.notifyWhenNotStarted(task.getId(), "2s", emailNotification);
notifications = userTaskAdminService.getTaskNotifications(task.getId(), true);
Assertions.assertThat(notifications).isNotNull();
Assertions.assertThat(notifications).hasSize(1);
userTaskAdminService.cancelNotification(task.getId(), notificationId);
notifications = userTaskAdminService.getTaskNotifications(task.getId(), true);
Assertions.assertThat(notifications).isNotNull();
Assertions.assertThat(notifications).hasSize(0);
}
Aggregations