forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(auth-impl): handle empty entities in field resolver providers (da…
- Loading branch information
1 parent
67c67ac
commit 78cf276
Showing
14 changed files
with
157 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...java/com/datahub/authorization/fieldresolverprovider/DomainFieldResolverProviderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.datahub.authorization.fieldresolverprovider; | ||
|
||
import static org.mockito.Mockito.mock; | ||
|
||
import com.linkedin.entity.client.SystemEntityClient; | ||
|
||
public class DomainFieldResolverProviderTest | ||
extends EntityFieldResolverProviderBaseTest<DomainFieldResolverProvider> { | ||
@Override | ||
protected DomainFieldResolverProvider buildFieldResolverProvider() { | ||
return new DomainFieldResolverProvider(mock(SystemEntityClient.class)); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../com/datahub/authorization/fieldresolverprovider/EntityFieldResolverProviderBaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.datahub.authorization.fieldresolverprovider; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.testng.Assert.assertEquals; | ||
|
||
import com.datahub.authorization.EntitySpec; | ||
import com.datahub.authorization.FieldResolver; | ||
import io.datahubproject.metadata.context.OperationContext; | ||
import java.util.Collections; | ||
import java.util.concurrent.ExecutionException; | ||
import org.testng.annotations.Test; | ||
|
||
public abstract class EntityFieldResolverProviderBaseTest<T extends EntityFieldResolverProvider> { | ||
protected abstract T buildFieldResolverProvider(); | ||
|
||
@Test | ||
public void testEmpty() throws ExecutionException, InterruptedException { | ||
assertEquals( | ||
buildFieldResolverProvider() | ||
.getFieldResolver(mock(OperationContext.class), new EntitySpec("dataset", "")) | ||
.getFieldValuesFuture() | ||
.get(), | ||
FieldResolver.getResolverFromValues(Collections.emptySet()).getFieldValuesFuture().get()); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...a/com/datahub/authorization/fieldresolverprovider/EntityUrnFieldResolverProviderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.datahub.authorization.fieldresolverprovider; | ||
|
||
public class EntityUrnFieldResolverProviderTest | ||
extends EntityFieldResolverProviderBaseTest<EntityUrnFieldResolverProvider> { | ||
@Override | ||
protected EntityUrnFieldResolverProvider buildFieldResolverProvider() { | ||
return new EntityUrnFieldResolverProvider(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../java/com/datahub/authorization/fieldresolverprovider/OwnerFieldResolverProviderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.datahub.authorization.fieldresolverprovider; | ||
|
||
import static org.mockito.Mockito.mock; | ||
|
||
import com.linkedin.entity.client.SystemEntityClient; | ||
|
||
public class OwnerFieldResolverProviderTest | ||
extends EntityFieldResolverProviderBaseTest<OwnerFieldResolverProvider> { | ||
@Override | ||
protected OwnerFieldResolverProvider buildFieldResolverProvider() { | ||
return new OwnerFieldResolverProvider(mock(SystemEntityClient.class)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters