Search in sources :

Example 11 with BusinessObjectDataAvailability

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityIncludeAllRegisteredSubPartitionsSecondSubPartitionDeletedBdataArchived.

@Test
public void testCheckBusinessObjectDataAvailabilityIncludeAllRegisteredSubPartitionsSecondSubPartitionDeletedBdataArchived() {
    // Create VALID and DELETED sub-partitions - the first with an "available" storage unit and the second with an "ARCHIVED" storage unit.
    storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUB_PARTITION_VALUE_1), DATA_VERSION, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH);
    storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUB_PARTITION_VALUE_2), DATA_VERSION, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.DELETED, StorageUnitStatusEntity.ARCHIVED, NO_STORAGE_DIRECTORY_PATH);
    // Check this business object data availability with "IncludeAllRegisteredSubPartitions" option enabled.
    BusinessObjectDataAvailability result = businessObjectDataService.checkBusinessObjectDataAvailability(new BusinessObjectDataAvailabilityRequest(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(PARTITION_KEY, Arrays.asList(PARTITION_VALUE), NO_PARTITION_VALUE_RANGE, NO_LATEST_BEFORE_PARTITION_VALUE, NO_LATEST_AFTER_PARTITION_VALUE)), NO_STANDALONE_PARTITION_VALUE_FILTER, NO_DATA_VERSION, NO_STORAGE_NAMES, STORAGE_NAME, INCLUDE_ALL_REGISTERED_SUBPARTITIONS));
    // Validate the response object. Only one sub-partition should be listed - the first sub-partition as VALID "available".
    assertEquals(new BusinessObjectDataAvailability(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(PARTITION_KEY, Arrays.asList(PARTITION_VALUE), NO_PARTITION_VALUE_RANGE, NO_LATEST_BEFORE_PARTITION_VALUE, NO_LATEST_AFTER_PARTITION_VALUE)), NO_STANDALONE_PARTITION_VALUE_FILTER, NO_DATA_VERSION, NO_STORAGE_NAMES, STORAGE_NAME, Arrays.asList(new BusinessObjectDataStatus(FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUB_PARTITION_VALUE_1), DATA_VERSION, BusinessObjectDataStatusEntity.VALID)), NO_NOT_AVAILABLE_STATUSES), result);
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) BusinessObjectDataAvailability(org.finra.herd.model.api.xml.BusinessObjectDataAvailability) BusinessObjectDataStatus(org.finra.herd.model.api.xml.BusinessObjectDataStatus) PartitionValueFilter(org.finra.herd.model.api.xml.PartitionValueFilter) Test(org.junit.Test)

Example 12 with BusinessObjectDataAvailability

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityLowerCaseParameters.

@Test
public void testCheckBusinessObjectDataAvailabilityLowerCaseParameters() {
    // Prepare test data and execute the check business object data availability request
    // with all parameter values in lower case (except for case-sensitive partition values).
    businessObjectDataAvailabilityTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityTesting(null);
    BusinessObjectDataAvailabilityRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityRequest(UNSORTED_PARTITION_VALUES);
    request.setBusinessObjectDefinitionName(request.getBusinessObjectDefinitionName().toLowerCase());
    request.setBusinessObjectFormatUsage(request.getBusinessObjectFormatUsage().toLowerCase());
    request.setBusinessObjectFormatFileType(request.getBusinessObjectFormatFileType().toLowerCase());
    request.getPartitionValueFilters().get(0).setPartitionKey(request.getPartitionValueFilters().get(0).getPartitionKey().toLowerCase());
    request.setStorageName(request.getStorageName().toLowerCase());
    BusinessObjectDataAvailability resultAvailability = businessObjectDataService.checkBusinessObjectDataAvailability(request);
    // Validate the results.
    List<BusinessObjectDataStatus> expectedAvailableStatuses = businessObjectDataServiceTestHelper.getTestBusinessObjectDataStatuses(FORMAT_VERSION, BusinessObjectDataEntity.FIRST_PARTITION_COLUMN_POSITION, STORAGE_1_AVAILABLE_PARTITION_VALUES, NO_SUBPARTITION_VALUES, DATA_VERSION, BusinessObjectDataStatusEntity.VALID, false);
    List<BusinessObjectDataStatus> expectedNotAvailableStatuses = businessObjectDataServiceTestHelper.getTestBusinessObjectDataStatuses(FORMAT_VERSION, BusinessObjectDataEntity.FIRST_PARTITION_COLUMN_POSITION, STORAGE_1_NOT_AVAILABLE_PARTITION_VALUES, null, DATA_VERSION, BusinessObjectDataServiceImpl.REASON_NOT_REGISTERED, false);
    businessObjectDataServiceTestHelper.validateBusinessObjectDataAvailability(request, expectedAvailableStatuses, expectedNotAvailableStatuses, resultAvailability);
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) BusinessObjectDataAvailability(org.finra.herd.model.api.xml.BusinessObjectDataAvailability) BusinessObjectDataStatus(org.finra.herd.model.api.xml.BusinessObjectDataStatus) Test(org.junit.Test)

