Search in sources :

Example 6 with BusinessObjectDefinitionTagCreateRequest

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);
}
Also used : BusinessObjectDefinitionTag(org.finra.herd.model.api.xml.BusinessObjectDefinitionTag) BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) BusinessObjectDefinitionTagCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest) Test(org.junit.Test)

Example 7 with BusinessObjectDefinitionTagCreateRequest

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());
    }
}
Also used : AlreadyExistsException(org.finra.herd.model.AlreadyExistsException) BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) BusinessObjectDefinitionTagCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest) Test(org.junit.Test)

Example 8 with BusinessObjectDefinitionTagCreateRequest

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);
}
Also used : BusinessObjectDefinitionTag(org.finra.herd.model.api.xml.BusinessObjectDefinitionTag) BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) BusinessObjectDefinitionTagCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest) Test(org.junit.Test)

Example 9 with BusinessObjectDefinitionTagCreateRequest

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());
    }
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) ObjectNotFoundException(org.finra.herd.model.ObjectNotFoundException) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) BusinessObjectDefinitionTagCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest) Test(org.junit.Test)

Example 10 with BusinessObjectDefinitionTagCreateRequest

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());
    }
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) ObjectNotFoundException(org.finra.herd.model.ObjectNotFoundException) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) BusinessObjectDefinitionTagCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)10 BusinessObjectDefinitionTagCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionTagCreateRequest)10 BusinessObjectDefinitionTagKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey)10 TagKey (org.finra.herd.model.api.xml.TagKey)10 Test (org.junit.Test)10 BusinessObjectDefinitionTag (org.finra.herd.model.api.xml.BusinessObjectDefinitionTag)5 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)2 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)1