Addressed review comments

This commit is contained in:
Praveen Singh
2023-03-13 19:35:39 +05:30
parent 32eb4e1a2c
commit 76a174831e
2 changed files with 8 additions and 12 deletions

View File

@@ -196,7 +196,11 @@ public class TagsImpl implements Tags
public NodeRef validateTag(String tagId)
{
NodeRef tagNodeRef = nodes.validateNode(tagId);
return validateTag(tagNodeRef.getStoreRef(), tagId);
if (tagNodeRef == null || nodeService.hasAspect(tagNodeRef, ContentModel.ASPECT_TAGGABLE))
{
throw new EntityNotFoundException(tagId);
}
return tagNodeRef;
}
public NodeRef validateTag(StoreRef storeRef, String tagId)
@@ -247,10 +251,6 @@ public class TagsImpl implements Tags
public CollectionWithPagingInfo<Tag> getTags(String nodeId, Parameters params)
{
NodeRef nodeRef = nodes.validateNode(nodeId);
if( nodeRef == null )
{
throw new EntityNotFoundException(nodeId);
}
PagingResults<Pair<NodeRef, String>> results = taggingService.getTags(nodeRef, Util.getPagingRequest(params.getPaging()));
Integer totalItems = results.getTotalResultCount().getFirst();
List<Pair<NodeRef, String>> page = results.getPage();

View File

@@ -100,13 +100,6 @@ public class TagsImplTest
assertEquals(expectedTags, actualCreatedTags);
}
@Test
public void testTagNotFoundValidation()
{
given(nodeServiceMock.hasAspect(any(),any())).willReturn(true);
assertThrows(EntityNotFoundException.class, () ->objectUnderTest.validateTag(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, TAG_ID));
}
@Test
public void testDeleteTagById()
{
@@ -151,6 +144,9 @@ public class TagsImplTest
then(nodesMock).should().validateNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "dummy-id");
then(nodesMock).shouldHaveNoMoreInteractions();
then(taggingServiceMock).shouldHaveNoInteractions();
}
@Test