Search in sources :

Example 6 with PartitionKeyGroupKey

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

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

the class PartitionKeyGroupServiceTest method testDeletePartitionKeyGroup.

@Test
public void testDeletePartitionKeyGroup() {
    // Create and persist a partition key group entity.
    partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
    // Validate that this partition key group exists.
    partitionKeyGroupService.getPartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
    // 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) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 8 with PartitionKeyGroupKey

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

the class PartitionKeyGroupServiceTest method testDeletePartitionKeyGroupTrimParameters.

@Test
public void testDeletePartitionKeyGroupTrimParameters() {
    // Create and persist a partition key group entity.
    partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
    // Validate that this partition key group exists.
    partitionKeyGroupService.getPartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
    // Delete this partition key group by passing partition key group name with leading and trailing whitespace characters.
    PartitionKeyGroup deletedPartitionKeyGroup = partitionKeyGroupService.deletePartitionKeyGroup(new PartitionKeyGroupKey(addWhitespace(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) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 9 with PartitionKeyGroupKey

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

the class PartitionKeyGroupRestController method deletePartitionKeyGroup.

/**
 * Deletes an existing partition key group by name.
 *
 * @param partitionKeyGroupName the partition key group name
 *
 * @return the partition key group that got deleted
 */
@RequestMapping(value = PARTITION_KEY_GROUPS_URI_PREFIX + "/{partitionKeyGroupName}", method = RequestMethod.DELETE)
@Secured(SecurityFunctions.FN_PARTITION_KEY_GROUPS_DELETE)
public PartitionKeyGroup deletePartitionKeyGroup(@PathVariable("partitionKeyGroupName") String partitionKeyGroupName) {
    PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey();
    partitionKeyGroupKey.setPartitionKeyGroupName(partitionKeyGroupName);
    return partitionKeyGroupService.deletePartitionKeyGroup(partitionKeyGroupKey);
}
Also used : PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Secured(org.springframework.security.access.annotation.Secured) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with PartitionKeyGroupKey

use of org.finra.herd.model.api.xml.PartitionKeyGroupKey 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)

Aggregations

PartitionKeyGroupKey (org.finra.herd.model.api.xml.PartitionKeyGroupKey)36 Test (org.junit.Test)29 PartitionKeyGroup (org.finra.herd.model.api.xml.PartitionKeyGroup)13 PartitionValueRange (org.finra.herd.model.api.xml.PartitionValueRange)12 ExpectedPartitionValuesInformation (org.finra.herd.model.api.xml.ExpectedPartitionValuesInformation)9 PartitionKeyGroupEntity (org.finra.herd.model.jpa.PartitionKeyGroupEntity)9 Secured (org.springframework.security.access.annotation.Secured)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ArrayList (java.util.ArrayList)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)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 ExpectedPartitionValuesDeleteRequest (org.finra.herd.model.api.xml.ExpectedPartitionValuesDeleteRequest)1 PartitionKeyGroupCreateRequest (org.finra.herd.model.api.xml.PartitionKeyGroupCreateRequest)1 PartitionKeyGroupKeys (org.finra.herd.model.api.xml.PartitionKeyGroupKeys)1 ExpectedPartitionValueEntity (org.finra.herd.model.jpa.ExpectedPartitionValueEntity)1