Search in sources :

Example 46 with BusinessObjectDataStatus

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityLatestBeforePartitionValue.

@Test
public void testCheckBusinessObjectDataAvailabilityLatestBeforePartitionValue() {
    // Create database entities required for testing.
    storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, true, BusinessObjectDataStatusEntity.VALID, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH);
    // Check an availability using a latest before partition value filter option.
    for (String upperBoundPartitionValue : Arrays.asList(PARTITION_VALUE, PARTITION_VALUE_2)) {
        BusinessObjectDataAvailability resultBusinessObjectDataAvailability = businessObjectDataService.checkBusinessObjectDataAvailability(new BusinessObjectDataAvailabilityRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(PARTITION_KEY, NO_PARTITION_VALUES, NO_PARTITION_VALUE_RANGE, new LatestBeforePartitionValue(upperBoundPartitionValue), NO_LATEST_AFTER_PARTITION_VALUE)), null, DATA_VERSION, NO_STORAGE_NAMES, STORAGE_NAME, NO_INCLUDE_ALL_REGISTERED_SUBPARTITIONS));
        // Validate the response object.
        assertEquals(new BusinessObjectDataAvailability(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(PARTITION_KEY, NO_PARTITION_VALUES, NO_PARTITION_VALUE_RANGE, new LatestBeforePartitionValue(upperBoundPartitionValue), NO_LATEST_AFTER_PARTITION_VALUE)), null, DATA_VERSION, NO_STORAGE_NAMES, STORAGE_NAME, Arrays.asList(new BusinessObjectDataStatus(FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, BusinessObjectDataStatusEntity.VALID)), new ArrayList<>()), resultBusinessObjectDataAvailability);
    }
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) LatestBeforePartitionValue(org.finra.herd.model.api.xml.LatestBeforePartitionValue) BusinessObjectDataAvailability(org.finra.herd.model.api.xml.BusinessObjectDataAvailability) ArrayList(java.util.ArrayList) BusinessObjectDataStatus(org.finra.herd.model.api.xml.BusinessObjectDataStatus) PartitionValueFilter(org.finra.herd.model.api.xml.PartitionValueFilter) Test(org.junit.Test)

Aggregations

BusinessObjectDataStatus (org.finra.herd.model.api.xml.BusinessObjectDataStatus)46 BusinessObjectDataAvailability (org.finra.herd.model.api.xml.BusinessObjectDataAvailability)42 BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)40 Test (org.junit.Test)39 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)27 ArrayList (java.util.ArrayList)18 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)3 LatestAfterPartitionValue (org.finra.herd.model.api.xml.LatestAfterPartitionValue)3 LatestBeforePartitionValue (org.finra.herd.model.api.xml.LatestBeforePartitionValue)3 List (java.util.List)2 SchemaColumn (org.finra.herd.model.api.xml.SchemaColumn)2 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)2 StorageUnitEntity (org.finra.herd.model.jpa.StorageUnitEntity)2 HashMap (java.util.HashMap)1 BusinessObjectDataAvailabilityCollectionResponse (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)1 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)1 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)1