Search in sources :

Example 6 with TagChild

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

the class TagServiceTest method testGetTagsUpperCaseParameters.

@Test
public void testGetTagsUpperCaseParameters() {
    // Create and persist a tag type entity.
    TagTypeEntity tagTypeEntity = tagTypeDaoTestHelper.createTagTypeEntity(TAG_TYPE, TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
    // Create and persist two tag entities for the same tag type.
    tagDaoTestHelper.createTagEntity(tagTypeEntity, TAG_CODE, TAG_DISPLAY_NAME, TAG_SEARCH_SCORE_MULTIPLIER, TAG_DESCRIPTION);
    tagDaoTestHelper.createTagEntity(tagTypeEntity, TAG_CODE_2, TAG_TYPE_DISPLAY_NAME_2, TAG_SEARCH_SCORE_MULTIPLIER_2, TAG_DESCRIPTION);
    // Retrieve a list of tag keys using uppercase input parameters.
    TagListResponse resultTagKeys = tagService.getTags(TAG_TYPE.toUpperCase(), NO_PARENT_TAG_CODE);
    // Validate the returned object.
    assertNotNull(resultTagKeys);
    assertEquals(Arrays.asList(new TagChild(new TagKey(TAG_TYPE, TAG_CODE), TAG_HAS_NO_CHILDREN), new TagChild(new TagKey(TAG_TYPE, TAG_CODE_2), TAG_HAS_NO_CHILDREN)), resultTagKeys.getTagChildren());
}
Also used : TagChild(org.finra.herd.model.api.xml.TagChild) TagListResponse(org.finra.herd.model.api.xml.TagListResponse) TagTypeEntity(org.finra.herd.model.jpa.TagTypeEntity) TagKey(org.finra.herd.model.api.xml.TagKey) Test(org.junit.Test)

Example 7 with TagChild

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

the class TagServiceTest method testGetTagsTrimParameters.

@Test
public void testGetTagsTrimParameters() {
    // Create and persist a tag type entity.
    TagTypeEntity tagTypeEntity = tagTypeDaoTestHelper.createTagTypeEntity(TAG_TYPE, TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
    // Create and persist two tag entities for the same tag type.
    tagDaoTestHelper.createTagEntity(tagTypeEntity, TAG_CODE, TAG_DISPLAY_NAME, TAG_SEARCH_SCORE_MULTIPLIER, TAG_DESCRIPTION);
    tagDaoTestHelper.createTagEntity(tagTypeEntity, TAG_CODE_2, TAG_TYPE_DISPLAY_NAME_2, TAG_SEARCH_SCORE_MULTIPLIER_2, TAG_DESCRIPTION_2);
    // Retrieve a list of tag keys using input parameters with leading and trailing empty spaces.
    TagListResponse resultTagKeys = tagService.getTags(addWhitespace(TAG_TYPE), NO_PARENT_TAG_CODE);
    // Validate the returned object.
    assertNotNull(resultTagKeys);
    assertEquals(Arrays.asList(new TagChild(new TagKey(TAG_TYPE, TAG_CODE), TAG_HAS_NO_CHILDREN), new TagChild(new TagKey(TAG_TYPE, TAG_CODE_2), TAG_HAS_NO_CHILDREN)), resultTagKeys.getTagChildren());
}
Also used : TagChild(org.finra.herd.model.api.xml.TagChild) TagListResponse(org.finra.herd.model.api.xml.TagListResponse) TagTypeEntity(org.finra.herd.model.jpa.TagTypeEntity) TagKey(org.finra.herd.model.api.xml.TagKey) Test(org.junit.Test)

Example 8 with TagChild

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

the class TagServiceTest method testGetTagsLowerCaseParameters.

@Test
public void testGetTagsLowerCaseParameters() {
    // Create and persist a tag type entity.
    TagTypeEntity tagTypeEntity = tagTypeDaoTestHelper.createTagTypeEntity(TAG_TYPE, TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
    // Create and persist two tag entities for the same tag type.
    tagDaoTestHelper.createTagEntity(tagTypeEntity, TAG_CODE, TAG_DISPLAY_NAME, TAG_SEARCH_SCORE_MULTIPLIER, TAG_DESCRIPTION);
    tagDaoTestHelper.createTagEntity(tagTypeEntity, TAG_CODE_2, TAG_TYPE_DISPLAY_NAME_2, TAG_DESCRIPTION_2);
    // Retrieve a list of tag keys using lowercase input parameters.
    TagListResponse resultTagKeys = tagService.getTags(addWhitespace(TAG_TYPE), NO_PARENT_TAG_CODE);
    // Validate the returned object.
    assertNotNull(resultTagKeys);
    assertEquals(Arrays.asList(new TagChild(new TagKey(TAG_TYPE, TAG_CODE), TAG_HAS_NO_CHILDREN), new TagChild(new TagKey(TAG_TYPE, TAG_CODE_2), TAG_HAS_NO_CHILDREN)), resultTagKeys.getTagChildren());
}
Also used : TagChild(org.finra.herd.model.api.xml.TagChild) TagListResponse(org.finra.herd.model.api.xml.TagListResponse) TagTypeEntity(org.finra.herd.model.jpa.TagTypeEntity) TagKey(org.finra.herd.model.api.xml.TagKey) Test(org.junit.Test)

Aggregations

TagChild (org.finra.herd.model.api.xml.TagChild)8 TagKey (org.finra.herd.model.api.xml.TagKey)8 TagListResponse (org.finra.herd.model.api.xml.TagListResponse)6 TagTypeEntity (org.finra.herd.model.jpa.TagTypeEntity)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)2 TagEntity (org.finra.herd.model.jpa.TagEntity)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 Predicate (javax.persistence.criteria.Predicate)1 Tag (org.finra.herd.model.api.xml.Tag)1 TagTypeKey (org.finra.herd.model.api.xml.TagTypeKey)1