Search in sources :

Example 36 with NotificationRegistrationKey

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

the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNamespaceTrimParameters.

@Test
public void testGetStorageUnitNotificationRegistrationsByNamespaceTrimParameters() {
    // Create and persist storage unit notification entities.
    for (NotificationRegistrationKey notificationRegistrationKey : notificationRegistrationDaoTestHelper.getTestNotificationRegistrationKeys()) {
        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 input parameters with leading and trailing empty spaces.
    StorageUnitNotificationRegistrationKeys resultKeys = storageUnitNotificationRegistrationService.getStorageUnitNotificationRegistrationsByNamespace(addWhitespace(NAMESPACE));
    // Validate the returned object.
    assertEquals(notificationRegistrationDaoTestHelper.getExpectedNotificationRegistrationKeys(), 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 37 with NotificationRegistrationKey

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

the class StorageUnitNotificationRegistrationServiceTest method testDeleteStorageUnitNotificationRegistrationTrimParameters.

@Test
public void testDeleteStorageUnitNotificationRegistrationTrimParameters() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    // Create and persist a storage unit notification registration entity.
    StorageUnitNotificationRegistrationEntity storageUnitNotificationRegistrationEntity = 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);
    // Validate that this storage unit notification exists.
    assertNotNull(storageUnitNotificationRegistrationDao.getStorageUnitNotificationRegistrationByAltKey(notificationRegistrationKey));
    // Delete this storage unit notification using input parameters with leading and trailing empty spaces.
    StorageUnitNotificationRegistration deletedStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.deleteStorageUnitNotificationRegistration(new NotificationRegistrationKey(addWhitespace(NAMESPACE), addWhitespace(NOTIFICATION_NAME)));
    // Validate the returned object.
    assertEquals(new StorageUnitNotificationRegistration(storageUnitNotificationRegistrationEntity.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.ENABLED), deletedStorageUnitNotificationRegistration);
    // Ensure that this storage unit notification is no longer there.
    assertNull(storageUnitNotificationRegistrationDao.getStorageUnitNotificationRegistrationByAltKey(notificationRegistrationKey));
}
Also used : StorageUnitNotificationRegistration(org.finra.herd.model.api.xml.StorageUnitNotificationRegistration) StorageUnitNotificationRegistrationEntity(org.finra.herd.model.jpa.StorageUnitNotificationRegistrationEntity) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 38 with NotificationRegistrationKey

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

the class StorageUnitNotificationRegistrationServiceTest method testUpdateStorageUnitNotificationRegistrationMissingRequiredParameters.

@Test
public void testUpdateStorageUnitNotificationRegistrationMissingRequiredParameters() {
    // Try to update a storage unit notification registration when namespace is not specified.
    try {
        storageUnitNotificationRegistrationService.updateStorageUnitNotificationRegistration(new NotificationRegistrationKey(BLANK_TEXT, 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, STORAGE_UNIT_STATUS_2), notificationRegistrationDaoTestHelper.getTestJobActions2(), NotificationRegistrationStatusEntity.ENABLED));
        fail("Should throw an IllegalArgumentException when namespace is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    // Try to update a storage unit notification registration when notification name is not specified.
    try {
        storageUnitNotificationRegistrationService.updateStorageUnitNotificationRegistration(new NotificationRegistrationKey(NAMESPACE, BLANK_TEXT), 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, STORAGE_UNIT_STATUS_2), notificationRegistrationDaoTestHelper.getTestJobActions2(), NotificationRegistrationStatusEntity.ENABLED));
        fail("Should throw an IllegalArgumentException when notification name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A notification name must be specified.", e.getMessage());
    }
    // Try to update a storage unit notification registration when storage name is not specified.
    try {
        storageUnitNotificationRegistrationService.updateStorageUnitNotificationRegistration(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME), new StorageUnitNotificationRegistrationUpdateRequest(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, BLANK_TEXT, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2), notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED));
        fail("Should throw an IllegalArgumentException when storage name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A storage name must be specified.", e.getMessage());
    }
    // Try to update a storage unit notification registration when notification status is not specified.
    try {
        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, STORAGE_UNIT_STATUS_2), notificationRegistrationDaoTestHelper.getTestJobActions2(), BLANK_TEXT));
        fail("Should throw an IllegalArgumentException when notification registration status is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A notification registration status must be specified.", e.getMessage());
    }
}
Also used : StorageUnitNotificationRegistrationUpdateRequest(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationUpdateRequest) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 39 with NotificationRegistrationKey

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

the class StorageUnitNotificationRegistrationServiceTest method testGetStorageUnitNotificationRegistrationsByNotificationFilter.

@Test
public void testGetStorageUnitNotificationRegistrationsByNotificationFilter() {
    // 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)));
}
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 40 with NotificationRegistrationKey

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

the class StorageUnitNotificationRegistrationServiceTest method testUpdateStorageUnitNotificationRegistrationTrimParameters.

@Test
public void testUpdateStorageUnitNotificationRegistrationTrimParameters() {
    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 using input parameters with leading and trailing empty spaces.
    StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.updateStorageUnitNotificationRegistration(new NotificationRegistrationKey(addWhitespace(NAMESPACE), addWhitespace(NOTIFICATION_NAME)), new StorageUnitNotificationRegistrationUpdateRequest(addWhitespace(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name()), new StorageUnitNotificationFilter(addWhitespace(BDEF_NAMESPACE_2), addWhitespace(BDEF_NAME_2), addWhitespace(FORMAT_USAGE_CODE_2), addWhitespace(FORMAT_FILE_TYPE_CODE_2), FORMAT_VERSION_2, addWhitespace(STORAGE_NAME_2), addWhitespace(STORAGE_UNIT_STATUS_3), NO_STORAGE_UNIT_STATUS), Arrays.asList(new JobAction(addWhitespace(JOB_NAMESPACE_2), addWhitespace(JOB_NAME_2), addWhitespace(CORRELATION_DATA_2))), BLANK_TEXT + NotificationRegistrationStatusEntity.ENABLED + BLANK_TEXT));
    // 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), Arrays.asList(new JobAction(JOB_NAMESPACE_2, JOB_NAME_2, addWhitespace(CORRELATION_DATA_2))), NotificationRegistrationStatusEntity.ENABLED), resultStorageUnitNotificationRegistration);
}
Also used : JobAction(org.finra.herd.model.api.xml.JobAction) 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)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