Search in sources :

Example 26 with BusinessObjectDataSearchKey

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());
}
Also used : PartitionValueRange(org.finra.herd.model.api.xml.PartitionValueRange) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) ArrayList(java.util.ArrayList) BusinessObjectDataSearchKey(org.finra.herd.model.api.xml.BusinessObjectDataSearchKey) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) PartitionValueFilter(org.finra.herd.model.api.xml.PartitionValueFilter) Test(org.junit.Test)

Example 27 with BusinessObjectDataSearchKey

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());
    }
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) BusinessObjectDataSearchKey(org.finra.herd.model.api.xml.BusinessObjectDataSearchKey) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) Test(org.junit.Test)

Example 28 with BusinessObjectDataSearchKey

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());
}
Also used : BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) BusinessObjectDataSearchKey(org.finra.herd.model.api.xml.BusinessObjectDataSearchKey) Test(org.junit.Test)

Example 29 with BusinessObjectDataSearchKey

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());
}
Also used : BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) BusinessObjectDataSearchKey(org.finra.herd.model.api.xml.BusinessObjectDataSearchKey) Test(org.junit.Test)

Example 30 with BusinessObjectDataSearchKey

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());
    }
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) ArrayList(java.util.ArrayList) BusinessObjectDataSearchKey(org.finra.herd.model.api.xml.BusinessObjectDataSearchKey) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) AttributeValueFilter(org.finra.herd.model.api.xml.AttributeValueFilter) Test(org.junit.Test)

Aggregations

BusinessObjectDataSearchKey (org.finra.herd.model.api.xml.BusinessObjectDataSearchKey)40 Test (org.junit.Test)35 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)28 ArrayList (java.util.ArrayList)21 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)15 BusinessObjectDataSearchFilter (org.finra.herd.model.api.xml.BusinessObjectDataSearchFilter)13 BusinessObjectDataSearchRequest (org.finra.herd.model.api.xml.BusinessObjectDataSearchRequest)12 AttributeValueFilter (org.finra.herd.model.api.xml.AttributeValueFilter)11 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)8 BusinessObjectDataSearchResultPagingInfoDto (org.finra.herd.model.dto.BusinessObjectDataSearchResultPagingInfoDto)6 BusinessObjectDataAttributeEntity (org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity)6 PartitionValueRange (org.finra.herd.model.api.xml.PartitionValueRange)4 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)3 BusinessObjectDataSearchResult (org.finra.herd.model.api.xml.BusinessObjectDataSearchResult)2 RetentionTypeEntity (org.finra.herd.model.jpa.RetentionTypeEntity)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1 BusinessObjectDefinition (org.finra.herd.model.api.xml.BusinessObjectDefinition)1 LatestBeforePartitionValue (org.finra.herd.model.api.xml.LatestBeforePartitionValue)1