use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceImpl method getStorageUnitNotificationRegistrationsByNotificationFilter.
@NamespacePermission(fields = "#storageUnitNotificationFilter?.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public StorageUnitNotificationRegistrationKeys getStorageUnitNotificationRegistrationsByNotificationFilter(StorageUnitNotificationFilter storageUnitNotificationFilter) {
// Validate and trim the storage unit notification filter parameters.
validateStorageUnitNotificationFilterBusinessObjectDefinitionFields(storageUnitNotificationFilter);
trimStorageUnitNotificationFilterBusinessObjectFormatFields(storageUnitNotificationFilter);
// Create and populate a list of storage unit notification registration keys.
StorageUnitNotificationRegistrationKeys storageUnitNotificationKeys = new StorageUnitNotificationRegistrationKeys();
storageUnitNotificationKeys.getStorageUnitNotificationRegistrationKeys().addAll(storageUnitNotificationRegistrationDao.getStorageUnitNotificationRegistrationKeysByNotificationFilter(storageUnitNotificationFilter));
return storageUnitNotificationKeys;
}
use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationRestControllerTest method testGetStorageUnitNotificationRegistrationsByNamespace.
@Test
public void testGetStorageUnitNotificationRegistrationsByNamespace() {
StorageUnitNotificationRegistrationKeys storageUnitNotificationRegistrationKeys = new StorageUnitNotificationRegistrationKeys(notificationRegistrationDaoTestHelper.getExpectedNotificationRegistrationKeys());
when(storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNamespace(NAMESPACE)).thenReturn(storageUnitNotificationRegistrationKeys);
// Retrieve a list of business object data notification registration keys.
StorageUnitNotificationRegistrationKeys resultStorageUnitNotificationRegistrationKeys = storageUnitNotificationRegistrationRestController.getStorageUnitNotificationRegistrationsByNamespace(NAMESPACE);
// Verify the external calls.
verify(storageUnitNotificationRegistrationService).getStorageUnitNotificationRegistrationsByNamespace(NAMESPACE);
verifyNoMoreInteractions(storageUnitNotificationRegistrationService);
// Validate the returned object.
assertEquals(storageUnitNotificationRegistrationKeys, resultStorageUnitNotificationRegistrationKeys);
}
use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNamespaceTrimParameters.
@Test
public void testGetStorageUnitNotificationRegistrationsByNamespaceTrimParameters() {
// Create and persist storage unit notification entities.
for (NotificationRegistrationKey notificationRegistrationKey : notificationRegistrationDaoTestHelper.getTestNotificationRegistrationKeys()) {
notificationRegistrationDaoTestHelper.createStorageUnitNotificationRegistrationEntity(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
}
// Retrieve a list of storage unit notification registration keys using input parameters with leading and trailing empty spaces.
StorageUnitNotificationRegistrationKeys resultKeys = storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNamespace(addWhitespace(NAMESPACE));
// Validate the returned object.
assertEquals(notificationRegistrationDaoTestHelper.getExpectedNotificationRegistrationKeys(), resultKeys.getStorageUnitNotificationRegistrationKeys());
}
use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNotificationFilter.
@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilter() {
// Create a storage unit notification registration key.
NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
// Create and persist a storage unit notification registration entity.
notificationRegistrationDaoTestHelper.createStorageUnitNotificationRegistrationEntity(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
// Retrieve a list of storage unit notification registration keys.
assertEquals(new StorageUnitNotificationRegistrationKeys(Arrays.asList(notificationRegistrationKey)), storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_STORAGE_UNIT_STATUS, NO_STORAGE_UNIT_STATUS)));
}
use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNamespaceLowerCaseParameters.
@Test
public void testGetStorageUnitNotificationRegistrationsByNamespaceLowerCaseParameters() {
// Create and persist storage unit notification entities using upper case alternate key values.
for (NotificationRegistrationKey notificationRegistrationKey : notificationRegistrationDaoTestHelper.getTestNotificationRegistrationKeys()) {
NotificationRegistrationKey notificationRegistrationKeyUpperCase = new NotificationRegistrationKey(notificationRegistrationKey.getNamespace().toUpperCase(), notificationRegistrationKey.getNotificationName().toUpperCase());
notificationRegistrationDaoTestHelper.createStorageUnitNotificationRegistrationEntity(notificationRegistrationKeyUpperCase, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
}
// Retrieve a list of storage unit notification registration keys using lower case namespace code value.
StorageUnitNotificationRegistrationKeys resultKeys = storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNamespace(NAMESPACE.toLowerCase());
// 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().toUpperCase());
expectedKey.setNotificationName(origKey.getNotificationName().toUpperCase());
}
assertEquals(expectedKeys, resultKeys.getStorageUnitNotificationRegistrationKeys());
}
Aggregations