Search in sources :

Example 11 with PartitionValueRange

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

the class ExpectedPartitionValueServiceTest method testGetExpectedPartitionValuesExpectedPartitionValuesNoExist.

@Test
public void testGetExpectedPartitionValuesExpectedPartitionValuesNoExist() {
    // Create and persist a partition key group entity.
    partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
    // Get a range of non-existing expected partition values.
    ExpectedPartitionValuesInformation resultPartitionValuesInformation = expectedPartitionValueService.getExpectedPartitionValues(new PartitionKeyGroupKey(PARTITION_KEY_GROUP), new PartitionValueRange(PARTITION_VALUE, PARTITION_VALUE_2));
    // Validate that returned object contains an empty list of expected partition values.
    expectedPartitionValueServiceTestHelper.validateExpectedPartitionValuesInformation(PARTITION_KEY_GROUP, new ArrayList<String>(), resultPartitionValuesInformation);
}
Also used : PartitionValueRange(org.finra.herd.model.api.xml.PartitionValueRange) ExpectedPartitionValuesInformation(org.finra.herd.model.api.xml.ExpectedPartitionValuesInformation) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 12 with PartitionValueRange

use of org.finra.herd.model.api.xml.PartitionValueRange 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 13 with PartitionValueRange

use of org.finra.herd.model.api.xml.PartitionValueRange 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());
    }
}
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 14 with PartitionValueRange

use of org.finra.herd.model.api.xml.PartitionValueRange 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());
    }
}
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 15 with PartitionValueRange

use of org.finra.herd.model.api.xml.PartitionValueRange 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());
    }
}
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)

Aggregations

PartitionValueRange (org.finra.herd.model.api.xml.PartitionValueRange)26 Test (org.junit.Test)19 PartitionKeyGroupKey (org.finra.herd.model.api.xml.PartitionKeyGroupKey)12 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)12 ArrayList (java.util.ArrayList)8 ExpectedPartitionValuesInformation (org.finra.herd.model.api.xml.ExpectedPartitionValuesInformation)8 PartitionKeyGroupEntity (org.finra.herd.model.jpa.PartitionKeyGroupEntity)6 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)4 BusinessObjectDataSearchKey (org.finra.herd.model.api.xml.BusinessObjectDataSearchKey)4 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)4 BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)3 BusinessObjectDataDdlRequest (org.finra.herd.model.api.xml.BusinessObjectDataDdlRequest)2 ExpectedPartitionValueEntity (org.finra.herd.model.jpa.ExpectedPartitionValueEntity)2 Predicate (javax.persistence.criteria.Predicate)1 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)1 AttributeValueFilter (org.finra.herd.model.api.xml.AttributeValueFilter)1 BusinessObjectDataAvailability (org.finra.herd.model.api.xml.BusinessObjectDataAvailability)1 ExpectedPartitionValueInformation (org.finra.herd.model.api.xml.ExpectedPartitionValueInformation)1 ExpectedPartitionValueKey (org.finra.herd.model.api.xml.ExpectedPartitionValueKey)1 ExpectedPartitionValuesCreateRequest (org.finra.herd.model.api.xml.ExpectedPartitionValuesCreateRequest)1