Search in sources :

Example 56 with NotificationRegistrationKey

use of org.finra.herd.model.api.xml.NotificationRegistrationKey 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 57 with NotificationRegistrationKey

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

the class NotificationRegistrationStatusServiceTest method testUpdateNotificationRegistrationStatusAssertUpdateSuccessTrim.

@Test
public void testUpdateNotificationRegistrationStatusAssertUpdateSuccessTrim() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
    NotificationRegistrationStatusUpdateResponse response = notificationRegistrationStatusService.updateNotificationRegistrationStatus(addWhitespace(NAMESPACE), addWhitespace(NOTIFICATION_NAME), new NotificationRegistrationStatusUpdateRequest(addWhitespace(NotificationRegistrationStatusEntity.DISABLED)));
    assertEquals(new NotificationRegistrationStatusUpdateResponse(notificationRegistrationKey, NotificationRegistrationStatusEntity.DISABLED), response);
}
Also used : NotificationRegistrationStatusUpdateRequest(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateRequest) NotificationRegistrationStatusUpdateResponse(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 58 with NotificationRegistrationKey

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

the class NotificationRegistrationStatusServiceTest method testUpdateNotificationRegistrationStatusAssertUpdateSuccessCaseInsensitive.

@Test
public void testUpdateNotificationRegistrationStatusAssertUpdateSuccessCaseInsensitive() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
    NotificationRegistrationStatusUpdateResponse response = notificationRegistrationStatusService.updateNotificationRegistrationStatus(NAMESPACE, NOTIFICATION_NAME, new NotificationRegistrationStatusUpdateRequest(NotificationRegistrationStatusEntity.DISABLED.toLowerCase()));
    assertEquals(new NotificationRegistrationStatusUpdateResponse(notificationRegistrationKey, NotificationRegistrationStatusEntity.DISABLED), response);
}
Also used : NotificationRegistrationStatusUpdateRequest(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateRequest) NotificationRegistrationStatusUpdateResponse(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 59 with NotificationRegistrationKey

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

the class BusinessObjectDataNotificationRegistrationRestControllerTest method testGetBusinessObjectDataNotificationRegistrationsByNotificationFilter.

@Test
public void testGetBusinessObjectDataNotificationRegistrationsByNotificationFilter() {
    // Create a business object data notification filter.
    BusinessObjectDataNotificationFilter businessObjectDataNotificationFilter = new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, NO_STORAGE_NAME, NO_BDATA_STATUS, NO_BDATA_STATUS);
    // Create notification registration keys.
    BusinessObjectDataNotificationRegistrationKeys businessObjectDataNotificationRegistrationKeys = new BusinessObjectDataNotificationRegistrationKeys(Arrays.asList(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME)));
    // Create a mock servlet request that contains hard coded business object data notification filter parameters.
    MockHttpServletRequest servletRequest = new MockHttpServletRequest();
    servletRequest.setParameter("businessObjectDefinitionNamespace", BDEF_NAMESPACE);
    servletRequest.setParameter("businessObjectDefinitionName", BDEF_NAME);
    servletRequest.setParameter("businessObjectFormatUsage", FORMAT_USAGE_CODE);
    servletRequest.setParameter("businessObjectFormatFileType", FORMAT_FILE_TYPE_CODE);
    // Mock the external calls.
    when(businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistrationsByNotificationFilter(businessObjectDataNotificationFilter)).thenReturn(businessObjectDataNotificationRegistrationKeys);
    // Call the method under test.
    BusinessObjectDataNotificationRegistrationKeys result = businessObjectDataNotificationRegistrationRestController.getBusinessObjectDataNotificationRegistrationsByNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, servletRequest);
    // Verify the external calls.
    verify(businessObjectDataNotificationRegistrationService).getBusinessObjectDataNotificationRegistrationsByNotificationFilter(businessObjectDataNotificationFilter);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataNotificationRegistrationKeys, result);
}
Also used : BusinessObjectDataNotificationFilter(org.finra.herd.model.api.xml.BusinessObjectDataNotificationFilter) BusinessObjectDataNotificationRegistrationKeys(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 60 with NotificationRegistrationKey

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

the class BusinessObjectDataNotificationRegistrationRestControllerTest method testGetBusinessObjectDataNotificationRegistration.

@Test
public void testGetBusinessObjectDataNotificationRegistration() {
    // Create a notification registration key.
    NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    // Create a business object data notification filter.
    BusinessObjectDataNotificationFilter businessObjectDataNotificationFilter = new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS_2);
    // Create a list of job actions.
    List<JobAction> jobActions = Arrays.asList(new JobAction(JOB_NAMESPACE, JOB_NAME, CORRELATION_DATA));
    // Create a business object data notification registration.
    BusinessObjectDataNotificationRegistration businessObjectDataNotificationRegistration = new BusinessObjectDataNotificationRegistration(ID, businessObjectDataNotificationRegistrationKey, NOTIFICATION_EVENT_TYPE, businessObjectDataNotificationFilter, jobActions, NOTIFICATION_REGISTRATION_STATUS);
    // Mock the external calls.
    when(businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationKey)).thenReturn(businessObjectDataNotificationRegistration);
    // Call the method under test.
    BusinessObjectDataNotificationRegistration result = businessObjectDataNotificationRegistrationRestController.getBusinessObjectDataNotificationRegistration(NAMESPACE, NOTIFICATION_NAME);
    // Verify the external calls.
    verify(businessObjectDataNotificationRegistrationService).getBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationKey);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataNotificationRegistration, result);
}
Also used : JobAction(org.finra.herd.model.api.xml.JobAction) BusinessObjectDataNotificationFilter(org.finra.herd.model.api.xml.BusinessObjectDataNotificationFilter) BusinessObjectDataNotificationRegistration(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistration) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Aggregations

NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)141 Test (org.junit.Test)129 JobAction (org.finra.herd.model.api.xml.JobAction)49 BusinessObjectDataNotificationFilter (org.finra.herd.model.api.xml.BusinessObjectDataNotificationFilter)46 StorageUnitNotificationFilter (org.finra.herd.model.api.xml.StorageUnitNotificationFilter)44 BusinessObjectDataNotificationRegistration (org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistration)27 StorageUnitNotificationRegistration (org.finra.herd.model.api.xml.StorageUnitNotificationRegistration)26 BusinessObjectDataNotificationRegistrationEntity (org.finra.herd.model.jpa.BusinessObjectDataNotificationRegistrationEntity)17 ArrayList (java.util.ArrayList)16 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)15 BusinessObjectDataNotificationRegistrationCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationCreateRequest)14 StorageUnitNotificationRegistrationEntity (org.finra.herd.model.jpa.StorageUnitNotificationRegistrationEntity)14 BusinessObjectDataNotificationRegistrationKeys (org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys)13 StorageUnitNotificationRegistrationKeys (org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationKeys)13 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)11 BusinessObjectDataNotificationRegistrationUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationUpdateRequest)11 StorageUnitNotificationRegistrationCreateRequest (org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationCreateRequest)11 StorageUnitNotificationRegistrationUpdateRequest (org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationUpdateRequest)11 StorageEntity (org.finra.herd.model.jpa.StorageEntity)10 JobDefinition (org.finra.herd.model.api.xml.JobDefinition)9