Search in sources :

Example 11 with PartitionKeyGroupEntity

use of org.finra.herd.model.jpa.PartitionKeyGroupEntity in project herd by FINRAOS.

the class PartitionKeyGroupServiceTest method testDeletePartitionKeyGroupExpectedPartitionValuesPresent.

@Test
public void testDeletePartitionKeyGroupExpectedPartitionValuesPresent() {
    // Create and persist a partition key group entity.
    PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
    // Add expected partition values to this partition key group.
    expectedPartitionValueDaoTestHelper.createExpectedPartitionValueProcessDatesForApril2014(PARTITION_KEY_GROUP);
    herdDao.saveAndRefresh(partitionKeyGroupEntity);
    // Delete this partition key group.
    PartitionKeyGroup deletedPartitionKeyGroup = partitionKeyGroupService.deletePartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
    // Validate the returned object.
    partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP, deletedPartitionKeyGroup);
    // Ensure that this partition key group is no longer there.
    assertNull(partitionKeyGroupDao.getPartitionKeyGroupByKey(partitionKeyGroupServiceTestHelper.createPartitionKeyGroupKey(PARTITION_KEY_GROUP)));
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) PartitionKeyGroupEntity(org.finra.herd.model.jpa.PartitionKeyGroupEntity) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 12 with PartitionKeyGroupEntity

use of org.finra.herd.model.jpa.PartitionKeyGroupEntity in project herd by FINRAOS.

the class ExpectedPartitionValueServiceTest method testGetExpectedPartitionValues.

@Test
public void testGetExpectedPartitionValues() {
    // Create and persist a partition key group entity.
    PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
    // Create and persist a list of test expected partition values.
    expectedPartitionValueDaoTestHelper.createExpectedPartitionValueEntities(partitionKeyGroupEntity, expectedPartitionValueDaoTestHelper.getTestUnsortedExpectedPartitionValues());
    // Get expected partition values for a range.
    List<String> testSortedExpectedPartitionValues = expectedPartitionValueDaoTestHelper.getTestSortedExpectedPartitionValues();
    int startExpectedPartitionValueIndex = 1;
    int endExpectedPartitionValueIndex = testSortedExpectedPartitionValues.size() - 2;
    ExpectedPartitionValuesInformation resultPartitionValuesInformation = expectedPartitionValueService.getExpectedPartitionValues(new PartitionKeyGroupKey(PARTITION_KEY_GROUP), new PartitionValueRange(testSortedExpectedPartitionValues.get(startExpectedPartitionValueIndex), testSortedExpectedPartitionValues.get(endExpectedPartitionValueIndex)));
    // Validate the returned object.
    expectedPartitionValueServiceTestHelper.validateExpectedPartitionValuesInformation(PARTITION_KEY_GROUP, testSortedExpectedPartitionValues.subList(startExpectedPartitionValueIndex, endExpectedPartitionValueIndex + 1), resultPartitionValuesInformation);
}
Also used : PartitionValueRange(org.finra.herd.model.api.xml.PartitionValueRange) ExpectedPartitionValuesInformation(org.finra.herd.model.api.xml.ExpectedPartitionValuesInformation) PartitionKeyGroupEntity(org.finra.herd.model.jpa.PartitionKeyGroupEntity) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 13 with PartitionKeyGroupEntity

use of org.finra.herd.model.jpa.PartitionKeyGroupEntity in project herd by FINRAOS.

the class ExpectedPartitionValueServiceTest method testGetExpectedPartitionValueLowerCaseParameters.

@Test
public void testGetExpectedPartitionValueLowerCaseParameters() {
    // Create and persist a partition key group entity.
    PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP.toUpperCase());
    // Create and persist a single test expected partition value.
    expectedPartitionValueDaoTestHelper.createExpectedPartitionValueEntities(partitionKeyGroupEntity, Arrays.asList(PARTITION_VALUE.toUpperCase()));
    // Get expected partition value with offset set to null using relative input parameters in lower case.
    ExpectedPartitionValueInformation resultPartitionValueInformation = expectedPartitionValueService.getExpectedPartitionValue(new ExpectedPartitionValueKey(PARTITION_KEY_GROUP.toLowerCase(), PARTITION_VALUE.toUpperCase()), null);
    // Validate the returned object.
    expectedPartitionValueServiceTestHelper.validateExpectedPartitionValueInformation(PARTITION_KEY_GROUP.toUpperCase(), PARTITION_VALUE.toUpperCase(), resultPartitionValueInformation);
}
Also used : ExpectedPartitionValueInformation(org.finra.herd.model.api.xml.ExpectedPartitionValueInformation) PartitionKeyGroupEntity(org.finra.herd.model.jpa.PartitionKeyGroupEntity) ExpectedPartitionValueKey(org.finra.herd.model.api.xml.ExpectedPartitionValueKey) Test(org.junit.Test)

Example 14 with PartitionKeyGroupEntity

