Search in sources :

Example 11 with NotificationRegistrationKey

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

the class BusinessObjectDataNotificationRegistrationServiceTest method testGetBusinessObjectDataNotificationRegistrationsByNamespaceTrimParameters.

@Test
public void testGetBusinessObjectDataNotificationRegistrationsByNamespaceTrimParameters() {
    // Create and persist business object data notification entities.
    for (NotificationRegistrationKey notificationRegistrationKey : notificationRegistrationDaoTestHelper.getTestNotificationRegistrationKeys()) {
        notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKey, 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 input parameters with leading and trailing empty spaces.
    BusinessObjectDataNotificationRegistrationKeys resultKeys = businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistrationsByNamespace(addWhitespace(NAMESPACE));
    // Validate the returned object.
    assertEquals(notificationRegistrationDaoTestHelper.getExpectedNotificationRegistrationKeys(), resultKeys.getBusinessObjectDataNotificationRegistrationKeys());
}
Also used : BusinessObjectDataNotificationRegistrationKeys(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationKeys) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 12 with NotificationRegistrationKey

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

the class BusinessObjectDataNotificationRegistrationServiceTest method testCreateBusinessObjectDataNotificationRegistrationForBusinessObjectDataRegistration.

@Test
public void testCreateBusinessObjectDataNotificationRegistrationForBusinessObjectDataRegistration() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    // Create and persist the relative database entities.
    notificationRegistrationServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataNotificationRegistrationTesting();
    // Create a business object data notification registration for business object data registration notification event with ENABLED status.
    BusinessObjectDataNotificationRegistration result = businessObjectDataNotificationRegistrationService.createBusinessObjectDataNotificationRegistration(new BusinessObjectDataNotificationRegistrationCreateRequest(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_RGSTN.name(), new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, NO_BDATA_STATUS), notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED));
    // Validate the returned object.
    assertEquals(new BusinessObjectDataNotificationRegistration(result.getId(), notificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_RGSTN.name(), new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, NO_BDATA_STATUS), notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED), result);
}
Also used : BusinessObjectDataNotificationRegistrationCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationCreateRequest) 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)

Example 13 with NotificationRegistrationKey

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

the class BusinessObjectDataNotificationRegistrationServiceTest method testGetBusinessObjectDataNotificationRegistrationLowerCaseParameters.

@Test
public void testGetBusinessObjectDataNotificationRegistrationLowerCaseParameters() {
    // Create and persist a business object data notification registration entity using upper case alternate key values.
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE.toUpperCase(), NOTIFICATION_NAME.toUpperCase());
    BusinessObjectDataNotificationRegistrationEntity businessObjectDataNotificationRegistrationEntity = notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKey, 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 the business object data notification using lower case input parameters.
    BusinessObjectDataNotificationRegistration resultBusinessObjectDataNotificationRegistration = businessObjectDataNotificationRegistrationService.getBusinessObjectDataNotificationRegistration(new NotificationRegistrationKey(NAMESPACE.toLowerCase(), NOTIFICATION_NAME.toLowerCase()));
    // Validate the returned object.
    assertEquals(new BusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationEntity.getId(), notificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS_2), notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED), resultBusinessObjectDataNotificationRegistration);
}
Also used : BusinessObjectDataNotificationFilter(org.finra.herd.model.api.xml.BusinessObjectDataNotificationFilter) BusinessObjectDataNotificationRegistration(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistration) BusinessObjectDataNotificationRegistrationEntity(org.finra.herd.model.jpa.BusinessObjectDataNotificationRegistrationEntity) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 14 with NotificationRegistrationKey

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

the class BusinessObjectDataNotificationRegistrationServiceTest method testUpdateBusinessObjectDataNotificationRegistrationNoExists.

@Test
public void testUpdateBusinessObjectDataNotificationRegistrationNoExists() {
    // Try to update a non-existing business object data notification registration.
    try {
        businessObjectDataNotificationRegistrationService.updateBusinessObjectDataNotificationRegistration(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME), new BusinessObjectDataNotificationRegistrationUpdateRequest(NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_RGSTN.name(), new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, STORAGE_NAME_2, BDATA_STATUS, NO_BDATA_STATUS), notificationRegistrationDaoTestHelper.getTestJobActions2(), NotificationRegistrationStatusEntity.ENABLED));
        fail("Should throw an ObjectNotFoundException when trying to update a non-existing business object data notification.");
    } catch (ObjectNotFoundException e) {
        assertEquals(String.format("Business object data notification registration with name \"%s\" does not exist for \"%s\" namespace.", NOTIFICATION_NAME, NAMESPACE), e.getMessage());
    }
}
Also used : BusinessObjectDataNotificationFilter(org.finra.herd.model.api.xml.BusinessObjectDataNotificationFilter) ObjectNotFoundException(org.finra.herd.model.ObjectNotFoundException) BusinessObjectDataNotificationRegistrationUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationUpdateRequest) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 15 with NotificationRegistrationKey

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

the class BusinessObjectDataNotificationRegistrationServiceTest method testCreateBusinessObjectDataNotificationRegistrationMissingOptionalParametersPassedAsWhitespace.

@Test
public void testCreateBusinessObjectDataNotificationRegistrationMissingOptionalParametersPassedAsWhitespace() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    // Create a business object definition.
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION);
    // Create and persist the relative database entities.
    notificationRegistrationServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataNotificationRegistrationTesting();
    // Create a business object data notification without specifying any of the optional parameters (passing whitespace characters).
    BusinessObjectDataNotificationRegistration resultBusinessObjectDataNotificationRegistration = businessObjectDataNotificationRegistrationService.createBusinessObjectDataNotificationRegistration(new BusinessObjectDataNotificationRegistrationCreateRequest(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, BLANK_TEXT, BLANK_TEXT, null, BLANK_TEXT, BLANK_TEXT, BLANK_TEXT), Arrays.asList(new JobAction(JOB_NAMESPACE, JOB_NAME, BLANK_TEXT)), BLANK_TEXT));
    // Validate the returned object.
    assertEquals(new BusinessObjectDataNotificationRegistration(resultBusinessObjectDataNotificationRegistration.getId(), notificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), new BusinessObjectDataNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, null, null, null, null, null, null), Arrays.asList(new JobAction(JOB_NAMESPACE, JOB_NAME, BLANK_TEXT)), NotificationRegistrationStatusEntity.ENABLED), resultBusinessObjectDataNotificationRegistration);
}
Also used : JobAction(org.finra.herd.model.api.xml.JobAction) BusinessObjectDataNotificationRegistrationCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationCreateRequest) 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