use of org.kie.kogito.index.model.UserTaskInstance in project kogito-apps by kiegroup.
the class UserTaskInstanceEntityMapperTest method testMapToModel.
@Test
void testMapToModel() {
UserTaskInstance result = userTaskInstanceEntityMapper.mapToModel(userTaskInstanceEntity);
assertEquals(userTaskInstance, result);
}
use of org.kie.kogito.index.model.UserTaskInstance in project kogito-apps by kiegroup.
the class AbstractGraphQLRuntimesQueriesIT method testCreateTaskAttachment.
@Test
void testCreateTaskAttachment() {
String processInstanceId = UUID.randomUUID().toString();
String taskId = UUID.randomUUID().toString();
String attachmentName = "attachment name";
String attachmentUri = "https://drive.google.com/file/d/1Z_Lipg2jzY9TNewTaskAttachmentUri";
UserTaskInstanceDataEvent event = getUserTaskCloudEvent(taskId, processId, processInstanceId, null, null, "InProgress", user);
indexUserTaskCloudEvent(event);
checkOkResponse("{ \"query\" : \"mutation{ UserTaskInstanceAttachmentCreate(" + "taskId: \\\"" + taskId + "\\\", " + "user: \\\"" + user + "\\\", " + "groups: [\\\"managers\\\", \\\"users\\\", \\\"IT\\\"]," + "name: \\\"" + attachmentName + "\\\", " + "uri: \\\"" + attachmentUri + "\\\" " + ")}\"}");
ArgumentCaptor<UserTaskInstance> userTaskInstanceCaptor = ArgumentCaptor.forClass(UserTaskInstance.class);
verify(dataIndexApiClient).createUserTaskInstanceAttachment(eq("http://localhost:8080"), userTaskInstanceCaptor.capture(), eq(user), eq(groups), eq(attachmentName), eq(attachmentUri));
assertUserTaskInstance(userTaskInstanceCaptor.getValue(), taskId, processId, processInstanceId, user);
}
use of org.kie.kogito.index.model.UserTaskInstance in project kogito-apps by kiegroup.
the class KogitoRuntimeClientTest method testCreateUserTaskInstanceComment.
@Test
public void testCreateUserTaskInstanceComment() {
String commentInfo = "newComment";
setupIdentityMock();
when(webClientMock.post(any())).thenReturn(httpRequestMock);
when(httpRequestMock.putHeader(eq("Content-Type"), anyString())).thenReturn(httpRequestMock);
UserTaskInstance taskInstance = createUserTaskInstance(PROCESS_INSTANCE_ID, TASK_ID, "InProgress");
client.createUserTaskInstanceComment(SERVICE_URL, taskInstance, "jdoe", Collections.singletonList("managers"), commentInfo);
verify(client).sendPostWithBodyClientRequest(eq(webClientMock), eq("/travels/" + PROCESS_INSTANCE_ID + "/" + taskInstance.getName() + "/" + TASK_ID + "/comments?user=jdoe&group=managers"), eq("Adding comment to UserTask:" + taskInstance.getName() + " with id: " + taskInstance.getId()), eq(commentInfo), eq("text/plain"));
ArgumentCaptor<Handler> handlerCaptor = ArgumentCaptor.forClass(Handler.class);
verify(httpRequestMock).sendBuffer(any(), handlerCaptor.capture());
checkResponseHandling(handlerCaptor.getValue());
}
use of org.kie.kogito.index.model.UserTaskInstance in project kogito-apps by kiegroup.
the class KogitoRuntimeClientTest method testDeleteTaskInstanceAttachment.
@Test
public void testDeleteTaskInstanceAttachment() {
String attachmentId = "attachmentId";
setupIdentityMock();
when(webClientMock.delete(any())).thenReturn(httpRequestMock);
UserTaskInstance taskInstance = createUserTaskInstance(PROCESS_INSTANCE_ID, TASK_ID, "InProgress");
client.deleteUserTaskInstanceAttachment(SERVICE_URL, taskInstance, "jdoe", Collections.singletonList("managers"), attachmentId);
verify(client).sendDeleteClientRequest(eq(webClientMock), eq("/travels/" + PROCESS_INSTANCE_ID + "/" + taskInstance.getName() + "/" + TASK_ID + "/attachments/" + attachmentId + "?user=jdoe&group=managers"), eq("Delete attachment : " + attachmentId + "of Task: " + taskInstance.getName() + " with taskid: " + taskInstance.getId()));
ArgumentCaptor<Handler> handlerCaptor = ArgumentCaptor.forClass(Handler.class);
verify(httpRequestMock).send(handlerCaptor.capture());
checkResponseHandling(handlerCaptor.getValue());
}
use of org.kie.kogito.index.model.UserTaskInstance in project kogito-apps by kiegroup.
the class KogitoRuntimeClientTest method testUpdateUserTaskInstanceComment.
@Test
public void testUpdateUserTaskInstanceComment() {
String commentInfo = "NewCommentContent";
String commentId = "commentId";
setupIdentityMock();
when(webClientMock.put(any())).thenReturn(httpRequestMock);
when(httpRequestMock.putHeader(eq("Content-Type"), anyString())).thenReturn(httpRequestMock);
UserTaskInstance taskInstance = createUserTaskInstance(PROCESS_INSTANCE_ID, TASK_ID, "InProgress");
client.updateUserTaskInstanceComment(SERVICE_URL, taskInstance, "jdoe", Collections.singletonList("managers"), commentId, commentInfo);
verify(client).sendPutClientRequest(eq(webClientMock), eq("/travels/" + PROCESS_INSTANCE_ID + "/" + taskInstance.getName() + "/" + TASK_ID + "/comments/" + commentId + "?user=jdoe&group=managers"), eq("Update UserTask: " + taskInstance.getName() + " comment:" + commentId + " with taskid: " + taskInstance.getId()), eq(commentInfo), eq("text/plain"));
ArgumentCaptor<Handler> handlerCaptor = ArgumentCaptor.forClass(Handler.class);
verify(httpRequestMock).sendBuffer(any(), handlerCaptor.capture());
checkResponseHandling(handlerCaptor.getValue());
}
Aggregations