use of org.finra.herd.model.api.xml.BusinessObjectData in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithSearchWithBdefKey.
@Test
public void testBusinessObjectDataSearchWithSearchWithBdefKey() {
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, true, "VALID");
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, true, "INVALID");
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE_2, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, true, "INVALID");
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
businessObjectDataSearchKey.setNamespace(NAMESPACE);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(BDEF_NAME);
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());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectData in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithSubPartitionValues.
@Test
public void testBusinessObjectDataSearchWithSubPartitionValues() {
String[] subpartions = { "P1", "P2", "P3", "P4" };
List<String> subpartitionList = Arrays.asList(subpartions);
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, subpartitionList, DATA_VERSION, true, "VALID");
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, subpartitionList, DATA_VERSION, true, "INVALID");
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE_2, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, subpartitionList, DATA_VERSION, true, "INVALID");
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
businessObjectDataSearchKey.setNamespace(NAMESPACE);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(BDEF_NAME);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(2, result.size());
result.get(0).getSubPartitionValues().containsAll(subpartitionList);
}
use of org.finra.herd.model.api.xml.BusinessObjectData in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithRetentionExpirationFilter.
@Test
public void testBusinessObjectDataSearchWithRetentionExpirationFilter() {
int retentionPeriod = 180;
java.util.Date date = DateUtils.addDays(new java.util.Date(), -1 * retentionPeriod);
String partitionValueDate = DateFormatUtils.format(date, AbstractHerdDao.DEFAULT_SINGLE_DAY_DATE_MASK);
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, partitionValueDate, null, DATA_VERSION, true, "VALID");
BusinessObjectDataEntity businessObjectDataEntity2 = businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION_2, partitionValueDate, null, DATA_VERSION, true, "INVALID");
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE_2, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, partitionValueDate, null, DATA_VERSION, true, "INVALID");
RetentionTypeEntity existingRetentionType = retentionTypeDao.getRetentionTypeByCode(RetentionTypeEntity.PARTITION_VALUE);
if (existingRetentionType == null) {
retentionTypeDaoTestHelper.createRetentionTypeEntity(RetentionTypeEntity.PARTITION_VALUE);
}
businessObjectDataEntity2.getBusinessObjectFormat().setRetentionType(existingRetentionType);
businessObjectDataEntity2.getBusinessObjectFormat().setRetentionPeriodInDays(retentionPeriod - 1);
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
businessObjectDataSearchKey.setNamespace(NAMESPACE);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(BDEF_NAME);
businessObjectDataSearchKey.setBusinessObjectFormatUsage(FORMAT_USAGE_CODE);
businessObjectDataSearchKey.setBusinessObjectFormatFileType(FORMAT_FILE_TYPE_CODE);
businessObjectDataSearchKey.setFilterOnRetentionExpiration(true);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(2, result.size());
}
use of org.finra.herd.model.api.xml.BusinessObjectData 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.BusinessObjectData 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());
}
}
Aggregations