use of org.finra.herd.model.api.xml.BusinessObjectDataSearchKey in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithPartitionValueRangeFiltersNegative.
@Test
public void testBusinessObjectDataSearchWithPartitionValueRangeFiltersNegative() {
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 formatVerion = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion();
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
List<PartitionValueFilter> partitionValueFilters = new ArrayList<>();
PartitionValueFilter partitionValueFilter = new PartitionValueFilter();
partitionValueFilters.add(partitionValueFilter);
partitionValueFilter.setPartitionKey(PARTITION_KEY + "6");
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(formatVerion);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(0, result.size());
}
use of org.finra.herd.model.api.xml.BusinessObjectDataSearchKey in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithAttributeValueFiltersWithNoAttributeValueFilter.
@Test
public void testBusinessObjectDataSearchWithAttributeValueFiltersWithNoAttributeValueFilter() {
// Create and persist an attribute for the business object data
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataAttributeEntity.getBusinessObjectData();
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();
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());
assertNull(data.getAttributes());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataSearchKey in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithRetentionExpirationFilterEmptyResult.
@Test
public void testBusinessObjectDataSearchWithRetentionExpirationFilterEmptyResult() {
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, 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);
businessObjectDataSearchKey.setBusinessObjectFormatUsage(FORMAT_USAGE_CODE);
businessObjectDataSearchKey.setBusinessObjectFormatFileType(FORMAT_FILE_TYPE_CODE);
businessObjectDataSearchKey.setBusinessObjectFormatVersion(FORMAT_VERSION);
businessObjectDataSearchKey.setFilterOnRetentionExpiration(true);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(0, result.size());
}
use of org.finra.herd.model.api.xml.BusinessObjectDataSearchKey in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithAltSearchKeyFields.
@Test
public void testBusinessObjectDataSearchWithAltSearchKeyFields() {
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, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, true, "INVALID");
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION_2, PARTITION_VALUE, null, DATA_VERSION, true, "INVALID");
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, PARTITION_VALUE, null, DATA_VERSION, true, "VALID");
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
businessObjectDataSearchKey.setNamespace(NAMESPACE_2);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(BDEF_NAME_2);
businessObjectDataSearchKey.setBusinessObjectFormatUsage(FORMAT_USAGE_CODE_2);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(2, result.size());
businessObjectDataSearchKey.setBusinessObjectFormatFileType(FORMAT_FILE_TYPE_CODE_2);
result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(1, result.size());
businessObjectDataSearchKey.setBusinessObjectFormatVersion(FORMAT_VERSION_2);
result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(1, result.size());
businessObjectDataSearchKey.setBusinessObjectFormatFileType(null);
result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(2, result.size());
}
use of org.finra.herd.model.api.xml.BusinessObjectDataSearchKey in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithAttributeValueFilters.
@Test
public void testBusinessObjectDataSearchWithAttributeValueFilters() {
// Create and persist an attribute for the business object data
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_2_MIXED_CASE, ATTRIBUTE_VALUE_2);
businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION_2, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataAttributeEntity.getBusinessObjectData();
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<AttributeValueFilter> attributeValueFilters = new ArrayList<>();
attributeValueFilters.add(new AttributeValueFilter(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1));
businessObjectDataSearchKey.setAttributeValueFilters(attributeValueFilters);
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());
assertEquals(ATTRIBUTE_NAME_1_MIXED_CASE, data.getAttributes().get(0).getName());
assertEquals(ATTRIBUTE_VALUE_1, data.getAttributes().get(0).getValue());
}
}
Aggregations