Search in sources :

Example 71 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testGetBusinessObjectDefinitionTagsByBusinessObjectDefinitionLowerCaseParameters.

@Test
public void testGetBusinessObjectDefinitionTagsByBusinessObjectDefinitionLowerCaseParameters() {
    // Create a business object definition key.
    BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME);
    // Create tag keys.
    List<TagKey> tagKeys = Arrays.asList(new TagKey(TAG_TYPE, TAG_CODE), new TagKey(TAG_TYPE_2, TAG_CODE_2));
    // Create and persist business object definition tag entities.
    for (TagKey tagKey : tagKeys) {
        businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionKey, tagKey);
    }
    // Get business object definition tags by business object definition using lower case parameter values.
    BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByBusinessObjectDefinition(new BusinessObjectDefinitionKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase()));
    // Validate the returned object.
    assertNotNull(result);
    assertEquals(Arrays.asList(new BusinessObjectDefinitionTagKey(businessObjectDefinitionKey, tagKeys.get(0)), new BusinessObjectDefinitionTagKey(businessObjectDefinitionKey, tagKeys.get(1))), 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 72 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testCreateBusinessObjectDefinitionTagMissingRequiredParameters.

@Test
public void testCreateBusinessObjectDefinitionTagMissingRequiredParameters() {
    // Try to create a business object definition tag when business object definition namespace is not specified.
    try {
        businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BLANK_TEXT, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    // Try to create a business object definition tag when business object definition name is not specified.
    try {
        businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BLANK_TEXT), new TagKey(TAG_TYPE, TAG_CODE))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("A business object definition name must be specified.", e.getMessage());
    }
    // Try to create a business object definition tag when tag type is not specified.
    try {
        businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(BLANK_TEXT, TAG_CODE))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("A tag type code must be specified.", e.getMessage());
    }
    // Try to create a business object definition tag when tag code is not specified.
    try {
        businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, BLANK_TEXT))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("A tag code must be specified.", e.getMessage());
    }
}
Also used : 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 73 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testGetBusinessObjectDefinitionTagsByBusinessObjectDefinitionTrimParameters.

@Test
public void testGetBusinessObjectDefinitionTagsByBusinessObjectDefinitionTrimParameters() {
    // Create a business object definition key.
    BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME);
    // Create tag keys.
    List<TagKey> tagKeys = Arrays.asList(new TagKey(TAG_TYPE, TAG_CODE), new TagKey(TAG_TYPE_2, TAG_CODE_2));
    // Create and persist business object definition tag entities.
    for (TagKey tagKey : tagKeys) {
        businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionKey, tagKey);
    }
    // Get business object definition tags by business object definition using input parameters with leading and trailing empty spaces.
    BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByBusinessObjectDefinition(new BusinessObjectDefinitionKey(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME)));
    // Validate the returned object.
    assertNotNull(result);
    assertEquals(Arrays.asList(new BusinessObjectDefinitionTagKey(businessObjectDefinitionKey, tagKeys.get(0)), new BusinessObjectDefinitionTagKey(businessObjectDefinitionKey, tagKeys.get(1))), 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 74 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testGetBusinessObjectDefinitionTagsByTagLowerCaseParameters.

@Test
public void testGetBusinessObjectDefinitionTagsByTagLowerCaseParameters() {
    // 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 lower case parameter values.
    BusinessObjectDefinitionTagKeys result = businessObjectDefinitionTagService.getBusinessObjectDefinitionTagsByTag(new TagKey(TAG_TYPE.toLowerCase(), TAG_CODE.toLowerCase()));
    // 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 75 with BusinessObjectDefinitionKey

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

the class BusinessObjectDefinitionTagServiceTest method testCreateBusinessObjectDefinitionTagInvalidParameters.

@Test
public void testCreateBusinessObjectDefinitionTagInvalidParameters() {
    // Try to create a business object definition tag when business object definition namespace contains a forward slash character.
    try {
        businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(addSlash(BDEF_NAMESPACE), BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("Namespace can not contain a forward slash character.", e.getMessage());
    }
    // Try to create a business object definition tag when business object definition name contains a forward slash character.
    try {
        businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, addSlash(BDEF_NAME)), new TagKey(TAG_TYPE, TAG_CODE))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("Business object definition name can not contain a forward slash character.", e.getMessage());
    }
    // Try to create a business object definition tag when business object definition namespace contains a forward slash character.
    try {
        businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(addSlash(TAG_TYPE), TAG_CODE))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("Tag type code can not contain a forward slash character.", e.getMessage());
    }
    // Try to create a business object definition tag when business object definition name contains a forward slash character.
    try {
        businessObjectDefinitionTagService.createBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagCreateRequest(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, addSlash(TAG_CODE)))));
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("Tag code can not contain a forward slash character.", e.getMessage());
    }
}
Also used : 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)

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