use of org.kie.kogito.taskassigning.service.TaskData in project kogito-apps by kiegroup.
the class TaskUtilTest method fromTaskDataEvents.
@Test
void fromTaskDataEvents() {
TaskData taskData1 = mock(TaskData.class);
TaskData taskData2 = mock(TaskData.class);
List<TaskData> result = TaskUtil.fromTaskDataEvents(Arrays.asList(new TaskDataEvent(taskData1), new TaskDataEvent(taskData2)));
assertThat(result).containsExactly(taskData1, taskData2);
}
use of org.kie.kogito.taskassigning.service.TaskData in project kogito-apps by kiegroup.
the class TaskUtilTest method fromTaskData.
@Test
void fromTaskData() {
Task task = TaskUtil.fromTaskData(new TaskData() {
@Override
public String getId() {
return TASK_ID;
}
@Override
public String getName() {
return TASK_NAME;
}
@Override
public String getState() {
return STATE;
}
@Override
public String getDescription() {
return TASK_DESCRIPTION;
}
@Override
public String getReferenceName() {
return REFERENCE_NAME;
}
@Override
public String getPriority() {
return TASK_PRIORITY;
}
@Override
public String getProcessInstanceId() {
return PROCESS_INSTANCE_ID;
}
@Override
public String getProcessId() {
return PROCESS_ID;
}
@Override
public String getRootProcessInstanceId() {
return ROOT_PROCESS_INSTANCE_ID;
}
@Override
public String getRootProcessId() {
return ROOT_PROCESS_ID;
}
@Override
public String getActualOwner() {
return ACTUAL_OWNER;
}
@Override
public Set<String> getPotentialUsers() {
return new HashSet<>(POTENTIAL_USERS);
}
@Override
public Set<String> getPotentialGroups() {
return new HashSet<>(POTENTIAL_GROUPS);
}
@Override
public Set<String> getAdminUsers() {
return new HashSet<>(ADMIN_USERS);
}
@Override
public Set<String> getAdminGroups() {
return new HashSet<>(ADMIN_GROUPS);
}
@Override
public Set<String> getExcludedUsers() {
return new HashSet<>(EXCLUDED_USERS);
}
@Override
public ZonedDateTime getStarted() {
return START_DATE;
}
@Override
public ZonedDateTime getCompleted() {
return COMPLETED_DATE;
}
@Override
public ZonedDateTime getLastUpdate() {
return LAST_UPDATE;
}
@Override
public JsonNode getInputs() {
return TASK_INPUTS;
}
@Override
public String getEndpoint() {
return ENDPOINT;
}
});
assertThat(task.getId()).isEqualTo(TASK_ID);
assertThat(task.getDescription()).isEqualTo(TASK_DESCRIPTION);
assertThat(task.getName()).isEqualTo(TASK_NAME);
assertThat(task.getPriority()).isEqualTo(TASK_PRIORITY);
assertThat(task.getProcessInstanceId()).isEqualTo(PROCESS_INSTANCE_ID);
assertThat(task.getProcessId()).isEqualTo(PROCESS_ID);
assertThat(task.getRootProcessId()).isEqualTo(ROOT_PROCESS_ID);
assertThat(task.getRootProcessInstanceId()).isEqualTo(ROOT_PROCESS_INSTANCE_ID);
assertThat(task.getState()).isEqualTo(STATE);
assertThat(task.getAdminGroups()).containsExactlyInAnyOrder(ADMIN_GROUPS.toArray(new String[0]));
assertThat(task.getAdminUsers()).containsExactlyInAnyOrder(ADMIN_USERS.toArray(new String[0]));
assertThat(task.getCompleted()).isEqualTo(COMPLETED_DATE);
assertThat(task.getStarted()).isEqualTo(START_DATE);
assertThat(task.getExcludedUsers()).containsExactlyInAnyOrder(EXCLUDED_USERS.toArray(new String[0]));
assertThat(task.getPotentialGroups()).containsExactlyInAnyOrder(POTENTIAL_GROUPS.toArray(new String[0]));
assertThat(task.getPotentialUsers()).containsExactlyInAnyOrder(POTENTIAL_USERS.toArray(new String[0]));
assertThat(task.getReferenceName()).isEqualTo(REFERENCE_NAME);
assertThat(task.getLastUpdate()).isEqualTo(LAST_UPDATE);
assertThat(task.getEndpoint()).isEqualTo(ENDPOINT);
assertThat(task.getInputData()).containsExactlyInAnyOrderEntriesOf(buildExpectedInputs());
}
use of org.kie.kogito.taskassigning.service.TaskData in project kogito-apps by kiegroup.
the class TaskUtilTest method fromUserTaskEvent.
@Test
void fromUserTaskEvent() {
UserTaskEvent userTaskEvent = new UserTaskEvent();
userTaskEvent.setTaskId(TASK_ID);
userTaskEvent.setDescription(TASK_DESCRIPTION);
userTaskEvent.setName(TASK_NAME);
userTaskEvent.setPriority(TASK_PRIORITY);
userTaskEvent.setProcessInstanceId(PROCESS_INSTANCE_ID);
userTaskEvent.setProcessId(PROCESS_ID);
userTaskEvent.setRootProcessInstanceId(ROOT_PROCESS_INSTANCE_ID);
userTaskEvent.setRootProcessId(ROOT_PROCESS_ID);
userTaskEvent.setState(STATE);
userTaskEvent.setActualOwner(ACTUAL_OWNER);
userTaskEvent.setAdminGroups(ADMIN_GROUPS);
userTaskEvent.setAdminUsers(ADMIN_USERS);
userTaskEvent.setCompleted(COMPLETED_DATE);
userTaskEvent.setStarted(START_DATE);
userTaskEvent.setExcludedUsers(EXCLUDED_USERS);
userTaskEvent.setPotentialGroups(POTENTIAL_GROUPS);
userTaskEvent.setPotentialUsers(POTENTIAL_USERS);
userTaskEvent.setReferenceName(REFERENCE_NAME);
userTaskEvent.setLastUpdate(LAST_UPDATE);
userTaskEvent.setInputs(TASK_INPUTS);
userTaskEvent.setEndpoint(ENDPOINT);
TaskData result = TaskUtil.fromUserTaskEvent(userTaskEvent);
assertThat(result).isNotNull();
assertExpectedTaskData(result);
}
use of org.kie.kogito.taskassigning.service.TaskData in project kogito-apps by kiegroup.
the class EventUtilTest method mockTaskDataEvent.
private static TaskDataEvent mockTaskDataEvent(String taskId, ZonedDateTime lastUpdate) {
TaskData taskData = mock(TaskData.class);
doReturn(taskId).when(taskData).getId();
doReturn(lastUpdate).when(taskData).getLastUpdate();
return new TaskDataEvent(taskData);
}
use of org.kie.kogito.taskassigning.service.TaskData in project kogito-apps by kiegroup.
the class TaskUtilTest method fromUserTaskInstances.
@Test
void fromUserTaskInstances() {
UserTaskInstance userTaskInstance = new UserTaskInstance();
userTaskInstance.setId(TASK_ID);
userTaskInstance.setDescription(TASK_DESCRIPTION);
userTaskInstance.setName(TASK_NAME);
userTaskInstance.setPriority(TASK_PRIORITY);
userTaskInstance.setProcessInstanceId(PROCESS_INSTANCE_ID);
userTaskInstance.setProcessId(PROCESS_ID);
userTaskInstance.setRootProcessInstanceId(ROOT_PROCESS_INSTANCE_ID);
userTaskInstance.setRootProcessId(ROOT_PROCESS_ID);
userTaskInstance.setState(STATE);
userTaskInstance.setActualOwner(ACTUAL_OWNER);
userTaskInstance.setAdminGroups(ADMIN_GROUPS);
userTaskInstance.setAdminUsers(ADMIN_USERS);
userTaskInstance.setCompleted(COMPLETED_DATE);
userTaskInstance.setStarted(START_DATE);
userTaskInstance.setExcludedUsers(EXCLUDED_USERS);
userTaskInstance.setPotentialGroups(POTENTIAL_GROUPS);
userTaskInstance.setPotentialUsers(POTENTIAL_USERS);
userTaskInstance.setReferenceName(REFERENCE_NAME);
userTaskInstance.setLastUpdate(LAST_UPDATE);
userTaskInstance.setInputs(TASK_INPUTS);
userTaskInstance.setEndpoint(ENDPOINT);
List<TaskData> result = TaskUtil.fromUserTaskInstances(Collections.singletonList(userTaskInstance));
assertThat(result).hasSize(1);
TaskData taskData = result.get(0);
assertExpectedTaskData(taskData);
}
Aggregations