use of org.kie.kogito.event.process.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.event.process.UserTaskInstanceEventBody in project kogito-apps by kiegroup.
the class AbstractGraphQLRuntimesQueriesIT method testDeleteUserTaskInstanceAttachment.
@Test
void testDeleteUserTaskInstanceAttachment() {
String processInstanceId = UUID.randomUUID().toString();
String taskId = UUID.randomUUID().toString();
String attachmentId = UUID.randomUUID().toString();
UserTaskInstanceDataEvent event = getUserTaskCloudEvent(taskId, processId, processInstanceId, null, null, "InProgress", user);
UserTaskInstanceEventBody userTaskInstance = event.getData();
userTaskInstance.setAttachments(List.of(getTaskAttachment(attachmentId, null, null, null)));
indexUserTaskCloudEvent(event);
checkOkResponse("{ \"query\" : \"mutation { UserTaskInstanceAttachmentDelete ( " + "user: \\\"" + user + "\\\", " + "groups: [\\\"managers\\\", \\\"users\\\", \\\"IT\\\"]," + "attachmentId: \\\"" + attachmentId + "\\\"" + ")}\"}");
ArgumentCaptor<UserTaskInstance> userTaskInstanceCaptor = ArgumentCaptor.forClass(UserTaskInstance.class);
verify(dataIndexApiClient).deleteUserTaskInstanceAttachment(eq("http://localhost:8080"), userTaskInstanceCaptor.capture(), eq(user), eq(groups), eq(attachmentId));
assertUserTaskInstance(userTaskInstanceCaptor.getValue(), taskId, processId, processInstanceId, user);
}
use of org.kie.kogito.event.process.UserTaskInstanceEventBody in project kogito-apps by kiegroup.
the class AbstractGraphQLRuntimesQueriesIT method testDeleteUserTaskInstanceComment.
@Test
void testDeleteUserTaskInstanceComment() {
String processInstanceId = UUID.randomUUID().toString();
String taskId = UUID.randomUUID().toString();
String commentId = UUID.randomUUID().toString();
UserTaskInstanceDataEvent event = getUserTaskCloudEvent(taskId, processId, processInstanceId, null, null, "InProgress", user);
UserTaskInstanceEventBody userTaskInstance = event.getData();
userTaskInstance.setComments(List.of(getTaskComment(commentId, null, null)));
indexUserTaskCloudEvent(event);
checkOkResponse("{ \"query\" : \"mutation { UserTaskInstanceCommentDelete ( " + "user: \\\"" + user + "\\\", " + "groups: [\\\"managers\\\", \\\"users\\\", \\\"IT\\\"]," + "commentId: \\\"" + commentId + "\\\"" + ")}\"}");
ArgumentCaptor<UserTaskInstance> userTaskInstanceCaptor = ArgumentCaptor.forClass(UserTaskInstance.class);
verify(dataIndexApiClient).deleteUserTaskInstanceComment(eq("http://localhost:8080"), userTaskInstanceCaptor.capture(), eq(user), eq(groups), eq(commentId));
assertUserTaskInstance(userTaskInstanceCaptor.getValue(), taskId, processId, processInstanceId, user);
}
use of org.kie.kogito.event.process.UserTaskInstanceEventBody in project kogito-apps by kiegroup.
the class AbstractGraphQLRuntimesQueriesIT method testUpdateUserTaskInstanceAttachment.
@Test
void testUpdateUserTaskInstanceAttachment() {
String processInstanceId = UUID.randomUUID().toString();
String taskId = UUID.randomUUID().toString();
String attachmentId = UUID.randomUUID().toString();
String attachmentName = "attachmentName";
String attachmentUri = "attachmentUri";
UserTaskInstanceDataEvent event = getUserTaskCloudEvent(taskId, processId, processInstanceId, null, null, "InProgress", user);
UserTaskInstanceEventBody userTaskInstance = event.getData();
userTaskInstance.setAttachments(List.of(getTaskAttachment(attachmentId, null, null, null)));
indexUserTaskCloudEvent(event);
checkOkResponse("{ \"query\" : \"mutation { UserTaskInstanceAttachmentUpdate ( " + "user: \\\"" + user + "\\\", " + "groups: [\\\"managers\\\", \\\"users\\\", \\\"IT\\\"]," + "attachmentId: \\\"" + attachmentId + "\\\"" + "name: \\\"" + attachmentName + "\\\"" + "uri: \\\"" + attachmentUri + "\\\"" + ")}\"}");
ArgumentCaptor<UserTaskInstance> userTaskInstanceCaptor = ArgumentCaptor.forClass(UserTaskInstance.class);
verify(dataIndexApiClient).updateUserTaskInstanceAttachment(eq("http://localhost:8080"), userTaskInstanceCaptor.capture(), eq(user), eq(groups), eq(attachmentId), eq(attachmentName), eq(attachmentUri));
assertUserTaskInstance(userTaskInstanceCaptor.getValue(), taskId, processId, processInstanceId, user);
}
use of org.kie.kogito.event.process.UserTaskInstanceEventBody in project kogito-apps by kiegroup.
the class AbstractGraphQLRuntimesQueriesIT method testUpdateUserTaskInstanceComment.
@Test
void testUpdateUserTaskInstanceComment() {
String processInstanceId = UUID.randomUUID().toString();
String taskId = UUID.randomUUID().toString();
String commentId = UUID.randomUUID().toString();
String commentContent = "commentContent";
UserTaskInstanceDataEvent event = getUserTaskCloudEvent(taskId, processId, processInstanceId, null, null, "InProgress", user);
UserTaskInstanceEventBody userTaskInstance = event.getData();
userTaskInstance.setComments(List.of(getTaskComment(commentId, null, null)));
indexUserTaskCloudEvent(event);
checkOkResponse("{ \"query\" : \"mutation { UserTaskInstanceCommentUpdate ( " + "user: \\\"" + user + "\\\", " + "groups: [\\\"managers\\\", \\\"users\\\", \\\"IT\\\"]," + "commentId: \\\"" + commentId + "\\\"" + "comment: \\\"" + commentContent + "\\\"" + ")}\"}");
ArgumentCaptor<UserTaskInstance> userTaskInstanceCaptor = ArgumentCaptor.forClass(UserTaskInstance.class);
verify(dataIndexApiClient).updateUserTaskInstanceComment(eq("http://localhost:8080"), userTaskInstanceCaptor.capture(), eq(user), eq(groups), eq(commentId), eq(commentContent));
assertUserTaskInstance(userTaskInstanceCaptor.getValue(), taskId, processId, processInstanceId, user);
}
Aggregations