use of org.finra.herd.model.api.xml.PartitionValueFilter in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithPartitionValueAndRangeFilters.
@Test
public void testBusinessObjectDataSearchWithPartitionValueAndRangeFilters() {
BusinessObjectDataEntity businessObjectDataEntity = createBusinessObjectEntityForPartitionValueFilterTest();
String namespace = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode();
String bDefName = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName();
String usage = businessObjectDataEntity.getBusinessObjectFormat().getUsage();
String fileTypeCode = businessObjectDataEntity.getBusinessObjectFormat().getFileType().getCode();
int formatVersion = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion();
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
List<PartitionValueFilter> partitionValueFilters = new ArrayList<>();
PartitionValueFilter partitionValueFilter = new PartitionValueFilter();
partitionValueFilters.add(partitionValueFilter);
partitionValueFilter.setPartitionKey(PARTITION_KEY.toLowerCase());
List<String> values = new ArrayList<>();
values.add(PARTITION_VALUE);
partitionValueFilter.setPartitionValues(values);
PartitionValueFilter partitionValueFilter2 = new PartitionValueFilter();
partitionValueFilters.add(partitionValueFilter2);
partitionValueFilter2.setPartitionKey(PARTITION_KEY + "1");
PartitionValueRange partitionValueRange = new PartitionValueRange();
partitionValueRange.setStartPartitionValue(businessObjectDataEntity.getPartitionValue2());
partitionValueRange.setEndPartitionValue(businessObjectDataEntity.getPartitionValue2() + "1");
partitionValueFilter2.setPartitionValueRange(partitionValueRange);
businessObjectDataSearchKey.setPartitionValueFilters(partitionValueFilters);
businessObjectDataSearchKey.setNamespace(namespace);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(bDefName);
businessObjectDataSearchKey.setBusinessObjectFormatUsage(usage);
businessObjectDataSearchKey.setBusinessObjectFormatFileType(fileTypeCode);
businessObjectDataSearchKey.setBusinessObjectFormatVersion(formatVersion);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(1, result.size());
for (BusinessObjectData data : result) {
assertEquals(NAMESPACE, data.getNamespace());
assertEquals(BDEF_NAME, data.getBusinessObjectDefinitionName());
assertEquals(FORMAT_USAGE_CODE, data.getBusinessObjectFormatUsage());
assertEquals(FORMAT_FILE_TYPE_CODE, data.getBusinessObjectFormatFileType());
assertTrue(FORMAT_VERSION == data.getBusinessObjectFormatVersion());
}
}
use of org.finra.herd.model.api.xml.PartitionValueFilter in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithPartitionValueRangeFiltersSubPartition.
@Test
public void testBusinessObjectDataSearchWithPartitionValueRangeFiltersSubPartition() {
BusinessObjectDataEntity businessObjectDataEntity = createBusinessObjectEntityForPartitionValueFilterTest();
String namespace = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode();
String bDefName = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName();
String usage = businessObjectDataEntity.getBusinessObjectFormat().getUsage();
String fileTypeCode = businessObjectDataEntity.getBusinessObjectFormat().getFileType().getCode();
int formatVersion = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion();
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
List<PartitionValueFilter> partitionValueFilters = new ArrayList<>();
PartitionValueFilter partitionValueFilter = new PartitionValueFilter();
partitionValueFilters.add(partitionValueFilter);
partitionValueFilter.setPartitionKey(PARTITION_KEY + "1");
PartitionValueRange partitionValueRange = new PartitionValueRange();
partitionValueRange.setStartPartitionValue(businessObjectDataEntity.getPartitionValue2());
partitionValueRange.setEndPartitionValue(businessObjectDataEntity.getPartitionValue2() + "1");
partitionValueFilter.setPartitionValueRange(partitionValueRange);
businessObjectDataSearchKey.setPartitionValueFilters(partitionValueFilters);
businessObjectDataSearchKey.setNamespace(namespace);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(bDefName);
businessObjectDataSearchKey.setBusinessObjectFormatUsage(usage);
businessObjectDataSearchKey.setBusinessObjectFormatFileType(fileTypeCode);
businessObjectDataSearchKey.setBusinessObjectFormatVersion(formatVersion);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(1, result.size());
for (BusinessObjectData data : result) {
assertEquals(namespace, data.getNamespace());
assertEquals(bDefName, data.getBusinessObjectDefinitionName());
assertEquals(usage, data.getBusinessObjectFormatUsage());
assertEquals(fileTypeCode, data.getBusinessObjectFormatFileType());
assertTrue(formatVersion == data.getBusinessObjectFormatVersion());
}
}
use of org.finra.herd.model.api.xml.PartitionValueFilter in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithPartitionValueRangeFilters.
@Test
public void testBusinessObjectDataSearchWithPartitionValueRangeFilters() {
BusinessObjectDataEntity businessObjectDataEntity = createBusinessObjectEntityForPartitionValueFilterTest();
String namespace = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode();
String bDefName = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName();
String usage = businessObjectDataEntity.getBusinessObjectFormat().getUsage();
String fileTypeCode = businessObjectDataEntity.getBusinessObjectFormat().getFileType().getCode();
int formatVersion = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion();
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
List<PartitionValueFilter> partitionValueFilters = new ArrayList<>();
PartitionValueFilter partitionValueFilter = new PartitionValueFilter();
partitionValueFilters.add(partitionValueFilter);
partitionValueFilter.setPartitionKey(PARTITION_KEY);
PartitionValueRange partitionValueRange = new PartitionValueRange();
partitionValueRange.setStartPartitionValue(PARTITION_VALUE);
partitionValueRange.setEndPartitionValue(PARTITION_VALUE + "1");
partitionValueFilter.setPartitionValueRange(partitionValueRange);
businessObjectDataSearchKey.setPartitionValueFilters(partitionValueFilters);
businessObjectDataSearchKey.setNamespace(namespace);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(bDefName);
businessObjectDataSearchKey.setBusinessObjectFormatUsage(usage);
businessObjectDataSearchKey.setBusinessObjectFormatFileType(fileTypeCode);
businessObjectDataSearchKey.setBusinessObjectFormatVersion(formatVersion);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(1, result.size());
for (BusinessObjectData data : result) {
assertEquals(namespace, data.getNamespace());
assertEquals(bDefName, data.getBusinessObjectDefinitionName());
assertEquals(usage, data.getBusinessObjectFormatUsage());
assertEquals(fileTypeCode, data.getBusinessObjectFormatFileType());
assertTrue(formatVersion == data.getBusinessObjectFormatVersion());
}
}
use of org.finra.herd.model.api.xml.PartitionValueFilter 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;
}
use of org.finra.herd.model.api.xml.PartitionValueFilter 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;
}
Aggregations