From 27ff500742838f28b85b7a1d28770558dba38cec Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Wed, 4 Sep 2024 22:05:48 -0700 Subject: [PATCH] add lix getter method (#415) Co-authored-by: Yang Yang --- .../restli/BaseAspectRoutingResource.java | 24 +-- .../restli/BaseBrowsableEntityResource.java | 10 -- .../metadata/restli/BaseEntityResource.java | 59 +++---- .../restli/BaseSearchableEntityResource.java | 21 +-- .../restli/BaseEntityResourceTest.java | 158 ++++++++--------- .../BaseEntitySimpleKeyResourceTest.java | 159 +++++++++--------- 6 files changed, 195 insertions(+), 236 deletions(-) diff --git a/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseAspectRoutingResource.java b/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseAspectRoutingResource.java index 3667f36db..c42fe276a 100644 --- a/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseAspectRoutingResource.java +++ b/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseAspectRoutingResource.java @@ -10,7 +10,6 @@ import com.linkedin.metadata.dao.utils.ModelUtils; import com.linkedin.metadata.events.IngestionTrackingContext; import com.linkedin.metadata.internal.IngestionParams; -import com.linkedin.metadata.restli.lix.ResourceLix; import com.linkedin.parseq.Task; import com.linkedin.restli.common.HttpStatus; import com.linkedin.restli.server.RestLiServiceException; @@ -84,21 +83,6 @@ public BaseAspectRoutingResource(@Nullable Class snapshotClass, _assetClass = assetClass; } - public BaseAspectRoutingResource(@Nullable Class snapshotClass, - @Nullable Class aspectUnionClass, @Nonnull Class urnClass, @Nonnull Class valueClass, - @Nonnull Class internalSnapshotClass, - @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass, - @Nonnull ResourceLix resourceLix) { - super(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass, - resourceLix); - _valueClass = valueClass; - _aspectUnionClass = aspectUnionClass; - _snapshotClass = snapshotClass; - _internalSnapshotClass = internalSnapshotClass; - _internalAspectUnionClass = internalAspectUnionClass; - _assetClass = assetClass; - } - /** * Get the aspect routing client manager which provides multiple aspect routing support. * @return {@link AspectRoutingGmsClientManager} @@ -113,7 +97,7 @@ public BaseAspectRoutingResource(@Nullable Class snapshotClass, @Override public Task get(@Nonnull KEY id, @QueryParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final URN urn = toUrn(id); - return get(id, aspectNames, _resourceLix.testGet(String.valueOf(urn), urn.getEntityType())); + return get(id, aspectNames, getResourceLix().testGet(String.valueOf(urn), urn.getEntityType())); } @Nonnull @@ -154,7 +138,7 @@ public Task getSnapshot(@ActionParam(PARAM_URN) @Nonnull String urnStr @ActionParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final URN urn = parseUrnParam(urnString); return getSnapshot(urnString, aspectNames, - _resourceLix.testGetSnapshot(String.valueOf(urn), ModelUtils.getEntityType(urn))); + getResourceLix().testGetSnapshot(String.valueOf(urn), ModelUtils.getEntityType(urn))); } @Nonnull @@ -244,7 +228,7 @@ public Task backfill(@ActionParam(PARAM_URNS) @Nonnull String[] @ActionParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final String urnString = urns[0]; final URN urn = parseUrnParam(urnString); - return backfill(urns, aspectNames, _resourceLix.testBackfillWithUrns(urnString, ModelUtils.getEntityType(urn))); + return backfill(urns, aspectNames, getResourceLix().testBackfillWithUrns(urnString, ModelUtils.getEntityType(urn))); } @Nonnull @@ -295,7 +279,7 @@ public Task backfillWithNewValue(@ActionParam(PARAM_URNS) @Nonnu final String urnString = urns[0]; final URN urn = parseUrnParam(urnString); return backfillWithNewValue(urns, aspectNames, - _resourceLix.testBackfillWithNewValue(urnString, ModelUtils.getEntityType(urn))); + getResourceLix().testBackfillWithNewValue(urnString, ModelUtils.getEntityType(urn))); } private Task backfillWithNewValue(@ActionParam(PARAM_URNS) @Nonnull String[] urns, diff --git a/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseBrowsableEntityResource.java b/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseBrowsableEntityResource.java index 2ef288cb8..1451ccc4f 100644 --- a/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseBrowsableEntityResource.java +++ b/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseBrowsableEntityResource.java @@ -8,7 +8,6 @@ import com.linkedin.metadata.dao.utils.QueryUtils; import com.linkedin.metadata.query.BrowseResult; import com.linkedin.metadata.query.Filter; -import com.linkedin.metadata.restli.lix.ResourceLix; import com.linkedin.parseq.Task; import com.linkedin.restli.server.annotations.Action; import com.linkedin.restli.server.annotations.ActionParam; @@ -62,15 +61,6 @@ public BaseBrowsableEntityResource(@Nullable Class snapshotClass, super(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass); } - public BaseBrowsableEntityResource(@Nullable Class snapshotClass, - @Nullable Class aspectUnionClass, @Nonnull Class urnClass, - @Nonnull Class internalSnapshotClass, - @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass, - @Nonnull ResourceLix resourceLix) { - super(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass, - resourceLix); - } - /** * Returns a {@link BaseBrowseDAO}. */ diff --git a/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseEntityResource.java b/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseEntityResource.java index 9bde4b29d..5ac8cf543 100644 --- a/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseEntityResource.java +++ b/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseEntityResource.java @@ -95,40 +95,34 @@ public abstract class BaseEntityResource< private final Class _internalAspectUnionClass; private final Class _assetClass; protected final Class _urnClass; - protected ResourceLix _resourceLix; protected BaseTrackingManager _trackingManager = null; + private ResourceLix _defaultResourceLix = new DummyResourceLix(); - // allows resource lix to be updated by real lix impl - public void setResourceLix(ResourceLix resourceLix) { - _resourceLix = resourceLix; + /** + * This method is to be overriden by specific resource endpoint implementation with real lix impl. + * @return {@link ResourceLix} + */ + protected ResourceLix getResourceLix() { + return _defaultResourceLix; } + public BaseEntityResource(@Nullable Class snapshotClass, @Nullable Class aspectUnionClass, @Nonnull Class internalSnapshotClass, @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass) { - this(snapshotClass, aspectUnionClass, null, internalSnapshotClass, internalAspectUnionClass, assetClass, - new DummyResourceLix()); + this(snapshotClass, aspectUnionClass, null, internalSnapshotClass, internalAspectUnionClass, assetClass); } public BaseEntityResource(@Nullable Class snapshotClass, @Nullable Class aspectUnionClass, @Nonnull Class internalSnapshotClass, @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass, @Nonnull ResourceLix resourceLix) { - this(snapshotClass, aspectUnionClass, null, internalSnapshotClass, internalAspectUnionClass, assetClass, - resourceLix); + this(snapshotClass, aspectUnionClass, null, internalSnapshotClass, internalAspectUnionClass, assetClass); } public BaseEntityResource(@Nullable Class snapshotClass, @Nullable Class aspectUnionClass, @Nullable Class urnClass, @Nonnull Class internalSnapshotClass, @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass) { - this(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass, - new DummyResourceLix()); - } - - public BaseEntityResource(@Nullable Class snapshotClass, @Nullable Class aspectUnionClass, - @Nullable Class urnClass, @Nonnull Class internalSnapshotClass, - @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass, - @Nonnull ResourceLix resourceLix) { super(); ModelUtils.validateSnapshotAspect(internalSnapshotClass, internalAspectUnionClass); _snapshotClass = snapshotClass; @@ -139,7 +133,6 @@ public BaseEntityResource(@Nullable Class snapshotClass, @Nullable Cla _supportedAspectClasses = ModelUtils.getValidAspectTypes(_aspectUnionClass); _supportedInternalAspectClasses = ModelUtils.getValidAspectTypes(_internalAspectUnionClass); _assetClass = assetClass; - _resourceLix = resourceLix; } public BaseEntityResource(@Nullable Class snapshotClass, @Nullable Class aspectUnionClass, @@ -147,8 +140,7 @@ public BaseEntityResource(@Nullable Class snapshotClass, @Nullable Cla @Nonnull Class internalSnapshotClass, @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass, @Nonnull ResourceLix resourceLix) { - this(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass, - resourceLix); + this(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass); _trackingManager = trackingManager; } @@ -156,8 +148,7 @@ public BaseEntityResource(@Nullable Class snapshotClass, @Nullable Cla @Nullable Class urnClass, @Nullable BaseTrackingManager trackingManager, @Nonnull Class internalSnapshotClass, @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass) { - this(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass, - new DummyResourceLix()); + this(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass); _trackingManager = trackingManager; } @@ -221,7 +212,7 @@ protected VALUE toInternalValue(@Nonnull INTERNAL_SNAPSHOT internalSnapshot) { @Nonnull public Task get(@Nonnull KEY id, @QueryParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final URN urn = toUrn(id); - return get(id, aspectNames, _resourceLix.testGet(String.valueOf(urn), urn.getEntityType())); + return get(id, aspectNames, getResourceLix().testGet(String.valueOf(urn), urn.getEntityType())); } protected Task get(@Nonnull KEY id, @QueryParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames, @@ -254,7 +245,7 @@ protected Task get(@Nonnull KEY id, @QueryParam(PARAM_ASPECTS) @Optional public Task> batchGet(@Nonnull Set ids, @QueryParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final URN urn = ids.stream().findFirst().isPresent() ? toUrn(ids.stream().findFirst().get()) : null; - return batchGet(ids, aspectNames, _resourceLix.testBatchGet(String.valueOf(urn), ModelUtils.getEntityType(urn))); + return batchGet(ids, aspectNames, getResourceLix().testBatchGet(String.valueOf(urn), ModelUtils.getEntityType(urn))); } @Deprecated @@ -281,7 +272,7 @@ public Task> batchGetWithErrors(@Nonnull Set ids, @QueryParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final URN urn = ids.stream().findFirst().isPresent() ? toUrn(ids.stream().findFirst().get()) : null; return batchGetWithErrors(ids, aspectNames, - _resourceLix.testBatchGetWithErrors(String.valueOf(urn), ModelUtils.getEntityType(urn))); + getResourceLix().testBatchGetWithErrors(String.valueOf(urn), ModelUtils.getEntityType(urn))); } @Nonnull @@ -396,7 +387,7 @@ public Task getSnapshot(@ActionParam(PARAM_URN) @Nonnull String urnStr @ActionParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final URN urn = parseUrnParam(urnString); return getSnapshot(urnString, aspectNames, - _resourceLix.testGetSnapshot(String.valueOf(urn), ModelUtils.getEntityType(urn))); + getResourceLix().testGetSnapshot(String.valueOf(urn), ModelUtils.getEntityType(urn))); } @Deprecated @@ -471,7 +462,7 @@ public Task backfill(@ActionParam(PARAM_URN) @Nonnull String urn @ActionParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final URN urn = parseUrnParam(urnString); return backfill(urnString, aspectNames, - _resourceLix.testBackfillLegacy(String.valueOf(urn), ModelUtils.getEntityType(urn))); + getResourceLix().testBackfillLegacy(String.valueOf(urn), ModelUtils.getEntityType(urn))); } @Nonnull @@ -500,7 +491,7 @@ public Task backfill(@ActionParam(PARAM_URNS) @Nonnull String[] @ActionParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames) { final String urnString = urns[0]; final URN urn = parseUrnParam(urnString); - return backfill(urns, aspectNames, _resourceLix.testBackfillWithUrns(urnString, ModelUtils.getEntityType(urn))); + return backfill(urns, aspectNames, getResourceLix().testBackfillWithUrns(urnString, ModelUtils.getEntityType(urn))); } private Task backfill(@ActionParam(PARAM_URNS) @Nonnull String[] urns, @@ -528,7 +519,7 @@ public Task emitNoChangeMetadataAuditEvent(@ActionParam(PARAM_UR final String urnString = urns[0]; final URN urn = parseUrnParam(urnString); return emitNoChangeMetadataAuditEvent(urns, aspectNames, ingestionMode, - _resourceLix.testEmitNoChangeMetadataAuditEvent(urnString, ModelUtils.getEntityType(urn))); + getResourceLix().testEmitNoChangeMetadataAuditEvent(urnString, ModelUtils.getEntityType(urn))); } @Nonnull @@ -559,7 +550,7 @@ public Task backfillWithNewValue(@ActionParam(PARAM_URNS) @Nonnu final String urnString = urns[0]; final URN urn = parseUrnParam(urnString); return backfillWithNewValue(urns, aspectNames, - _resourceLix.testBackfillWithNewValue(urnString, ModelUtils.getEntityType(urn))); + getResourceLix().testBackfillWithNewValue(urnString, ModelUtils.getEntityType(urn))); } private Task backfillWithNewValue(@ActionParam(PARAM_URNS) @Nonnull String[] urns, @@ -582,7 +573,7 @@ public Task backfillEntityTables(@ActionParam(PARAM_URNS) @Nonnu final String urnString = urns[0]; final URN urn = parseUrnParam(urnString); return backfillEntityTables(urns, aspectNames, - _resourceLix.testBackfillEntityTables(urnString, ModelUtils.getEntityType(urn))); + getResourceLix().testBackfillEntityTables(urnString, ModelUtils.getEntityType(urn))); } private Task backfillEntityTables(@ActionParam(PARAM_URNS) @Nonnull String[] urns, @@ -605,7 +596,7 @@ public Task backfillRelationshipTables(@ActionParam(PARAM_URNS) final String urnString = urns[0]; final URN urn = parseUrnParam(urnString); return backfillRelationshipTables(urns, aspectNames, - _resourceLix.testBackfillRelationshipTables(urnString, ModelUtils.getEntityType(urn))); + getResourceLix().testBackfillRelationshipTables(urnString, ModelUtils.getEntityType(urn))); } private Task backfillRelationshipTables(@ActionParam(PARAM_URNS) @Nonnull String[] urns, @@ -649,7 +640,7 @@ public Task backfill(@ActionParam(PARAM_MODE) @Nonnull BackfillM @ActionParam(PARAM_URN) @Optional @Nullable String lastUrn, @ActionParam(PARAM_LIMIT) int limit) { return backfill(mode, aspectNames, lastUrn, limit, - _resourceLix.testBackfill(_assetClass.getSimpleName(), mode.name())); + getResourceLix().testBackfill(_assetClass.getSimpleName(), mode.name())); } @Nonnull @@ -849,7 +840,7 @@ public Task> filter(@QueryParam(PARAM_FILTER) @Optional @Nullable In @QueryParam(PARAM_URN) @Optional @Nullable String lastUrn, @QueryParam(PARAM_COUNT) @Optional("10") int count) { return filter(indexFilter, indexSortCriterion, aspectNames, lastUrn, count, - _resourceLix.testFilter(_assetClass.getSimpleName())); + getResourceLix().testFilter(_assetClass.getSimpleName())); } @Nonnull @@ -904,7 +895,7 @@ public Task> filter(@QueryParam(PARAM_FILTER) @Optional @Nulla @QueryParam(PARAM_ASPECTS) @Optional @Nullable String[] aspectNames, @PagingContextParam @Nonnull PagingContext pagingContext) { return filter(indexFilter, indexSortCriterion, aspectNames, pagingContext, - _resourceLix.testFilter(_assetClass.getSimpleName())); + getResourceLix().testFilter(_assetClass.getSimpleName())); } @Nonnull diff --git a/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseSearchableEntityResource.java b/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseSearchableEntityResource.java index 3884f3ef6..8eeb9db23 100644 --- a/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseSearchableEntityResource.java +++ b/restli-resources/src/main/java/com/linkedin/metadata/restli/BaseSearchableEntityResource.java @@ -13,8 +13,6 @@ import com.linkedin.metadata.query.SearchResultMetadata; import com.linkedin.metadata.query.SortCriterion; import com.linkedin.metadata.query.SortOrder; -import com.linkedin.metadata.restli.lix.DummyResourceLix; -import com.linkedin.metadata.restli.lix.ResourceLix; import com.linkedin.parseq.Task; import com.linkedin.restli.server.CollectionResult; import com.linkedin.restli.server.PagingContext; @@ -76,20 +74,9 @@ public BaseSearchableEntityResource(@Nullable Class snapshotClass, @Nullable Class aspectUnionClass, @Nonnull Class urnClass, @Nonnull Class internalSnapshotClass, @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass) { - super(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass, - new DummyResourceLix()); + super(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass); } - public BaseSearchableEntityResource(@Nullable Class snapshotClass, - @Nullable Class aspectUnionClass, @Nonnull Class urnClass, - @Nonnull Class internalSnapshotClass, - @Nonnull Class internalAspectUnionClass, @Nonnull Class assetClass, - @Nonnull ResourceLix resourceLix) { - super(snapshotClass, aspectUnionClass, urnClass, internalSnapshotClass, internalAspectUnionClass, assetClass, - resourceLix); - } - - /** * Returns a document-specific {@link BaseSearchDAO}. */ @@ -113,7 +100,7 @@ public Task> getAll(@Nonnull PagingContext pagingContext, @QueryParam(PARAM_FILTER) @Optional @Nullable Filter filter, @QueryParam(PARAM_SORT) @Optional @Nullable SortCriterion sortCriterion) { final String urnType = _urnClass == null ? null : _urnClass.getSimpleName(); - return getAll(pagingContext, aspectNames, filter, sortCriterion, _resourceLix.testGetAll(urnType)); + return getAll(pagingContext, aspectNames, filter, sortCriterion, getResourceLix().testGetAll(urnType)); } @Nonnull @@ -139,7 +126,7 @@ public Task> search(@QueryParam(PA @QueryParam(PARAM_SORT) @Optional @Nullable SortCriterion sortCriterion, @PagingContextParam @Nonnull PagingContext pagingContext) { final String urnType = _urnClass == null ? null : _urnClass.getSimpleName(); - return search(input, aspectNames, filter, sortCriterion, pagingContext, _resourceLix.testSearch(urnType)); + return search(input, aspectNames, filter, sortCriterion, pagingContext, getResourceLix().testSearch(urnType)); } @Nonnull @@ -177,7 +164,7 @@ public Task> searchV2(@QueryParam( @PagingContextParam @Nonnull PagingContext pagingContext) { final String urnType = _urnClass == null ? null : _urnClass.getSimpleName(); return searchV2(input, aspectNames, filter, sortCriterion, preference, pagingContext, - _resourceLix.testSearchV2(urnType)); + getResourceLix().testSearchV2(urnType)); } @Nonnull diff --git a/restli-resources/src/test/java/com/linkedin/metadata/restli/BaseEntityResourceTest.java b/restli-resources/src/test/java/com/linkedin/metadata/restli/BaseEntityResourceTest.java index 714a78f6a..6cfba974f 100644 --- a/restli-resources/src/test/java/com/linkedin/metadata/restli/BaseEntityResourceTest.java +++ b/restli-resources/src/test/java/com/linkedin/metadata/restli/BaseEntityResourceTest.java @@ -160,85 +160,89 @@ class TestInternalResource extends BaseEntityResource, EntityValue, FooUrn, EntitySnapshot, EntityAspectUnion, InternalEntitySnapshot, InternalEntityAspectUnion, EntityAsset> { + @Override + protected ResourceLix getResourceLix() { + return new ResourceLix() { + @Override + public boolean testGet(@Nonnull String urn, @Nonnull String entityType) { + return true; + } + + @Override + public boolean testBatchGet(@Nullable String urn, @Nullable String entityType) { + return true; + } + + @Override + public boolean testBatchGetWithErrors(@Nullable String urn, @Nullable String type) { + return false; + } + + @Override + public boolean testGetSnapshot(@Nullable String urn, @Nullable String entityType) { + return true; + } + + @Override + public boolean testBackfillLegacy(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillWithUrns(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testEmitNoChangeMetadataAuditEvent(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillWithNewValue(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillEntityTables(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillRelationshipTables(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfill(@Nonnull String assetType, @Nonnull String mode) { + return false; + } + + @Override + public boolean testFilter(@Nonnull String assetType) { + return true; + } + + @Override + public boolean testGetAll(@Nullable String urnType) { + return false; + } + + @Override + public boolean testSearch(@Nullable String urnType) { + return false; + } + + @Override + public boolean testSearchV2(@Nullable String urnType) { + return false; + } + }; + } + public TestInternalResource() { super(EntitySnapshot.class, EntityAspectUnion.class, FooUrn.class, InternalEntitySnapshot.class, - InternalEntityAspectUnion.class, EntityAsset.class, new ResourceLix() { - - @Override - public boolean testGet(@Nonnull String urn, @Nonnull String entityType) { - return true; - } - - @Override - public boolean testBatchGet(@Nullable String urn, @Nullable String entityType) { - return true; - } - - @Override - public boolean testBatchGetWithErrors(@Nullable String urn, @Nullable String type) { - return false; - } - - @Override - public boolean testGetSnapshot(@Nullable String urn, @Nullable String entityType) { - return true; - } - - @Override - public boolean testBackfillLegacy(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillWithUrns(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testEmitNoChangeMetadataAuditEvent(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillWithNewValue(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillEntityTables(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillRelationshipTables(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfill(@Nonnull String assetType, @Nonnull String mode) { - return false; - } - - @Override - public boolean testFilter(@Nonnull String assetType) { - return true; - } - - @Override - public boolean testGetAll(@Nullable String urnType) { - return false; - } - - @Override - public boolean testSearch(@Nullable String urnType) { - return false; - } - - @Override - public boolean testSearchV2(@Nullable String urnType) { - return false; - } - }); + InternalEntityAspectUnion.class, EntityAsset.class); } @Nonnull diff --git a/restli-resources/src/test/java/com/linkedin/metadata/restli/BaseEntitySimpleKeyResourceTest.java b/restli-resources/src/test/java/com/linkedin/metadata/restli/BaseEntitySimpleKeyResourceTest.java index 4c25bdacf..3ccaf9fe3 100644 --- a/restli-resources/src/test/java/com/linkedin/metadata/restli/BaseEntitySimpleKeyResourceTest.java +++ b/restli-resources/src/test/java/com/linkedin/metadata/restli/BaseEntitySimpleKeyResourceTest.java @@ -481,88 +481,91 @@ private class TestInternalResource extends BaseEntityResource { + @Override + protected ResourceLix getResourceLix() { + return new ResourceLix() { + @Override + public boolean testGet(@Nonnull String urn, @Nonnull String entityType) { + return false; + } + + @Override + public boolean testBatchGet(@Nullable String urn, @Nullable String entityType) { + return true; + } + + @Override + public boolean testBatchGetWithErrors(@Nullable String urn, @Nullable String type) { + return false; + } + + @Override + public boolean testGetSnapshot(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillLegacy(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillWithUrns(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testEmitNoChangeMetadataAuditEvent(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillWithNewValue(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillEntityTables(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfillRelationshipTables(@Nullable String urn, @Nullable String entityType) { + return false; + } + + @Override + public boolean testBackfill(@Nonnull String assetType, @Nonnull String mode) { + return false; + } + + @Override + public boolean testFilter(@Nonnull String assetType) { + return false; + } + + @Override + public boolean testGetAll(@Nullable String urnType) { + return false; + } + + @Override + public boolean testSearch(@Nullable String urnType) { + return false; + } + + @Override + public boolean testSearchV2(@Nullable String urnType) { + return false; + } + }; + } + TestInternalResource() { super(EntitySnapshot.class, EntityAspectUnion.class, InternalEntitySnapshot.class, - InternalEntityAspectUnion.class, EntityAsset.class, new ResourceLix() { - @Override - public boolean testGet(@Nonnull String urn, @Nonnull String entityType) { - return false; - } - - @Override - public boolean testBatchGet(@Nullable String urn, @Nullable String entityType) { - return true; - } - - @Override - public boolean testBatchGetWithErrors(@Nullable String urn, @Nullable String type) { - return false; - } - - @Override - public boolean testGetSnapshot(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillLegacy(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillWithUrns(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testEmitNoChangeMetadataAuditEvent(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillWithNewValue(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillEntityTables(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfillRelationshipTables(@Nullable String urn, @Nullable String entityType) { - return false; - } - - @Override - public boolean testBackfill(@Nonnull String assetType, @Nonnull String mode) { - return false; - } - - @Override - public boolean testFilter(@Nonnull String assetType) { - return false; - } - - @Override - public boolean testGetAll(@Nullable String urnType) { - return false; - } - - @Override - public boolean testSearch(@Nullable String urnType) { - return false; - } - - @Override - public boolean testSearchV2(@Nullable String urnType) { - return false; - } - }); + InternalEntityAspectUnion.class, EntityAsset.class); } - - @Override @Nonnull protected BaseLocalDAO getLocalDAO() {