Search in sources :

Example 31 with BusinessObjectDataInvalidateUnregisteredRequest

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

the class InvalidateUnregisteredBusinessObjectDataTest method testInvalidateUnregisteredBusinessObjectDataSuccessJson.

/**
 * Tests a standard request that is valid JSON.
 *
 * @throws Exception
 */
@Test
public void testInvalidateUnregisteredBusinessObjectDataSuccessJson() throws Exception {
    // The test request
    BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE);
    // The expected response
    BusinessObjectDataInvalidateUnregisteredResponse expectedResponse = getExpectedBusinessObjectDataInvalidateUnregisteredResponse(request);
    // Setup format
    businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request);
    // Construct Activiti parameters
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataInvalidateUnregisteredRequest", "${businessObjectDataInvalidateUnregisteredRequest}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("contentType", "json"));
    parameters.add(buildParameter("businessObjectDataInvalidateUnregisteredRequest", jsonHelper.objectToJson(request)));
    /*
         * Assert that:
         * Status is SUCCESS
         * Error message is not set
         * Response is expected JSON
         */
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(ActivitiRuntimeHelper.VARIABLE_STATUS, ActivitiRuntimeHelper.TASK_STATUS_SUCCESS);
    variableValuesToValidate.put(ActivitiRuntimeHelper.VARIABLE_ERROR_MESSAGE, VARIABLE_VALUE_IS_NULL);
    variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedResponse));
    testActivitiServiceTaskSuccess(InvalidateUnregisteredBusinessObjectData.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataInvalidateUnregisteredRequest(org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest) HashMap(java.util.HashMap) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) BusinessObjectDataInvalidateUnregisteredResponse(org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredResponse) Test(org.junit.Test)

Example 32 with BusinessObjectDataInvalidateUnregisteredRequest

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

the class BusinessObjectDataServiceTest method testBusinessObjectDataServiceMethodsNewTx.

/**
 * This method is to get the coverage for the business object data service method that starts the new transaction.
 */
@Test
public void testBusinessObjectDataServiceMethodsNewTx() throws Exception {
    BusinessObjectDataAvailabilityRequest businessObjectDataAvailabilityRequest = new BusinessObjectDataAvailabilityRequest();
    try {
        businessObjectDataServiceImpl.checkBusinessObjectDataAvailability(businessObjectDataAvailabilityRequest);
        fail("Should throw an IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    BusinessObjectDataAvailabilityCollectionRequest businessObjectDataAvailabilityCollectionRequest = new BusinessObjectDataAvailabilityCollectionRequest();
    try {
        businessObjectDataServiceImpl.checkBusinessObjectDataAvailabilityCollection(businessObjectDataAvailabilityCollectionRequest);
        fail("Should throw an IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
        assertEquals("At least one business object data availability request must be specified.", e.getMessage());
    }
    BusinessObjectDataCreateRequest businessObjectDataCreateRequest = new BusinessObjectDataCreateRequest();
    try {
        businessObjectDataServiceImpl.createBusinessObjectData(businessObjectDataCreateRequest);
        fail("Should throw an IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    try {
        businessObjectDataServiceImpl.getBusinessObjectData(new BusinessObjectDataKey(), null, NO_BDATA_STATUS, NO_INCLUDE_BUSINESS_OBJECT_DATA_STATUS_HISTORY, NO_INCLUDE_STORAGE_UNIT_STATUS_HISTORY);
        fail("Should throw an IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    try {
        businessObjectDataServiceImpl.generateBusinessObjectDataDdl(new BusinessObjectDataDdlRequest());
        fail("Should throw an IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    try {
        businessObjectDataServiceImpl.generateBusinessObjectDataDdlCollection(new BusinessObjectDataDdlCollectionRequest());
        fail("Should throw an IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
        assertEquals("At least one business object data DDL request must be specified.", e.getMessage());
    }
    try {
        businessObjectDataServiceImpl.invalidateUnregisteredBusinessObjectData(new BusinessObjectDataInvalidateUnregisteredRequest());
    } catch (IllegalArgumentException e) {
        assertEquals("The namespace is required", e.getMessage());
    }
    try {
        businessObjectDataServiceImpl.retryStoragePolicyTransition(new BusinessObjectDataKey(), new BusinessObjectDataRetryStoragePolicyTransitionRequest());
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
    try {
        businessObjectDataServiceImpl.restoreBusinessObjectData(new BusinessObjectDataKey(), EXPIRATION_IN_DAYS);
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) BusinessObjectDataDdlCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest) BusinessObjectDataInvalidateUnregisteredRequest(org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest) BusinessObjectDataDdlRequest(org.finra.herd.model.api.xml.BusinessObjectDataDdlRequest) BusinessObjectDataCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataCreateRequest) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataRetryStoragePolicyTransitionRequest(org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest) Test(org.junit.Test)

Aggregations

BusinessObjectDataInvalidateUnregisteredRequest (org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest)32 Test (org.junit.Test)31 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)21 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)21 BusinessObjectDataInvalidateUnregisteredResponse (org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredResponse)13 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)12 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)4 NotificationMessageDefinition (org.finra.herd.model.api.xml.NotificationMessageDefinition)4 NotificationMessageDefinitions (org.finra.herd.model.api.xml.NotificationMessageDefinitions)4 StorageUnit (org.finra.herd.model.api.xml.StorageUnit)4 ConfigurationEntity (org.finra.herd.model.jpa.ConfigurationEntity)4 FieldExtension (org.activiti.bpmn.model.FieldExtension)3 MessageHeaderDefinition (org.finra.herd.model.api.xml.MessageHeaderDefinition)3 Parameter (org.finra.herd.model.api.xml.Parameter)3 NotificationMessage (org.finra.herd.model.dto.NotificationMessage)3 BusinessObjectDataAvailabilityCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest)1 BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)1