use of org.finra.herd.model.api.xml.NotificationRegistrationKey in project herd by FINRAOS.
the class NotificationRegistrationDaoTest method testGetNotificationRegistrationAssertReturnEntityWhenRegistrationExistAndDifferentCase.
@Test
public void testGetNotificationRegistrationAssertReturnEntityWhenRegistrationExistAndDifferentCase() {
NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE.toLowerCase(), NOTIFICATION_NAME.toLowerCase());
notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(businessObjectDataNotificationRegistrationKey, NOTIFICATION_EVENT_TYPE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
NotificationRegistrationEntity notificationRegistration = notificationRegistrationDao.getNotificationRegistration(businessObjectDataNotificationRegistrationKey.getNamespace(), businessObjectDataNotificationRegistrationKey.getNotificationName());
assertNotNull(notificationRegistration);
assertEquals(BusinessObjectDataNotificationRegistrationEntity.class, notificationRegistration.getClass());
}
use of org.finra.herd.model.api.xml.NotificationRegistrationKey in project herd by FINRAOS.
the class AbstractNotificationRegistrationDao method getNotificationRegistrationKeys.
/**
* Gets a list of notification registration keys from the list of tuples that contain notification registration name and namespace columns.
*
* @param tuples the list tof tuples that contain notification registration name and namespace columns
* @param notificationRegistrationNamespaceColumn the column that contains the namespace of the notification registration
* @param notificationRegistrationNameColumn the column that contains the name of the notification registration
*
* @return the list of notification registration keys
*/
protected List<NotificationRegistrationKey> getNotificationRegistrationKeys(List<Tuple> tuples, Path<String> notificationRegistrationNamespaceColumn, Path<String> notificationRegistrationNameColumn) {
List<NotificationRegistrationKey> notificationRegistrationKeys = new ArrayList<>();
// Populate the "keys" objects from the returned tuples (i.e. 1 tuple for each row).
for (Tuple tuple : tuples) {
NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey();
notificationRegistrationKeys.add(notificationRegistrationKey);
notificationRegistrationKey.setNamespace(tuple.get(notificationRegistrationNamespaceColumn));
notificationRegistrationKey.setNotificationName(tuple.get(notificationRegistrationNameColumn));
}
return notificationRegistrationKeys;
}
use of org.finra.herd.model.api.xml.NotificationRegistrationKey in project herd by FINRAOS.
the class BusinessObjectDataNotificationRegistrationRestControllerTest method testCreateBusinessObjectDataNotificationRegistration.
@Test
public void testCreateBusinessObjectDataNotificationRegistration() {
// Create a notification registration key.
NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
// Create a business object data notification filter.
BusinessObjectDataNotificationFilter businessObjectDataNotificationFilter = new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS_2);
// Create a list of job actions.
List<JobAction> jobActions = Arrays.asList(new JobAction(JOB_NAMESPACE, JOB_NAME, CORRELATION_DATA));
// Create a business object data notification registration create request.
BusinessObjectDataNotificationRegistrationCreateRequest businessObjectDataNotificationRegistrationCreateRequest = new BusinessObjectDataNotificationRegistrationCreateRequest(businessObjectDataNotificationRegistrationKey, NOTIFICATION_EVENT_TYPE, businessObjectDataNotificationFilter, jobActions, NOTIFICATION_REGISTRATION_STATUS);
// Create a business object data notification registration.
BusinessObjectDataNotificationRegistration businessObjectDataNotificationRegistration = new BusinessObjectDataNotificationRegistration(ID, businessObjectDataNotificationRegistrationKey, NOTIFICATION_EVENT_TYPE, businessObjectDataNotificationFilter, jobActions, NOTIFICATION_REGISTRATION_STATUS);
// Mock the external calls.
when(businessObjectDataNotificationRegistrationService.createBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationCreateRequest)).thenReturn(businessObjectDataNotificationRegistration);
// Call the method under test.
BusinessObjectDataNotificationRegistration result = businessObjectDataNotificationRegistrationRestController.createBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationCreateRequest);
// Verify the external calls.
verify(businessObjectDataNotificationRegistrationService).createBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationCreateRequest);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(businessObjectDataNotificationRegistration, result);
}
use of org.finra.herd.model.api.xml.NotificationRegistrationKey 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.NotificationRegistrationKey in project herd by FINRAOS.
the class BusinessObjectDataNotificationRegistrationRestControllerTest method testDeleteBusinessObjectDataNotificationRegistration.
@Test
public void testDeleteBusinessObjectDataNotificationRegistration() {
// Create a notification registration key.
NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
// Create a business object data notification filter.
BusinessObjectDataNotificationFilter businessObjectDataNotificationFilter = new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS_2);
// Create a list of job actions.
List<JobAction> jobActions = Arrays.asList(new JobAction(JOB_NAMESPACE, JOB_NAME, CORRELATION_DATA));
// Create a business object data notification registration.
BusinessObjectDataNotificationRegistration businessObjectDataNotificationRegistration = new BusinessObjectDataNotificationRegistration(ID, businessObjectDataNotificationRegistrationKey, NOTIFICATION_EVENT_TYPE, businessObjectDataNotificationFilter, jobActions, NOTIFICATION_REGISTRATION_STATUS);
// Mock the external calls.
when(businessObjectDataNotificationRegistrationService.deleteBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationKey)).thenReturn(businessObjectDataNotificationRegistration);
// Call the method under test.
BusinessObjectDataNotificationRegistration result = businessObjectDataNotificationRegistrationRestController.deleteBusinessObjectDataNotification(NAMESPACE, NOTIFICATION_NAME);
// Verify the external calls.
verify(businessObjectDataNotificationRegistrationService).deleteBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationKey);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(businessObjectDataNotificationRegistration, result);
}
Aggregations