use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectDefinitionDaoTestHelper method getExpectedBusinessObjectDefinitionKeys.
/**
* Returns a list of test business object definition keys expected to be returned by getBusinessObjectDefinitionKeys() method.
*
* @return the list of expected business object definition keys
*/
public List<BusinessObjectDefinitionKey> getExpectedBusinessObjectDefinitionKeys() {
List<BusinessObjectDefinitionKey> keys = new ArrayList<>();
keys.add(new BusinessObjectDefinitionKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME));
keys.add(new BusinessObjectDefinitionKey(AbstractDaoTest.NAMESPACE_2, AbstractDaoTest.BDEF_NAME));
keys.add(new BusinessObjectDefinitionKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME_2));
keys.add(new BusinessObjectDefinitionKey(AbstractDaoTest.NAMESPACE_2, AbstractDaoTest.BDEF_NAME_2));
return keys;
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectDefinitionTagDaoTest method testGetBusinessObjectDefinitionTagsByTagEntities.
@Test
public void testGetBusinessObjectDefinitionTagsByTagEntities() {
// Create and persist two business object definition entities with display names in reverse order.
List<BusinessObjectDefinitionEntity> businessObjectDefinitionEntities = Arrays.asList(businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, BDEF_DISPLAY_NAME_2, NO_ATTRIBUTES), businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE_2, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION_2, BDEF_DISPLAY_NAME, NO_ATTRIBUTES));
// Create and persist three tag entities with display names in reverse order.
List<TagEntity> tagEntities = Arrays.asList(tagDaoTestHelper.createTagEntity(TAG_TYPE, TAG_CODE, TAG_DISPLAY_NAME_2, TAG_DESCRIPTION), tagDaoTestHelper.createTagEntity(TAG_TYPE_2, TAG_CODE_2, TAG_DISPLAY_NAME, TAG_DESCRIPTION), tagDaoTestHelper.createTagEntity(TAG_TYPE, TAG_CODE_2, TAG_DISPLAY_NAME, TAG_DESCRIPTION));
// Create and persist two business object definition tag entities for the first two tag entities.
for (BusinessObjectDefinitionEntity businessObjectDefinitionEntity : businessObjectDefinitionEntities) {
for (TagEntity tagEntity : tagEntities.subList(0, 2)) {
businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionEntity, tagEntity);
}
}
// Get business object definition tags by the list of tag entities.
// Validate that the keys are ordered by business object definition display name and tag display name.
assertEquals(Arrays.asList(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE_2, BDEF_NAME_2), new TagKey(TAG_TYPE_2, TAG_CODE_2)), new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE_2, BDEF_NAME_2), new TagKey(TAG_TYPE, TAG_CODE)), new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE_2, TAG_CODE_2)), new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE))), businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagsByTagEntities(tagEntities));
// Try invalid values for all input parameters.
assertTrue(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagsByTagEntities(Arrays.asList(tagEntities.get(2))).isEmpty());
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectDefinitionTagDaoTest method testGetBusinessObjectDefinitionTagByKey.
@Test
public void testGetBusinessObjectDefinitionTagByKey() {
// 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.
BusinessObjectDefinitionTagEntity businessObjectDefinitionTagEntity = businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE));
// Get the business object definition tag.
assertEquals(businessObjectDefinitionTagEntity, businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(businessObjectDefinitionTagKey));
// Get business object definition tag by passing all case-insensitive parameters in uppercase.
assertEquals(businessObjectDefinitionTagEntity, businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase()), new TagKey(TAG_TYPE.toUpperCase(), TAG_CODE.toUpperCase()))));
// Get business object definition tag by passing all case-insensitive parameters in lowercase.
assertEquals(businessObjectDefinitionTagEntity, businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase()), new TagKey(TAG_TYPE.toLowerCase(), TAG_CODE.toLowerCase()))));
// Try invalid values for all input parameters.
assertNull(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey("I_DO_NOT_EXIST", BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE))));
assertNull(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, "I_DO_NOT_EXIST"), new TagKey(TAG_TYPE, TAG_CODE))));
assertNull(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey("I_DO_NOT_EXIST", TAG_CODE))));
assertNull(businessObjectDefinitionTagDao.getBusinessObjectDefinitionTagByKey(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, "I_DO_NOT_EXIST"))));
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTestHelper method createBusinessObjectFormatEntity.
/**
* Creates and persists a new business object format entity.
*
* @return the newly created business object format entity.
*/
public BusinessObjectFormatEntity createBusinessObjectFormatEntity(String namespaceCode, String businessObjectDefinitionName, String businessObjectFormatUsage, String fileType, Integer businessObjectFormatVersion, String businessObjectFormatDescription, Boolean businessObjectFormatLatestVersion, String businessObjectFormatPartitionKey, String partitionKeyGroupName, List<Attribute> attributes, String schemaDelimiterCharacter, String schemaEscapeCharacter, String schemaNullValue, List<SchemaColumn> schemaColumns, List<SchemaColumn> partitionColumns) {
// Create a business object definition entity if it does not exist.
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDao.getBusinessObjectDefinitionByKey(new BusinessObjectDefinitionKey(namespaceCode, businessObjectDefinitionName));
if (businessObjectDefinitionEntity == null) {
businessObjectDefinitionEntity = businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(namespaceCode, businessObjectDefinitionName, AbstractDaoTest.DATA_PROVIDER_NAME, null);
}
// Create a business object format file type entity if it does not exist.
FileTypeEntity fileTypeEntity = fileTypeDao.getFileTypeByCode(fileType);
if (fileTypeEntity == null) {
fileTypeEntity = fileTypeDaoTestHelper.createFileTypeEntity(fileType, null);
}
// If partition key group was specified, check if we need to create an entity for it first.
PartitionKeyGroupEntity partitionKeyGroupEntity = null;
if (StringUtils.isNotBlank(partitionKeyGroupName)) {
partitionKeyGroupEntity = partitionKeyGroupDao.getPartitionKeyGroupByName(partitionKeyGroupName);
if (partitionKeyGroupEntity == null) {
partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(partitionKeyGroupName);
}
}
return createBusinessObjectFormatEntity(businessObjectDefinitionEntity, businessObjectFormatUsage, fileTypeEntity, businessObjectFormatVersion, businessObjectFormatDescription, businessObjectFormatLatestVersion, businessObjectFormatPartitionKey, partitionKeyGroupEntity, attributes, schemaDelimiterCharacter, schemaEscapeCharacter, schemaNullValue, schemaColumns, partitionColumns);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectDefinitionHelperTest method testGetBusinessObjectDefinitionKey.
@Test
public void testGetBusinessObjectDefinitionKey() {
// Create a business object definition column key.
BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
// Get a business object definition key from the column key.
BusinessObjectDefinitionKey response = businessObjectDefinitionHelper.getBusinessObjectDefinitionKey(businessObjectDefinitionColumnKey);
// Validate the returned object.
assertEquals(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), response);
}
Aggregations