Search in sources :

Example 11 with StorageUnitNotificationRegistration

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

the class StorageUnitNotificationRegistrationServiceTest method testUpdateStorageUnitNotificationRegistrationWithDisabledStatus.

@Test
public void testUpdateStorageUnitNotificationRegistrationWithDisabledStatus() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    // Create 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, Arrays.asList(FORMAT_FILE_TYPE_CODE, FORMAT_FILE_TYPE_CODE_2), Arrays.asList(STORAGE_NAME, STORAGE_NAME_2), Arrays.asList(STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2, STORAGE_UNIT_STATUS_3, STORAGE_UNIT_STATUS_4), notificationRegistrationDaoTestHelper.getTestJobActions2());
    // 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 registration.
    StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.updateStorageUnitNotificationRegistration(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME), new StorageUnitNotificationRegistrationUpdateRequest(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, STORAGE_NAME_2, STORAGE_UNIT_STATUS_3, NO_STORAGE_UNIT_STATUS), notificationRegistrationDaoTestHelper.getTestJobActions2(), NotificationRegistrationStatusEntity.DISABLED));
    // 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, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, STORAGE_NAME_2, STORAGE_UNIT_STATUS_3, NO_STORAGE_UNIT_STATUS), notificationRegistrationDaoTestHelper.getTestJobActions2(), NotificationRegistrationStatusEntity.DISABLED), resultStorageUnitNotificationRegistration);
}
Also used : StorageUnitNotificationRegistrationUpdateRequest(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationUpdateRequest) StorageUnitNotificationRegistration(org.finra.herd.model.api.xml.StorageUnitNotificationRegistration) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 12 with StorageUnitNotificationRegistration

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

the class StorageUnitNotificationRegistrationServiceTest method testCreateStorageUnitNotificationRegistration.

@Test
public void testCreateStorageUnitNotificationRegistration() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    // Create and persist the relative database entities.
    notificationRegistrationServiceTestHelper.createDatabaseEntitiesForStorageUnitNotificationRegistrationTesting();
    // Create a storage unit notification registration for storage unit status change notification event with DISABLED status.
    StorageUnitNotificationRegistration result = storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(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.DISABLED));
    // Validate the returned object.
    assertEquals(new StorageUnitNotificationRegistration(result.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.DISABLED), result);
}
Also used : StorageUnitNotificationRegistrationCreateRequest(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationCreateRequest) StorageUnitNotificationRegistration(org.finra.herd.model.api.xml.StorageUnitNotificationRegistration) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 13 with StorageUnitNotificationRegistration

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

the class StorageUnitNotificationRegistrationRestControllerTest method testCreateStorageUnitNotificationRegistration.

@Test
public void testCreateStorageUnitNotificationRegistration() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    StorageUnitNotificationRegistrationCreateRequest request = new StorageUnitNotificationRegistrationCreateRequest(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);
    StorageUnitNotificationRegistration storageUnitNotificationRegistration = new StorageUnitNotificationRegistration(ID, 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);
    when(storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(request)).thenReturn(storageUnitNotificationRegistration);
    // Create a business object data notification.
    StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationRestController.createStorageUnitNotificationRegistration(request);
    // Verify the external calls.
    verify(storageUnitNotificationRegistrationService).createStorageUnitNotificationRegistration(request);
    verifyNoMoreInteractions(storageUnitNotificationRegistrationService);
    // Validate the returned object.
    assertEquals(storageUnitNotificationRegistration, resultStorageUnitNotificationRegistration);
}
Also used : StorageUnitNotificationRegistrationCreateRequest(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationCreateRequest) StorageUnitNotificationRegistration(org.finra.herd.model.api.xml.StorageUnitNotificationRegistration) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 14 with StorageUnitNotificationRegistration

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

the class StorageUnitNotificationRegistrationRestControllerTest method testGetStorageUnitNotificationRegistration.

@Test
public void testGetStorageUnitNotificationRegistration() {
    NotificationRegistrationKey storageUnitNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    StorageUnitNotificationRegistration storageUnitNotificationRegistration = new StorageUnitNotificationRegistration(ID, storageUnitNotificationRegistrationKey, 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);
    when(storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistration(storageUnitNotificationRegistrationKey)).thenReturn(storageUnitNotificationRegistration);
    // Retrieve the business object data notification.
    StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationRestController.getStorageUnitNotificationRegistration(NAMESPACE, NOTIFICATION_NAME);
    // Verify the external calls.
    verify(storageUnitNotificationRegistrationService).getStorageUnitNotificationRegistration(storageUnitNotificationRegistrationKey);
    verifyNoMoreInteractions(storageUnitNotificationRegistrationService);
    // Validate the returned object.
    assertEquals(storageUnitNotificationRegistration, resultStorageUnitNotificationRegistration);
}
Also used : StorageUnitNotificationRegistration(org.finra.herd.model.api.xml.StorageUnitNotificationRegistration) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 15 with StorageUnitNotificationRegistration

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

the class StorageUnitNotificationRegistrationRestControllerTest method testUpdateStorageUnitNotificationRegistration.

@Test
public void testUpdateStorageUnitNotificationRegistration() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    StorageUnitNotificationRegistration storageUnitNotificationRegistration = new StorageUnitNotificationRegistration(ID, notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, STORAGE_NAME_2, STORAGE_UNIT_STATUS_3, STORAGE_UNIT_STATUS_4), notificationRegistrationDaoTestHelper.getTestJobActions2(), NotificationRegistrationStatusEntity.DISABLED);
    StorageUnitNotificationRegistrationUpdateRequest request = new StorageUnitNotificationRegistrationUpdateRequest(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, STORAGE_NAME_2, STORAGE_UNIT_STATUS_3, STORAGE_UNIT_STATUS_4), notificationRegistrationDaoTestHelper.getTestJobActions2(), NotificationRegistrationStatusEntity.DISABLED);
    when(storageUnitNotificationRegistrationService.updateStorageUnitNotificationRegistration(notificationRegistrationKey, request)).thenReturn(storageUnitNotificationRegistration);
    // Update the business object data notification registration.
    StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationRestController.updateStorageUnitNotificationRegistration(NAMESPACE, NOTIFICATION_NAME, request);
    // Verify the external calls.
    verify(storageUnitNotificationRegistrationService).updateStorageUnitNotificationRegistration(notificationRegistrationKey, request);
    verifyNoMoreInteractions(storageUnitNotificationRegistrationService);
    // Validate the returned object.
    assertEquals(storageUnitNotificationRegistration, resultStorageUnitNotificationRegistration);
}
Also used : StorageUnitNotificationRegistrationUpdateRequest(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationUpdateRequest) StorageUnitNotificationRegistration(org.finra.herd.model.api.xml.StorageUnitNotificationRegistration) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Aggregations

NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)26 StorageUnitNotificationFilter (org.finra.herd.model.api.xml.StorageUnitNotificationFilter)26 StorageUnitNotificationRegistration (org.finra.herd.model.api.xml.StorageUnitNotificationRegistration)26 Test (org.junit.Test)25 JobAction (org.finra.herd.model.api.xml.JobAction)11 StorageUnitNotificationRegistrationUpdateRequest (org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationUpdateRequest)8 StorageUnitNotificationRegistrationCreateRequest (org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationCreateRequest)7 StorageUnitNotificationRegistrationEntity (org.finra.herd.model.jpa.StorageUnitNotificationRegistrationEntity)7 ArrayList (java.util.ArrayList)1 NotificationActionEntity (org.finra.herd.model.jpa.NotificationActionEntity)1 NotificationJobActionEntity (org.finra.herd.model.jpa.NotificationJobActionEntity)1