Search in sources :

Example 26 with PartitionKeyGroupKey

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

the class PartitionKeyGroupServiceTest method testDeletePartitionKeyGroupUsedByFormat.

@Test
public void testDeletePartitionKeyGroupUsedByFormat() {
    // Create a partition key group.
    partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
    // Create a business object format that uses this partition key group.
    businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, FORMAT_DESCRIPTION, true, PARTITION_KEY, PARTITION_KEY_GROUP);
    // Try to delete this partition key group.
    try {
        partitionKeyGroupService.deletePartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP));
        fail("Suppose to throw an IllegalArgumentException when partition key group is used by business object format.");
    } catch (IllegalArgumentException e) {
        assertEquals(String.format("Can not delete \"%s\" partition key group since it is being used by a business object format.", PARTITION_KEY_GROUP), e.getMessage());
    }
}
Also used : PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 27 with PartitionKeyGroupKey

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

the class PartitionKeyGroupServiceTest method testGetPartitionKeyGroupUpperCaseParameters.

@Test
public void testGetPartitionKeyGroupUpperCaseParameters() {
    // Create and persist a partition key group entity with a lowercase name.
    partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP.toLowerCase());
    // Retrieve the partition key group by passing partition key group name in upper case.
    PartitionKeyGroup resultPartitionKeyGroup = partitionKeyGroupService.getPartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP.toUpperCase()));
    // Validate the returned object.
    partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP.toLowerCase(), resultPartitionKeyGroup);
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 28 with PartitionKeyGroupKey

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

the class PartitionKeyGroupServiceTest method testDeletePartitionKeyGroupMissingRequiredParameters.

@Test
public void testDeletePartitionKeyGroupMissingRequiredParameters() {
    // Try to perform a delete without specifying partition key group name.
    try {
        partitionKeyGroupService.deletePartitionKeyGroup(new PartitionKeyGroupKey(BLANK_TEXT));
        fail("Should throw an IllegalArgumentException when partition key group is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A partition key group name must be specified.", e.getMessage());
    }
}
Also used : PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 29 with PartitionKeyGroupKey

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

the class PartitionKeyGroupServiceTest method testGetPartitionKeyGroupLowerCaseParameters.

@Test
public void testGetPartitionKeyGroupLowerCaseParameters() {
    // Create and persist a partition key group with an uppercase name.
    partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP.toUpperCase());
    // Retrieve the partition key group by passing partition key group name in lower case.
    PartitionKeyGroup resultPartitionKeyGroup = partitionKeyGroupService.getPartitionKeyGroup(new PartitionKeyGroupKey(PARTITION_KEY_GROUP.toLowerCase()));
    // Validate the returned object.
    partitionKeyGroupServiceTestHelper.validatePartitionKeyGroup(PARTITION_KEY_GROUP.toUpperCase(), resultPartitionKeyGroup);
}
Also used : PartitionKeyGroup(org.finra.herd.model.api.xml.PartitionKeyGroup) PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey) Test(org.junit.Test)

Example 30 with PartitionKeyGroupKey

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

the class PartitionKeyGroupServiceTestHelper method createPartitionKeyGroupKey.

/**
 * Creates a partition key group key.
 *
 * @param partitionKeyGroupName the partition key group name
 *
 * @return the created partition key group key
 */
public PartitionKeyGroupKey createPartitionKeyGroupKey(String partitionKeyGroupName) {
    PartitionKeyGroupKey partitionKeyGroupKey = new PartitionKeyGroupKey();
    partitionKeyGroupKey.setPartitionKeyGroupName(partitionKeyGroupName);
    return partitionKeyGroupKey;
}
Also used : PartitionKeyGroupKey(org.finra.herd.model.api.xml.PartitionKeyGroupKey)

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