Example 13 with BusinessObjectDataAvailability

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityFilterOnSubPartitionValuesStandalonePartitionValueFilter.

@Test
public void testCheckBusinessObjectDataAvailabilityFilterOnSubPartitionValuesStandalonePartitionValueFilter() {
    List<SchemaColumn> columns = schemaColumnDaoTestHelper.getTestSchemaColumns();
    List<SchemaColumn> partitionColumns = schemaColumnDaoTestHelper.getTestPartitionColumns();
    // Test data availability using primary partition and each of the available subpartition columns.
    for (int i = 0; i < Math.min(BusinessObjectDataEntity.MAX_SUBPARTITIONS + 1, PARTITION_COLUMNS.length); i++) {
        // Prepare test data and execute the check business object data availability request.
        businessObjectDataAvailabilityTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityTesting(null, columns, partitionColumns, i + 1, SUBPARTITION_VALUES, ALLOW_DUPLICATE_BUSINESS_OBJECT_DATA);
        BusinessObjectDataAvailabilityRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityRequest(UNSORTED_PARTITION_VALUES);
        request.setPartitionValueFilter(request.getPartitionValueFilters().get(0));
        request.setPartitionValueFilters(null);
        request.getPartitionValueFilter().setPartitionKey(partitionColumns.get(i).getName());
        BusinessObjectDataAvailability resultAvailability = businessObjectDataService.checkBusinessObjectDataAvailability(request);
        // Validate the results.
        List<BusinessObjectDataStatus> expectedAvailableStatuses = businessObjectDataServiceTestHelper.getTestBusinessObjectDataStatuses(FORMAT_VERSION, i + 1, STORAGE_1_AVAILABLE_PARTITION_VALUES, SUBPARTITION_VALUES, DATA_VERSION, BusinessObjectDataStatusEntity.VALID, false);
        List<BusinessObjectDataStatus> expectedNotAvailableStatuses = businessObjectDataServiceTestHelper.getTestBusinessObjectDataStatuses(FORMAT_VERSION, i + 1, STORAGE_1_NOT_AVAILABLE_PARTITION_VALUES, null, DATA_VERSION, BusinessObjectDataServiceImpl.REASON_NOT_REGISTERED, true);
        businessObjectDataServiceTestHelper.validateBusinessObjectDataAvailability(request, expectedAvailableStatuses, expectedNotAvailableStatuses, resultAvailability);
    }
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) SchemaColumn(org.finra.herd.model.api.xml.SchemaColumn) BusinessObjectDataAvailability(org.finra.herd.model.api.xml.BusinessObjectDataAvailability) BusinessObjectDataStatus(org.finra.herd.model.api.xml.BusinessObjectDataStatus) Test(org.junit.Test)

Example 14 with BusinessObjectDataAvailability

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityLatestAfterPartitionValueWhenLatestDataVersionInvalid.

@Test
public void testCheckBusinessObjectDataAvailabilityLatestAfterPartitionValueWhenLatestDataVersionInvalid() {
    // Prepare test business object data, where the "latest after" partition value has no VALID business object data version and
    // the "latest after" VALID business object data partition value is eclipsed by the latest INVALID business object data version.
    storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE_2, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, NO_LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH);
    storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE_2, SUBPARTITION_VALUES, SECOND_DATA_VERSION, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.INVALID, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH);
    storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE_3, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.INVALID, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH);
    // Check business object data availability using the latest after partition value filter option with the business object data version specified.
    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, NO_LATEST_BEFORE_PARTITION_VALUE, new LatestAfterPartitionValue(PARTITION_VALUE))), NO_STANDALONE_PARTITION_VALUE_FILTER, INITIAL_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, NO_LATEST_BEFORE_PARTITION_VALUE, new LatestAfterPartitionValue(PARTITION_VALUE))), NO_STANDALONE_PARTITION_VALUE_FILTER, INITIAL_DATA_VERSION, NO_STORAGE_NAMES, STORAGE_NAME, Arrays.asList(new BusinessObjectDataStatus(FORMAT_VERSION, PARTITION_VALUE_3, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, BusinessObjectDataStatusEntity.INVALID)), new ArrayList<>()), resultBusinessObjectDataAvailability);
    // Check business object data availability using the latest after partition value filter option and without business object data version specified.
    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, NO_LATEST_BEFORE_PARTITION_VALUE, new LatestAfterPartitionValue(PARTITION_VALUE))), NO_STANDALONE_PARTITION_VALUE_FILTER, NO_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, NO_LATEST_BEFORE_PARTITION_VALUE, new LatestAfterPartitionValue(PARTITION_VALUE))), NO_STANDALONE_PARTITION_VALUE_FILTER, NO_DATA_VERSION, NO_STORAGE_NAMES, STORAGE_NAME, Arrays.asList(new BusinessObjectDataStatus(FORMAT_VERSION, PARTITION_VALUE_2, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, BusinessObjectDataStatusEntity.VALID)), new ArrayList<>()), resultBusinessObjectDataAvailability);
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) 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) LatestAfterPartitionValue(org.finra.herd.model.api.xml.LatestAfterPartitionValue) Test(org.junit.Test)

