Search in sources :

Example 56 with JobAction

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

the class StorageUnitNotificationRegistrationServiceTest method testCreateStorageUnitNotificationRegistrationMissingRequiredParameters.

@Test
public void testCreateStorageUnitNotificationRegistrationMissingRequiredParameters() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    // Try to create a storage unit notification instance when namespace is not specified.
    try {
        storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(new NotificationRegistrationKey(BLANK_TEXT, NOTIFICATION_NAME), NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(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));
        fail("Should throw an IllegalArgumentException when namespace is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    // Try to create a storage unit notification instance when notification name is not specified.
    try {
        storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(new NotificationRegistrationKey(NAMESPACE, BLANK_TEXT), NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(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));
        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 create a storage unit notification instance when storage unit notification event type is not specified.
    try {
        storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(notificationRegistrationKey, BLANK_TEXT, new StorageUnitNotificationFilter(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));
        fail("Should throw an IllegalArgumentException when storage unit notification event type is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A storage unit event type must be specified.", e.getMessage());
    }
    // Try to create a storage unit notification instance when object definition name is not specified.
    try {
        storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(NAMESPACE, BLANK_TEXT, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2), notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED));
        fail("Should throw an IllegalArgumentException when business object definition name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object definition name must be specified.", e.getMessage());
    }
    // Try to create a storage unit notification instance when storage name is not specified.
    try {
        storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(notificationRegistrationKey, 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 create a storage unit notification instance when job actions are not specified.
    try {
        storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2), null, NotificationRegistrationStatusEntity.ENABLED));
        fail("Should throw an IllegalArgumentException when job actions are not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("At least one notification action must be specified.", e.getMessage());
    }
    // Try to create a storage unit notification instance when job action job namespace is not specified.
    try {
        storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2), Arrays.asList(new JobAction(BLANK_TEXT, JOB_NAME, CORRELATION_DATA)), NotificationRegistrationStatusEntity.ENABLED));
        fail("Should throw an IllegalArgumentException when job action job namespace is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A job action namespace must be specified.", e.getMessage());
    }
    // Try to create a storage unit notification instance when job action job name is not specified.
    try {
        storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2), Arrays.asList(new JobAction(NAMESPACE, BLANK_TEXT, CORRELATION_DATA)), NotificationRegistrationStatusEntity.ENABLED));
        fail("Should throw an IllegalArgumentException when job action job name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A job action job name must be specified.", e.getMessage());
    }
}
Also used : JobAction(org.finra.herd.model.api.xml.JobAction) StorageUnitNotificationRegistrationCreateRequest(org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationCreateRequest) StorageUnitNotificationFilter(org.finra.herd.model.api.xml.StorageUnitNotificationFilter) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 57 with JobAction

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

the class StorageUnitNotificationRegistrationServiceTest method testCreateStorageUnitNotificationRegistrationTrimParameters.

@Test
public void testCreateStorageUnitNotificationRegistrationTrimParameters() {
    // Create and persist the relative database entities.
    notificationRegistrationServiceTestHelper.createDatabaseEntitiesForStorageUnitNotificationRegistrationTesting();
    // Create a storage unit notification using input parameters with leading and trailing empty spaces.
    StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(new NotificationRegistrationKey(addWhitespace(NAMESPACE), addWhitespace(NOTIFICATION_NAME)), addWhitespace(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name()), new StorageUnitNotificationFilter(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(FORMAT_USAGE_CODE), addWhitespace(FORMAT_FILE_TYPE_CODE), FORMAT_VERSION, addWhitespace(STORAGE_NAME), addWhitespace(STORAGE_UNIT_STATUS), addWhitespace(STORAGE_UNIT_STATUS_2)), Arrays.asList(new JobAction(addWhitespace(JOB_NAMESPACE), addWhitespace(JOB_NAME), addWhitespace(CORRELATION_DATA))), addWhitespace(NotificationRegistrationStatusEntity.ENABLED)));
    // Validate the returned object.
    assertEquals(new StorageUnitNotificationRegistration(resultStorageUnitNotificationRegistration.getId(), new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME), 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), Arrays.asList(new JobAction(JOB_NAMESPACE, JOB_NAME, addWhitespace(CORRELATION_DATA))), NotificationRegistrationStatusEntity.ENABLED), resultStorageUnitNotificationRegistration);
}
Also used : JobAction(org.finra.herd.model.api.xml.JobAction) 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 58 with JobAction

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

the class StorageUnitNotificationRegistrationServiceTest method testCreateStorageUnitNotificationRegistrationMissingOptionalParametersPassedAsNulls.

