use of org.finra.herd.model.api.xml.NotificationRegistrationKey in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testUpdateStorageUnitNotificationRegistrationMissingOptionalParametersPassedAsWhitespace.
@Test
public void testUpdateStorageUnitNotificationRegistrationMissingOptionalParametersPassedAsWhitespace() {
NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
// Create other database entities required for testing.
notificationRegistrationServiceTestHelper.createDatabaseEntitiesForStorageUnitNotificationRegistrationTesting(NAMESPACE, Arrays.asList(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name()), BDEF_NAMESPACE_2, BDEF_NAME_2, null, null, Arrays.asList(STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2), notificationRegistrationDaoTestHelper.getTestJobActions());
// 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);
// Update the storage unit notification without specifying any of the optional parameters (passing whitespace characters).
StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.updateStorageUnitNotificationRegistration(notificationRegistrationKey, new StorageUnitNotificationRegistrationUpdateRequest(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE_2, BDEF_NAME_2, BLANK_TEXT, BLANK_TEXT, null, STORAGE_NAME, BLANK_TEXT, BLANK_TEXT), Arrays.asList(new JobAction(JOB_NAMESPACE_2, JOB_NAME_2, BLANK_TEXT)), NotificationRegistrationStatusEntity.ENABLED));
// Validate the returned object.
assertEquals(new StorageUnitNotificationRegistration(resultStorageUnitNotificationRegistration.getId(), notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE_2, BDEF_NAME_2, null, null, null, STORAGE_NAME, null, null), Arrays.asList(new JobAction(JOB_NAMESPACE_2, JOB_NAME_2, BLANK_TEXT)), NotificationRegistrationStatusEntity.ENABLED), resultStorageUnitNotificationRegistration);
}
use of org.finra.herd.model.api.xml.NotificationRegistrationKey in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationUpperCaseParameters.
@Test
public void testGetStorageUnitNotificationRegistrationUpperCaseParameters() {
// Create and persist a storage unit notification registration entity using lower case alternate key values.
NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE.toLowerCase(), NOTIFICATION_NAME.toLowerCase());
StorageUnitNotificationRegistrationEntity storageUnitNotificationRegistrationEntity = 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 the storage unit notification using upper case input parameters.
StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistration(new NotificationRegistrationKey(NAMESPACE.toUpperCase(), NOTIFICATION_NAME.toUpperCase()));
// Validate the returned object.
assertEquals(new StorageUnitNotificationRegistration(storageUnitNotificationRegistrationEntity.getId(), notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(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), resultStorageUnitNotificationRegistration);
}
use of org.finra.herd.model.api.xml.NotificationRegistrationKey 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());
}
use of org.finra.herd.model.api.xml.NotificationRegistrationKey in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNotificationFilterInvalidParameters.
@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilterInvalidParameters() {
// 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)));
// Try invalid values for all input parameters.
assertTrue(storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter("I_DO_NO_EXIST", BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_STORAGE_UNIT_STATUS, NO_STORAGE_UNIT_STATUS)).getStorageUnitNotificationRegistrationKeys().isEmpty());
assertTrue(storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(BDEF_NAMESPACE, "I_DO_NO_EXIST", FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_STORAGE_UNIT_STATUS, NO_STORAGE_UNIT_STATUS)).getStorageUnitNotificationRegistrationKeys().isEmpty());
assertTrue(storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, "I_DO_NO_EXIST", FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_STORAGE_UNIT_STATUS, NO_STORAGE_UNIT_STATUS)).getStorageUnitNotificationRegistrationKeys().isEmpty());
assertTrue(storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, "I_DO_NO_EXIST", NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_STORAGE_UNIT_STATUS, NO_STORAGE_UNIT_STATUS)).getStorageUnitNotificationRegistrationKeys().isEmpty());
}
use of org.finra.herd.model.api.xml.NotificationRegistrationKey in project herd by FINRAOS.
the class StorageUnitNotificationRegistrationServiceTest method testUpdateStorageUnitNotificationRegistrationMissingOptionalParametersPassedAsNulls.
@Test
public void testUpdateStorageUnitNotificationRegistrationMissingOptionalParametersPassedAsNulls() {
NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
// Create other database entities required for testing.
notificationRegistrationServiceTestHelper.createDatabaseEntitiesForStorageUnitNotificationRegistrationTesting(NAMESPACE, Arrays.asList(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name()), BDEF_NAMESPACE_2, BDEF_NAME_2, null, null, Arrays.asList(STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2), notificationRegistrationDaoTestHelper.getTestJobActions());
// 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);
// Update the storage unit notification without specifying any of the optional parameters (passing whitespace characters).
StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.updateStorageUnitNotificationRegistration(notificationRegistrationKey, new StorageUnitNotificationRegistrationUpdateRequest(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE_2, BDEF_NAME_2, null, null, null, STORAGE_NAME, null, null), Arrays.asList(new JobAction(JOB_NAMESPACE_2, JOB_NAME_2, null)), NotificationRegistrationStatusEntity.ENABLED));
// Validate the returned object.
assertEquals(new StorageUnitNotificationRegistration(resultStorageUnitNotificationRegistration.getId(), notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE_2, BDEF_NAME_2, null, null, null, STORAGE_NAME, null, null), Arrays.asList(new JobAction(JOB_NAMESPACE_2, JOB_NAME_2, null)), NotificationRegistrationStatusEntity.ENABLED), resultStorageUnitNotificationRegistration);
}
Aggregations