Search in sources :

Example 41 with BusinessObjectDataAvailabilityRequest

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

the class BusinessObjectDataServiceTestHelper method getTestBusinessObjectDataAvailabilityRequest.

/**
 * Creates and returns a business object data availability request using passed parameters along with some hard-coded test values.
 *
 * @param partitionKey the partition key
 * @param startPartitionValue the start partition value for the partition value range
 * @param endPartitionValue the end partition value for the partition value range
 * @param partitionValues the list of partition values
 *
 * @return the newly created business object data availability request
 */
public BusinessObjectDataAvailabilityRequest getTestBusinessObjectDataAvailabilityRequest(String partitionKey, String startPartitionValue, String endPartitionValue, List<String> partitionValues) {
    BusinessObjectDataAvailabilityRequest request = new BusinessObjectDataAvailabilityRequest();
    request.setNamespace(AbstractServiceTest.NAMESPACE);
    request.setBusinessObjectDefinitionName(AbstractServiceTest.BDEF_NAME);
    request.setBusinessObjectFormatUsage(AbstractServiceTest.FORMAT_USAGE_CODE);
    request.setBusinessObjectFormatFileType(AbstractServiceTest.FORMAT_FILE_TYPE_CODE);
    request.setBusinessObjectFormatVersion(AbstractServiceTest.FORMAT_VERSION);
    PartitionValueFilter partitionValueFilter = new PartitionValueFilter();
    request.setPartitionValueFilters(Arrays.asList(partitionValueFilter));
    partitionValueFilter.setPartitionKey(partitionKey);
    if (startPartitionValue != null || endPartitionValue != null) {
        PartitionValueRange partitionValueRange = new PartitionValueRange();
        partitionValueFilter.setPartitionValueRange(partitionValueRange);
        partitionValueRange.setStartPartitionValue(startPartitionValue);
        partitionValueRange.setEndPartitionValue(endPartitionValue);
    }
    if (partitionValues != null) {
        partitionValueFilter.setPartitionValues(new ArrayList<>(partitionValues));
    }
    request.setBusinessObjectDataVersion(AbstractServiceTest.DATA_VERSION);
    request.setStorageName(AbstractServiceTest.STORAGE_NAME);
    request.setIncludeAllRegisteredSubPartitions(AbstractServiceTest.NO_INCLUDE_ALL_REGISTERED_SUBPARTITIONS);
    return request;
}
Also used : PartitionValueRange(org.finra.herd.model.api.xml.PartitionValueRange) BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) PartitionValueFilter(org.finra.herd.model.api.xml.PartitionValueFilter)

Example 42 with BusinessObjectDataAvailabilityRequest

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

the class BusinessObjectDataServiceTestHelper method getTestBusinessObjectDataAvailabilityCollectionRequest.

/**
 * Creates a check business object data availability collection request using hard coded test values.
 *
 * @return the business object data availability collection request
 */
public BusinessObjectDataAvailabilityCollectionRequest getTestBusinessObjectDataAvailabilityCollectionRequest() {
    // Create a check business object data availability collection request.
    BusinessObjectDataAvailabilityCollectionRequest businessObjectDataAvailabilityCollectionRequest = new BusinessObjectDataAvailabilityCollectionRequest();
    // Create a list of check business object data availability requests.
    List<BusinessObjectDataAvailabilityRequest> businessObjectDataAvailabilityRequests = new ArrayList<>();
    businessObjectDataAvailabilityCollectionRequest.setBusinessObjectDataAvailabilityRequests(businessObjectDataAvailabilityRequests);
    // Create a business object data availability request.
    BusinessObjectDataAvailabilityRequest businessObjectDataAvailabilityRequest = new BusinessObjectDataAvailabilityRequest(AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME, AbstractServiceTest.FORMAT_USAGE_CODE, AbstractServiceTest.FORMAT_FILE_TYPE_CODE, AbstractServiceTest.FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(AbstractServiceTest.PARTITION_KEY, Arrays.asList(AbstractServiceTest.PARTITION_VALUE), AbstractServiceTest.NO_PARTITION_VALUE_RANGE, AbstractServiceTest.NO_LATEST_BEFORE_PARTITION_VALUE, AbstractServiceTest.NO_LATEST_AFTER_PARTITION_VALUE)), null, AbstractServiceTest.DATA_VERSION, AbstractServiceTest.NO_STORAGE_NAMES, AbstractServiceTest.STORAGE_NAME, AbstractServiceTest.NO_INCLUDE_ALL_REGISTERED_SUBPARTITIONS);
    businessObjectDataAvailabilityRequests.add(businessObjectDataAvailabilityRequest);
    return businessObjectDataAvailabilityCollectionRequest;
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) ArrayList(java.util.ArrayList) PartitionValueFilter(org.finra.herd.model.api.xml.PartitionValueFilter)

