Search in sources :

Example 11 with TagSearchKey

use of org.finra.herd.model.api.xml.TagSearchKey in project herd by FINRAOS.

the class TagServiceTest method testSearchTagsTrimParameters.

@Test
public void testSearchTagsTrimParameters() {
    // Create and persist database entities required for testing.
    createDatabaseEntitiesForTagSearchTesting();
    // Search the tags by using input parameters with leading and trailing empty spaces.
    TagSearchResponse tagSearchResponse = tagService.searchTags(new TagSearchRequest(Arrays.asList(new TagSearchFilter(Arrays.asList(new TagSearchKey(addWhitespace(TAG_TYPE), addWhitespace(TAG_CODE), NO_IS_PARENT_TAG_NULL_FLAG))))), Sets.newHashSet(addWhitespace(TagServiceImpl.DISPLAY_NAME_FIELD), addWhitespace(TagServiceImpl.SEARCH_SCORE_MULTIPLIER_FIELD), addWhitespace(TagServiceImpl.DESCRIPTION_FIELD), addWhitespace(TagServiceImpl.PARENT_TAG_KEY_FIELD), addWhitespace(TagServiceImpl.HAS_CHILDREN_FIELD)));
    // Validate the returned object.
    assertEquals(new TagSearchResponse(Arrays.asList(new Tag(NO_ID, new TagKey(TAG_TYPE, TAG_CODE_3), TAG_DISPLAY_NAME_2, TAG_SEARCH_SCORE_MULTIPLIER_3, TAG_DESCRIPTION_3, NO_USER_ID, NO_USER_ID, NO_UPDATED_TIME, new TagKey(TAG_TYPE, TAG_CODE), TAG_HAS_NO_CHILDREN), new Tag(NO_ID, new TagKey(TAG_TYPE, TAG_CODE_2), TAG_DISPLAY_NAME_3, TAG_SEARCH_SCORE_MULTIPLIER_2, TAG_DESCRIPTION_2, NO_USER_ID, NO_USER_ID, NO_UPDATED_TIME, new TagKey(TAG_TYPE, TAG_CODE), TAG_HAS_NO_CHILDREN))), tagSearchResponse);
}
Also used : TagSearchFilter(org.finra.herd.model.api.xml.TagSearchFilter) TagSearchKey(org.finra.herd.model.api.xml.TagSearchKey) TagSearchResponse(org.finra.herd.model.api.xml.TagSearchResponse) TagKey(org.finra.herd.model.api.xml.TagKey) Tag(org.finra.herd.model.api.xml.Tag) TagSearchRequest(org.finra.herd.model.api.xml.TagSearchRequest) Test(org.junit.Test)

Aggregations

TagSearchKey (org.finra.herd.model.api.xml.TagSearchKey)11 TagSearchFilter (org.finra.herd.model.api.xml.TagSearchFilter)10 TagSearchRequest (org.finra.herd.model.api.xml.TagSearchRequest)9 Test (org.junit.Test)9 Tag (org.finra.herd.model.api.xml.Tag)8 TagSearchResponse (org.finra.herd.model.api.xml.TagSearchResponse)8 TagKey (org.finra.herd.model.api.xml.TagKey)7 ArrayList (java.util.ArrayList)3 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)1 TagTypeKey (org.finra.herd.model.api.xml.TagTypeKey)1 TagEntity (org.finra.herd.model.jpa.TagEntity)1 TagTypeEntity (org.finra.herd.model.jpa.TagTypeEntity)1