use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceTest method testCreateBusinessObjectDefinitionTag.
@Test
public void testCreateBusinessObjectDefinitionTag() {
// Create a business object definition key.
BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME);
// Create a business object definition tag key.
BusinessObjectDefinitionTagKey businessObjectDefinitionTagKey = new BusinessObjectDefinitionTagKey(businessObjectDefinitionKey, new TagKey(TAG_TYPE, TAG_CODE));
// Create and persist a business object definition entity.
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(businessObjectDefinitionKey, DATA_PROVIDER_NAME, DESCRIPTION);
// Create and persist a tag entity.
tagDaoTestHelper.createTagEntity(TAG_TYPE, TAG_CODE, TAG_DISPLAY_NAME, TAG_DESCRIPTION);
// Create a business object definition tag.
BusinessObjectDefinitionTag result = businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(businessObjectDefinitionTagKey));
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionTag(result.getId(), businessObjectDefinitionTagKey), result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceTest method testCreateBusinessObjectDefinitionTagBusinessObjectDefinitionTagAlreadyExists.
@Test
public void testCreateBusinessObjectDefinitionTagBusinessObjectDefinitionTagAlreadyExists() {
// Create a business object definition tag key.
BusinessObjectDefinitionTagKey businessObjectDefinitionTagKey = new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE));
// Create and persist a business object definition tag entity.
businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionTagKey);
// Try to add a duplicate business object definition tag.
try {
businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(businessObjectDefinitionTagKey));
fail();
} catch (AlreadyExistsException e) {
assertEquals(String.format("Tag with tag type \"%s\" and code \"%s\" already exists for business object definition {%s}.", TAG_TYPE, TAG_CODE, businessObjectDefinitionServiceTestHelper.getExpectedBusinessObjectDefinitionKeyAsString(BDEF_NAMESPACE, BDEF_NAME)), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceTest method testCreateBusinessObjectDefinitionTagLowerCaseParameters.
@Test
public void testCreateBusinessObjectDefinitionTagLowerCaseParameters() {
// Create and persist a business object definition entity.
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), DATA_PROVIDER_NAME, DESCRIPTION);
// Create and persist a tag entity.
tagDaoTestHelper.createTagEntity(TAG_TYPE, TAG_CODE, TAG_DISPLAY_NAME, TAG_DESCRIPTION);
// Create a business object definition tag using lower case parameter values.
BusinessObjectDefinitionTag result = businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase()), new TagKey(TAG_TYPE.toLowerCase(), TAG_CODE.toLowerCase()))));
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionTag(result.getId(), new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE))), result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceTest method testCreateBusinessObjectDefinitionTagBusinessObjectDefinitionNoExists.
@Test
public void testCreateBusinessObjectDefinitionTagBusinessObjectDefinitionNoExists() {
// Create and persist a tag entity.
tagDaoTestHelper.createTagEntity(TAG_TYPE, TAG_CODE, TAG_DISPLAY_NAME, TAG_DESCRIPTION);
// Try to create a business object definition tag for a non-existing business object definition.
try {
businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE))));
fail();
} catch (ObjectNotFoundException e) {
assertEquals(businessObjectDefinitionServiceTestHelper.getExpectedBusinessObjectDefinitionNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceTest method testCreateBusinessObjectDefinitionTagTagNoExists.
@Test
public void testCreateBusinessObjectDefinitionTagTagNoExists() {
// Create and persist a business object definition entity.
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), DATA_PROVIDER_NAME, DESCRIPTION);
// Try to create a business object definition tag for a non-existing tag.
try {
businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE))));
fail();
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Tag with code \"%s\" doesn't exist for tag type \"%s\".", TAG_CODE, TAG_TYPE), e.getMessage());
}
}
Aggregations