|
7 | 7 |
|
8 | 8 | import static marquez.db.ColumnLineageTestUtils.getDatasetA; |
9 | 9 | import static marquez.db.ColumnLineageTestUtils.getDatasetB; |
| 10 | +import static marquez.db.LineageTestUtils.PRODUCER_URL; |
| 11 | +import static marquez.db.LineageTestUtils.SCHEMA_URL; |
10 | 12 | import static org.assertj.core.api.Assertions.assertThat; |
11 | 13 |
|
12 | 14 | import com.fasterxml.jackson.core.type.TypeReference; |
@@ -574,4 +576,57 @@ public void testApp_doesNotShowDeletedDatasetAfterUndeleteNamespace() throws IOE |
574 | 576 | jobs = client.listJobs(namespaceName); |
575 | 577 | assertThat(jobs).hasSize(1); |
576 | 578 | } |
| 579 | + |
| 580 | + @Test |
| 581 | + public void testApp_getTableVersionsWithSymlinks() { |
| 582 | + client.createDataset(NAMESPACE_NAME, DB_TABLE_NAME, DB_TABLE_META); |
| 583 | + |
| 584 | + ImmutableMap<String, Object> outputFacets = |
| 585 | + ImmutableMap.of("outputFacetKey", "outputFacetValue"); |
| 586 | + ImmutableMap<String, Object> inputFacets = ImmutableMap.of("inputFacetKey", "inputFacetValue"); |
| 587 | + |
| 588 | + final LineageEvent.DatasetFacets datasetFacets = |
| 589 | + LineageTestUtils.newDatasetFacet( |
| 590 | + outputFacets, |
| 591 | + LineageEvent.SchemaField.builder() |
| 592 | + .name("firstname") |
| 593 | + .type("string") |
| 594 | + .description("the first name") |
| 595 | + .build()); |
| 596 | + datasetFacets |
| 597 | + .getDocumentation() |
| 598 | + .setDescription(DB_TABLE_META.getDescription().orElse("the dataset documentation")); |
| 599 | + datasetFacets.setSymlinks( |
| 600 | + new LineageEvent.DatasetSymlinkFacet( |
| 601 | + PRODUCER_URL, |
| 602 | + SCHEMA_URL, |
| 603 | + Collections.singletonList( |
| 604 | + new LineageEvent.SymlinkIdentifier("symlinkNamespace", "symlinkName", "type")))); |
| 605 | + final LineageEvent lineageEvent = |
| 606 | + LineageEvent.builder() |
| 607 | + .producer("testApp_getTableVersionsWithSymlinks") |
| 608 | + .eventType("COMPLETE") |
| 609 | + .run( |
| 610 | + new LineageEvent.Run( |
| 611 | + UUID.randomUUID().toString(), LineageEvent.RunFacet.builder().build())) |
| 612 | + .job(LineageEvent.Job.builder().namespace(NAMESPACE_NAME).name(JOB_NAME).build()) |
| 613 | + .eventTime(ZonedDateTime.now()) |
| 614 | + .inputs( |
| 615 | + Collections.singletonList( |
| 616 | + LineageEvent.Dataset.builder() |
| 617 | + .namespace(NAMESPACE_NAME) |
| 618 | + .name(DB_TABLE_NAME) |
| 619 | + .facets(datasetFacets) |
| 620 | + .build())) |
| 621 | + .outputs(Collections.emptyList()) |
| 622 | + .build(); |
| 623 | + final CompletableFuture<Integer> resp = sendEvent(lineageEvent); |
| 624 | + assertThat(resp.join()).isEqualTo(201); |
| 625 | + List<DatasetVersion> versions = client.listDatasetVersions(NAMESPACE_NAME, DB_TABLE_NAME); |
| 626 | + |
| 627 | + versions.forEach( |
| 628 | + datasetVersion -> { |
| 629 | + assertThat(datasetVersion.getName()).isNotEqualTo("symlinkName"); |
| 630 | + }); |
| 631 | + } |
577 | 632 | } |
0 commit comments