### Question:
OpenLineageService { public Map<String, List> getEndToEndLineage(String userId, String guid, boolean includeProcesses) { try { LineageVerticesAndEdges response = openLineageClient.lineage(userId, Scope.END_TO_END, guid, "", includeProcesses); return processResponse(response,guid); } catch (InvalidParameterException | PropertyServerException | OpenLineageException e) { LOG.error("Cannot get end to end lineage for guid {}", guid); throw new RuntimeException("end2end lineage error", e); } } @Autowired  OpenLineageService(OpenLineageClient openLineageClient); Map<String, List> getUltimateSource(String userId,
                                               String guid,
                                               boolean includeProcesses); Map<String, List> getEndToEndLineage(String userId,
                                                String guid,
                                                boolean includeProcesses); Map<String, List> getUltimateDestination(String userId,
                                                    String guid,
                                                    boolean includeProcesses); Map<String, List> getVerticalLineage(String userId,
                                                String guid,
                                                boolean includeProcesses); Map<String, List> getSourceAndDestination(String userId,
                                                     String guid,
                                                     boolean includeProcesses); static final String EDGES_LABEL; static final String NODES_LABEL; }### Answer:
@Test @DisplayName("End To End") public void testEndToEnd() throws PropertyServerException, InvalidParameterException { try { when(openLineageClient.lineage(eq(USER_ID), eq(Scope.END_TO_END), eq(guid), eq(""), eq(true))) .thenReturn(lineageVerticesAndEdges); } catch (OpenLineageException e) { e.printStackTrace(); } Map<String, List> response = openLineageService.getEndToEndLineage(USER_ID, guid, true); checkResponse(response); }
@Test @DisplayName("TestNodesLevels") @SuppressWarnings("unchecked") public void testNodesLevels() throws PropertyServerException, InvalidParameterException, IOException { setupLineageVerticesAndEdges(); try { when(openLineageClient.lineage(eq(USER_ID), eq(Scope.END_TO_END), eq("n11"), eq(""), eq(true))) .thenReturn(lineageVerticesAndEdges); } catch (OpenLineageException e) { e.printStackTrace(); } Map<String, List> response = openLineageService.getEndToEndLineage(USER_ID, "n11", true); List<Node> nodes = response.get("nodes"); List<Edge> edges = response.get("edges"); assertEquals("Response should contain 21 nodes", 21, nodes.size()); assertEquals("Response should contain 20 edges", 20, edges.size()); Map<String,Node> nodesMap = nodes.stream() .collect(Collectors.toMap(Node::getId, Function.identity())); assertEquals("Level of n11 should be 0", Integer.valueOf(0), nodesMap.get("n11").getLevel()); assertEquals("Level of n7 should be -1", Integer.valueOf(-1), nodesMap.get("n7").getLevel()); assertEquals("Level of n10 should be -1", Integer.valueOf(-1), nodesMap.get("n10").getLevel()); assertEquals("Level of n1 should be -4", Integer.valueOf(-4), nodesMap.get("n1").getLevel()); assertEquals("Level of n3 should be -2", Integer.valueOf(-4), nodesMap.get("n1").getLevel()); assertEquals("Level of n19 should be1", Integer.valueOf(1), nodesMap.get("n19").getLevel()); assertEquals("Level of n20 should be2", Integer.valueOf(2), nodesMap.get("n20").getLevel()); assertEquals("Level of n17 should be 3", Integer.valueOf(3), nodesMap.get("n17").getLevel()); assertEquals("Level of n15 should be 4", Integer.valueOf(4), nodesMap.get("n15").getLevel()); readResource(); }