use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class AbstractTaskSerializationTest method statusInCommandSerialization.
@Test
public void statusInCommandSerialization() throws Exception {
Assume.assumeTrue(getType().equals(TestType.JAXB));
addClassesToSerializationContext(GetTaskAssignedAsPotentialOwnerCommand.class);
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Completed);
statuses.add(Status.Exited);
List<String> groupIds = new ArrayList<String>();
groupIds.add("team");
groupIds.add("region");
QueryFilter filter = new QueryFilter(0, 0, "order", false);
GetTaskAssignedAsPotentialOwnerCommand cmd = new GetTaskAssignedAsPotentialOwnerCommand("user", groupIds, statuses, filter);
GetTaskAssignedAsPotentialOwnerCommand copyCmd = testRoundTrip(cmd);
Assertions.assertThat(cmd).isEqualToComparingFieldByFieldRecursively(copyCmd);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class EThreadInfoTest method testHumanTaskThreadInfo.
@Test
public void testHumanTaskThreadInfo() throws Exception {
Long pid = startProcessInstance(THREAD_INFO_PROCESS_ID);
processService.signalProcessInstance(pid, "start", "usertask");
listener.waitTillCompleted();
List<TaskSummary> taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter());
Assertions.assertThat(taskSummaries).isNotNull().hasSize(1);
userTaskService.start(taskSummaries.get(0).getId(), "john");
userTaskService.complete(taskSummaries.get(0).getId(), "john", new HashMap<String, Object>());
Assertions.assertThat(hasNodeLeft(pid, "usertask")).isTrue();
Assertions.assertThat(hasNodeLeft(pid, "User Task")).isTrue();
Collection<VariableDesc> stackTraceHistory = getStackTrace(pid);
Collection<VariableDesc> threadNameHistory = getThreadName(pid);
System.out.println("====stackTraceHistory====");
System.out.println(stackTraceHistory);
System.out.println("====stackTraceHistoryLast====");
System.out.println(stackTraceHistory.iterator().next().getNewValue());
System.out.println("====stackTraceHistorySize====");
System.out.println(stackTraceHistory.size());
System.out.println("====threadNameHistory====");
System.out.println(threadNameHistory);
System.out.println("====threadNameHistoryLast====");
System.out.println(threadNameHistory.iterator().next().getNewValue());
// in this scenario we have to check the middle value, so it is the old one in the last history entry
Assertions.assertThat(threadNameHistory.iterator().next().getOldValue()).startsWith("EE");
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class EMigrateProcessTest method testUpgradeProcessInstanceWithNodeMapping.
@Test
public void testUpgradeProcessInstanceWithNodeMapping() throws Exception {
Long processInstanceId = processService.startProcess(kieJar, EVALUATION_PROCESS_ID_V1);
if (processInstanceId != null) {
archive.getPids().add(processInstanceId);
}
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(1);
TaskSummary task = tasks.get(0);
Assertions.assertThat(tasks.get(0).getName()).isEqualTo("Evaluate items");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V1);
Assertions.assertThat(task.getProcessInstanceId()).isEqualTo(processInstanceId);
Map<String, String> nodeMapping = new HashMap<String, String>();
nodeMapping.put("_4E8E7545-FB70-494E-9136-2B9ABE655889", "_56FB3E50-DEDD-415B-94DD-0357C91836B9");
// migrate process instance to evaluation 2 in container 2
MigrationReport report = migrationService.migrate(kieJar, processInstanceId, kieJar2, EVALUATION_PROCESS_ID_V2, nodeMapping);
Assertions.assertThat(report).isNotNull();
Assertions.assertThat(report.isSuccessful()).isTrue();
// migrated to Approve user task
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(1);
task = tasks.get(0);
Assertions.assertThat(task.getName()).isEqualTo("Approve");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar2);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V2);
Assertions.assertThat(task.getProcessInstanceId()).isEqualTo(processInstanceId);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class EGetTaskTest method testFormName.
@Test
public void testFormName() {
Map<String, Object> params = new HashMap<>();
params.put("userName", "johndoe");
Long pid = ejb.startProcess(ProcessDefinitions.HUMAN_TASK_WITH_FORM, params);
List<Status> statusList = new ArrayList<>();
statusList.add(Status.Reserved);
List<TaskSummary> summaryList = ejb.getTasksByStatusByProcessInstanceId(pid, statusList, new QueryFilter(0, 1));
Assertions.assertThat(summaryList).isNotNull().isNotEmpty();
TaskSummary summary = summaryList.get(0);
Task task = ejb.getTask(summary.getId());
String formName = ((InternalTask) task).getFormName();
Assertions.assertThat(formName).as("Expected different form name.").isEqualTo("UserNameInputTask");
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class EGetTaskTest method testTaskQuery.
@Test
public void testTaskQuery() {
Long pid = ejb.startProcess(ProcessDefinitions.HUMAN_TASK);
List<TaskSummary> taskList = ejb.getTasksOwned(userId, new QueryFilter(0, 5));
Assertions.assertThat(taskList.size()).isLessThanOrEqualTo(5);
TaskSummary task = null;
for (TaskSummary potentialTask : taskList) {
System.out.println("id=" + potentialTask.getProcessInstanceId());
if (potentialTask.getProcessInstanceId() == pid) {
task = potentialTask;
}
}
Assertions.assertThat(task).isNotNull();
Assertions.assertThat(task.getName()).isEqualTo("Hello");
Assertions.assertThat(task.getStatus()).isEqualTo(Status.Reserved);
Assertions.assertThat(task.getActualOwnerId()).isEqualTo(userId);
}
Aggregations