use of org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest in project herd by FINRAOS.
the class InvalidateUnregisteredBusinessObjectData method executeImpl.
@Override
public void executeImpl(DelegateExecution execution) throws Exception {
String contentTypeString = activitiHelper.getRequiredExpressionVariableAsString(this.contentType, execution, "contentType");
String businessObjectDataInvalidateUnregisteredRequestString = activitiHelper.getRequiredExpressionVariableAsString(this.businessObjectDataInvalidateUnregisteredRequest, execution, "businessObjectDataInvalidateUnregisteredRequest");
BusinessObjectDataInvalidateUnregisteredRequest businessObjectDataInvalidateUnregisteredRequest = getRequestObject(contentTypeString, businessObjectDataInvalidateUnregisteredRequestString, BusinessObjectDataInvalidateUnregisteredRequest.class);
BusinessObjectDataInvalidateUnregisteredResponse businessObjectDataInvalidateUnregisteredResponse = businessObjectDataService.invalidateUnregisteredBusinessObjectData(businessObjectDataInvalidateUnregisteredRequest);
// Trigger notifications.
businessObjectDataDaoHelper.triggerNotificationsForInvalidateUnregisteredBusinessObjectData(businessObjectDataInvalidateUnregisteredResponse);
setJsonResponseAsWorkflowVariable(businessObjectDataInvalidateUnregisteredResponse, execution);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest in project herd by FINRAOS.
the class MessageNotificationEventServiceTest method testProcessBusinessObjectFormatVersionChangeNotificationEventHerdSqsNotificationNotEnabled.
@Test
public void testProcessBusinessObjectFormatVersionChangeNotificationEventHerdSqsNotificationNotEnabled() throws Exception {
// Create a business object format entity.
BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE);
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request);
// Get a business object data key.
BusinessObjectFormatKey businessObjectFormatKey = businessObjectFormatHelper.getBusinessObjectFormatKey(businessObjectFormatEntity);
// Override configuration.
Map<String, Object> overrideMap = new HashMap<>();
overrideMap.put(ConfigurationValue.HERD_NOTIFICATION_SQS_ENABLED.getKey(), false);
modifyPropertySourceInEnvironment(overrideMap);
try {
// Trigger the notification.
List<NotificationMessage> result = messageNotificationEventService.processBusinessObjectFormatVersionChangeNotificationEvent(businessObjectFormatKey, NO_OLD_BUSINESS_OBJECT_FORMAT_VERSION);
// Validate the results.
assertTrue(CollectionUtils.isEmpty(result));
} finally {
// Restore the property sources so we don't affect other tests.
restorePropertySourceInEnvironment();
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest in project herd by FINRAOS.
the class MessageNotificationEventServiceTest method testProcessBusinessObjectFormatVersionChangeNotificationEventWithNoMessageHeaders.
@Test
public void testProcessBusinessObjectFormatVersionChangeNotificationEventWithNoMessageHeaders() throws Exception {
// Create a business object format entity.
BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE);
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request);
// Get a business object data key.
BusinessObjectFormatKey businessObjectFormatKey = businessObjectFormatHelper.getBusinessObjectFormatKey(businessObjectFormatEntity);
// 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_XML, NO_MESSAGE_HEADER_DEFINITIONS)))));
configurationDao.saveAndRefresh(configurationEntity);
// Trigger the notification.
List<NotificationMessage> result = messageNotificationEventService.processBusinessObjectFormatVersionChangeNotificationEvent(businessObjectFormatKey, NO_OLD_BUSINESS_OBJECT_FORMAT_VERSION);
// Validate the results.
assertEquals(1, CollectionUtils.size(result));
businessObjectFormatServiceTestHelper.validateBusinessObjectFormatVersionChangeMessageWithXmlPayload(MESSAGE_TYPE, MESSAGE_DESTINATION, businessObjectFormatKey, HerdDaoSecurityHelper.SYSTEM_USER, businessObjectFormatKey.getBusinessObjectFormatVersion().toString(), NO_OLD_BUSINESS_OBJECT_FORMAT_VERSION, NO_MESSAGE_HEADERS, result.get(0));
}
use of org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest in project herd by FINRAOS.
the class BusinessObjectDataInvalidateUnregisteredHelperTest method testInvalidateUnregisteredBusinessObjectDataValidationBusinessObjectFormatFileTypeRequired.
/**
* Asserts that business object format file type requiredness validation is working.
*/
@Test
public void testInvalidateUnregisteredBusinessObjectDataValidationBusinessObjectFormatFileTypeRequired() {
BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, BLANK_TEXT, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE);
// Given a business object format
try {
businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request);
} catch (Exception e) {
throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e);
}
// Call the API
try {
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request);
Assert.fail("expected a IllegalArgumentException, but no exception was thrown");
} catch (Exception e) {
Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass());
Assert.assertEquals("thrown exception message", "The business object format file type is required", e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest in project herd by FINRAOS.
the class BusinessObjectDataInvalidateUnregisteredHelperTest method testInvalidateUnregisteredBusinessObjectDataValidationBusinessObjectDefinitionNameRequired.
/**
* Asserts that business object definition name requiredness validation is working.
*/
@Test
public void testInvalidateUnregisteredBusinessObjectDataValidationBusinessObjectDefinitionNameRequired() {
BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BLANK_TEXT, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE);
// Given a business object format
try {
businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request);
} catch (Exception e) {
throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e);
}
// Call the API
try {
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request);
Assert.fail("expected a IllegalArgumentException, but no exception was thrown");
} catch (Exception e) {
Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass());
Assert.assertEquals("thrown exception message", "The business object definition name is required", e.getMessage());
}
}
Aggregations