Search in sources :

Example 6 with StorageUnitNotificationRegistrationKeys

use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys 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());
}
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 7 with StorageUnitNotificationRegistrationKeys

use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.

the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNotificationFilterMissingOptionalParameters.

@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilterMissingOptionalParameters() {
    // 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 by not specifying optional parameters.
    assertEquals(new StorageUnitNotificationRegistrationKeys(Arrays.asList(notificationRegistrationKey)), storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, NO_FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_STORAGE_UNIT_STATUS, NO_STORAGE_UNIT_STATUS)));
    assertEquals(new StorageUnitNotificationRegistrationKeys(Arrays.asList(notificationRegistrationKey)), storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, NO_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 8 with StorageUnitNotificationRegistrationKeys

use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.

the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNamespaceStorageUnitNotificationsNoExist.

@Test
public void testGetStorageUnitNotificationRegistrationsByNamespaceStorageUnitNotificationsNoExist() {
    // Create and persist the relative database entities.
    notificationRegistrationServiceTestHelper.createDatabaseEntitiesForStorageUnitNotificationRegistrationTesting();
    // Retrieve an empty list of storage unit notification registration keys.
    StorageUnitNotificationRegistrationKeys resultKeys = storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNamespace(NAMESPACE);
    // Validate the returned object.
    assertEquals(new ArrayList<NotificationRegistrationKey>(), 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 9 with StorageUnitNotificationRegistrationKeys

use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.

the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNotificationFilterUpperCaseParameters.

@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilterUpperCaseParameters() {
    // 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 upper case input parameters.
    assertEquals(new StorageUnitNotificationRegistrationKeys(Arrays.asList(notificationRegistrationKey)), storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(new StorageUnitNotificationFilter(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), 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 10 with StorageUnitNotificationRegistrationKeys

use of org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys in project herd by FINRAOS.

the class StorageUnitNotificationRegistrationRestControllerTest method testGetStorageUnitNotificationRegistrationsByNotificationFilterMissingOptionalParameters.

@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilterMissingOptionalParameters() {
    // 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, NO_FORMAT_USAGE_CODE, NO_FORMAT_FILE_TYPE_CODE, null, null, null, null);
    when(storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNotificationFilter(storageUnitNotificationFilter)).thenReturn(storageUnitNotificationRegistrationKeys);
    // Retrieve a list of business object data notification registration keys by not specifying optional parameters.
    StorageUnitNotificationRegistrationKeys resultStorageUnitNotificationRegistrationKeys = storageUnitNotificationRegistrationRestController.getStorageUnitNotificationRegistrationsByNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, NO_FORMAT_USAGE_CODE, NO_FORMAT_FILE_TYPE_CODE, getServletRequestWithNotificationFilterParameters());
    // Verify the external calls.
    verify(storageUnitNotificationRegistrationService).getStorageUnitNotificationRegistrationsByNotificationFilter(storageUnitNotificationFilter);
    verifyNoMoreInteractions(storageUnitNotificationRegistrationService);
    // Validate the returned object.
    assertEquals(storageUnitNotificationRegistrationKeys, resultStorageUnitNotificationRegistrationKeys);
}
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)

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