Search in sources :

Example 1 with StorageUnitNotificationRegistrationKeys

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;
}
Also used : StorageUnitNotificationRegistrationKeys(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 2 with StorageUnitNotificationRegistrationKeys

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);
}
Also used : StorageUnitNotificationRegistrationKeys(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys) Test(org.junit.Test)

Example 3 with StorageUnitNotificationRegistrationKeys

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());
}
Also used : StorageUnitNotificationRegistrationKeys(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 4 with StorageUnitNotificationRegistrationKeys

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)));
}
Also used : StorageUnitNotificationRegistrationKeys(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 5 with StorageUnitNotificationRegistrationKeys

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());
}
Also used : StorageUnitNotificationRegistrationKeys(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys) ArrayList(java.util.ArrayList) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Aggregations

StorageUnitNotificationRegistrationKeys (org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys)16 Test (org.junit.Test)14 NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)13 StorageUnitNotificationFilter (org.finra.herd.model.api.xml.StorageUnitNotificationFilter)8 ArrayList (java.util.ArrayList)2 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1