use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationRestControllerTest method testGetStorageUnitNotificationRegistrationsByNotificationFilter.
@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilter() {
// Create a business object data notification registration key.
NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
StorageUnitNotificationRegistrationKeys storageUnitNotificationRegistrationKeys = new StorageUnitNotificationRegistrationKeys(Arrays.asList(notificationRegistrationKey));
StorageUnitNotificationFilter storageUnitNotificationFilter = new StorageUnitNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null, null, null, null);
when(storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(storageUnitNotificationFilter)).thenReturn(storageUnitNotificationRegistrationKeys);
// Retrieve a list of business object data notification registration keys.
StorageUnitNotificationRegistrationKeys resultStorageUnitNotificationRegistrationKeys = storageUnitNotificationRegistrationRestController.getStorageUnitNotificationRegistrationsByNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, getServletRequestWithNotificationFilterParameters());
// Verify the external calls.
verify(storageUnitNotificationRegistrationService).getStorageUnitNotificationRegistrationsByNotificationFilter(storageUnitNotificationFilter);
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 StorageUnitNotificationRegistrationServiceImpl method getStorageUnitNotificationRegistrationsByNamespace.
@Override
public StorageUnitNotificationRegistrationKeys getStorageUnitNotificationRegistrationsByNamespace(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 storage unit notification registration keys.
StorageUnitNotificationRegistrationKeys storageUnitNotificationKeys = new StorageUnitNotificationRegistrationKeys();
storageUnitNotificationKeys.getStorageUnitNotificationRegistrationKeys().addAll(storageUnitNotificationRegistrationDao.getStorageUnitNotificationRegistrationKeysByNamespace(namespaceLocal));
return storageUnitNotificationKeys;
}
use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNamespaceUpperCaseParameters.
@Test
public void testGetStorageUnitNotificationRegistrationsByNamespaceUpperCaseParameters() {
// Create and persist storage unit notification entities using lower case alternate key values.
for (NotificationRegistrationKey notificationRegistrationKey : notificationRegistrationDaoTestHelper.getTestNotificationRegistrationKeys()) {
NotificationRegistrationKey notificationRegistrationKeyLowerCase = new NotificationRegistrationKey(notificationRegistrationKey.getNamespace().toLowerCase(), notificationRegistrationKey.getNotificationName().toLowerCase());
notificationRegistrationDaoTestHelper.createStorageUnitNotificationRegistrationEntity(notificationRegistrationKeyLowerCase, 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 upper case namespace code value.
StorageUnitNotificationRegistrationKeys resultKeys = storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNamespace(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.getStorageUnitNotificationRegistrationKeys());
}
use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNotificationFilterTrimParameters.
@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilterTrimParameters() {
// 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 using input parameters with leading and trailing empty spaces.
assertEquals(new StorageUnitNotificationRegistrationKeys(Arrays.asList(notificationRegistrationKey)), storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(FORMAT_USAGE_CODE), addWhitespace(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 testGetStorageUnitNotificationRegistrationsByNotificationFilterLowerCaseParameters.
@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilterLowerCaseParameters() {
// 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 using lower case input parameters.
assertEquals(new StorageUnitNotificationRegistrationKeys(Arrays.asList(notificationRegistrationKey)), storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_STORAGE_UNIT_STATUS, NO_STORAGE_UNIT_STATUS)));
}
Aggregations