mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-14 10:19:51 +00:00
fix(tags): Support null tagProperties aspect when updating tag color (#13572)
Co-authored-by: John Joyce <john@Mac.lan>
This commit is contained in:
parent
822be781cd
commit
3a81adb94a
@ -67,7 +67,7 @@ public class SetTagColorResolver implements DataFetcher<CompletableFuture<Boolea
|
|||||||
tagUrn.toString(),
|
tagUrn.toString(),
|
||||||
TAG_PROPERTIES_ASPECT_NAME,
|
TAG_PROPERTIES_ASPECT_NAME,
|
||||||
_entityService,
|
_entityService,
|
||||||
null);
|
new TagProperties().setName(tagUrn.getId()));
|
||||||
|
|
||||||
if (tagProperties == null) {
|
if (tagProperties == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
|||||||
@ -76,7 +76,7 @@ public class SetTagColorResolverTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFailureNoExistingProperties() throws Exception {
|
public void testGetDefaultPropertiesIfNoExistingProperties() throws Exception {
|
||||||
// Create resolver
|
// Create resolver
|
||||||
EntityClient mockClient = Mockito.mock(EntityClient.class);
|
EntityClient mockClient = Mockito.mock(EntityClient.class);
|
||||||
EntityService<?> mockService = getMockEntityService();
|
EntityService<?> mockService = getMockEntityService();
|
||||||
@ -101,9 +101,21 @@ public class SetTagColorResolverTest {
|
|||||||
Mockito.when(mockEnv.getArgument(Mockito.eq("urn"))).thenReturn(TEST_ENTITY_URN);
|
Mockito.when(mockEnv.getArgument(Mockito.eq("urn"))).thenReturn(TEST_ENTITY_URN);
|
||||||
Mockito.when(mockEnv.getArgument(Mockito.eq("colorHex"))).thenReturn(TEST_COLOR_HEX);
|
Mockito.when(mockEnv.getArgument(Mockito.eq("colorHex"))).thenReturn(TEST_COLOR_HEX);
|
||||||
Mockito.when(mockEnv.getContext()).thenReturn(mockContext);
|
Mockito.when(mockEnv.getContext()).thenReturn(mockContext);
|
||||||
assertThrows(CompletionException.class, () -> resolver.get(mockEnv).join());
|
|
||||||
|
|
||||||
Mockito.verify(mockClient, Mockito.times(0)).ingestProposal(any(), Mockito.any(), anyBoolean());
|
boolean result = resolver.get(mockEnv).get();
|
||||||
|
|
||||||
|
assertTrue(result);
|
||||||
|
|
||||||
|
final TagProperties newTagProperties =
|
||||||
|
new TagProperties().setName("test-tag").setColorHex(TEST_COLOR_HEX);
|
||||||
|
final MetadataChangeProposal proposal =
|
||||||
|
MutationUtils.buildMetadataChangeProposalWithUrn(
|
||||||
|
UrnUtils.getUrn(TEST_ENTITY_URN), TAG_PROPERTIES_ASPECT_NAME, newTagProperties);
|
||||||
|
|
||||||
|
verifyIngestProposal(mockClient, 1, proposal);
|
||||||
|
|
||||||
|
Mockito.verify(mockService, Mockito.times(1))
|
||||||
|
.exists(any(), Mockito.eq(Urn.createFromString(TEST_ENTITY_URN)), eq(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -32,7 +32,7 @@ const EmptyTags = ({ isEmptySearch }: Props) => {
|
|||||||
<div>
|
<div>
|
||||||
{!isEmptySearch && (
|
{!isEmptySearch && (
|
||||||
<Typography.Paragraph>
|
<Typography.Paragraph>
|
||||||
Tags can be used to organize and categorize data assets across the platform.
|
Tags can be used to organize data assets in DataHub.
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user