@Test
public void testCreateStorageUnitNotificationRegistrationMissingOptionalParametersPassedAsNulls() {
    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.createDatabaseEntitiesForStorageUnitNotificationRegistrationTesting();
    // Create a storage unit notification without specifying any of the optional parameters (passing null values).
    StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, null, null, null, STORAGE_NAME, null, null), Arrays.asList(new JobAction(JOB_NAMESPACE, JOB_NAME, null)), null));
    // Validate the returned object.
    assertEquals(new StorageUnitNotificationRegistration(resultStorageUnitNotificationRegistration.getId(), notificationRegistrationKey, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE, BDEF_NAME, null, null, null, STORAGE_NAME, null, null), Arrays.asList(new JobAction(JOB_NAMESPACE, JOB_NAME, null)), NotificationRegistrationStatusEntity.ENABLED), resultStorageUnitNotificationRegistration);
}
Also used : JobAction(org.finra.herd.model.api.xml.JobAction) 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 59 with JobAction

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

the class StorageUnitNotificationRegistrationServiceTest method testCreateStorageUnitNotificationRegistrationLowerCaseParameters.

@Test
public void testCreateStorageUnitNotificationRegistrationLowerCaseParameters() {
    // Create and persist the relative database entities using upper case values.
    notificationRegistrationServiceTestHelper.createDatabaseEntitiesForStorageUnitNotificationRegistrationTesting(NAMESPACE.toUpperCase(), Arrays.asList(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name()), BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), Arrays.asList(FORMAT_FILE_TYPE_CODE.toUpperCase()), Arrays.asList(STORAGE_NAME.toUpperCase()), Arrays.asList(STORAGE_UNIT_STATUS.toUpperCase(), STORAGE_UNIT_STATUS_2.toUpperCase()), Arrays.asList(new JobAction(NAMESPACE.toUpperCase(), JOB_NAME.toUpperCase(), BLANK_TEXT)));
    // Create a storage unit notification using lower case input parameters.
    StorageUnitNotificationRegistration resultStorageUnitNotificationRegistration = storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(new StorageUnitNotificationRegistrationCreateRequest(new NotificationRegistrationKey(NAMESPACE.toLowerCase(), NOTIFICATION_NAME.toLowerCase()), NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name().toLowerCase(), new StorageUnitNotificationFilter(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, STORAGE_NAME.toLowerCase(), STORAGE_UNIT_STATUS.toLowerCase(), STORAGE_UNIT_STATUS_2.toLowerCase()), Arrays.asList(new JobAction(NAMESPACE.toLowerCase(), JOB_NAME.toLowerCase(), CORRELATION_DATA.toLowerCase())), NotificationRegistrationStatusEntity.ENABLED.toLowerCase()));
    // Validate the returned object.
    assertEquals(new StorageUnitNotificationRegistration(resultStorageUnitNotificationRegistration.getId(), new NotificationRegistrationKey(NAMESPACE.toUpperCase(), NOTIFICATION_NAME.toLowerCase()), NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, STORAGE_NAME.toUpperCase(), STORAGE_UNIT_STATUS.toUpperCase(), STORAGE_UNIT_STATUS_2.toUpperCase()), Arrays.asList(new JobAction(NAMESPACE.toUpperCase(), JOB_NAME.toUpperCase(), CORRELATION_DATA.toLowerCase())), NotificationRegistrationStatusEntity.ENABLED), resultStorageUnitNotificationRegistration);
}
Also used : JobAction(org.finra.herd.model.api.xml.JobAction) 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)

Aggregations

JobAction (org.finra.herd.model.api.xml.JobAction)59 NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)49 Test (org.junit.Test)41 BusinessObjectDataNotificationFilter (org.finra.herd.model.api.xml.BusinessObjectDataNotificationFilter)23 StorageUnitNotificationFilter (org.finra.herd.model.api.xml.StorageUnitNotificationFilter)17 ArrayList (java.util.ArrayList)15 BusinessObjectDataNotificationRegistration (org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistration)15 StorageEntity (org.finra.herd.model.jpa.StorageEntity)12 BusinessObjectDataNotificationRegistrationCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationCreateRequest)11 StorageUnitNotificationRegistration (org.finra.herd.model.api.xml.StorageUnitNotificationRegistration)11 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)9 JobDefinition (org.finra.herd.model.api.xml.JobDefinition)9 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)8 StorageUnitNotificationRegistrationCreateRequest (org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationCreateRequest)8 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)8 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)8 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)8 NotificationEventTypeEntity (org.finra.herd.model.jpa.NotificationEventTypeEntity)8 BusinessObjectDataNotificationRegistrationUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDataNotificationRegistrationUpdateRequest)7 Job (org.finra.herd.model.api.xml.Job)6