Search in sources :

Example 1 with TagType

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

the class TagTypeServiceImpl method createTagTypeFromEntity.

/**
 * Creates the tag type registration from the persisted entity.
 *
 * @param tagTypeEntity the tag type registration entity
 * @param includeDisplayName specifies to include the display name field
 * @param includeTagTypeOrder specifies to include the tag type order field
 * @param includeDescription specifies to include the description field
 *
 * @return the tag type registration
 */
private TagType createTagTypeFromEntity(TagTypeEntity tagTypeEntity, boolean includeDisplayName, boolean includeTagTypeOrder, boolean includeDescription) {
    TagType tagType = new TagType();
    TagTypeKey tagTypeKey = new TagTypeKey();
    tagType.setTagTypeKey(tagTypeKey);
    tagTypeKey.setTagTypeCode(tagTypeEntity.getCode());
    if (includeDisplayName) {
        tagType.setDisplayName(tagTypeEntity.getDisplayName());
    }
    if (includeTagTypeOrder) {
        tagType.setTagTypeOrder(tagTypeEntity.getOrderNumber());
    }
    if (includeDescription) {
        tagType.setDescription(tagTypeEntity.getDescription());
    }
    return tagType;
}
Also used : TagType(org.finra.herd.model.api.xml.TagType) TagTypeKey(org.finra.herd.model.api.xml.TagTypeKey)

Example 2 with TagType

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

the class TagTypeRestControllerTest method testDeleteTagType.

@Test
public void testDeleteTagType() throws Exception {
    TagTypeKey tagTypeKey = new TagTypeKey(TAG_TYPE);
    TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
    when(tagTypeService.deleteTagType(tagTypeKey)).thenReturn(tagType);
    // Delete this tag type.
    TagType deletedTagType = tagTypeRestController.deleteTagType(TAG_TYPE);
    // Verify the external calls.
    verify(tagTypeService).deleteTagType(tagTypeKey);
    verifyNoMoreInteractions(tagTypeService);
    // Validate the returned object.
    assertEquals(tagType, deletedTagType);
}
Also used : TagType(org.finra.herd.model.api.xml.TagType) TagTypeKey(org.finra.herd.model.api.xml.TagTypeKey) Test(org.junit.Test)

Example 3 with TagType

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

the class TagTypeRestControllerTest method testGetTagType.

@Test
public void testGetTagType() throws Exception {
    TagTypeKey tagTypeKey = new TagTypeKey(TAG_TYPE);
    TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
    when(tagTypeService.getTagType(tagTypeKey)).thenReturn(tagType);
    // Retrieve the tag type.
    TagType resultTagType = tagTypeRestController.getTagType(TAG_TYPE);
    // Verify the external calls.
    verify(tagTypeService).getTagType(tagTypeKey);
    verifyNoMoreInteractions(tagTypeService);
    // Validate the returned object.
    assertEquals(tagType, resultTagType);
}
Also used : TagType(org.finra.herd.model.api.xml.TagType) TagTypeKey(org.finra.herd.model.api.xml.TagTypeKey) Test(org.junit.Test)

Example 4 with TagType

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

the class TagTypeRestControllerTest method testCreateTagType.

@Test
public void testCreateTagType() throws Exception {
    TagTypeCreateRequest request = new TagTypeCreateRequest(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
    TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
    when(tagTypeService.createTagType(request)).thenReturn(tagType);
    // Create a tag type.
    TagType resultTagType = tagTypeRestController.createTagType(new TagTypeCreateRequest(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION));
    // Verify the external calls.
    verify(tagTypeService).createTagType(request);
    verifyNoMoreInteractions(tagTypeService);
    // Validate the returned object.
    assertEquals(tagType, resultTagType);
}
Also used : TagType(org.finra.herd.model.api.xml.TagType) TagTypeCreateRequest(org.finra.herd.model.api.xml.TagTypeCreateRequest) TagTypeKey(org.finra.herd.model.api.xml.TagTypeKey) Test(org.junit.Test)

Example 5 with TagType

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

the class TagTypeRestControllerTest method testUpdateTagType.

@Test
public void testUpdateTagType() throws Exception {
    TagTypeKey tagTypeKey = new TagTypeKey(TAG_TYPE);
    TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME_2, TAG_TYPE_ORDER_2, TAG_TYPE_DESCRIPTION_2);
    TagTypeUpdateRequest request = new TagTypeUpdateRequest(TAG_TYPE_DISPLAY_NAME_2, TAG_TYPE_ORDER_2, TAG_TYPE_DESCRIPTION_2);
    when(tagTypeService.updateTagType(tagTypeKey, request)).thenReturn(tagType);
    // Retrieve the tag type.
    TagType resultTagType = tagTypeRestController.updateTagType(TAG_TYPE, request);
    // Validate the returned object.
    assertEquals(tagType, resultTagType);
}
Also used : TagType(org.finra.herd.model.api.xml.TagType) TagTypeKey(org.finra.herd.model.api.xml.TagTypeKey) TagTypeUpdateRequest(org.finra.herd.model.api.xml.TagTypeUpdateRequest) Test(org.junit.Test)

Aggregations

TagType (org.finra.herd.model.api.xml.TagType)28 TagTypeKey (org.finra.herd.model.api.xml.TagTypeKey)27 Test (org.junit.Test)26 TagTypeSearchResponse (org.finra.herd.model.api.xml.TagTypeSearchResponse)7 TagTypeUpdateRequest (org.finra.herd.model.api.xml.TagTypeUpdateRequest)7 TagTypeSearchRequest (org.finra.herd.model.api.xml.TagTypeSearchRequest)6 TagTypeCreateRequest (org.finra.herd.model.api.xml.TagTypeCreateRequest)3 ArrayList (java.util.ArrayList)1 TagTypeEntity (org.finra.herd.model.jpa.TagTypeEntity)1