Search in sources :

Example 6 with BusinessObjectDataAvailabilityCollectionRequest

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

the class CheckBusinessObjectDataAvailabilityCollectionTest method testCheckBusinessObjectDataAvailabilityCollectionJson.

@Test
public void testCheckBusinessObjectDataAvailabilityCollectionJson() throws Exception {
    // Prepare database entities required for testing.
    businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityCollectionTesting();
    // Prepare the request.
    BusinessObjectDataAvailabilityCollectionRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityCollectionRequest();
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataAvailabilityCollectionRequest", "${businessObjectDataAvailabilityCollectionRequest}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("contentType", "json"));
    parameters.add(buildParameter("businessObjectDataAvailabilityCollectionRequest", jsonHelper.objectToJson(request)));
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(CheckBusinessObjectDataAvailabilityCollection.VARIABLE_IS_ALL_DATA_AVAILABLE, true);
    variableValuesToValidate.put(CheckBusinessObjectDataAvailabilityCollection.VARIABLE_IS_ALL_DATA_NOT_AVAILABLE, false);
    variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataAvailabilityCollectionResponse()));
    testActivitiServiceTaskSuccess(CheckBusinessObjectDataAvailabilityCollection.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) HashMap(java.util.HashMap) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 7 with BusinessObjectDataAvailabilityCollectionRequest

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

BusinessObjectDataAvailabilityCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest)7 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)3 HashMap (java.util.HashMap)2 FieldExtension (org.activiti.bpmn.model.FieldExtension)2 BusinessObjectDataAvailabilityCollectionResponse (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)2 Parameter (org.finra.herd.model.api.xml.Parameter)2 BusinessObjectDataCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataCreateRequest)1 BusinessObjectDataDdlCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataDdlCollectionRequest)1 BusinessObjectDataDdlRequest (org.finra.herd.model.api.xml.BusinessObjectDataDdlRequest)1 BusinessObjectDataInvalidateUnregisteredRequest (org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest)1 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)1 BusinessObjectDataRetryStoragePolicyTransitionRequest (org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest)1 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)1