DataSetLineageService implements LineageService { @Override @GraphTransaction public String getInputsGraph(String tableName) throws AtlasException { LOG.info("Fetching lineage inputs graph for tableName={}", tableName); tableName = ParamChecker.notEmpty(tableName, "table name"); TypeUtils.Pair<String, String> typeIdPair = validateDatasetNameExists(tableName); return getInputsGraphForId(typeIdPair.right); } @Inject  DataSetLineageService(MetadataRepository metadataRepository,
                          GraphBackedDiscoveryService discoveryService,
                          AtlasGraph atlasGraph); @Override @GraphTransaction String getOutputsGraph(String datasetName); @Override @GraphTransaction String getInputsGraph(String tableName); @Override @GraphTransaction String getInputsGraphForEntity(String guid); @Override @GraphTransaction String getOutputsGraphForEntity(String guid); @Override @GraphTransaction String getSchema(String datasetName); @Override @GraphTransaction String getSchemaForEntity(String guid); static final String SELECT_INSTANCE_GUID; static final String DATASET_SCHEMA_QUERY_PREFIX; }
@Test(enabled = false) public void testGetInputsGraphInvalidArguments(final String tableName, String expectedException) throws Exception { testInvalidArguments(expectedException, new Invoker() { @Override void run() throws AtlasException { lineageService.getInputsGraph(tableName); } }); }
@Test(enabled = false) public void testGetInputsGraphForEntityInvalidArguments(final String tableName, String expectedException) throws Exception { testInvalidArguments(expectedException, new Invoker() { @Override void run() throws AtlasException { lineageService.getInputsGraph(tableName); } }); }
@Test(enabled = false) public void testGetInputsGraph() throws Exception { JSONObject results = getInputsGraph("sales_fact_monthly_mv"); assertNotNull(results); System.out.println("inputs graph = " + results); JSONObject values = results.getJSONObject("values"); assertNotNull(values); final JSONObject vertices = values.getJSONObject("vertices"); Assert.assertEquals(vertices.length(), 4); final JSONObject edges = values.getJSONObject("edges"); Assert.assertEquals(edges.length(), 4); }
@Test(enabled = false) public void testCircularLineage() throws Exception{ JSONObject results = getInputsGraph("table2"); assertNotNull(results); System.out.println("inputs graph = " + results); JSONObject values = results.getJSONObject("values"); assertNotNull(values); final JSONObject vertices = values.getJSONObject("vertices"); Assert.assertEquals(vertices.length(), 2); final JSONObject edges = values.getJSONObject("edges"); Assert.assertEquals(edges.length(), 4); }