use of org.kie.kogito.services.event.impl.UserTaskInstanceEventBody in project kogito-runtimes by kiegroup.
the class PublishEventIT method assertUserTaskInstanceEvent.
protected UserTaskInstanceEventBody assertUserTaskInstanceEvent(DataEvent<?> event, String taskName, String taskDescription, String taskPriority, String taskState, String processId, String nodeName) {
assertThat(event).isInstanceOf(UserTaskInstanceDataEvent.class);
UserTaskInstanceEventBody body = ((UserTaskInstanceDataEvent) event).getData();
assertThat(body).isNotNull();
assertThat(body.getId()).isNotNull();
assertThat(body.getTaskName()).isEqualTo(taskName);
assertThat(body.getTaskDescription()).isEqualTo(taskDescription);
assertThat(body.getReferenceName()).isEqualTo(nodeName);
assertThat(body.getTaskPriority()).isEqualTo(taskPriority);
assertThat(body.getStartDate()).isNotNull();
assertThat(body.getState()).isEqualTo(taskState);
if (taskState.equals("Completed") || taskState.equals("Aborted")) {
assertThat(body.getCompleteDate()).isNotNull();
} else {
assertThat(body.getCompleteDate()).isNull();
}
assertThat(event.getSource().toString()).isEqualTo("http://myhost/" + processId);
assertThat(event.getTime()).isBeforeOrEqualTo(ZonedDateTime.now().toOffsetDateTime());
assertThat(((UserTaskInstanceDataEvent) event).getKogitoAddons()).isEqualTo("test");
return body;
}
use of org.kie.kogito.services.event.impl.UserTaskInstanceEventBody in project kogito-runtimes by kiegroup.
the class UserTaskInstanceDataEventCodecTest method setUp.
@BeforeEach
void setUp() {
codec = new UserTaskInstanceDataEventCodec();
String source = "testSource";
String kogitoAddons = "testKogitoAddons";
Comment comment = new Comment("testCommentId", "testCommentUpdatedBy");
comment.setContent("testCommentContent");
comment.setUpdatedAt(new Date());
Set<Comment> comments = Collections.singleton(comment);
Attachment attachment = new Attachment("testAttachmentId", "testAttachmentUpdatedBy");
attachment.setContent(URI.create("test.attachment.test"));
attachment.setName("testAttachmentName");
attachment.setUpdatedAt(new Date());
Set<Attachment> attachments = Collections.singleton(attachment);
Map<String, String> metaData = new HashMap<>();
metaData.put(ProcessInstanceEventBody.ID_META_DATA, "testKogitoProcessinstanceId");
metaData.put(ProcessInstanceEventBody.ROOT_ID_META_DATA, "testKogitoRootProcessinstanceId");
metaData.put(ProcessInstanceEventBody.PROCESS_ID_META_DATA, "testKogitoProcessId");
metaData.put(ProcessInstanceEventBody.ROOT_PROCESS_ID_META_DATA, "testKogitoRootProcessId");
metaData.put(UserTaskInstanceEventBody.UT_STATE_META_DATA, "testKogitoUserTaskinstanceState");
metaData.put(UserTaskInstanceEventBody.UT_ID_META_DATA, "testKogitoUserTaskinstanceId");
UserTaskInstanceEventBody body = UserTaskInstanceEventBody.create().id("testId").taskName("testTaskName").taskDescription("testTaskDescription").taskPriority("testTaskPriority").referenceName("testReferenceName").startDate(new Date()).completeDate(new Date()).state("testState").actualOwner("testActualOwner").potentialUsers(Collections.singleton("testPotentialUsers")).potentialGroups(Collections.singleton("testPotentialGroups")).excludedUsers(Collections.singleton("testExcludedUsers")).adminUsers(Collections.singleton("testAdminUsers")).adminGroups(Collections.singleton("testAdminGroups")).inputs(Collections.singletonMap("testInputsKey", "testInputsValue")).outputs(Collections.singletonMap("testOutputsKey", "testOutputsValue")).processInstanceId("testKogitoProcessinstanceId").rootProcessInstanceId("testKogitoRootProcessinstanceId").processId("testKogitoProcessId").rootProcessId("testKogitoRootProcessId").comments(comments).attachments(attachments).build();
event = new UserTaskInstanceDataEvent(source, kogitoAddons, metaData, body);
}
Aggregations