Search in sources :

Example 66 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testGetBusinessObjectDefinitionTagsByTagUpperCaseParameters.

@Test
public void testGetBusinessObjectDefinitionTagsByTagUpperCaseParameters() {
    // Create business object definition keys.
    List<BusinessObjectDefinitionKey> businessObjectDefinitionKeys = Arrays.asList(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new BusinessObjectDefinitionKey(BDEF_NAMESPACE_2, BDEF_NAME_2));
    // Create a tag key.
    TagKey tagKey = new TagKey(TAG_TYPE, TAG_CODE);
    // Create and persist business object definition tag entities.
    for (BusinessObjectDefinitionKey businessObjectDefinitionKey : businessObjectDefinitionKeys) {
        businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionKey, tagKey);
    }
    // Get business object definition tags by tag using upper case parameter values.
    BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByTag(new TagKey(TAG_TYPE.toUpperCase(), TAG_CODE.toUpperCase()));
    // Validate the returned object.
    assertNotNull(result);
    assertEquals(Arrays.asList(new BusinessObjectDefinitionTagKey(businessObjectDefinitionKeys.get(0), tagKey), new BusinessObjectDefinitionTagKey(businessObjectDefinitionKeys.get(1), tagKey)), result.getBusinessObjectDefinitionTagKeys());
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) Test(org.junit.Test)

Example 67 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testCreateBusinessObjectDefinitionTagTrimParameters.

@Test
public void testCreateBusinessObjectDefinitionTagTrimParameters() {
    // 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 input parameters with leading and trailing empty spaces.
    BusinessObjectDefinitionTag result = businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME)), new TagKey(addWhitespace(TAG_TYPE), addWhitespace(TAG_CODE)))));
    // 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 68 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testGetBusinessObjectDefinitionTagsByTag.

@Test
public void testGetBusinessObjectDefinitionTagsByTag() {
    // Create business object definition keys.
    List<BusinessObjectDefinitionKey> businessObjectDefinitionKeys = Arrays.asList(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new BusinessObjectDefinitionKey(BDEF_NAMESPACE_2, BDEF_NAME_2));
    // Create a tag key.
    TagKey tagKey = new TagKey(TAG_TYPE, TAG_CODE);
    // Create and persist business object definition tag entities.
    for (BusinessObjectDefinitionKey businessObjectDefinitionKey : businessObjectDefinitionKeys) {
        businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionKey, tagKey);
    }
    // Get business object definition tags by tag.
    BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByTag(tagKey);
    // Validate the returned object.
    assertNotNull(result);
    assertEquals(Arrays.asList(new BusinessObjectDefinitionTagKey(businessObjectDefinitionKeys.get(0), tagKey), new BusinessObjectDefinitionTagKey(businessObjectDefinitionKeys.get(1), tagKey)), result.getBusinessObjectDefinitionTagKeys());
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) Test(org.junit.Test)

Example 69 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testGetBusinessObjectDefinitionTagsByTagTrimParameters.

@Test
public void testGetBusinessObjectDefinitionTagsByTagTrimParameters() {
    // Create business object definition keys.
    List<BusinessObjectDefinitionKey> businessObjectDefinitionKeys = Arrays.asList(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new BusinessObjectDefinitionKey(BDEF_NAMESPACE_2, BDEF_NAME_2));
    // Create a tag key.
    TagKey tagKey = new TagKey(TAG_TYPE, TAG_CODE);
    // Create and persist business object definition tag entities.
    for (BusinessObjectDefinitionKey businessObjectDefinitionKey : businessObjectDefinitionKeys) {
        businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionKey, tagKey);
    }
    // Get business object definition tags by tag using input parameters with leading and trailing empty spaces.
    BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByTag(new TagKey(addWhitespace(TAG_TYPE), addWhitespace(TAG_CODE)));
    // Validate the returned object.
    assertNotNull(result);
    assertEquals(Arrays.asList(new BusinessObjectDefinitionTagKey(businessObjectDefinitionKeys.get(0), tagKey), new BusinessObjectDefinitionTagKey(businessObjectDefinitionKeys.get(1), tagKey)), result.getBusinessObjectDefinitionTagKeys());
}
Also used : BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) BusinessObjectDefinitionTagKeys(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) TagKey(org.finra.herd.model.api.xml.TagKey) BusinessObjectDefinitionTagKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey) Test(org.junit.Test)

Example 70 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testDeleteBusinessObjectDefinitionTagTagNoExists.

@Test
public void testDeleteBusinessObjectDefinitionTagTagNoExists() {
    // Try to create a non-existing business object definition tag.
    try {
        businessObjectDefinitionTagService.deleteBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE)));
        fail();
    } catch (ObjectNotFoundException e) {
        assertEquals(String.format("Tag with tag type \"%s\" and code \"%s\" does not exist for business object definition {%s}.", TAG_TYPE, TAG_CODE, businessObjectDefinitionServiceTestHelper.getExpectedBusinessObjectDefinitionKeyAsString(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) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)187 Test (org.junit.Test)152 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)73 BusinessObjectDefinition (org.finra.herd.model.api.xml.BusinessObjectDefinition)44 TagKey (org.finra.herd.model.api.xml.TagKey)39 BusinessObjectDefinitionTagKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKey)34 Attribute (org.finra.herd.model.api.xml.Attribute)32 ArrayList (java.util.ArrayList)21 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)16 BusinessObjectDefinitionCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionCreateRequest)16 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)15 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)14 BusinessObjectDefinitionDescriptiveInformationUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionDescriptiveInformationUpdateRequest)13 FileTypeEntity (org.finra.herd.model.jpa.FileTypeEntity)13 StorageEntity (org.finra.herd.model.jpa.StorageEntity)13 BusinessObjectDefinitionTagKeys (org.finra.herd.model.api.xml.BusinessObjectDefinitionTagKeys)12 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)11 BusinessObjectDefinitionUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionUpdateRequest)11 DescriptiveBusinessObjectFormat (org.finra.herd.model.api.xml.DescriptiveBusinessObjectFormat)11 SampleDataFile (org.finra.herd.model.api.xml.SampleDataFile)11