use of org.finra.herd.model.api.xml.TagTypeKey in project herd by FINRAOS.
the class TagTypeServiceTest method testDeleteTagType.
@Test
public void testDeleteTagType() {
// Create and persist a tag type entity.
tagTypeDaoTestHelper.createTagTypeEntity(TAG_TYPE, TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
// Delete the tag type.
TagType resultTagType = tagTypeService.deleteTagType(new TagTypeKey(TAG_TYPE));
// Validate the returned object.
assertEquals(new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION), resultTagType);
// Ensure that this tag type is no longer there.
assertNull(tagTypeDao.getTagTypeByKey(resultTagType.getTagTypeKey()));
}
use of org.finra.herd.model.api.xml.TagTypeKey in project herd by FINRAOS.
the class TagTypeServiceTest method testDeleteTagTypeTrimParameters.
@Test
public void testDeleteTagTypeTrimParameters() {
// Create and persist a tag type entity.
tagTypeDaoTestHelper.createTagTypeEntity(TAG_TYPE, TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
// Delete the tag type using input parameters with leading and trailing empty spaces.
TagType resultTagType = tagTypeService.deleteTagType(new TagTypeKey(addWhitespace(TAG_TYPE)));
// Validate the returned object.
assertEquals(new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION), resultTagType);
// Ensure that this tag type is no longer there.
assertNull(tagTypeDao.getTagTypeByKey(resultTagType.getTagTypeKey()));
}
use of org.finra.herd.model.api.xml.TagTypeKey in project herd by FINRAOS.
the class TagTypeServiceTest method testCreateTagTypeTrimParameters.
@Test
public void testCreateTagTypeTrimParameters() throws Exception {
// Create a tag type using input parameters with leading and trailing empty spaces.
TagType resultTagType = tagTypeService.createTagType(new TagTypeCreateRequest(new TagTypeKey(addWhitespace(TAG_TYPE)), addWhitespace(TAG_TYPE_DISPLAY_NAME), TAG_TYPE_ORDER, addWhitespace(TAG_TYPE_DESCRIPTION)));
// Validate the returned object.
assertEquals(new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, addWhitespace(TAG_TYPE_DESCRIPTION)), resultTagType);
}
use of org.finra.herd.model.api.xml.TagTypeKey in project herd by FINRAOS.
the class TagTypeServiceTest method testUpdateTagTypeDisplayNameAlreadyExists.
@Test
public void testUpdateTagTypeDisplayNameAlreadyExists() {
// Create and persist two tag type entities with the second one having display name that we want to update to.
tagTypeDaoTestHelper.createTagTypeEntity(TAG_TYPE, TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION);
tagTypeDaoTestHelper.createTagTypeEntity(TAG_TYPE_2, TAG_TYPE_DISPLAY_NAME_2, TAG_TYPE_ORDER_2, TAG_TYPE_DESCRIPTION_2);
// Try to update a tag type instance when display name already exists.
try {
tagTypeService.updateTagType(new TagTypeKey(TAG_TYPE), new TagTypeUpdateRequest(TAG_TYPE_DISPLAY_NAME_2, TAG_TYPE_ORDER_2, TAG_TYPE_DESCRIPTION_2));
fail();
} catch (AlreadyExistsException e) {
assertEquals(String.format("Display name \"%s\" already exists for tag type \"%s\".", TAG_TYPE_DISPLAY_NAME_2, TAG_TYPE_2), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.TagTypeKey in project herd by FINRAOS.
the class TagTypeServiceTest method testGetTagTypeTagTypeNotExists.
@Test
public void testGetTagTypeTagTypeNotExists() {
// Try to retrieve a tag type instance when tag type code is not registered.
try {
tagTypeService.getTagType(new TagTypeKey(TAG_TYPE));
fail();
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Tag type with code \"%s\" doesn't exist.", TAG_TYPE), e.getMessage());
}
}
Aggregations