Search in sources :

Example 41 with BusinessObjectDataStatus

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityTrimParametersPartitionValueList.

@Test
public void testCheckBusinessObjectDataAvailabilityTrimParametersPartitionValueList() {
    // Prepare test data and execute the check business object data availability request with all string values requiring trimming.
    businessObjectDataAvailabilityTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityTesting(null);
    BusinessObjectDataAvailabilityRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityRequest(UNSORTED_PARTITION_VALUES);
    request.setBusinessObjectDefinitionName(addWhitespace(request.getBusinessObjectDefinitionName()));
    request.setBusinessObjectFormatUsage(addWhitespace(request.getBusinessObjectFormatUsage()));
    request.setBusinessObjectFormatFileType(addWhitespace(request.getBusinessObjectFormatFileType()));
    request.getPartitionValueFilters().get(0).setPartitionKey(addWhitespace(request.getPartitionValueFilters().get(0).getPartitionKey()));
    for (int i = 0; i < request.getPartitionValueFilters().get(0).getPartitionValues().size(); i++) {
        request.getPartitionValueFilters().get(0).getPartitionValues().set(i, addWhitespace(request.getPartitionValueFilters().get(0).getPartitionValues().get(i)));
    }
    request.setStorageName(addWhitespace(request.getStorageName()));
    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 42 with BusinessObjectDataStatus

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityLatestBeforePartitionValueNoStorage.

@Test
public void testCheckBusinessObjectDataAvailabilityLatestBeforePartitionValueNoStorage() {
    // 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 and without specifying any storage.
    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, NO_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, NO_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)

Example 43 with BusinessObjectDataStatus

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityIncludeAllRegisteredSubPartitionsSecondSubPartitionInvalidBdataArchived.

@Test
public void testCheckBusinessObjectDataAvailabilityIncludeAllRegisteredSubPartitionsSecondSubPartitionInvalidBdataArchived() {
    // Create VALID and INVALID sub-partitions - the first with an "available" storage unit and the second with a "non-available" 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.INVALID, 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. Both sub-partitions should be listed - the first as VALID "available" and the second as "ARCHIVED" "non-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)), Arrays.asList(new BusinessObjectDataStatus(FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUB_PARTITION_VALUE_2), DATA_VERSION, StorageUnitStatusEntity.ARCHIVED))), 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 44 with BusinessObjectDataStatus

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityPartitionValueListMinPartitionValueTokenNoStorage.

@Test
public void testCheckBusinessObjectDataAvailabilityPartitionValueListMinPartitionValueTokenNoStorage() {
    // Prepare test data.
    businessObjectDataAvailabilityTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityTesting(NO_PARTITION_KEY_GROUP, schemaColumnDaoTestHelper.getTestSchemaColumns(), schemaColumnDaoTestHelper.getTestPartitionColumns(), BusinessObjectDataEntity.FIRST_PARTITION_COLUMN_POSITION, NO_SUBPARTITION_VALUES, NO_ALLOW_DUPLICATE_BUSINESS_OBJECT_DATA);
    // Check business object data availability using minimum partition value token and without specifying storage.
    BusinessObjectDataAvailabilityRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityRequest(null);
    List<PartitionValueFilter> partitionValueFilters = new ArrayList<>();
    request.setPartitionValueFilters(partitionValueFilters);
    partitionValueFilters.add(new PartitionValueFilter(FIRST_PARTITION_COLUMN_NAME, Arrays.asList(BusinessObjectDataService.MIN_PARTITION_VALUE_TOKEN), NO_PARTITION_VALUE_RANGE, NO_LATEST_BEFORE_PARTITION_VALUE, NO_LATEST_AFTER_PARTITION_VALUE));
    request.setStorageNames(NO_STORAGE_NAMES);
    request.setStorageName(NO_STORAGE_NAME);
    BusinessObjectDataAvailability resultAvailability = businessObjectDataService.checkBusinessObjectDataAvailability(request);
    // Validate the results.
    List<BusinessObjectDataStatus> expectedAvailableStatuses = businessObjectDataServiceTestHelper.getTestBusinessObjectDataStatuses(FORMAT_VERSION, BusinessObjectDataEntity.FIRST_PARTITION_COLUMN_POSITION, Arrays.asList(STORAGE_1_LEAST_PARTITION_VALUE), NO_SUBPARTITION_VALUES, DATA_VERSION, BusinessObjectDataStatusEntity.VALID, false);
    List<BusinessObjectDataStatus> expectedNotAvailableStatuses = new ArrayList<>();
    businessObjectDataServiceTestHelper.validateBusinessObjectDataAvailability(request, expectedAvailableStatuses, expectedNotAvailableStatuses, resultAvailability);
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) ArrayList(java.util.ArrayList) 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 45 with BusinessObjectDataStatus

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

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityTest method testCheckBusinessObjectDataAvailabilityPartitionValueList.

@Test
public void testCheckBusinessObjectDataAvailabilityPartitionValueList() {
    // Prepare test data and execute the check business object data availability request.
    businessObjectDataAvailabilityTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityTesting(null);
    BusinessObjectDataAvailabilityRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityRequest(UNSORTED_PARTITION_VALUES);
    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)

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