RemoteProcessImageServiceImpl extends AbstractKieServerService implements ProcessImageService { @Override public String getProcessDiagram(String serverTemplateId, String containerId, String processId) { UIServicesClient uiServicesClient = getClient(serverTemplateId, containerId, UIServicesClient.class); try { return removeActionsFromSVG(uiServicesClient.getProcessImage(containerId, processId)); } catch (KieServicesHttpException ex) { LOGGER.warn("Failed to retrieve process definition image: {}", ex.getMessage()); if (ex.getHttpCode() == 404) { return null; } else { throw ex; } } }  @Override String getProcessInstanceDiagram(String serverTemplateId,
                                            String containerId,
                                            Long processInstanceId,
                                            String completedNodeColor,
                                            String completedNodeBorderColor,
                                            String activeNodeBorderColor); @Override String getProcessDiagram(String serverTemplateId,
                                    String containerId,
                                    String processId);  }
@Test public void testProcessDiagramHTML() { when(uiServicesClient.getProcessImage("", "")).thenReturn(SVG_WITH_ACTIONS, SVG_WITHOUT_ACTIONS); validateHTMLContent(service.getProcessDiagram("", "", "")); validateHTMLContent(service.getProcessDiagram("", "", "")); }
@Test public void testProcessImageNotFound() { final Integer okCode = 400; when(uiServicesClient.getProcessImage("", null)).thenThrow(new KieServicesHttpException(null, 404, null, null), new KieServicesHttpException(null, okCode, null, null)); assertNull(service.getProcessDiagram("", "", null)); try { service.getProcessDiagram("", "", null); fail("Method should throw exception"); } catch (KieServicesHttpException ex) { assertEquals(okCode, ex.getHttpCode()); } }