use of org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys in project herd by FINRAOS.
the class BusinessObjectDataNotificationRegistrationServiceImpl method getBusinessObjectDataNotificationRegistrationsByNotificationFilter.
@NamespacePermission(fields = "#businessObjectDataNotificationFilter?.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public BusinessObjectDataNotificationRegistrationKeys getBusinessObjectDataNotificationRegistrationsByNotificationFilter(BusinessObjectDataNotificationFilter businessObjectDataNotificationFilter) {
// Validate and trim the business object data notification filter parameters.
validateBusinessObjectDataNotificationFilterBusinessObjectDefinitionFields(businessObjectDataNotificationFilter);
trimBusinessObjectDataNotificationFilterBusinessObjectFormatFields(businessObjectDataNotificationFilter);
// Create and populate a list of business object data notification registration keys.
BusinessObjectDataNotificationRegistrationKeys businessObjectDataNotificationKeys = new BusinessObjectDataNotificationRegistrationKeys();
businessObjectDataNotificationKeys.getBusinessObjectDataNotificationRegistrationKeys().addAll(businessObjectDataNotificationRegistrationDao.getBusinessObjectDataNotificationRegistrationKeysByNotificationFilter(businessObjectDataNotificationFilter));
return businessObjectDataNotificationKeys;
}
use of org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys in project herd by FINRAOS.
the class BusinessObjectDataNotificationRegistrationRestControllerTest method testGetBusinessObjectDataNotificationRegistrationsByNotificationFilter.
@Test
public void testGetBusinessObjectDataNotificationRegistrationsByNotificationFilter() {
// Create a business object data notification filter.
BusinessObjectDataNotificationFilter businessObjectDataNotificationFilter = new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_BDATA_STATUS, NO_BDATA_STATUS);
// Create notification registration keys.
BusinessObjectDataNotificationRegistrationKeys businessObjectDataNotificationRegistrationKeys = new BusinessObjectDataNotificationRegistrationKeys(Arrays.asList(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME)));
// Create a mock servlet request that contains hard coded business object data notification filter parameters.
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setParameter("businessObjectDefinitionNamespace", BDEF_NAMESPACE);
servletRequest.setParameter("businessObjectDefinitionName", BDEF_NAME);
servletRequest.setParameter("businessObjectFormatUsage", FORMAT_USAGE_CODE);
servletRequest.setParameter("businessObjectFormatFileType", FORMAT_FILE_TYPE_CODE);
// Mock the external calls.
when(businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistrationsByNotificationFilter(businessObjectDataNotificationFilter)).thenReturn(businessObjectDataNotificationRegistrationKeys);
// Call the method under test.
BusinessObjectDataNotificationRegistrationKeys result = businessObjectDataNotificationRegistrationRestController.getBusinessObjectDataNotificationRegistrationsByNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, servletRequest);
// Verify the external calls.
verify(businessObjectDataNotificationRegistrationService).getBusinessObjectDataNotificationRegistrationsByNotificationFilter(businessObjectDataNotificationFilter);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(businessObjectDataNotificationRegistrationKeys, result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys in project herd by FINRAOS.
the class BusinessObjectDataNotificationRegistrationRestControllerTest method testGetBusinessObjectDataNotificationRegistrationsByNamespace.
@Test
public void testGetBusinessObjectDataNotificationRegistrationsByNamespace() {
// Create notification registration keys.
BusinessObjectDataNotificationRegistrationKeys businessObjectDataNotificationRegistrationKeys = new BusinessObjectDataNotificationRegistrationKeys(Arrays.asList(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME)));
// Mock the external calls.
when(businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistrationsByNamespace(NAMESPACE)).thenReturn(businessObjectDataNotificationRegistrationKeys);
// Call the method under test.
BusinessObjectDataNotificationRegistrationKeys result = businessObjectDataNotificationRegistrationRestController.getBusinessObjectDataNotificationRegistrationsByNamespace(NAMESPACE);
// Verify the external calls.
verify(businessObjectDataNotificationRegistrationService).getBusinessObjectDataNotificationRegistrationsByNamespace(NAMESPACE);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(businessObjectDataNotificationRegistrationKeys, result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys in project herd by FINRAOS.
the class BusinessObjectDataNotificationRegistrationServiceImpl method getBusinessObjectDataNotificationRegistrationsByNamespace.
@Override
public BusinessObjectDataNotificationRegistrationKeys getBusinessObjectDataNotificationRegistrationsByNamespace(String namespace) {
String namespaceLocal = namespace;
// Validate and trim the namespace value.
Assert.hasText(namespaceLocal, "A namespace must be specified.");
namespaceLocal = namespaceLocal.trim();
// Ensure that this namespace exists.
namespaceDaoHelper.getNamespaceEntity(namespaceLocal);
// Create and populate a list of business object data notification registration keys.
BusinessObjectDataNotificationRegistrationKeys businessObjectDataNotificationKeys = new BusinessObjectDataNotificationRegistrationKeys();
businessObjectDataNotificationKeys.getBusinessObjectDataNotificationRegistrationKeys().addAll(businessObjectDataNotificationRegistrationDao.getBusinessObjectDataNotificationRegistrationKeysByNamespace(namespaceLocal));
return businessObjectDataNotificationKeys;
}
use of org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys in project herd by FINRAOS.
the class BusinessObjectDataNotificationRegistrationServiceTest method testGetBusinessObjectDataNotificationRegistrationsByNamespaceUpperCaseParameters.
@Test
public void testGetBusinessObjectDataNotificationRegistrationsByNamespaceUpperCaseParameters() {
// Create and persist business object data notification entities using lower case alternate key values.
for (NotificationRegistrationKey notificationRegistrationKey : notificationRegistrationDaoTestHelper.getTestNotificationRegistrationKeys()) {
NotificationRegistrationKey notificationRegistrationKeyLowerCase = new NotificationRegistrationKey(notificationRegistrationKey.getNamespace().toLowerCase(), notificationRegistrationKey.getNotificationName().toLowerCase());
notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKeyLowerCase, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS_2, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
}
// Retrieve a list of business object data notification registration keys using upper case namespace code value.
BusinessObjectDataNotificationRegistrationKeys resultKeys = businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistrationsByNamespace(NAMESPACE.toUpperCase());
// Validate the returned object.
List<NotificationRegistrationKey> expectedKeys = new ArrayList<>();
for (NotificationRegistrationKey origKey : notificationRegistrationDaoTestHelper.getExpectedNotificationRegistrationKeys()) {
NotificationRegistrationKey expectedKey = new NotificationRegistrationKey();
expectedKeys.add(expectedKey);
expectedKey.setNamespace(origKey.getNamespace().toLowerCase());
expectedKey.setNotificationName(origKey.getNotificationName().toLowerCase());
}
assertEquals(expectedKeys, resultKeys.getBusinessObjectDataNotificationRegistrationKeys());
}
Aggregations