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());
}
}
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);
}
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());
}
}
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);
}
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;
}
Aggregations