use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTestHelper method getExpectedBusinessObjectFormatLatestVersionKeys.
/**
* Returns a list of test business object format keys expected to be returned by getBusinessObjectFormatKeys() method with the
* latestBusinessObjectFormatVersion flag set to "true".
*
* @return the list of expected business object format keys
*/
public List<BusinessObjectFormatKey> getExpectedBusinessObjectFormatLatestVersionKeys() {
List<BusinessObjectFormatKey> keys = new ArrayList<>();
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, 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_2, AbstractDaoTest.FORMAT_FILE_TYPE_CODE, AbstractDaoTest.SECOND_FORMAT_VERSION));
return keys;
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class BusinessObjectFormatDaoTestHelper method getExpectedBusinessObjectFormatKeys.
/**
* Returns a list of test business object format keys expected to be returned by getBusinessObjectFormatKeys() method.
*
* @return the list of expected business object format keys
*/
public List<BusinessObjectFormatKey> getExpectedBusinessObjectFormatKeys() {
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, 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_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));
return keys;
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class CustomDdlDaoTest method testGetCustomDdls.
@Test
public void testGetCustomDdls() {
// List of test custom DDL names.
List<String> testCustomDdlNames = Arrays.asList(CUSTOM_DDL_NAME, CUSTOM_DDL_NAME_2);
// Create and persist a custom DDL entities.
for (String customDdlName : testCustomDdlNames) {
customDdlDaoTestHelper.createCustomDdlEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, customDdlName, TEST_DDL);
}
// Retrieve a list of custom DDL keys.
List<CustomDdlKey> resultCustomDdlKeys = customDdlDao.getCustomDdls(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION));
// Validate the returned object.
assertNotNull(resultCustomDdlKeys);
assertEquals(testCustomDdlNames.size(), resultCustomDdlKeys.size());
for (int i = 0; i < testCustomDdlNames.size(); i++) {
assertEquals(new CustomDdlKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, testCustomDdlNames.get(i)), resultCustomDdlKeys.get(i));
}
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class DefaultNotificationMessageBuilderTest method testBuildBusinessObjectFormatVersionChangeMessagesJsonPayload.
@Test
public void testBuildBusinessObjectFormatVersionChangeMessagesJsonPayload() throws Exception {
// Create a business object format key.
BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION);
// Override configuration.
ConfigurationEntity configurationEntity = new ConfigurationEntity();
configurationEntity.setKey(ConfigurationValue.HERD_NOTIFICATION_BUSINESS_OBJECT_FORMAT_VERSION_CHANGE_MESSAGE_DEFINITIONS.getKey());
configurationEntity.setValueClob(xmlHelper.objectToXml(new NotificationMessageDefinitions(Collections.singletonList(new NotificationMessageDefinition(MESSAGE_TYPE, MESSAGE_DESTINATION, BUSINESS_OBJECT_FORMAT_VERSION_CHANGE_NOTIFICATION_MESSAGE_VELOCITY_TEMPLATE_JSON, getMessageHeaderDefinitions())))));
configurationDao.saveAndRefresh(configurationEntity);
// Build a notification message.
List<NotificationMessage> result = defaultNotificationMessageBuilder.buildBusinessObjectFormatVersionChangeMessages(businessObjectFormatKey, FORMAT_VERSION_2.toString());
// Validate the results.
assertEquals(1, CollectionUtils.size(result));
assertEquals(7, CollectionUtils.size(result.get(0).getMessageHeaders()));
String uuid = result.get(0).getMessageHeaders().get(4).getValue();
assertEquals(UUID.randomUUID().toString().length(), StringUtils.length(uuid));
validateBusinessObjectFormatVersionChangeMessageWithJsonPayload(MESSAGE_TYPE, MESSAGE_DESTINATION, businessObjectFormatKey, businessObjectFormatKey.getBusinessObjectFormatVersion().toString(), FORMAT_VERSION_2.toString(), getExpectedMessageHeaders(uuid), result.get(0));
}
use of org.finra.herd.model.api.xml.BusinessObjectFormatKey in project herd by FINRAOS.
the class DefaultNotificationMessageBuilderTest method testBuildBusinessObjectFormatVersionChangeMessagesJsonPayloadNoOldBusinessObjectFormatVersion.
@Test
public void testBuildBusinessObjectFormatVersionChangeMessagesJsonPayloadNoOldBusinessObjectFormatVersion() throws Exception {
// Create a business object format key.
BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION);
// Override configuration.
ConfigurationEntity configurationEntity = new ConfigurationEntity();
configurationEntity.setKey(ConfigurationValue.HERD_NOTIFICATION_BUSINESS_OBJECT_FORMAT_VERSION_CHANGE_MESSAGE_DEFINITIONS.getKey());
configurationEntity.setValueClob(xmlHelper.objectToXml(new NotificationMessageDefinitions(Collections.singletonList(new NotificationMessageDefinition(MESSAGE_TYPE, MESSAGE_DESTINATION, BUSINESS_OBJECT_FORMAT_VERSION_CHANGE_NOTIFICATION_MESSAGE_VELOCITY_TEMPLATE_JSON, NO_MESSAGE_HEADER_DEFINITIONS)))));
configurationDao.saveAndRefresh(configurationEntity);
// Build a notification message.
List<NotificationMessage> result = defaultNotificationMessageBuilder.buildBusinessObjectFormatVersionChangeMessages(businessObjectFormatKey, NO_OLD_BUSINESS_OBJECT_FORMAT_VERSION);
// Validate the results.
assertEquals(1, CollectionUtils.size(result));
validateBusinessObjectFormatVersionChangeMessageWithJsonPayload(MESSAGE_TYPE, MESSAGE_DESTINATION, businessObjectFormatKey, businessObjectFormatKey.getBusinessObjectFormatVersion().toString(), NO_OLD_BUSINESS_OBJECT_FORMAT_VERSION, NO_MESSAGE_HEADERS, result.get(0));
}
Aggregations