Example 43 with BusinessObjectDataAvailabilityRequest

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

the class CheckBusinessObjectDataAvailabilityMultiplePartitionsTest method testCheckBusinessObjectDataAvailabilityMultiplePartitionsJson.

@Test
public void testCheckBusinessObjectDataAvailabilityMultiplePartitionsJson() throws Exception {
    // Prepare test data.
    businessObjectDataAvailabilityTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityTesting(null);
    // Prepare a check business object data availability request.
    BusinessObjectDataAvailabilityRequest businessObjectDataAvailabilityRequest = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityRequest(UNSORTED_PARTITION_VALUES);
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataAvailabilityRequest", "${businessObjectDataAvailabilityRequest}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("contentType", "json"));
    parameters.add(buildParameter("businessObjectDataAvailabilityRequest", jsonHelper.objectToJson(businessObjectDataAvailabilityRequest)));
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(CheckBusinessObjectDataAvailabilityMultiplePartitions.VARIABLE_IS_ALL_DATA_AVAILABLE, false);
    variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_NOT_NULL);
    testActivitiServiceTaskSuccess(CheckBusinessObjectDataAvailabilityMultiplePartitions.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) 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 44 with BusinessObjectDataAvailabilityRequest

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

the class CheckBusinessObjectDataAvailabilityMultiplePartitionsTest method testCheckBusinessObjectDataAvailabilityMultiplePartitionsXmlAllDataAvailable.

@Test
public void testCheckBusinessObjectDataAvailabilityMultiplePartitionsXmlAllDataAvailable() throws Exception {
    // Prepare test data.
    businessObjectDataAvailabilityTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityTesting(null);
    // Prepare a check business object data availability request that should result in response with the all business object data being available.
    BusinessObjectDataAvailabilityRequest businessObjectDataAvailabilityRequest = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityRequest(STORAGE_1_AVAILABLE_PARTITION_VALUES);
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataAvailabilityRequest", "${businessObjectDataAvailabilityRequest}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("contentType", "xml"));
    parameters.add(buildParameter("businessObjectDataAvailabilityRequest", xmlHelper.objectToXml(businessObjectDataAvailabilityRequest)));
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(CheckBusinessObjectDataAvailabilityMultiplePartitions.VARIABLE_IS_ALL_DATA_AVAILABLE, true);
    variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_NOT_NULL);
    testActivitiServiceTaskSuccess(CheckBusinessObjectDataAvailabilityMultiplePartitions.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) 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 45 with BusinessObjectDataAvailabilityRequest

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

BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)69 Test (org.junit.Test)62 BusinessObjectDataAvailability (org.finra.herd.model.api.xml.BusinessObjectDataAvailability)48 BusinessObjectDataStatus (org.finra.herd.model.api.xml.BusinessObjectDataStatus)40 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)38 ArrayList (java.util.ArrayList)27 LatestAfterPartitionValue (org.finra.herd.model.api.xml.LatestAfterPartitionValue)5 LatestBeforePartitionValue (org.finra.herd.model.api.xml.LatestBeforePartitionValue)5 HashMap (java.util.HashMap)4 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)4 FieldExtension (org.activiti.bpmn.model.FieldExtension)3 BusinessObjectDataAvailabilityCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest)3 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)3 Parameter (org.finra.herd.model.api.xml.Parameter)3 PartitionValueRange (org.finra.herd.model.api.xml.PartitionValueRange)3 SchemaColumn (org.finra.herd.model.api.xml.SchemaColumn)3 BusinessObjectDataAvailabilityCollectionResponse (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)1 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