use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class BusinessObjectDataDaoTestHelper method createBusinessObjectDataEntity.
/**
* Creates and persists a new business object data entity.
*
* @return the newly created business object data entity.
*/
public BusinessObjectDataEntity createBusinessObjectDataEntity(String namespaceCode, String businessObjectDefinitionName, String businessObjectFormatUsage, String businessObjectFormatFileType, Integer businessObjectFormatVersion, String businessObjectDataPartitionValue, List<String> businessObjectDataSubPartitionValues, Integer businessObjectDataVersion, Boolean businessObjectDataLatestVersion, String businessObjectDataStatusCode, List<BusinessObjectDataEntity> businessObjectDataParents) {
// Create a business object format entity if it does not exist.
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDao.getBusinessObjectFormatByAltKey(new BusinessObjectFormatKey(namespaceCode, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, businessObjectFormatVersion));
if (businessObjectFormatEntity == null) {
businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(namespaceCode, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, businessObjectFormatVersion, AbstractDaoTest.FORMAT_DESCRIPTION, true, AbstractDaoTest.PARTITION_KEY);
}
// Create a business object data status entity if it does not exist.
BusinessObjectDataStatusEntity businessObjectDataStatusEntity = businessObjectDataStatusDao.getBusinessObjectDataStatusByCode(businessObjectDataStatusCode);
if (businessObjectDataStatusEntity == null) {
businessObjectDataStatusEntity = businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(businessObjectDataStatusCode);
}
return createBusinessObjectDataEntity(businessObjectFormatEntity, businessObjectDataPartitionValue, businessObjectDataSubPartitionValues, businessObjectDataVersion, businessObjectDataLatestVersion, businessObjectDataStatusEntity, businessObjectDataParents);
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTest method testGetBusinessObjectFormatByAltKeyAllParamsUpperCase.
@Test
public void testGetBusinessObjectFormatByAltKeyAllParamsUpperCase() {
// Create relative database entities.
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), DATA_PROVIDER_NAME.toLowerCase(), BDEF_DESCRIPTION);
fileTypeDaoTestHelper.createFileTypeEntity(FORMAT_FILE_TYPE_CODE.toLowerCase(), "Description of " + FORMAT_FILE_TYPE_CODE);
businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), INITIAL_FORMAT_VERSION, "Test format 0", Boolean.TRUE, PARTITION_KEY);
// Retrieve business object format entity by specifying values for all text alternate key fields in upper case.
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDao.getBusinessObjectFormatByAltKey(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), INITIAL_FORMAT_VERSION));
// Validate the results.
assertNotNull(businessObjectFormatEntity);
assertTrue(businessObjectFormatEntity.getBusinessObjectDefinition().getName().equals(BDEF_NAME.toLowerCase()));
assertTrue(businessObjectFormatEntity.getUsage().equals(FORMAT_USAGE_CODE.toLowerCase()));
assertTrue(businessObjectFormatEntity.getFileType().getCode().equals(FORMAT_FILE_TYPE_CODE.toLowerCase()));
assertTrue(businessObjectFormatEntity.getBusinessObjectFormatVersion().equals(INITIAL_FORMAT_VERSION));
assertTrue(businessObjectFormatEntity.getLatestVersion());
assertTrue(businessObjectFormatEntity.getPartitionKey().equals(PARTITION_KEY));
assertTrue(businessObjectFormatEntity.getDescription().equals("Test format 0"));
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTest method testGetBusinessObjectFormatMaxVersion.
@Test
public void testGetBusinessObjectFormatMaxVersion() {
// Create and persist two versions of the business object format.
for (Integer version : Arrays.asList(INITIAL_FORMAT_VERSION, SECOND_FORMAT_VERSION)) {
businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, version, FORMAT_DESCRIPTION, false, PARTITION_KEY);
}
// Retrieve the latest (maximum available) business object format version.
Integer resultLatestVersion = businessObjectFormatDao.getBusinessObjectFormatMaxVersion(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null));
// Validate the results.
assertEquals(SECOND_DATA_VERSION, resultLatestVersion);
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTest method testGetBusinessObjectFormatByAltKeyAllParamsLowerCase.
@Test
public void testGetBusinessObjectFormatByAltKeyAllParamsLowerCase() {
// Create relative database entities.
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), DATA_PROVIDER_NAME.toUpperCase(), BDEF_DESCRIPTION);
fileTypeDaoTestHelper.createFileTypeEntity(FORMAT_FILE_TYPE_CODE.toUpperCase(), "Description of " + FORMAT_FILE_TYPE_CODE);
businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), INITIAL_FORMAT_VERSION, "Test format 0", Boolean.TRUE, PARTITION_KEY);
// Retrieve business object format entity by specifying values for all text alternate key fields in lower case.
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDao.getBusinessObjectFormatByAltKey(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), INITIAL_FORMAT_VERSION));
// Validate the results.
assertNotNull(businessObjectFormatEntity);
assertTrue(businessObjectFormatEntity.getBusinessObjectDefinition().getName().equals(BDEF_NAME.toUpperCase()));
assertTrue(businessObjectFormatEntity.getUsage().equals(FORMAT_USAGE_CODE.toUpperCase()));
assertTrue(businessObjectFormatEntity.getFileType().getCode().equals(FORMAT_FILE_TYPE_CODE.toUpperCase()));
assertTrue(businessObjectFormatEntity.getBusinessObjectFormatVersion().equals(INITIAL_FORMAT_VERSION));
assertTrue(businessObjectFormatEntity.getLatestVersion());
assertTrue(businessObjectFormatEntity.getPartitionKey().equals(PARTITION_KEY));
assertTrue(businessObjectFormatEntity.getDescription().equals("Test format 0"));
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTestHelper method getTestBusinessObjectFormatKeys.
/**
* Returns a list of test business object format keys.
*
* @return the list of test business object format keys
*/
public List<BusinessObjectFormatKey> getTestBusinessObjectFormatKeys() {
List<BusinessObjectFormatKey> keys = new ArrayList<>();
keys.add(new BusinessObjectFormatKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME, AbstractDaoTest.FORMAT_USAGE_CODE, AbstractDaoTest.FORMAT_FILE_TYPE_CODE, AbstractDaoTest.INITIAL_FORMAT_VERSION));
keys.add(new BusinessObjectFormatKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME, AbstractDaoTest.FORMAT_USAGE_CODE_2, AbstractDaoTest.FORMAT_FILE_TYPE_CODE, AbstractDaoTest.INITIAL_FORMAT_VERSION));
keys.add(new BusinessObjectFormatKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME, AbstractDaoTest.FORMAT_USAGE_CODE_2, AbstractDaoTest.FORMAT_FILE_TYPE_CODE, AbstractDaoTest.SECOND_FORMAT_VERSION));
keys.add(new BusinessObjectFormatKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME, AbstractDaoTest.FORMAT_USAGE_CODE, AbstractDaoTest.FORMAT_FILE_TYPE_CODE_2, AbstractDaoTest.INITIAL_FORMAT_VERSION));
keys.add(new BusinessObjectFormatKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME, AbstractDaoTest.FORMAT_USAGE_CODE, AbstractDaoTest.FORMAT_FILE_TYPE_CODE, AbstractDaoTest.SECOND_FORMAT_VERSION));
keys.add(new BusinessObjectFormatKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME_2, AbstractDaoTest.FORMAT_USAGE_CODE, AbstractDaoTest.FORMAT_FILE_TYPE_CODE, AbstractDaoTest.INITIAL_FORMAT_VERSION));
keys.add(new BusinessObjectFormatKey(AbstractDaoTest.NAMESPACE_2, AbstractDaoTest.BDEF_NAME, AbstractDaoTest.FORMAT_USAGE_CODE, AbstractDaoTest.FORMAT_FILE_TYPE_CODE, AbstractDaoTest.INITIAL_FORMAT_VERSION));
keys.add(new BusinessObjectFormatKey(AbstractDaoTest.NAMESPACE_2, AbstractDaoTest.BDEF_NAME_2, AbstractDaoTest.FORMAT_USAGE_CODE, AbstractDaoTest.FORMAT_FILE_TYPE_CODE, AbstractDaoTest.INITIAL_FORMAT_VERSION));
return keys;
}
Aggregations