use of org.kie.kogito.event.process.UserTaskDeadlineDataEvent in project kogito-runtimes by kiegroup.
the class ProcessInstanceEventBatch method buildUserTaskDeadlineEvent.
private DataEvent<?> buildUserTaskDeadlineEvent(HumanTaskDeadlineEvent event) {
HumanTaskWorkItem workItem = event.getWorkItem();
KogitoWorkflowProcessInstance pi = (KogitoWorkflowProcessInstance) event.getProcessInstance();
UserTaskDeadlineEventBody body = UserTaskDeadlineEventBody.create(workItem.getStringId(), event.getNotification()).state(workItem.getPhaseStatus()).taskName(workItem.getTaskName()).taskDescription(workItem.getTaskDescription()).taskPriority(workItem.getTaskPriority()).referenceName(workItem.getReferenceName()).actualOwner(workItem.getActualOwner()).startDate(workItem.getStartDate()).processInstanceId(pi.getStringId()).rootProcessInstanceId(pi.getRootProcessInstanceId()).processId(pi.getProcessId()).rootProcessId(pi.getRootProcessId()).inputs(workItem.getParameters()).outputs(workItem.getResults()).build();
return new UserTaskDeadlineDataEvent("UserTaskDeadline" + event.getType(), buildSource(pi.getProcessId()), addons.toString(), body, pi.getStringId(), pi.getRootProcessInstanceId(), pi.getProcessId(), pi.getRootProcessId());
}
use of org.kie.kogito.event.process.UserTaskDeadlineDataEvent in project kogito-runtimes by kiegroup.
the class QuarkusMailSenderTest method testMail.
@Test
void testMail() {
UserTaskDeadlineDataEvent event = Mockito.mock(UserTaskDeadlineDataEvent.class);
Map<String, Object> notification = new HashMap<>();
notification.put(MailInfo.SUBJECT_PROPERTY, SUBJECT);
notification.put(MailInfo.BODY_PROPERTY, TEXT);
notification.put(MailInfo.FROM_PROPERTY, "realbetisbalompie@gmail.com");
notification.put(MailInfo.TO_PROPERTY, TO + ",fulanito@doesnotexist.com");
UserTaskDeadlineEventBody eventData = UserTaskDeadlineEventBody.create("1", notification).build();
Mockito.when(event.getData()).thenReturn(eventData);
sender.onDeadline(event);
List<Mail> messages = mailBox.getMessagesSentTo(TO);
assertEquals(1, messages.size());
Mail message = messages.get(0);
assertEquals(TEXT, message.getText());
assertEquals(SUBJECT, message.getSubject());
}
Aggregations