Fix #660 Return fully qualified name in EntityReference for all the data assets

This commit is contained in:
sureshms 2021-10-04 11:59:34 -07:00
parent 9c5df8df7c
commit ce3fbe17ec
3 changed files with 9 additions and 9 deletions

View File

@ -468,27 +468,27 @@ public final class EntityUtil {
public static EntityReference getEntityReference(Database database) { public static EntityReference getEntityReference(Database database) {
return new EntityReference().withDescription(database.getDescription()).withId(database.getId()) return new EntityReference().withDescription(database.getDescription()).withId(database.getId())
.withName(database.getName()).withType(Entity.DATABASE); .withName(database.getFullyQualifiedName()).withType(Entity.DATABASE);
} }
public static EntityReference getEntityReference(Table table) { public static EntityReference getEntityReference(Table table) {
return new EntityReference().withDescription(table.getDescription()).withId(table.getId()) return new EntityReference().withDescription(table.getDescription()).withId(table.getId())
.withName(table.getName()).withType(Entity.TABLE); .withName(table.getFullyQualifiedName()).withType(Entity.TABLE);
} }
public static EntityReference getEntityReference(Report report) { public static EntityReference getEntityReference(Report report) {
return new EntityReference().withDescription(report.getDescription()).withId(report.getId()) return new EntityReference().withDescription(report.getDescription()).withId(report.getId())
.withName(report.getName()).withType(Entity.REPORT); .withName(report.getFullyQualifiedName()).withType(Entity.REPORT);
} }
public static EntityReference getEntityReference(Metrics metrics) { public static EntityReference getEntityReference(Metrics metrics) {
return new EntityReference().withDescription(metrics.getDescription()).withId(metrics.getId()) return new EntityReference().withDescription(metrics.getDescription()).withId(metrics.getId())
.withName(metrics.getName()).withType(Entity.METRICS); .withName(metrics.getFullyQualifiedName()).withType(Entity.METRICS);
} }
public static EntityReference getEntityReference(Dashboard dashboard) { public static EntityReference getEntityReference(Dashboard dashboard) {
return new EntityReference().withDescription(dashboard.getDescription()).withId(dashboard.getId()) return new EntityReference().withDescription(dashboard.getDescription()).withId(dashboard.getId())
.withName(dashboard.getName()).withType(Entity.DASHBOARD); .withName(dashboard.getFullyQualifiedName()).withType(Entity.DASHBOARD);
} }
public static EntityReference getEntityReference(Team team) { public static EntityReference getEntityReference(Team team) {

View File

@ -870,7 +870,7 @@ public class TableResourceTest extends CatalogApplicationTest {
assertEquals(table.getOwner().getId(), USER_OWNER1.getId()); assertEquals(table.getOwner().getId(), USER_OWNER1.getId());
assertEquals(table.getOwner().getType(), USER_OWNER1.getType()); assertEquals(table.getOwner().getType(), USER_OWNER1.getType());
assertEquals(table.getDatabase().getId(), DATABASE.getId()); assertEquals(table.getDatabase().getId(), DATABASE.getId());
assertEquals(table.getDatabase().getName(), DATABASE.getName()); assertEquals(table.getDatabase().getName(), DATABASE.getFullyQualifiedName());
} }
// List tables with databaseFQN as filter // List tables with databaseFQN as filter
@ -1198,7 +1198,7 @@ public class TableResourceTest extends CatalogApplicationTest {
assertEquals(table.getOwner().getId(), USER_OWNER1.getId()); assertEquals(table.getOwner().getId(), USER_OWNER1.getId());
assertEquals(table.getOwner().getType(), USER_OWNER1.getType()); assertEquals(table.getOwner().getType(), USER_OWNER1.getType());
assertEquals(table.getDatabase().getId(), DATABASE.getId()); assertEquals(table.getDatabase().getId(), DATABASE.getId());
assertEquals(table.getDatabase().getName(), DATABASE.getName()); assertEquals(table.getDatabase().getName(), DATABASE.getFullyQualifiedName());
} }
public static Table createTable(CreateTable create, Map<String, String> authHeaders) throws HttpResponseException { public static Table createTable(CreateTable create, Map<String, String> authHeaders) throws HttpResponseException {

View File

@ -194,8 +194,8 @@ public final class TestUtils {
assertNotNull(ref.getType()); assertNotNull(ref.getType());
// Ensure data entities use fully qualified name // Ensure data entities use fully qualified name
if (List.of("table", "database", "metrics", "dashboard", "pipeline", "report", "topic", "chart") if (List.of("table", "database", "metrics", "dashboard", "pipeline", "report", "topic", "chart")
.contains(ref.getName())) { .contains(ref.getType())) {
ref.getName().contains("."); // FullyQualifiedName has "." as separator assertTrue(ref.getName().contains(".")); // FullyQualifiedName has "." as separator
} }
} }