use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTest method testGetBusinessObjectFormatsWithFilters.
@Test
public void testGetBusinessObjectFormatsWithFilters() {
// Create and persist the relative business object definitions.
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
// Create and persist business object format entities.
for (BusinessObjectFormatKey key : businessObjectFormatDaoTestHelper.getTestBusinessObjectFormatKeys()) {
businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(key.getNamespace(), key.getBusinessObjectDefinitionName(), key.getBusinessObjectFormatUsage(), key.getBusinessObjectFormatFileType(), key.getBusinessObjectFormatVersion(), FORMAT_DESCRIPTION, false, PARTITION_KEY);
}
// Retrieve a list of business object format keys for the specified business object definition.
List<BusinessObjectFormatKey> resultKeys = businessObjectFormatDao.getBusinessObjectFormatsWithFilters(new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME), FORMAT_USAGE_CODE, false);
// Need to filter format usage
List<BusinessObjectFormatKey> expectedKeyList = businessObjectFormatDaoTestHelper.getExpectedBusinessObjectFormatKeys();
expectedKeyList = expectedKeyList.stream().filter(formatKey -> (formatKey.getBusinessObjectFormatUsage().equalsIgnoreCase(FORMAT_USAGE_CODE))).collect(Collectors.toList());
// Validate the returned object.
assertEquals(expectedKeyList, resultKeys);
// Retrieve a list of the latest version business object format keys for the specified business object definition.
resultKeys = businessObjectFormatDao.getBusinessObjectFormatsWithFilters(new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME), FORMAT_USAGE_CODE, true);
// Need to filter format usage
expectedKeyList = businessObjectFormatDaoTestHelper.getExpectedBusinessObjectFormatLatestVersionKeys();
expectedKeyList = expectedKeyList.stream().filter(formatKey -> (formatKey.getBusinessObjectFormatUsage().equalsIgnoreCase(FORMAT_USAGE_CODE))).collect(Collectors.toList());
// Validate the returned object.
assertEquals(expectedKeyList, resultKeys);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTest method testGetBusinessObjectFormats.
@Test
public void testGetBusinessObjectFormats() {
// Create and persist the relative business object definitions.
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME_2, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, null);
// Create and persist business object format entities.
for (BusinessObjectFormatKey key : businessObjectFormatDaoTestHelper.getTestBusinessObjectFormatKeys()) {
businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(key.getNamespace(), key.getBusinessObjectDefinitionName(), key.getBusinessObjectFormatUsage(), key.getBusinessObjectFormatFileType(), key.getBusinessObjectFormatVersion(), FORMAT_DESCRIPTION, false, PARTITION_KEY);
}
// Retrieve a list of business object format keys for the specified business object definition.
List<BusinessObjectFormatKey> resultKeys = businessObjectFormatDao.getBusinessObjectFormats(new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME), false);
// Validate the returned object.
assertEquals(businessObjectFormatDaoTestHelper.getExpectedBusinessObjectFormatKeys(), resultKeys);
// Retrieve a list of the latest version business object format keys for the specified business object definition.
resultKeys = businessObjectFormatDao.getBusinessObjectFormats(new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME), true);
// Validate the returned object.
assertEquals(businessObjectFormatDaoTestHelper.getExpectedBusinessObjectFormatLatestVersionKeys(), resultKeys);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTest method testGetBusinessObjectFormatEntitiesByBusinessObjectDefinition.
@Test
public void testGetBusinessObjectFormatEntitiesByBusinessObjectDefinition() {
// 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);
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2.toLowerCase(), BDEF_NAME_2.toLowerCase(), DATA_PROVIDER_NAME_2.toLowerCase(), BDEF_DESCRIPTION_2);
businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE_2, BDEF_NAME_2.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), INITIAL_FORMAT_VERSION, "Test format 0", Boolean.FALSE, PARTITION_KEY);
BusinessObjectFormatEntity businessObjectFormatEntityV0 = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), INITIAL_FORMAT_VERSION, "Test format 0", Boolean.FALSE, PARTITION_KEY);
BusinessObjectFormatEntity businessObjectFormatEntityV1 = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), SECOND_FORMAT_VERSION, "Test format 0", Boolean.TRUE, PARTITION_KEY);
BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME);
// Retrieve business object format entity by specifying values for all text alternate key fields in upper case.
List<BusinessObjectFormatEntity> businessObjectFormatList = businessObjectFormatDao.getLatestVersionBusinessObjectFormatsByBusinessObjectDefinition(businessObjectDefinitionKey);
assertEquals(businessObjectFormatList.size(), 1);
assertEquals(businessObjectFormatList.get(0), businessObjectFormatEntityV1);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectDefinitionDaoTest method testGetBusinessObjectDefinitionByKey.
@Test
public void testGetBusinessObjectDefinitionByKey() {
// Create two business object definitions having the same business object definition name.
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION);
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE_2, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION);
// Get the business object definition by key.
BusinessObjectDefinitionEntity resultBusinessObjectDefinitionEntity = businessObjectDefinitionDao.getBusinessObjectDefinitionByKey(new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME));
// Validate the returned object.
assertEquals(businessObjectDefinitionEntity, resultBusinessObjectDefinitionEntity);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionKey in project herd by FINRAOS.
the class BusinessObjectDefinitionDaoTestHelper method getTestBusinessObjectDefinitionKeys.
/**
* Returns a list of test business object definition keys.
*
* @return the list of test business object definition keys
*/
public List<BusinessObjectDefinitionKey> getTestBusinessObjectDefinitionKeys() {
List<BusinessObjectDefinitionKey> keys = new ArrayList<>();
keys.add(new BusinessObjectDefinitionKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME_2));
keys.add(new BusinessObjectDefinitionKey(AbstractDaoTest.NAMESPACE_2, AbstractDaoTest.BDEF_NAME_2));
keys.add(new BusinessObjectDefinitionKey(AbstractDaoTest.NAMESPACE, AbstractDaoTest.BDEF_NAME));
keys.add(new BusinessObjectDefinitionKey(AbstractDaoTest.NAMESPACE_2, AbstractDaoTest.BDEF_NAME));
return keys;
}
Aggregations