use of org.finra.herd.model.jpa.PartitionKeyGroupEntity in project herd by FINRAOS.

the class ExpectedPartitionValueServiceTest method testGetExpectedPartitionValueUpperCaseParameters.

@Test
public void testGetExpectedPartitionValueUpperCaseParameters() {
    // Create and persist a partition key group entity.
    PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP.toLowerCase());
    // Create and persist a single test expected partition value.
    expectedPartitionValueDaoTestHelper.createExpectedPartitionValueEntities(partitionKeyGroupEntity, Arrays.asList(PARTITION_VALUE.toLowerCase()));
    // Get expected partition value with offset set to null using relative input parameters in upper case.
    ExpectedPartitionValueInformation resultPartitionValueInformation = expectedPartitionValueService.getExpectedPartitionValue(new ExpectedPartitionValueKey(PARTITION_KEY_GROUP.toUpperCase(), PARTITION_VALUE.toLowerCase()), null);
    // Validate the returned object.
    expectedPartitionValueServiceTestHelper.validateExpectedPartitionValueInformation(PARTITION_KEY_GROUP.toLowerCase(), PARTITION_VALUE.toLowerCase(), resultPartitionValueInformation);
}
Also used : ExpectedPartitionValueInformation(org.finra.herd.model.api.xml.ExpectedPartitionValueInformation) PartitionKeyGroupEntity(org.finra.herd.model.jpa.PartitionKeyGroupEntity) ExpectedPartitionValueKey(org.finra.herd.model.api.xml.ExpectedPartitionValueKey) Test(org.junit.Test)

Example 15 with PartitionKeyGroupEntity

use of org.finra.herd.model.jpa.PartitionKeyGroupEntity in project herd by FINRAOS.

the class ExpectedPartitionValueServiceTest method testGetExpectedPartitionValueTrimParameters.

@Test
public void testGetExpectedPartitionValueTrimParameters() {
    // Create and persist a partition key group entity.
    PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
    // Create and persist a list of test expected partition values.
    expectedPartitionValueDaoTestHelper.createExpectedPartitionValueEntities(partitionKeyGroupEntity, expectedPartitionValueDaoTestHelper.getTestUnsortedExpectedPartitionValues());
    // Get expected partition value with offset set to 0 and with request parameters padded with whitespace characters.
    List<String> testSortedExpectedPartitionValues = expectedPartitionValueDaoTestHelper.getTestSortedExpectedPartitionValues();
    int testExpectedPartitionValueIndex = 3;
    ExpectedPartitionValueInformation resultPartitionValueInformation = expectedPartitionValueService.getExpectedPartitionValue(new ExpectedPartitionValueKey(addWhitespace(PARTITION_KEY_GROUP), addWhitespace(testSortedExpectedPartitionValues.get(testExpectedPartitionValueIndex))), 0);
    // Validate the returned object.
    expectedPartitionValueServiceTestHelper.validateExpectedPartitionValueInformation(PARTITION_KEY_GROUP, testSortedExpectedPartitionValues.get(testExpectedPartitionValueIndex), resultPartitionValueInformation);
}
Also used : ExpectedPartitionValueInformation(org.finra.herd.model.api.xml.ExpectedPartitionValueInformation) PartitionKeyGroupEntity(org.finra.herd.model.jpa.PartitionKeyGroupEntity) ExpectedPartitionValueKey(org.finra.herd.model.api.xml.ExpectedPartitionValueKey) Test(org.junit.Test)

Aggregations

PartitionKeyGroupEntity (org.finra.herd.model.jpa.PartitionKeyGroupEntity)40 Test (org.junit.Test)25 ExpectedPartitionValueKey (org.finra.herd.model.api.xml.ExpectedPartitionValueKey)9 PartitionKeyGroupKey (org.finra.herd.model.api.xml.PartitionKeyGroupKey)9 ExpectedPartitionValuesInformation (org.finra.herd.model.api.xml.ExpectedPartitionValuesInformation)8 ExpectedPartitionValueEntity (org.finra.herd.model.jpa.ExpectedPartitionValueEntity)7 ArrayList (java.util.ArrayList)6 ExpectedPartitionValueInformation (org.finra.herd.model.api.xml.ExpectedPartitionValueInformation)6 PartitionValueRange (org.finra.herd.model.api.xml.PartitionValueRange)6 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)4 HashMap (java.util.HashMap)3 Predicate (javax.persistence.criteria.Predicate)3 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)3 ExpectedPartitionValuesDeleteRequest (org.finra.herd.model.api.xml.ExpectedPartitionValuesDeleteRequest)3 Order (javax.persistence.criteria.Order)2 FieldExtension (org.activiti.bpmn.model.FieldExtension)2 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)2 ExpectedPartitionValuesCreateRequest (org.finra.herd.model.api.xml.ExpectedPartitionValuesCreateRequest)2 Parameter (org.finra.herd.model.api.xml.Parameter)2 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)2