Example 15 with BusinessObjectDataAvailability

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityNoStorageNamesAndMultipleValidBusinessObjectFormatVersionsInDifferentStorage.

@Test
public void testCheckBusinessObjectDataAvailabilityNoStorageNamesAndMultipleValidBusinessObjectFormatVersionsInDifferentStorage() {
    // Create two versions of a business object format.
    businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, DESCRIPTION, NO_LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, SECOND_FORMAT_VERSION, DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    // Create business object data keys for two business object format versions of business object data.
    List<BusinessObjectDataKey> businessObjectDataKeys = Arrays.asList(new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, SECOND_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION));
    // Create two storage units for the business object data instances in two different storage entities.
    storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME, businessObjectDataKeys.get(0), NO_LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH);
    storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME_2, businessObjectDataKeys.get(1), NO_LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH);
    // Check business object data availability when business object format version along with storage names are not specified
    // and different valid business object data versions are registered in different storage entities.
    BusinessObjectDataAvailability resultBusinessObjectDataAvailability = businessObjectDataService.checkBusinessObjectDataAvailability(new BusinessObjectDataAvailabilityRequest(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(PARTITION_KEY, Arrays.asList(PARTITION_VALUE), NO_PARTITION_VALUE_RANGE, NO_LATEST_BEFORE_PARTITION_VALUE, NO_LATEST_AFTER_PARTITION_VALUE)), NO_STANDALONE_PARTITION_VALUE_FILTER, DATA_VERSION, NO_STORAGE_NAMES, NO_STORAGE_NAME, NO_INCLUDE_ALL_REGISTERED_SUBPARTITIONS));
    // Validate the response object.
    assertEquals(new BusinessObjectDataAvailability(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(PARTITION_KEY, Arrays.asList(PARTITION_VALUE), NO_PARTITION_VALUE_RANGE, NO_LATEST_BEFORE_PARTITION_VALUE, NO_LATEST_AFTER_PARTITION_VALUE)), NO_STANDALONE_PARTITION_VALUE_FILTER, DATA_VERSION, NO_STORAGE_NAMES, NO_STORAGE_NAME, Arrays.asList(new BusinessObjectDataStatus(SECOND_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, BusinessObjectDataStatusEntity.VALID)), new ArrayList<>()), resultBusinessObjectDataAvailability);
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) BusinessObjectDataAvailability(org.finra.herd.model.api.xml.BusinessObjectDataAvailability) ArrayList(java.util.ArrayList) BusinessObjectDataStatus(org.finra.herd.model.api.xml.BusinessObjectDataStatus) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) PartitionValueFilter(org.finra.herd.model.api.xml.PartitionValueFilter) Test(org.junit.Test)

Aggregations

BusinessObjectDataAvailability (org.finra.herd.model.api.xml.BusinessObjectDataAvailability)51 BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)48 Test (org.junit.Test)44 BusinessObjectDataStatus (org.finra.herd.model.api.xml.BusinessObjectDataStatus)42 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)30 ArrayList (java.util.ArrayList)20 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 SchemaColumn (org.finra.herd.model.api.xml.SchemaColumn)3 BusinessObjectDataAvailabilityCollectionResponse (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)2 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)2 StorageUnitEntity (org.finra.herd.model.jpa.StorageUnitEntity)2 HashMap (java.util.HashMap)1 List (java.util.List)1 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)1 PartitionValueRange (org.finra.herd.model.api.xml.PartitionValueRange)1 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)1 StorageEntity (org.finra.herd.model.jpa.StorageEntity)1