ProcessInstanceDiagramPresenter implements ProcessInstanceSummaryAware { protected void onDiagramNodeSelectedByDoubleClick(final String nodeId) { List<NodeInstanceSummary> nodeInstanceSummaries = nodeInstances.stream().filter(node -> node.getNodeUniqueName().equals(nodeId)).collect(toList()); List<NodeInstanceSummary> nodeInstancesSubProcess = nodeInstanceSummaries.stream().filter(node -> node.getType().equals("SubProcessNode")).collect(toList()); if (nodeInstancesSubProcess.size() == 1) { openNavigationConfirmPopup(nodeInstancesSubProcess.get(0)); } if (nodeInstancesSubProcess.size() > 1) { alertPopup.alert(constants.AlertPopupTitle(), constants.AlertPopupMessage()); } if (nodeInstancesSubProcess.size() < 1) { view.setNodeInstances(nodeInstanceSummaries); view.setTimerInstances(getTimerInstanceForNode(nodeId)); } view.setValue(processNodes.stream().filter(node -> node.getUniqueId().equals(nodeId)).findFirst().orElseGet(() -> new ProcessNodeSummary())); }  @PostConstruct void init(); @Override void setProcessInstance(ProcessInstanceSummary processInstance); void onProcessInstanceSelectionEvent(@Observes final ProcessInstanceSelectionEvent event); void displayImage(final String svgContent, final String containerId); void onDiagramNodeSelected(final String nodeId); void onProcessNodeTrigger(final ProcessNodeSummary node); void listenParentProcessInstanceSelected(); void onNodeInstanceReTrigger(final NodeInstanceSummary node); void onNodeInstanceCancel(final NodeInstanceSummary node); void onTimerInstanceReschedule(final TimerInstanceSummary summary); void onShow(); @WorkbenchPartTitle String getName(); @WorkbenchPartView IsWidget getView(); @Inject void setProcessService(final Caller<ProcessRuntimeDataService> processService); void onProcessDiagramExpandEvent(@Observes ProcessDiagramExpandEvent event);  }
@Test public void testOnDiagramNodeSelectedByDoubleClick() { ProcessInstanceSummary processInstance = ProcessInstanceSummary.builder().withServerTemplateId("serverTemplateId").withDeploymentId("containerId").withProcessInstanceId(1L).withState(ProcessInstance.STATE_ACTIVE).build(); ProcessNodeSummary timerNode = new ProcessNodeSummary(1L, "name-1", "Timer", "_11"); List<ProcessNodeSummary> nodes = Arrays.asList(new ProcessNodeSummary(0L, " ", "Start", "_0"), timerNode, new ProcessNodeSummary(2L, " ", "Split", "_2")); NodeInstanceSummary timerNodeInstance = NodeInstanceSummary.builder().withId(1l).withName("name-1").withNodeUniqueName("_2").withType("Timer").withCompleted(false).build(); List<NodeInstanceSummary> nodeInstances = Arrays.asList( timerNodeInstance, NodeInstanceSummary.builder().withId(2L).withName(" ").withNodeUniqueName("_1").withType("SubProcessNode").withCompleted(false).build(), NodeInstanceSummary.builder().withId(3L).withName("name-3").withNodeUniqueName("_3").withType("HumanTask").withCompleted(true).build(), NodeInstanceSummary.builder().withId(4L).withName(" ").withNodeUniqueName("_4").withType("End").withCompleted(true).build() ); TimerInstanceSummary timerInstance = TimerInstanceSummary.builder().withId(1l).withTimerId(0l).withName("t1").build(); List<TimerInstanceSummary> timerInstances = Arrays.asList( timerInstance, TimerInstanceSummary.builder().withId(2L).withTimerId(1l).withName("t2").build() ); ProcessInstanceDiagramSummary summary = new ProcessInstanceDiagramSummary(); summary.setProcessDefinition(ProcessSummary.builder().nodes(nodes).timers(singletonList(TimerSummary.builder().id(0l).uniqueId("_1").build())).build()); summary.setNodeInstances(nodeInstances); summary.setTimerInstances(timerInstances); when(processService.getProcessInstanceDiagramSummary(eq(processInstance.getProcessInstanceKey()), anyString(), anyString(), anyString())).thenReturn(summary); presenter.setProcessInstance(processInstance); presenter.onDiagramNodeSelectedByDoubleClick("_1"); verify(view, never()).setNodeInstances(singletonList(timerNodeInstance)); ArgumentCaptor<Command> captureCommand = ArgumentCaptor.forClass(Command.class); verify(confirmPopup).show(any(), any(), any(), captureCommand.capture()); captureCommand.getValue().execute(); verify(processInstanceEvent).fire(any()); verify(view, never()).setTimerInstances(singletonList(timerInstance)); verify(view).onShow(); List<NodeInstanceSummary> nodeInstancesMultipleSubProcess = Arrays.asList( timerNodeInstance, NodeInstanceSummary.builder().withId(2L).withName("one").withNodeUniqueName("_1").withType("SubProcessNode").withCompleted(false).build(), NodeInstanceSummary.builder().withId(5L).withName("two").withNodeUniqueName("_1").withType("SubProcessNode").withCompleted(false).build(), NodeInstanceSummary.builder().withId(3L).withName("name-3").withNodeUniqueName("_3").withType("HumanTask").withCompleted(true).build(), NodeInstanceSummary.builder().withId(4L).withName(" ").withNodeUniqueName("_4").withType("End").withCompleted(true).build() ); summary.setNodeInstances(nodeInstancesMultipleSubProcess); when(processService.getProcessInstanceDiagramSummary(eq(processInstance.getProcessInstanceKey()), anyString(), anyString(), anyString())).thenReturn(summary); presenter.setProcessInstance(processInstance); presenter.onDiagramNodeSelectedByDoubleClick("_1"); verify(view, never()).setNodeInstances(singletonList(timerNodeInstance)); verify(alertPopup).alert(any(), any()); verify(view, never()).setTimerInstances(singletonList(timerInstance)); }