Search in sources :

Example 6 with BusinessObjectDataNotificationRegistrationKeys

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

the class BusinessObjectDataNotificationRegistrationServiceImpl method getBusinessObjectDataNotificationRegistrationsByNotificationFilter.

@NamespacePermission(fields = "#businessObjectDataNotificationFilter?.namespace", permissions = NamespacePermissionEnum.READ)
@Override
public BusinessObjectDataNotificationRegistrationKeys getBusinessObjectDataNotificationRegistrationsByNotificationFilter(BusinessObjectDataNotificationFilter businessObjectDataNotificationFilter) {
    // Validate and trim the business object data notification filter parameters.
    validateBusinessObjectDataNotificationFilterBusinessObjectDefinitionFields(businessObjectDataNotificationFilter);
    trimBusinessObjectDataNotificationFilterBusinessObjectFormatFields(businessObjectDataNotificationFilter);
    // Create and populate a list of business object data notification registration keys.
    BusinessObjectDataNotificationRegistrationKeys businessObjectDataNotificationKeys = new BusinessObjectDataNotificationRegistrationKeys();
    businessObjectDataNotificationKeys.getBusinessObjectDataNotificationRegistrationKeys().addAll(businessObjectDataNotificationRegistrationDao.getBusinessObjectDataNotificationRegistrationKeysByNotificationFilter(businessObjectDataNotificationFilter));
    return businessObjectDataNotificationKeys;
}
Also used : BusinessObjectDataNotificationRegistrationKeys(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Example 7 with BusinessObjectDataNotificationRegistrationKeys

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

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

the class BusinessObjectDataNotificationRegistrationRestControllerTest method testGetBusinessObjectDataNotificationRegistrationsByNamespace.

@Test
public void testGetBusinessObjectDataNotificationRegistrationsByNamespace() {
    // Create notification registration keys.
    BusinessObjectDataNotificationRegistrationKeys businessObjectDataNotificationRegistrationKeys = new BusinessObjectDataNotificationRegistrationKeys(Arrays.asList(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME)));
    // Mock the external calls.
    when(businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistrationsByNamespace(NAMESPACE)).thenReturn(businessObjectDataNotificationRegistrationKeys);
    // Call the method under test.
    BusinessObjectDataNotificationRegistrationKeys result = businessObjectDataNotificationRegistrationRestController.getBusinessObjectDataNotificationRegistrationsByNamespace(NAMESPACE);
    // Verify the external calls.
    verify(businessObjectDataNotificationRegistrationService).getBusinessObjectDataNotificationRegistrationsByNamespace(NAMESPACE);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataNotificationRegistrationKeys, result);
}
Also used : BusinessObjectDataNotificationRegistrationKeys(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 9 with BusinessObjectDataNotificationRegistrationKeys

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

the class BusinessObjectDataNotificationRegistrationServiceImpl method getBusinessObjectDataNotificationRegistrationsByNamespace.

@Override
public BusinessObjectDataNotificationRegistrationKeys getBusinessObjectDataNotificationRegistrationsByNamespace(String namespace) {
    String namespaceLocal = namespace;
    // Validate and trim the namespace value.
    Assert.hasText(namespaceLocal, "A namespace must be specified.");
    namespaceLocal = namespaceLocal.trim();
    // Ensure that this namespace exists.
    namespaceDaoHelper.getNamespaceEntity(namespaceLocal);
    // Create and populate a list of business object data notification registration keys.
    BusinessObjectDataNotificationRegistrationKeys businessObjectDataNotificationKeys = new BusinessObjectDataNotificationRegistrationKeys();
    businessObjectDataNotificationKeys.getBusinessObjectDataNotificationRegistrationKeys().addAll(businessObjectDataNotificationRegistrationDao.getBusinessObjectDataNotificationRegistrationKeysByNamespace(namespaceLocal));
    return businessObjectDataNotificationKeys;
}
Also used : BusinessObjectDataNotificationRegistrationKeys(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys)

Example 10 with BusinessObjectDataNotificationRegistrationKeys

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

the class BusinessObjectDataNotificationRegistrationServiceTest method testGetBusinessObjectDataNotificationRegistrationsByNamespaceUpperCaseParameters.

@Test
public void testGetBusinessObjectDataNotificationRegistrationsByNamespaceUpperCaseParameters() {
    // Create and persist business object data notification entities using lower case alternate key values.
    for (NotificationRegistrationKey notificationRegistrationKey : notificationRegistrationDaoTestHelper.getTestNotificationRegistrationKeys()) {
        NotificationRegistrationKey notificationRegistrationKeyLowerCase = new NotificationRegistrationKey(notificationRegistrationKey.getNamespace().toLowerCase(), notificationRegistrationKey.getNotificationName().toLowerCase());
        notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKeyLowerCase, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS_2, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
    }
    // Retrieve a list of business object data notification registration keys using upper case namespace code value.
    BusinessObjectDataNotificationRegistrationKeys resultKeys = businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistrationsByNamespace(NAMESPACE.toUpperCase());
    // 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().toLowerCase());
        expectedKey.setNotificationName(origKey.getNotificationName().toLowerCase());
    }
    assertEquals(expectedKeys, resultKeys.getBusinessObjectDataNotificationRegistrationKeys());
}
Also used : BusinessObjectDataNotificationRegistrationKeys(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys) ArrayList(java.util.ArrayList) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Aggregations

BusinessObjectDataNotificationRegistrationKeys (org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys)15 NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)13 Test (org.junit.Test)13 BusinessObjectDataNotificationFilter (org.finra.herd.model.api.xml.BusinessObjectDataNotificationFilter)7 ArrayList (java.util.ArrayList)2 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1