RemoteProcessRuntimeDataServiceImpl extends AbstractKieServerService implements ProcessRuntimeDataService { @Override public ProcessInstanceSummary getProcessInstance(ProcessInstanceKey processInstanceKey) { if (processInstanceKey == null || processInstanceKey.isValid() == false) { return null; } QueryServicesClient queryServicesClient = getClient(processInstanceKey.getServerTemplateId(), QueryServicesClient.class); ProcessInstance processInstance = queryServicesClient.findProcessInstanceById(processInstanceKey.getProcessInstanceId()); return new ProcessInstanceSummaryMapper(processInstanceKey.getServerTemplateId()).apply(processInstance); }  @Override ProcessInstanceSummary getProcessInstance(ProcessInstanceKey processInstanceKey); @Override List<NodeInstanceSummary> getProcessInstanceActiveNodes(ProcessInstanceKey processInstanceKey); @Override List<NodeInstanceSummary> getProcessInstanceCompletedNodes(ProcessInstanceKey processInstanceKey); @Override ProcessInstanceDiagramSummary getProcessInstanceDiagramSummary(ProcessInstanceKey processInstanceKey, String completedNodeColor,
                                                                          String completedNodeBorderColor, String activeNodeBorderColor); @Override List<TimerInstanceSummary> getProcessInstanceTimerInstances(ProcessInstanceKey processInstanceKey); @Override void triggerProcessInstanceNode(ProcessInstanceKey processInstanceKey,
                                           Long nodeId); @Override void cancelProcessInstanceNode(ProcessInstanceKey processInstanceKey,
                                          Long nodeInstanceId); @Override void reTriggerProcessInstanceNode(ProcessInstanceKey processInstanceKey,
                                             Long nodeInstanceId); @Override void rescheduleTimerInstance(ProcessInstanceKey processInstanceKey,
                                        TimerInstanceSummary summary); @Override List<ProcessSummary> getProcesses(String serverTemplateId,
                                             Integer page,
                                             Integer pageSize,
                                             String sort,
                                             Boolean sortOrder); @Override ProcessSummary getProcess(final ProcessDefinitionKey processDefinitionKey); @Override List<ProcessSummary> getProcessesByFilter(String serverTemplateId,
                                                     String textSearch,
                                                     Integer page,
                                                     Integer pageSize,
                                                     String sort,
                                                     Boolean sortOrder); @Override List<TaskDefSummary> getProcessUserTasks(final String serverTemplateId,
                                                    final String containerId,
                                                    final String processId); @Override WorkItemSummary getWorkItemByProcessInstanceId(final String serverTemplateId,
                                                          final String containerId,
                                                          final Long processInstanceId,
                                                          final Long workItemId); @Override ProcessInstanceSummary getProcessInstanceByCorrelationKey(String serverTemplateId, String correlationKey); static int NOT_FOUND_ERROR_CODE; }
@Test public void getProcessInstanceDetailsTest() { final Long processInstanceId = 1L; final TaskSummary taskSummaryMock = mock(TaskSummary.class); final TaskSummaryList taskSummaryListSpy = spy(new TaskSummaryList(singletonList(taskSummaryMock))); final ProcessInstance processInstanceSpy = spy(ProcessInstance.builder() .activeUserTasks(taskSummaryListSpy) .build()); when(queryServicesClient.findProcessInstanceById(processInstanceId)).thenReturn(processInstanceSpy); service.getProcessInstance(new ProcessInstanceKey(serverTemplateId, containerId, processInstanceId)); verify(processInstanceSpy).getProcessId(); verify(processInstanceSpy).getState(); verify(processInstanceSpy).getContainerId(); verify(processInstanceSpy).getProcessVersion(); verify(processInstanceSpy).getCorrelationKey(); verify(processInstanceSpy).getParentId(); verify(processInstanceSpy).getSlaCompliance(); verify(processInstanceSpy).getSlaDueDate(); verifyActiveUserTasks(taskSummaryListSpy, taskSummaryMock); verifyCurrentActivities(processInstanceId); }