Search in sources :

Example 1 with UserTaskDeadlineEventBody

use of org.kie.kogito.event.process.UserTaskDeadlineEventBody 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());
}
Also used : HumanTaskWorkItem(org.kie.kogito.process.workitem.HumanTaskWorkItem) KogitoWorkflowProcessInstance(org.kie.kogito.internal.process.runtime.KogitoWorkflowProcessInstance) UserTaskDeadlineDataEvent(org.kie.kogito.event.process.UserTaskDeadlineDataEvent) UserTaskDeadlineEventBody(org.kie.kogito.event.process.UserTaskDeadlineEventBody)

Example 2 with UserTaskDeadlineEventBody

use of org.kie.kogito.event.process.UserTaskDeadlineEventBody 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());
}
Also used : Mail(io.quarkus.mailer.Mail) HashMap(java.util.HashMap) UserTaskDeadlineDataEvent(org.kie.kogito.event.process.UserTaskDeadlineDataEvent) UserTaskDeadlineEventBody(org.kie.kogito.event.process.UserTaskDeadlineEventBody) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

UserTaskDeadlineDataEvent (org.kie.kogito.event.process.UserTaskDeadlineDataEvent)2 UserTaskDeadlineEventBody (org.kie.kogito.event.process.UserTaskDeadlineEventBody)2 Mail (io.quarkus.mailer.Mail)1 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 HashMap (java.util.HashMap)1 Test (org.junit.jupiter.api.Test)1 KogitoWorkflowProcessInstance (org.kie.kogito.internal.process.runtime.KogitoWorkflowProcessInstance)1 HumanTaskWorkItem (org.kie.kogito.process.workitem.HumanTaskWorkItem)1